/* ============================================================
   QUIZ PAGE — quiz.css
   ============================================================ */

/* ── Barre supérieure mobile/tablette (< 1024px) ──────────── */
.qz-topbar {
    display: none; /* affiché via media query */
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    height: 54px;
    background: #ffffff;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 168px;     /* sous le header complet (top-bar 40 + nav 128) */
    z-index: 1001;  /* au-dessus de la nav du site (z-index: 999) */
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.qz-topbar-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 800;
    font-size: 18px;
    color: #1e3a8a;
    min-width: 80px;
    white-space: nowrap;
}
.qz-topbar-timer i { color: #6366f1; font-size: 16px; }

.qz-topbar-counter {
    font-size: 15px;
    font-weight: 700;
    color: #475569;
    flex: 1;
    text-align: center;
    white-space: nowrap;
}
.qz-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}
.qz-topbar-icon-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border-radius: 8px;
    border: none;
    background: #f1f5f9;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s;
    white-space: nowrap;
}
.qz-topbar-icon-btn:hover { background: #e2e8f0; }

/* Bouton quitter — cercle rouge bien visible */
.qz-topbar-quit-btn {
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(239,68,68,.35);
}
.qz-topbar-quit-btn:hover { background: #dc2626; box-shadow: 0 4px 12px rgba(239,68,68,.45); }

/* Barre de progression sous le topbar */
.qz-topbar-progress {
    display: none;
    height: 4px;
    background: #e2e8f0;
    position: sticky;
    top: 222px;     /* 168px header + 54px qz-topbar */
    z-index: 1000;
}
.qz-topbar-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #4169E1);
    border-radius: 0 50px 50px 0;
    transition: width 1s linear;
}

/* ── Panneau navigation mobile ────────────────────────────── */
.qz-mob-overlay {
    display: none;
    position: fixed;
    top: 168px;                    /* sous le header complet */
    left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.4);
    z-index: 1002;
}
.qz-mob-overlay.open { display: block; }

.qz-mob-nav-panel {
    position: fixed;
    top: 168px;                    /* sous le header complet */
    right: -320px;
    width: 300px;
    height: calc(100vh - 168px);   /* hauteur disponible sous le header */
    background: white;
    z-index: 1003;
    padding: 14px 14px 10px;
    overflow-y: auto;
    transition: right .3s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: -4px 0 20px rgba(0,0,0,.15);
}
.qz-mob-nav-panel.open { right: 0; }

.qz-mob-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
    flex-shrink: 0;
}
.qz-mob-panel-title {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
}
.qz-mob-panel-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
}

/* ── Layout 2 colonnes (desktop) ──────────────────────────── */
.qz-layout {
    display: flex;
    height: calc(100vh - 133px);
    overflow: hidden;
    background: #f0f5ff;
}

/* ── SIDEBAR ──────────────────────────────────────────────── */
.qz-sidebar {
    width: 270px;
    flex-shrink: 0;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    padding: 18px 16px;
    gap: 14px;
    overflow-y: auto;
}

/* Timer sidebar */
.qz-timer-box {
    background: linear-gradient(135deg, #6366f1 0%, #3b5bdb 100%);
    border-radius: 14px;
    padding: 16px 14px 12px;
    color: white;
    text-align: center;
}
.qz-timer-val {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: 2px;
    line-height: 1;
    margin: 4px 0;
}
.qz-timer-label { font-size: 11px; opacity: .8; text-transform: uppercase; letter-spacing: 1px; }
.qz-timer-icon  { font-size: 16px; opacity: .85; }
.qz-timer-bar-wrap {
    background: rgba(255,255,255,.2);
    border-radius: 50px;
    height: 5px;
    margin-top: 10px;
    overflow: hidden;
}
.qz-timer-bar {
    background: white;
    height: 100%;
    border-radius: 50px;
    transition: width 1s linear;
}

/* Bouton auto-fill */
.qz-autofill-btn {
    background: #f97316;
    color: white;
    border: none;
    border-radius: 9px;
    padding: 9px 14px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    width: 100%;
    transition: background .2s, transform .2s;
    flex-shrink: 0;
}
.qz-autofill-btn:hover { background: #ea6c0a; transform: translateY(-1px); }

/* Navigation grille */
.qz-nav-label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.qz-nav-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 5px;
}
/* Grille du panneau mobile — plus dense (10 colonnes, boutons plus petits) */
#qz-nav-grid-mob {
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
    flex-shrink: 0;
}
#qz-nav-grid-mob .qz-nav-btn { font-size: 10px; }

.qz-nav-btn {
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1.5px solid #cbd5e1;
    background: white;
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.qz-nav-btn:hover      { border-color: #4169E1; color: #1e3a8a; }
.qz-nav-btn.current    { background: #3b5bdb; border-color: #3b5bdb; color: white; }
.qz-nav-btn.answered   { background: #22c55e; border-color: #22c55e; color: white; }
.qz-nav-btn.skipped    { background: #f1f5f9; border-color: #cbd5e1; color: #94a3b8; }

/* Légende */
.qz-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex-shrink: 0;
}
.qz-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #64748b;
}
.qz-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 1.5px solid #cbd5e1;
    display: inline-block;
    flex-shrink: 0;
}
.qz-dot.current    { background: #3b5bdb; border-color: #3b5bdb; }
.qz-dot.answered   { background: #22c55e; border-color: #22c55e; }
.qz-dot.unanswered { background: white; }

/* Bouton quitter (sidebar) */
.qz-quit-btn {
    margin-top: auto;
    background: transparent;
    border: 1.5px solid #ef4444;
    color: #ef4444;
    border-radius: 9px;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    width: 100%;
    transition: all .2s;
}
.qz-quit-btn:hover { background: #ef4444; color: white; }

/* ── MAIN ──────────────────────────────────────────────────── */
.qz-main {
    flex: 1;
    overflow-y: auto;
    padding: 24px 36px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Badge question */
.qz-q-badge {
    align-self: center;
    border: 2px solid #4169E1;
    border-radius: 50px;
    padding: 6px 28px;
    font-size: 15px;
    font-weight: 700;
    color: #1e3a8a;
    flex-shrink: 0;
}

/* Carte énoncé — hauteur adaptative avec défilement */
.qz-enonce-card {
    flex: none;
    min-height: 180px;
    max-height: 320px;
    overflow-y: auto;
    background: white;
    border: 2px solid #c7d2fe;
    border-radius: 16px;
    padding: 28px 36px;
    position: relative;
    box-shadow: 0 2px 16px rgba(99,102,241,.07);
    line-height: 2;
    font-size: 22px;
    color: #1e293b;
    scrollbar-width: thin;
    scrollbar-color: #c7d2fe #f0f7ff;
}
.qz-enonce-card::-webkit-scrollbar        { width: 6px; }
.qz-enonce-card::-webkit-scrollbar-track  { background: #f0f7ff; border-radius: 4px; }
.qz-enonce-card::-webkit-scrollbar-thumb  { background: #c7d2fe; border-radius: 4px; }


/* Loading skeleton dans la carte */
.qz-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 14px;
    gap: 8px;
    height: 100%;
    min-height: 80px;
}
.qz-loading i { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Texte de la question (séparé de la carte énoncé) */
.qz-question-text {
    display: none;
    font-size: 19px;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
    padding: 4px 8px;
    margin: 0;
    flex-shrink: 0;
}

/* Options — grille 2 colonnes sur desktop, 1 colonne sur mobile */
.qz-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    flex-shrink: 0;
}

.option-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fbff;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all .2s;
    text-align: left;
    font-size: 13px;
    color: #334155;
    width: 100%;
}
.option-btn:hover:not(:disabled) {
    border-color: #3b5bdb;
    background: #eef2ff;
    transform: translateX(4px);
    box-shadow: 0 2px 10px rgba(59,130,246,.12);
}
.option-letter {
    min-width: 27px;
    height: 27px;
    background: #eef2ff;
    color: #1e3a8a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 12px;
    flex-shrink: 0;
    border: 1.5px solid #c7d2fe;
}
/* Réponse sélectionnée (pendant le quiz — avant la correction finale) */
.option-btn.selected               { border-color: #3b5bdb; background: #eef2ff; }
.option-btn.selected .option-letter { background: #3b5bdb; color: white; border-color: #3b5bdb; }

/* Correction (visible uniquement sur l'écran de résultats) */
.option-btn.correct               { border-color: #22c55e; background: #f0fdf4; }
.option-btn.correct .option-letter { background: #22c55e; color: white; border-color: #22c55e; }
.option-btn.wrong                  { border-color: #ef4444; background: #fef2f2; }
.option-btn.wrong   .option-letter { background: #ef4444; color: white; border-color: #ef4444; }
.option-btn:disabled               { cursor: default; transform: none !important; box-shadow: none !important; }

/* Feedback */
.feedback-msg {
    display: none;
    padding: 12px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}
.feedback-msg.correct { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; display: flex; align-items: center; gap: 8px; }
.feedback-msg.wrong   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; display: flex; align-items: center; gap: 8px; }

/* Barre de navigation bas */
.qz-bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.qz-btn-prev, .qz-btn-next {
    padding: 11px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.qz-btn-prev          { background: white; border: 2px solid #e2e8f0; color: #475569; }
.qz-btn-prev:hover    { background: #f1f5f9; border-color: #cbd5e1; }
.qz-btn-next          { background: #3b5bdb; color: white; }
.qz-btn-next:hover    { background: #2563eb; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59,130,246,.3); }
.qz-btn-next:disabled { background: #cbd5e1; cursor: default; transform: none; box-shadow: none; }

.qz-pts-badge {
    background: #f1f5f9;
    color: #1e3a8a;
    border: 2px solid #c7d2fe;
    border-radius: 50px;
    padding: 7px 18px;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}
.qz-pts-badge .qz-level {
    background: #3b5bdb;
    color: white;
    border-radius: 50px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 800;
}

/* ── RÉSULTATS ─────────────────────────────────────────────── */
.result-card {
    background: white;
    border-radius: 16px;
    padding: 48px 40px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0,0,0,.1);
    max-width: 620px;
    margin: 40px auto;
}
.result-score-circle {
    width: 130px; height: 130px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #3b5bdb);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    margin: 0 auto 28px; color: white;
    box-shadow: 0 8px 25px rgba(99,102,241,.35);
}
.result-score-circle .score-num  { font-size: 40px; font-weight: 800; line-height: 1; }
.result-score-circle .score-deno { font-size: 14px; opacity: .85; }
.result-title    { font-size: 26px; font-weight: 700; color: #1e293b; margin-bottom: 10px; }
.result-subtitle { font-size: 15px; color: #64748b; margin-bottom: 32px; }
.result-stats    { display: flex; justify-content: center; gap: 40px; margin-bottom: 36px; flex-wrap: wrap; }
.stat-item       { text-align: center; }
.stat-item .stat-val   { font-size: 28px; font-weight: 700; color: #3b5bdb; }
.stat-item .stat-label { font-size: 12px; color: #94a3b8; margin-top: 4px; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Responsive tablette/mobile (< 1024px) ──────────────── */
@media (max-width: 1023px) {
    /* Topbar mobile */
    .qz-topbar          { display: flex; }
    .qz-topbar-progress { display: block; }

    /* Layout : défilement naturel */
    .qz-layout {
        height: auto;
        min-height: 0;
        overflow: visible;
        flex-direction: column;
    }

    /* Sidebar cachée sur mobile */
    .qz-sidebar { display: none; }

    /* Zone principale : padding réduit, gap serré */
    .qz-main {
        padding: 14px 14px 12px;
        overflow: visible;
        gap: 12px;
    }

    /* Badge question — compact */
    .qz-q-badge {
        padding: 4px 18px;
        font-size: 13px;
    }

    /* ═══ Carte énoncé — hauteur fixe avec scroll ═══ */
    .qz-enonce-card {
        padding: 18px 16px;
        font-size: 18px;
        line-height: 1.8;
        height: 200px;
        max-height: 200px;
    }

    /* Texte de la question */
    .qz-question-text { font-size: 16px; }

    /* Options — 1 colonne sur mobile, compactes */
    .qz-options-grid {
        grid-template-columns: 1fr;
        gap: 7px;
    }
    .option-btn {
        font-size: 15px;
        padding: 10px 13px;
        gap: 10px;
    }
    .option-letter {
        min-width: 34px;
        height: 34px;
        font-size: 13px;
    }

    /* ═══ Footer nav — ultra-compact ═══ */
    .qz-bottom-nav {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 7px 0 6px;
        border-top: 1px solid #e2e8f0;
        z-index: 50;
    }
    .qz-btn-prev, .qz-btn-next {
        padding: 9px 16px;
        font-size: 14px;
        gap: 6px;
    }
    .qz-pts-badge {
        padding: 5px 14px;
        font-size: 12px;
        gap: 5px;
    }
    .qz-pts-badge .qz-level {
        font-size: 10px;
        padding: 2px 6px;
    }

    /* Résultats */
    .result-card { padding: 32px 20px; margin: 20px 16px; }
}

/* ── Petit mobile (< 480px) — footer icônes seules ──────── */
@media (max-width: 480px) {
    /* Énoncé encore bien lisible */
    .qz-enonce-card   { font-size: 17px; padding: 16px 14px; line-height: 1.75; height: 180px; max-height: 180px; }
    .qz-question-text { font-size: 15px; }

    /* Options très compactes — 1 colonne */
    .qz-options-grid { grid-template-columns: 1fr; }
    .option-btn    { font-size: 14px; padding: 9px 11px; gap: 9px; }
    .option-letter { min-width: 30px; height: 30px; font-size: 12px; }

    /* Footer : masquer le label texte, garder uniquement les icônes */
    .qz-btn-label { display: none; }
    .qz-btn-prev, .qz-btn-next {
        padding: 9px 14px;
        font-size: 16px;   /* taille de l'icône */
    }
    .qz-pts-badge { font-size: 12px; padding: 5px 12px; }

    /* Topbar */
    .qz-topbar          { height: 50px; }
    .qz-topbar-timer    { font-size: 16px; }
    .qz-topbar-progress { top: 168px; } /* 118 + 50 */
}

/* ══ Correction des décalages : le header fixe = 128px sur mobile ══
   (la top-bar sombre est masquée sous 992px). Évite que la barre
   recouvre le badge « Question X » et le niveau. ══ */
@media (max-width: 991.98px) {
    .qz-topbar          { top: 128px; }
    .qz-topbar-progress { top: 182px; }
    .qz-mob-overlay     { top: 128px; }
    .qz-mob-nav-panel   { top: 128px; height: calc(100vh - 128px); }
    .qz-q-badge         { scroll-margin-top: 195px; }
    .qz-enonce-card     { scroll-margin-top: 195px; }
}
