:root {
    --primary: #f59e0b;
    --primary-dark: #d97706;
    --primary-light: #fbbf24;
    --primary-text: #92400e;
    --secondary: #1e3a5f;
    --background: #f5f5f5;
    --surface: #ffffff;
    --surface-hover: #f8f9fa;
    --bg-cream: #fffdf7;
    --text: #1f2937;
    --text-muted: #4b5563;
    --text-dim: #6b7280;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --border: #e5e7eb;
    --border-light: #f3f4f6;

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    --radius: 12px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Scrollbars stylisées (visibles mais discrètes) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

body {
    font-family: var(--font-body);
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Mobile: allow natural page scroll (fix LMS homepage cropped on mobile) */
@media (max-width: 768px) {
    body {
        height: auto;
        min-height: 100vh;
        overflow: auto;
        overflow-x: hidden;
    }
    #app {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }
    /* Reduce hero height further on mobile to give room to content below */
    .nfx-hero {
        height: 32vh !important;
        min-height: 180px !important;
        max-height: 280px !important;
    }
}

@media (max-width: 480px) {
    .nfx-hero {
        height: 28vh !important;
        min-height: 160px !important;
        max-height: 240px !important;
    }
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100%;
    background: var(--background);
    color: var(--text);
    display: none;
    flex-direction: column;
}

.screen.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
    z-index: 10;
}

.hidden {
    display: none !important;
    pointer-events: none;
}

#login-overlay:not(.hidden) {
    z-index: 9999;
}

/* Typography */
h1,
h2,
h3 {
    font-family: var(--font-heading);
    margin-bottom: 1rem;
    line-height: 1.3;
}

h3 {
    font-size: 1.15rem;
}

/* Components */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-back {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-body);
}

.btn-primary {
    background: var(--primary);
    color: #4a2400;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--surface-hover);
}

.btn-danger {
    background: #dc2626;
    color: #fff;
}

.btn-back {
    background: transparent;
    color: var(--text-muted);
    padding-left: 0;
    margin-bottom: 1rem;
}

/* Home */
.hero-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 2rem;
    text-align: center;
    overflow-y: auto !important;
    justify-content: flex-start;
}

.hero-section h1 {
    font-size: 2.6rem;
    background: linear-gradient(90deg, var(--primary-text), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.3rem;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 1.2rem;
    font-size: 1.1rem;
}

/* --- Home Stats Bar --- */
.home-stats-bar {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
}

.home-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 10px;
    padding: 0.6rem 1.4rem;
    min-width: 90px;
    transition: border-color 0.2s;
}

.home-stat:hover {
    border-color: var(--primary);
}

.home-stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary-text);
    font-family: var(--font-heading);
    line-height: 1.2;
}

.home-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Home Category Chips --- */
.home-categories {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    max-width: 800px;
}

.home-cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.home-cat-chip:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    color: var(--text);
    transform: translateY(-1px);
}

.home-cat-chip .chip-count {
    background: rgba(245, 158, 11, 0.15);
    color: var(--primary-dark);
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
}

/* --- Home Sections --- */
.home-section {
    width: 100%;
    max-width: 1200px;
    margin-bottom: 1rem;
}

.home-section-title {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 0.8rem;
    padding-left: 0.5rem;
    border-left: 3px solid var(--primary);
    text-align: left;
}

.cards-grid {
    display: flex;
    gap: 1.2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    width: 250px;
    cursor: pointer;
    border: 1px solid var(--border-light);
    transition: transform 0.2s, background 0.2s;
}

.card:hover {
    transform: translateY(-4px);
    background: var(--surface-hover);
    border-color: var(--primary);
}

.card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.card h3 {
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
}

.card p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.icon {
    font-size: 2.2rem;
    margin-bottom: 0.7rem;
}

@media (max-width: 750px) {
    .home-stats-bar { gap: 0.8rem; }
    .home-stat { padding: 0.4rem 0.8rem; min-width: 70px; }
    .home-stat-value { font-size: 1.2rem; }
    .card { width: 100%; max-width: 320px; }
    .resume-cards { flex-direction: column; align-items: center; }
}

/* --- Resume Cards (derniers cours consultes) --- */
.resume-cards {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    justify-content: center;
}

.resume-card {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    max-width: 320px;
    min-width: 220px;
}

.resume-card:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.resume-card .resume-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
}

.resume-card .resume-info {
    overflow: hidden;
}

.resume-card .resume-title {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.resume-card .resume-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.resume-card .resume-progress {
    width: 100%;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.resume-card .resume-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s;
}

/* --- Badge "Nouveau" --- */
.badge-new {
    display: inline-block;
    padding: 2px 6px;
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 0.4rem;
    vertical-align: middle;
    animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Forms */
.panel {
    max-width: 600px;
    margin: 2rem auto;
    /* Reduced margin to fit better */
    background: var(--surface);
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);

    /* FIX: Allow scroll if content is too tall */
    max-height: 90vh;
    overflow-y: auto !important;

    /* Hide scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.panel::-webkit-scrollbar {
    display: none;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.8rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface-hover);
    color: var(--text);
    font-size: 1rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Quiz Interface */
#quiz-interface {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#quiz-interface .quiz-content {
    flex: 1;
    overflow-y: auto;
    /* Allow scroll if needed */
    max-height: 100%;

    /* Centering */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;

    /* Hide Scrollbar */
    scrollbar-width: none;
    /* Firefox */
    /* IE 10+ */
}

.quiz-header {
    padding: 1rem 2rem;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.progress-bar-container {
    flex: 1;
    height: 8px;
    background: var(--background);
    margin: 0 2rem;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

.timer {
    font-family: monospace;
    font-size: 1.2rem;
    font-weight: bold;
    transition: color 0.3s ease;
}

#quiz-interface .quiz-content::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

#question-container {
    max-width: 900px;
    width: 100%;
    position: relative;
    /* Margin auto handled by flex parent now, but keeping for safety */
    margin: 0 auto;
}

/* Context Badge */
.context-badge {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    justify-content: flex-start;
}

.context-tag {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: var(--primary-text);
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
}

.context-tag:hover {
    background: rgba(245, 158, 11, 0.25);
    border-color: rgba(245, 158, 11, 0.5);
    transform: translateY(-1px);
}

#q-text {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    font-weight: 400;
}

.hint {
    color: var(--warning);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(245, 158, 11, 0.1);
    border-left: 3px solid var(--warning);
    border-radius: 4px;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.option-btn {
    padding: 1.25rem;
    background: var(--surface);
    border: 2px solid transparent;
    border-radius: var(--radius);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.option-btn:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
}

.option-btn.selected {
    background: rgba(245, 158, 11, 0.15);
    border-color: var(--primary);
}

.option-btn.correct {
    background: rgba(34, 197, 94, 0.12);
    border-color: var(--success);
}

.option-btn.incorrect {
    background: rgba(239, 68, 68, 0.12);
    border-color: var(--danger);
}

/* Radio and Checkbox Indicators */
.radio-indicator,
.checkbox-indicator {
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-muted);
    flex-shrink: 0;
    transition: all 0.2s;
}

.radio-indicator {
    border-radius: 50%;
}

.checkbox-indicator {
    border-radius: 4px;
}

.option-btn.selected .radio-indicator {
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: inset 0 0 0 4px var(--surface);
}

.option-btn.selected .checkbox-indicator {
    border-color: var(--primary);
    background: var(--primary);
    position: relative;
}

.option-btn.selected .checkbox-indicator::after {
    content: '\2713';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* Loader */
#loader {
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--surface);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Results */
.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 8px solid var(--primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 2rem auto;
    font-size: 2.5rem;
    font-weight: bold;
}

.score-circle small {
    font-size: 1rem;
    color: var(--text-muted);
}

.results-panel {
    text-align: center;
}

.actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Quiz Footer */
.quiz-footer {
    padding: 1rem 2rem;
    background: var(--surface);
    display: flex;
    gap: 1rem;
    justify-content: center;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--success);
    color: #052e16;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

/* Status bar */
.status-bar {
    padding: 0.5rem 1rem;
    background: rgba(34, 197, 94, 0.1);
    border-left: 3px solid var(--success);
    margin-top: 1rem;
    border-radius: 4px;
}

/* License info banner (USB keys) */
.license-banner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.6rem 1.2rem;
    background: linear-gradient(90deg, rgba(34,197,94,0.12), rgba(59,130,246,0.10));
    border-bottom: 2px solid var(--success);
    font-size: 0.82rem;
    color: var(--text);
    flex-wrap: wrap;
}
.license-banner span::before {
    margin-right: 0.4rem;
    font-weight: bold;
}
#license-trainee::before { content: "Stagiaire:"; color: var(--success); }
#license-parcours::before { content: "Parcours:"; color: var(--primary, #3b82f6); }
#license-validity::before { content: "Validite:"; color: var(--warning, #f59e0b); }

/* Divider */
.divider {
    height: 1px;
    background: var(--border);
    margin: 2rem 0;
}

/* Footer */
footer {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Insere a la fin du fichier style.css existant */

/* Nouveaux styles pour la configuration avancee */

.mode-selector {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.radio-card {
    flex: 1;
    cursor: pointer;
    position: relative;
}

.radio-card input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.radio-card .card-content {
    background: var(--surface-hover);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.2s;
}

.radio-card input:checked+.card-content {
    border-color: var(--primary);
    background: rgba(245, 158, 11, 0.1);
}

.radio-card .icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.radio-card small {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.2rem;
}

.input-lg {
    padding: 1rem !important;
    font-size: 1.1rem !important;
}

/* Grille de sliders */
.distribution-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: var(--surface-hover);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.slider-group label {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
    display: block;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.slider-row input[type="range"] {
    flex: 1;
    height: 6px;
    background: var(--surface-hover);
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    padding: 0;
    border: none;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: background .15s ease-in-out;
}

.slider-row .val {
    width: 50px;
    text-align: right;
    font-weight: bold;
    color: var(--primary-text);
}

.warning-text {
    color: var(--warning);
    font-weight: bold;
    text-align: center;
    margin-top: 0.5rem;
}

/* Styles specifiques pour l'explication (Feedback) */
.explanation-box {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: rgba(245, 158, 11, 0.06);
    border-left: 4px solid var(--primary);
    border-radius: 4px;
    animation: fadeIn 0.3s ease;
}

.explanation-box h4 {
    color: var(--text);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.explanation-box p {
    color: var(--text-muted);
    line-height: 1.5;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Pedagogical Explanation Enhancements --- */
.exp-verdict {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 14px;
}
.exp-verdict-ok { background: rgba(34,197,94,0.12); color: #22c55e; }
.exp-verdict-ko { background: rgba(239,68,68,0.12); color: #ef4444; }
.exp-verdict-icon { font-size: 20px; }

.exp-correct-answer {
    background: rgba(59,130,246,0.08);
    border-left: 3px solid #3b82f6;
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 14px;
    color: var(--text);
    line-height: 1.5;
}
.exp-answer-highlight {
    display: inline;
    color: #60a5fa;
    font-weight: 600;
}

.exp-why {
    margin-bottom: 14px;
}
.exp-why-title {
    font-weight: 700;
    color: #f59e0b;
    margin-bottom: 6px;
    font-size: 14px;
}
.exp-why p {
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

.exp-wrong {
    margin-bottom: 14px;
}
.exp-wrong-title {
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 6px;
    font-size: 13px;
}
.exp-wrong ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.exp-wrong li {
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}
.exp-wrong li:last-child { border-bottom: none; }
.exp-wrong li strong { color: #f87171; font-weight: 600; }

.exp-tip {
    background: rgba(245,158,11,0.08);
    border: 1px dashed rgba(245,158,11,0.3);
    border-radius: 8px;
    padding: 10px 14px;
    margin-top: 10px;
    font-size: 13px;
    color: #fbbf24;
    line-height: 1.5;
}
.exp-tip strong { color: #f59e0b; }

/* --- LMS / Formation Styles --- */

#lms-screen {
    position: relative;
    background-color: var(--background);
    color: var(--text);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

#reveal-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Catalog View */
.course-catalog-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.search-bar-container {
    flex: 1;
    max-width: 600px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 1rem 1.5rem;
    border-radius: 30px;
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: var(--primary);
    background: var(--surface);
    outline: none;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.15);
}

/* ============================================
   CATALOGUE DE COURS - NOUVELLE INTERFACE
   ============================================ */

/* Header compact */
.catalog-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 0 0.5rem;
}

.catalog-title-section {
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.catalog-title-section h1 {
    font-size: 2rem;
    margin: 0;
    background: linear-gradient(135deg, var(--text) 0%, var(--text-dim) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.courses-count {
    background: var(--primary);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-back-home {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-back-home:hover {
    background: var(--surface);
    color: var(--text);
    border-color: var(--primary);
}

/* Barre de filtres unifiee */
.catalog-filter-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--surface-hover);
    border-radius: 12px;
    border: 1px solid var(--border);
    flex-wrap: wrap;
    align-items: center;
}

/* Recherche */
.filter-search {
    flex: 1;
    min-width: 250px;
    position: relative;
    display: flex;
    align-items: center;
}

.filter-search .search-icon {
    position: absolute;
    left: 12px;
    font-size: 1rem;
    opacity: 0.5;
}

.filter-search input {
    width: 100%;
    padding: 0.7rem 2.5rem 0.7rem 2.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.filter-search input:focus {
    border-color: var(--primary);
    background: var(--surface);
    outline: none;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.filter-search input::placeholder {
    color: var(--text-dim);
}

.clear-search {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1rem;
    padding: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

.filter-search input:not(:placeholder-shown) + .clear-search,
.clear-search:focus {
    opacity: 1;
}

.clear-search:hover {
    color: var(--text);
}

/* Menu deroulant categorie */
.filter-dropdown {
    position: relative;
}

.dropdown-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    min-width: 200px;
}

.dropdown-btn:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
}

.dropdown-btn.open {
    border-color: var(--primary);
    background: var(--surface-hover);
}

.dropdown-icon {
    font-size: 1rem;
}

.dropdown-label {
    flex: 1;
    text-align: left;
    font-size: 0.95rem;
}

.dropdown-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.dropdown-btn.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 350px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: rgba(245, 158, 11, 0.08);
}

.dropdown-item.active {
    background: rgba(245, 158, 11, 0.1);
    color: var(--primary-text);
}

.dropdown-item .item-label {
    font-size: 0.9rem;
}

.dropdown-item .item-count {
    font-size: 0.8rem;
    background: rgba(245, 158, 11, 0.08);
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    color: var(--text-muted);
}

.dropdown-item.active .item-count {
    background: var(--primary);
    color: white;
}

/* Tri */
.filter-sort select {
    padding: 0.7rem 2rem 0.7rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    font-size: 0.9rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%231f2937' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 18px;
}

.filter-sort select:hover {
    background-color: var(--surface-hover);
    border-color: var(--primary);
}

.filter-sort select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Vue (grille/liste) */
.filter-view {
    display: flex;
    gap: 0.3rem;
    background: var(--surface);
    padding: 0.3rem;
    border-radius: 8px;
}

.view-btn {
    padding: 0.5rem 0.8rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.view-btn:hover {
    color: var(--text);
    background: rgba(245, 158, 11, 0.08);
}

.view-btn.active {
    background: var(--primary);
    color: white;
}

/* Tags rapides */
.quick-tags {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.cat-tab {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    background: rgba(245, 158, 11, 0.04);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    border: 1px solid transparent;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.cat-tab:hover {
    background: rgba(245, 158, 11, 0.08);
    border-color: var(--border);
}

.cat-tab.active {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

/* Grille des cours */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.courses-grid.list-view {
    grid-template-columns: 1fr;
    gap: 1rem;
}

.courses-grid.list-view .course-card {
    flex-direction: row;
    height: auto;
}

.courses-grid.list-view .course-thumb {
    width: 120px;
    height: 100px;
    flex-shrink: 0;
}

.courses-grid.list-view .course-info {
    padding: 1rem 1.5rem;
}

.courses-grid.list-view .course-title {
    font-size: 1.1rem;
}

.courses-grid.list-view .course-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.course-card {
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.course-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
    border-color: var(--primary);
}

.course-thumb {
    height: 160px;
    background: linear-gradient(135deg, var(--surface-hover), var(--surface));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: rgba(245, 158, 11, 0.3);
}

.course-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.course-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.course-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    flex: 1;
}

.course-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.tag-badge {
    background: rgba(245, 158, 11, 0.15);
    color: var(--primary-dark);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* Drawer Menu (Overlay during presentation) */
.drawer-toggle {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 10000;
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary-text);
    border: 1px solid var(--primary);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(5px);
    font-size: 0.85rem;
}

/* FIX: Prevent drawer toggle and XP bar from overlapping slide content */
/* XP bar = 36px, menu button area = ~50px, add margin */
.reveal .slides {
    padding-top: 50px !important;
    box-sizing: border-box;
}

/* Adjust slide section positioning to avoid top overlap */
.reveal .slides section {
    padding-top: 10px !important;
}

/* Reduce title font size slightly to fit better with the header elements */
.reveal .slides section h1:first-child,
.reveal .slides section h2:first-child {
    margin-top: 0 !important;
}

/* When XP bar is visible, add extra space */
body:has(.xp-bar-container) .reveal .slides {
    padding-top: 55px !important;
}

/* Hide XP bar during LMS presentation - NOT NEEDED */
#lms-screen .xp-bar-container,
#lms-screen ~ .xp-bar-container,
body:has(#lms-screen.active) .xp-bar-container,
.reveal-viewport .xp-bar-container,
#reveal-container ~ .xp-bar-container {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.drawer-toggle:hover {
    background: var(--primary);
    color: white;
}

.lms-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 350px;
    height: 100vh;
    background: var(--surface);
    z-index: 10001;
    /* Above Reveal */
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
}

.lms-drawer.open {
    transform: translateX(0);
}

.drawer-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-item {
    margin-bottom: 5px;
}

.toc-link {
    display: block;
    padding: 10px 15px;
    border-radius: 6px;
    color: var(--text-muted);
    text-decoration: none;
    transition: background 0.2s;
    font-size: 0.95rem;
    cursor: pointer;
}

.toc-link:hover {
    background: rgba(245, 158, 11, 0.08);
    color: var(--text);
}

.toc-link.active {
    background: var(--primary);
    color: white;
}

.toc-section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-dim);
    margin: 1.5rem 0 0.5rem 1rem;
    letter-spacing: 1px;
    font-weight: bold;
}

/* --- History & Stats Styles --- */

.wide-panel {
    max-width: 95% !important;
    width: 95%;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

/* Tabs */
.tabs-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 2px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -4px;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--primary-text);
    border-bottom-color: var(--primary);
}

/* Stats Cards */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    border: 1px solid var(--border-light);
}

.stat-icon {
    font-size: 2.5rem;
    background: rgba(245, 158, 11, 0.1);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.stat-info h3 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-info p {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text);
    margin: 0;
}

/* Domain Bars */
.domain-bars {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.domain-bar-item {
    background: rgba(245, 158, 11, 0.04);
    padding: 1rem;
    border-radius: 8px;
}

.db-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.db-progress-bg {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.db-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
}

/* Question Lists */
.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
}

.question-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.question-item {
    background: rgba(245, 158, 11, 0.04);
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid #64748b;
    font-size: 0.9rem;
}

.question-item.danger {
    border-left-color: var(--danger);
}

.question-item.success {
    border-left-color: var(--success);
}

.q-stats-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--success);
}

/* Table */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(245, 158, 11, 0.03);
    border-radius: 8px;
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.data-table th {
    background: var(--surface-hover);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.data-table tr:hover {
    background: rgba(245, 158, 11, 0.06);
}

.tag-score {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.9rem;
}

.tag-pass {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.tag-fail {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    margin-right: 0.5rem;
}

/* New Stats Table Styles */
.striped-table tbody tr:nth-child(odd) {
    background-color: rgba(245, 158, 11, 0.03);
}

.striped-table tbody tr:nth-child(even) {
    background-color: transparent;
}

.truncate-text {
    max-width: 400px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.text-warning {
    color: var(--warning);
}

.text-center {
    text-align: center !important;
}

.full-width-stats {
    margin-top: 2rem;
}

/* LMS Splash Screen */
.lms-splash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #000;
    z-index: 20000;
    /* Must be on top of everything inside LMS */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.8s ease-in-out, visibility 0.8s;
}

.lms-splash.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-content {
    text-align: center;
    animation: breath 3s infinite ease-in-out;
}

.splash-logo {
    max-width: 600px;
    width: 80%;
    height: auto;
    margin-bottom: 2rem;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.2));
}

.splash-text {
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Outfit', sans-serif;
    letter-spacing: 2px;
    font-size: 1.2rem;
    text-transform: uppercase;
    animation: blink 2s infinite;
}

@keyframes breath {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }
}

@keyframes blink {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 0.8;
    }
}

/* Footer App */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.75rem;
    color: rgba(0, 0, 0, 0.3);
    background: linear-gradient(to top, rgba(255, 255, 255, 0.8), transparent);
    z-index: 99999;
    pointer-events: none;
    font-family: 'Inter', sans-serif;
    text-shadow: none;
}

/* Hide fixed footer on mobile (it eats up screen space) */
@media (max-width: 768px) {
    .app-footer { display: none !important; }
}

/* CSS pour le Right Drawer (Miroir du Left Drawer) */

/* Toggle Button Position Right */
.drawer-toggle.right-toggle {
    left: auto;
    right: 20px;
}

/* Drawer Right Position */
.lms-drawer.right {
    left: auto;
    right: 0;
    transform: translateX(100%);
    border-left: 1px solid var(--border);
    border-right: none;
}

.lms-drawer.right.open {
    transform: translateX(0);
}

/* Slide Content Images - WRAPPER METHOD (Infaillible) */
.slide-image-wrapper {
    /* Le conteneur definit l'espace MAX disponible pour l'image */
    height: 55vh !important;
    /* Hauteur relative a l'ecran */
    max-height: 500px !important;
    /* Limite absolue pour eviter le debordement */
    width: 100%;

    /* Centrage */
    display: flex !important;
    align-items: center;
    justify-content: center;
    margin: 1rem auto !important;
}

.slide-image-wrapper img {
    /* L'image remplit le wrapper sans se deformer */
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;

    /* Style */
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

/* Ensure Title doesn't push image too far */
.reveal .slides section h2 {
    margin-bottom: 10px !important;
}

/* Global Library Browser Styles */
.library-browser-container {
    display: flex;
    gap: 0;
    height: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.library-tree {
    background: var(--surface-hover);
    color: var(--text);
    padding: 1rem;
    overflow-y: auto;
    font-size: 0.95rem;
    border-right: 1px solid var(--border);
}

.lib-item {
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
    user-select: none;
}

.lib-item:hover {
    background: rgba(245, 158, 11, 0.08);
}

.lib-item.active {
    background: var(--primary);
    color: white;
}

.lib-folder-content {
    margin-left: 18px;
    border-left: 1px solid var(--border);
}

.lib-arrow {
    display: inline-block;
    width: 16px;
    text-align: center;
    transition: transform 0.2s;
    font-size: 0.8em;
}

.lib-folder-row.open .lib-arrow {
    transform: rotate(90deg);
}

.library-preview {
    flex: 1;
    background: var(--surface);
    padding: 2rem;
    overflow-y: auto;
    color: var(--text);
    display: flex;
    flex-direction: column;
}

.preview-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.preview-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.preview-icon {
    font-size: 5rem;
    margin-bottom: 1.5rem;
    display: block;
    color: var(--text-muted);
}

/* Zoom Controls */
.zoom-controls {
    position: fixed;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    gap: 12px;
    background: rgba(255, 255, 255, 0.9);
    padding: 6px 14px;
    border-radius: 25px;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    border: 1px solid var(--border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: opacity 0.3s, transform 0.3s;
}

.zoom-controls.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(-20px);
}

.zoom-controls button {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
    font-family: monospace;
    font-weight: bold;
}

.zoom-controls button:hover {
    background: rgba(245, 158, 11, 0.15);
}

.zoom-controls button:active {
    transform: scale(0.95);
}

.zoom-label {
    color: var(--text);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    font-family: var(--font-body);
    font-variant-numeric: tabular-nums;
    min-width: 45px;
    justify-content: center;
}

.preview-actions {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* ========================================
   ACCESSIBILITÉ
======================================== */

/* Réduction des mouvements pour les utilisateurs sensibles */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus visible pour navigation clavier */
:focus-visible {
    outline: 2px solid var(--primary, #f59e0b);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Retirer l'outline par défaut sauf focus-visible */
:focus:not(:focus-visible) {
    outline: none;
}

/* Focus visible sur les boutons et inputs */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary, #f59e0b);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2);
}

/* Accessibility - focus indicators for role="button" elements */
*:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}
[role="button"] {
    cursor: pointer;
}

/* ============================================
   MOBILE UX — Touch targets 48px min (WCAG 2.5.8)
   ============================================ */
@media (max-width: 768px) {
    /* Tous les boutons: min 48px de hauteur */
    button, .btn, .btn-primary, .btn-secondary, .btn-danger,
    [role="button"], a.btn, .nfx-tab, .calc-btn {
        min-height: 48px;
        min-width: 48px;
        padding: 0.75rem 1.25rem;
        font-size: 1rem;
    }

    /* Inputs: min 48px, 16px font (evite auto-zoom iOS) */
    input, select, textarea {
        min-height: 48px;
        font-size: 16px !important;
    }

    /* Cards cliquables */
    .nfx-card, .course-card, .matching-item, .ordering-item, .draggable-item {
        min-height: 48px;
        padding: 0.75rem;
    }

    /* Navigation dots exam */
    .question-dot, .nav-dot {
        min-width: 40px;
        min-height: 40px;
    }

    /* Augmenter taille base texte mobile */
    body {
        font-size: 1.05rem;
    }

    /* Tab labels: garder texte visible sur mobile */
    .nfx-tab span:not(.tab-icon) {
        display: inline !important;
        font-size: 0.85rem;
    }
}

/* ============================================
   DARK MODE — Toggle via data-theme="dark"
   ============================================ */
:root[data-theme="dark"] {
    --background: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --bg-cream: #1a1f2e;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --border: #334155;
    --border-light: #1e293b;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
}

:root[data-theme="dark"] .data-table,
:root[data-theme="dark"] .question-item {
    background: rgba(245, 158, 11, 0.08);
}

:root[data-theme="dark"] img {
    opacity: 0.92;
}

/* Respect system preference as default */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --background: #0f172a;
        --surface: #1e293b;
        --surface-hover: #334155;
        --bg-cream: #1a1f2e;
        --text: #f1f5f9;
        --text-muted: #94a3b8;
        --text-dim: #64748b;
        --border: #334155;
        --border-light: #1e293b;
    }
}

/* ============================================
   ERROR STATES — Friendly visual feedback
   ============================================ */
.error-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    padding: 1rem 1.5rem;
    background: var(--danger);
    color: white;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}
.error-banner.visible {
    transform: translateY(0);
}
.error-banner .error-close {
    margin-left: auto;
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    min-height: auto;
    min-width: auto;
    padding: 0.25rem;
}

.offline-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--background);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    text-align: center;
    padding: 2rem;
}
.offline-screen .offline-icon {
    font-size: 4rem;
    opacity: 0.6;
}
.offline-screen h2 {
    font-family: var(--font-heading);
    color: var(--text);
}
.offline-screen p {
    color: var(--text-muted);
    max-width: 400px;
}

/* Image fallback */
.img-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: white;
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    border-radius: var(--radius);
    aspect-ratio: 16/9;
}

/* ============================================
   BREADCRUMBS — Navigation contextuelle
   ============================================ */
.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    white-space: nowrap;
}
.breadcrumb-nav a {
    color: var(--primary);
    text-decoration: none;
}
.breadcrumb-nav a:hover {
    text-decoration: underline;
}
.breadcrumb-nav .separator {
    color: var(--text-dim);
    font-size: 0.75rem;
}
.breadcrumb-nav .current {
    color: var(--text);
    font-weight: 500;
}

/* ============================================
   SEARCH BAR — Accueil
   ============================================ */
.search-container {
    position: relative;
    max-width: 500px;
    margin: 0 auto 1.5rem;
}
.search-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    border: 2px solid var(--border);
    border-radius: 50px;
    font-size: 1rem;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.2s;
}
.search-input:focus {
    border-color: var(--primary);
    outline: none;
}
.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
}
.search-results-count {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* ============================================
   QUIZ FEEDBACK — Retour immediat
   ============================================ */
.quiz-feedback {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    animation: feedbackSlide 0.3s ease;
}
.quiz-feedback.correct {
    background: rgba(34, 197, 94, 0.12);
    border-left: 4px solid var(--success);
    color: #166534;
}
.quiz-feedback.incorrect {
    background: rgba(239, 68, 68, 0.12);
    border-left: 4px solid var(--danger);
    color: #991b1b;
}
:root[data-theme="dark"] .quiz-feedback.correct { color: #86efac; }
:root[data-theme="dark"] .quiz-feedback.incorrect { color: #fca5a5; }

@keyframes feedbackSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Slide jump dialog */
.slide-jump-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    min-width: 300px;
}
.slide-jump-dialog .slide-list {
    max-height: 50vh;
    overflow-y: auto;
    margin: 1rem 0;
}
.slide-jump-dialog .slide-list-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}
.slide-jump-dialog .slide-list-item:hover {
    background: var(--surface-hover);
}
.slide-jump-dialog .slide-list-item.active {
    background: rgba(245, 158, 11, 0.15);
    font-weight: 600;
}
.slide-jump-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.5);
}
