/* Reset e Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #FF6B35;
    --secondary-color: #1E88E5;
    --success-color: #4CAF50;
    --danger-color: #F44336;
    --warning-color: #FF9800;
    --bg-color: #F5F7FA;
    --card-bg: #FFFFFF;
    --text-primary: #2C3E50;
    --text-secondary: #7F8C8D;
    --border-color: #E0E0E0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #FF8A65 100%);
    color: white;
    padding: 30px 0;
    box-shadow: var(--shadow);
}

.header-content {
    text-align: center;
}

.logo {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.95;
}

/* Main Container */
.main-container {
    margin-top: 40px;
    margin-bottom: 60px;
}

/* Page Management */
.page {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Welcome Section */
.welcome-section {
    text-align: center;
    margin-bottom: 50px;
}

.welcome-section h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.welcome-section p {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* Mode Selection */
.mode-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.mode-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.mode-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.exam-mode {
    border-color: var(--primary-color);
}

.practice-mode {
    border-color: var(--secondary-color);
}

.mode-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.mode-card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.mode-card p {
    color: var(--text-secondary);
    margin-bottom: 25px;
}

/* Buttons */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #ff5722;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #1976D2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 136, 229, 0.3);
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: #F57C00;
}

.btn-back {
    background: var(--text-secondary);
    color: white;
    margin-bottom: 30px;
}

.btn-back:hover {
    background: #5a6c7d;
}

/* Selection Section */
.selection-section {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 40px;
    box-shadow: var(--shadow);
}

.selection-section h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.selection-section p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* Exam Types Grid */
.exam-types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.exam-type-card {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.exam-type-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.exam-type-card h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.exam-type-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.exam-type-card .variant-indicator {
    display: block;
    margin-top: 10px;
    padding: 6px 12px;
    background: linear-gradient(135deg, var(--secondary-color) 0%, #42A5F5 100%);
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sections Grid - Hierarchical Structure */
.sections-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-top: 30px;
}

.section-group {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    border-left: 4px solid var(--secondary-color);
}

.section-group-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.subsections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.section-card {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.section-card:hover {
    border-color: var(--secondary-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    background: linear-gradient(135deg, #ffffff 0%, #f0f7ff 100%);
}

.section-code {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.section-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Practice Options */
.practice-options {
    margin: 30px 0;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.form-select {
    width: 100%;
    max-width: 300px;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--secondary-color);
}

/* Quiz Page */
.quiz-header {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.quiz-info h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.quiz-stats {
    display: flex;
    gap: 30px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Quiz Actions */
.quiz-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Progress Bar */
.progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 10px;
    margin-bottom: 30px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary-color), var(--primary-color));
    transition: width 0.3s ease;
}

/* Quiz Content */
.quiz-content {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
}

/* Quiz Navigation */
.quiz-navigation {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.quiz-navigation h3 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.question-nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 8px;
    margin-bottom: 20px;
}

.nav-btn {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    transform: scale(1.05);
}

.nav-btn.current {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.nav-btn.answered {
    border-color: var(--success-color);
    background: var(--success-color);
    color: white;
}

.nav-legend {
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.nav-indicator {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid var(--border-color);
    background: white;
}

.nav-indicator.current {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

.nav-indicator.answered {
    border-color: var(--success-color);
    background: var(--success-color);
}

/* Question Card */
.quiz-main {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.question-card {
    margin-bottom: 30px;
}

.question-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.question-section {
    background: var(--secondary-color);
    color: white;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.question-number {
    color: var(--text-secondary);
    font-weight: 600;
}

.question-text {
    font-size: 1.2rem;
    line-height: 1.8;
    margin-bottom: 30px;
    color: var(--text-primary);
}

/* Answers */
.answers-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.answer-option {
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 18px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.answer-option:hover {
    border-color: var(--secondary-color);
    background: rgba(30, 136, 229, 0.05);
}

.answer-option.selected {
    border-color: var(--primary-color);
    background: rgba(255, 107, 53, 0.1);
}

.answer-option.correct {
    border-color: var(--success-color);
    background: rgba(76, 175, 80, 0.1);
}

.answer-option.wrong {
    border-color: var(--danger-color);
    background: rgba(244, 67, 54, 0.1);
}

.answer-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-right: 10px;
}

.answer-text {
    color: var(--text-primary);
}

/* Quiz Controls */
.quiz-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

/* Results Page */
.results-header {
    text-align: center;
    margin-bottom: 40px;
}

.result-badge {
    display: inline-block;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.result-badge.passed {
    background: var(--success-color);
    color: white;
}

.result-badge.failed {
    background: var(--danger-color);
    color: white;
}

.result-badge.practice {
    background: var(--secondary-color);
    color: white;
}

/* Badge per distinzione Quiz/Esercitazione nelle tabelle */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

.badge-exam {
    background: linear-gradient(135deg, #FF6B35 0%, #FF8A65 100%);
    color: white;
}

.badge-practice {
    background: linear-gradient(135deg, #1E88E5 0%, #42A5F5 100%);
    color: white;
}

/* Sezioni separate per statistiche Quiz e Esercitazioni */
.stats-section {
    margin-bottom: 25px;
    padding: 15px;
    background: #252525;
    border-radius: 8px;
    border-left: 4px solid #ff6b00;
}

.stats-section h5 {
    color: #ff6b00;
    font-size: 1rem;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #333;
}

.stats-section:last-of-type {
    margin-bottom: 0;
}

.results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.summary-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    box-shadow: var(--shadow);
}

.summary-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.summary-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.summary-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.results-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
}

/* Review Section */
.review-section {
    margin-top: 40px;
}

.review-section h3 {
    font-size: 1.8rem;
    margin-bottom: 30px;
    text-align: center;
}

.review-question {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.review-question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.review-result-icon {
    font-size: 2rem;
}

.review-question-text {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.review-answers {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    flex-direction: column;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay p {
    color: white;
    margin-top: 20px;
    font-size: 1.2rem;
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    text-align: center;
    padding: 30px 0;
    margin-top: 60px;
}

.footer p {
    margin: 5px 0;
    opacity: 0.8;
}

/* Modal (ADR Images) */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    /* above loading overlay */
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    width: 100%;
    max-width: 1000px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 1.1rem;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
    background: var(--card-bg);
}

.modal-body.dark-bg {
    padding: 0;
    background: #000;
}

.pdf-viewer {
    width: 100%;
    height: 80vh;
    border: none;
    display: block;
}

.adr-image-viewer {
    width: 100%;
    height: 80vh;
    object-fit: contain;
    background: #000;
    display: block;
}

/* Responsive Design */
@media (max-width: 768px) {
    .quiz-content {
        grid-template-columns: 1fr;
    }

    .quiz-navigation {
        position: relative;
        top: 0;
    }

    .subsections-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .section-group {
        padding: 20px 15px;
    }

    .section-group-title {
        font-size: 1.1rem;
    }

    .mode-selection {
        grid-template-columns: 1fr;
    }

    .quiz-header {
        flex-direction: column;
        gap: 20px;
    }

    .quiz-stats {
        flex-direction: column;
        gap: 10px;
    }

    .quiz-controls {
        flex-direction: column;
        gap: 10px;
    }

    .results-actions {
        flex-direction: column;
    }

    .pdf-viewer {
        height: 75vh;
    }

    .adr-image-viewer {
        height: 75vh;
    }
}

/* ============================================
   LOGIN STYLES
   ============================================ */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
    padding: 40px 0;
}

.login-box {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 50px;
    max-width: 500px;
    width: 100%;
    text-align: center;
}

.login-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: fadeIn 0.5s ease;
}

.login-box h2 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 2rem;
}

.login-description {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.login-form {
    text-align: left;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.1);
}

.form-group input::placeholder {
    color: #bbb;
}

.form-help {
    display: block;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

.btn-login {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 10px;
}

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.error-message {
    background: #ffebee;
    color: var(--danger-color);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--danger-color);
    font-size: 0.95rem;
}

.success-message {
    background: #e8f5e9;
    color: var(--success-color);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--success-color);
    font-size: 0.95rem;
}

.login-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* User Info Display */
.user-info {
    background: #e3f2fd;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.user-info span {
    font-weight: 600;
    color: var(--secondary-color);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* Responsive Login */
@media (max-width: 768px) {
    .login-box {
        padding: 30px 20px;
    }

    .login-box h2 {
        font-size: 1.6rem;
    }

    .login-description {
        font-size: 1rem;
    }
}

/* ============================================
   ADMIN STYLES
   ============================================ */

.admin-container {
    max-width: 900px;
    margin: 0 auto;
}

.admin-section {
    animation: fadeIn 0.3s ease;
}

.admin-box {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 50px;
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.admin-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.admin-box h2 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 2rem;
}

.admin-description {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.admin-form {
    text-align: left;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.admin-header h2 {
    color: var(--text-primary);
    font-size: 2rem;
}

.admin-content {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.admin-card {
    margin-bottom: 30px;
}

.admin-card h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.admin-card p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.generate-form {
    max-width: 400px;
}

.codes-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.codes-list {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.code-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.code-item:hover {
    border-color: var(--secondary-color);
    box-shadow: var(--shadow);
}

.code-value {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 2px;
}

.btn-copy-code {
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.btn-copy-code:hover {
    background: #1976D2;
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .admin-box {
        padding: 30px 20px;
    }

    .admin-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .codes-actions {
        flex-direction: column;
    }

    .code-item {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* ============================================
   SUPERVISOR PAGE STYLES
   ============================================ */

.supervisor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.supervisor-header h2 {
    color: var(--text-primary);
    margin-bottom: 5px;
}

.supervisor-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.supervisor-content {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.supervisor-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 5px;
}

.supervisor-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.supervisor-card h3 {
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

/* Controlli candidati (ricerca e ordinamento) */
.candidates-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 250px;
}

.search-box input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.sort-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.sort-controls label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn-sort {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 15px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-sort:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

.btn-sort.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-sort .sort-label {
    font-weight: 500;
}

.btn-sort .sort-icon {
    font-size: 1rem;
}

/* Badge per statistiche */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-info {
    background: rgba(30, 136, 229, 0.15);
    color: var(--secondary-color);
}

.badge-success {
    background: rgba(76, 175, 80, 0.15);
    color: var(--success-color);
}

.badge-warning {
    background: rgba(255, 152, 0, 0.15);
    color: var(--warning-color);
}

.badge-practice {
    background: rgba(156, 39, 176, 0.15);
    color: #9C27B0;
}

.badge-exam {
    background: rgba(255, 107, 53, 0.15);
    color: var(--primary-color);
}

/* Modal large per dettagli candidato */
.modal-large {
    max-width: 900px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-large .modal-body {
    max-height: calc(85vh - 80px);
    overflow-y: auto;
}

/* Tabelle supervisor e admin */
.supervisor-table,
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.supervisor-table th,
.admin-table th {
    background: var(--bg-color);
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

.supervisor-table td,
.admin-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.supervisor-table tr:hover,
.admin-table tr:hover {
    background: var(--bg-color);
}

.result-passed {
    color: var(--success-color);
    font-weight: 600;
}

.result-failed {
    color: var(--danger-color);
    font-weight: 600;
}

/* Supervisor Item in Admin Panel */
.supervisor-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-color);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 10px;
}

.supervisor-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.supervisor-info strong {
    color: var(--text-primary);
}

.supervisor-info span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
}

/* Button Link Style */
.btn-link {
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.9rem;
}

.btn-link:hover {
    color: var(--primary-color);
}

/* Responsive Supervisor */
@media (max-width: 768px) {
    .supervisor-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .supervisor-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .supervisor-table,
    .admin-table {
        font-size: 0.85rem;
    }

    .supervisor-table th,
    .supervisor-table td,
    .admin-table th,
    .admin-table td {
        padding: 8px 10px;
    }

    /* Responsive controls */
    .candidates-controls {
        flex-direction: column;
        gap: 15px;
    }

    .search-box {
        min-width: 100%;
    }

    .sort-controls {
        width: 100%;
        justify-content: flex-start;
    }

    .btn-sort {
        font-size: 0.85rem;
        padding: 6px 12px;
    }

    .modal-large {
        max-width: 95vw;
        max-height: 90vh;
    }
}

@media (max-width: 480px) {
    .supervisor-stats {
        grid-template-columns: 1fr;
    }

    .supervisor-table {
        display: block;
        overflow-x: auto;
    }

    .sort-controls {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .btn-sort {
        width: 100%;
        justify-content: space-between;
    }
}

/* ============================================
   STATISTICHE CANDIDATO DETTAGLIATE
   ============================================ */

.candidate-stats-container {
    background: #1e1e1e;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid #333;
}

.candidate-stats-container h4 {
    color: #ff6b00;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.candidate-stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

.candidate-stat-item {
    background: #2a2a2a;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.candidate-stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.2);
}

.candidate-stat-item .stat-icon {
    font-size: 1.5rem;
}

.candidate-stat-item .stat-number {
    font-size: 1.8rem;
    font-weight: bold;
    color: #ff6b00;
}

.candidate-stat-item .stat-desc {
    font-size: 0.8rem;
    color: #aaa;
}

.candidate-stat-item.stat-passed .stat-number {
    color: #4caf50;
}

.candidate-stat-item.stat-failed .stat-number {
    color: #f44336;
}

/* Quiz List Section */
.quiz-list-section {
    margin-top: 20px;
}

.quiz-list-section h4 {
    color: #ff6b00;
    margin-bottom: 15px;
}

.errors-count {
    color: #f44336;
    font-weight: bold;
}

.no-details {
    color: #666;
    font-style: italic;
}

/* Quiz Detail Section */
.quiz-detail-section {
    background: #1e1e1e;
    border-radius: 12px;
    padding: 20px;
    margin-top: 25px;
    border: 2px solid #ff6b00;
}

.quiz-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #333;
}

.quiz-detail-header h4 {
    color: #ff6b00;
    margin: 0;
}

.quiz-summary {
    background: #2a2a2a;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.quiz-summary p {
    margin: 0;
    color: #ddd;
}

.quiz-summary strong {
    color: #ff6b00;
}

/* Errors by Section */
.errors-by-section {
    margin-bottom: 25px;
}

.errors-by-section h5 {
    color: #ff6b00;
    margin-bottom: 10px;
}

.section-errors-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.section-error-item {
    background: #2a2a2a;
    border-radius: 8px;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    gap: 15px;
    min-width: 200px;
}

.section-name {
    color: #ddd;
    font-weight: 500;
}

.section-count {
    color: #f44336;
    font-weight: bold;
}

/* Wrong Answers Section */
.wrong-answers-section {
    margin-top: 20px;
}

.wrong-answers-section h5 {
    color: #f44336;
    margin-bottom: 15px;
}

.wrong-answers-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.wrong-answer-item {
    background: #2a2a2a;
    border-radius: 10px;
    padding: 15px;
    border-left: 4px solid #f44336;
}

.wa-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.wa-number {
    background: #f44336;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.wa-section {
    background: #333;
    color: #aaa;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.wa-question {
    color: #fff;
    margin-bottom: 12px;
    line-height: 1.5;
    font-size: 0.95rem;
}

.wa-answers {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wa-user-answer,
.wa-correct-answer {
    margin: 0;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.wa-user-answer {
    background: rgba(244, 67, 54, 0.15);
    border: 1px solid #f44336;
}

.wa-correct-answer {
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid #4caf50;
}

.wa-answers .label {
    color: #aaa;
    margin-right: 5px;
}

.wa-answers .answer.wrong {
    color: #f44336;
    font-weight: bold;
}

.wa-answers .answer.correct {
    color: #4caf50;
    font-weight: bold;
}

.no-errors-detail {
    color: #888;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .candidate-stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .quiz-summary {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .candidate-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .candidate-stat-item .stat-number {
        font-size: 1.4rem;
    }

    .section-error-item {
        min-width: 100%;
    }

    .quiz-detail-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

@media (max-width: 400px) {
    .candidate-stats-grid {
        grid-template-columns: 1fr;
    }
}