/* ============================================================
   CRYOTEST — Feuille de style principale
   ============================================================ */

/* ── Variables ──────────────────────────────────────────────── */
:root {
    --bleu:          #1F4E79;
    --bleu-clair:    #2E75B6;
    --bleu-pale:     #DBEAFE;
    --vert:          #166534;
    --vert-pale:     #DCFCE7;
    --rouge:         #991B1B;
    --rouge-pale:    #FEE2E2;
    --orange:        #92400E;
    --orange-pale:   #FEF3C7;
    --gris:          #F1F5F9;
    --gris-bord:     #E2E8F0;
    --texte:         #1E293B;
    --texte-doux:    #64748B;
    --blanc:         #FFFFFF;
    --radius:        10px;
    --shadow:        0 2px 12px rgba(0,0,0,0.10);
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: Arial, Helvetica, sans-serif; color: var(--texte);
       background: var(--gris); min-height: 100vh; }
a { color: var(--bleu-clair); text-decoration: none; }
img { max-width: 100%; height: auto; }

/* ── Boutons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 22px; border-radius: 6px; border: none;
    font-size: 0.95rem; font-family: inherit; cursor: pointer;
    transition: background 0.18s, transform 0.1s;
    text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary   { background: var(--bleu);       color: white; }
.btn-primary:hover { background: var(--bleu-clair); }
.btn-secondary { background: var(--gris-bord);  color: var(--texte); }
.btn-secondary:hover { background: #CBD5E1; }
.btn-finish    { background: #16A34A;            color: white; }
.btn-finish:hover { background: #15803D; }
.btn-full { width: 100%; justify-content: center; padding: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Alertes ─────────────────────────────────────────────────── */
.alert { border-radius: 6px; padding: 12px 16px; margin-bottom: 16px; font-size: 0.9rem; }
.alert-err  { background: var(--rouge-pale); border-left: 4px solid #DC2626; color: var(--rouge); }
.alert-warn { background: var(--orange-pale); border-left: 4px solid #D97706; color: var(--orange); }
.alert-ok   { background: var(--vert-pale); border-left: 4px solid #16A34A; color: var(--vert); }

/* ══════════════════════════════════════════════════════════════
   PAGE CONNEXION
   ══════════════════════════════════════════════════════════════ */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh;
              background: linear-gradient(135deg, #1F4E79 0%, #2E75B6 100%); }

.login-container {
    background: white; border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    padding: 40px 36px; width: 100%; max-width: 400px;
}

.login-logo { text-align: center; margin-bottom: 28px; }
.logo-icon  { font-size: 3rem; }
.login-logo h1 { font-size: 2rem; color: var(--bleu); margin-top: 8px; }
.login-logo p  { color: var(--texte-doux); font-size: 0.9rem; margin-top: 4px; line-height: 1.5; }

.login-form { margin-top: 16px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.88rem; font-weight: bold;
                    color: var(--texte); margin-bottom: 6px; }
.form-group input {
    width: 100%; padding: 11px 14px; border: 1.5px solid var(--gris-bord);
    border-radius: 6px; font-size: 1rem; font-family: inherit;
    transition: border-color 0.18s;
}
.form-group input:focus { outline: none; border-color: var(--bleu-clair); }

.login-footer { text-align: center; margin-top: 20px; font-size: 0.82rem; color: var(--texte-doux); }

/* ══════════════════════════════════════════════════════════════
   PAGE TEST
   ══════════════════════════════════════════════════════════════ */
.test-page { display: flex; flex-direction: column; min-height: 100vh;
             background: var(--gris); padding-bottom: 120px; }

/* ── En-tête ─── */
.test-header {
    background: var(--bleu); color: white;
    padding: 12px 24px; display: flex;
    justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.test-header-left { display: flex; align-items: center; gap: 20px; }
.header-logo    { font-size: 1.1rem; font-weight: bold; }
.header-candidat { font-size: 0.9rem; opacity: 0.85; }

/* ── Chronomètre ─── */
.chrono {
    display: flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,0.15); border-radius: 8px;
    padding: 8px 16px; font-size: 1.2rem; font-weight: bold;
    min-width: 110px; justify-content: center;
    transition: background 0.3s, color 0.3s;
}
.chrono-warn   { background: #FEF3C7 !important; color: #92400E !important; }
.chrono-danger { background: #FEE2E2 !important; color: #991B1B !important;
                 animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.6; } }

/* ── Barre de progression ─── */
.progress-bar-container {
    background: var(--gris-bord); height: 8px; position: relative;
    display: flex; align-items: center;
}
.progress-bar {
    height: 100%; background: var(--bleu-clair);
    transition: width 0.3s ease; border-radius: 0 4px 4px 0;
}
.progress-label {
    position: absolute; right: 16px; font-size: 0.78rem;
    color: var(--texte-doux); white-space: nowrap;
}

/* ── Zone principale ─── */
.test-main { max-width: 820px; margin: 24px auto; padding: 0 16px; width: 100%; }

/* ── Carte question ─── */
.question-card { display: none; }
.question-card.active { display: block; }

.question-meta {
    display: flex; gap: 10px; flex-wrap: wrap;
    margin-bottom: 16px; align-items: center;
}
.q-numero    { background: var(--bleu); color: white; padding: 4px 12px;
               border-radius: 20px; font-size: 0.85rem; font-weight: bold; }
.q-categorie { background: var(--bleu-pale); color: var(--bleu); padding: 4px 10px;
               border-radius: 20px; font-size: 0.82rem; font-weight: bold; }
.q-type      { color: var(--texte-doux); font-size: 0.82rem; }

.question-texte {
    font-size: 1.05rem; line-height: 1.6; margin-bottom: 20px;
    padding: 20px; background: white; border-radius: var(--radius);
    box-shadow: var(--shadow); border-left: 4px solid var(--bleu-clair);
}

.question-image { margin-bottom: 20px; text-align: center; }
.question-image img { max-height: 320px; border-radius: 8px; box-shadow: var(--shadow); }

.instruction-multiple {
    background: var(--orange-pale); color: var(--orange);
    padding: 10px 14px; border-radius: 6px; font-size: 0.88rem;
    margin-bottom: 14px; border-left: 4px solid #D97706;
}

/* ── Réponses ─── */
.reponses-liste { display: flex; flex-direction: column; gap: 10px; }

.reponse-item {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 14px 18px; background: white; border-radius: 8px;
    border: 2px solid var(--gris-bord); cursor: pointer;
    transition: all 0.18s; user-select: none;
}
.reponse-item:hover { border-color: var(--bleu-clair); background: var(--bleu-pale); }
.reponse-item.selected { border-color: var(--bleu); background: var(--bleu-pale); }

.reponse-item input { display: none; }

.reponse-indicator {
    width: 22px; height: 22px; min-width: 22px; border: 2px solid var(--gris-bord);
    border-radius: 50%; margin-top: 1px; transition: all 0.18s;
    display: flex; align-items: center; justify-content: center;
}
.reponse-item input[type=checkbox] ~ .reponse-indicator { border-radius: 4px; }
.reponse-item.selected .reponse-indicator {
    background: var(--bleu); border-color: var(--bleu);
}
.reponse-item.selected .reponse-indicator::after {
    content: '✓'; color: white; font-size: 0.8rem; font-weight: bold;
}
.reponse-texte { font-size: 0.97rem; line-height: 1.5; }

/* ── Navigation ─── */
.test-nav {
    position: fixed; bottom: 60px; left: 0; right: 0;
    background: white; border-top: 1px solid var(--gris-bord);
    padding: 12px 24px; display: flex;
    justify-content: space-between; align-items: center;
    gap: 16px; z-index: 90; box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
}

.nav-dots {
    display: flex; gap: 4px; flex-wrap: wrap;
    max-width: 400px; justify-content: center;
    overflow: hidden; max-height: 36px;
}
.nav-dot {
    width: 10px; height: 10px; border-radius: 50%;
    border: none; background: var(--gris-bord); cursor: pointer;
    transition: all 0.18s; padding: 0;
}
.nav-dot.current  { background: var(--bleu); transform: scale(1.3); }
.nav-dot.answered { background: #86EFAC; }
.nav-dot.current.answered { background: var(--bleu); }

/* ── Bouton terminer ─── */
.finish-zone {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: white; border-top: 1px solid var(--gris-bord);
    padding: 10px 24px; text-align: center; z-index: 89;
}
.btn-finish { padding: 10px 32px; font-size: 1rem; }

/* ── Blocage ─── */
.blocage-container { display: flex; align-items: center; justify-content: center;
                     min-height: 100vh; padding: 24px; }
.blocage-card { background: white; border-radius: var(--radius); box-shadow: var(--shadow);
                padding: 48px 40px; text-align: center; max-width: 440px; }
.blocage-icon { font-size: 4rem; margin-bottom: 16px; }
.blocage-card h1 { font-size: 1.5rem; color: var(--bleu); margin-bottom: 12px; }
.blocage-card p  { color: var(--texte-doux); margin-bottom: 24px; line-height: 1.6; }

/* ── Modales ─── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
    z-index: 200; padding: 24px;
}
.modal {
    background: white; border-radius: var(--radius);
    padding: 36px; max-width: 460px; width: 100%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.modal h2 { font-size: 1.3rem; color: var(--bleu); margin-bottom: 16px; }
.modal p  { color: var(--texte-doux); margin-bottom: 12px; line-height: 1.5; }
.modal p:last-of-type { margin-bottom: 24px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; }

/* ══════════════════════════════════════════════════════════════
   PAGE RÉSULTAT
   ══════════════════════════════════════════════════════════════ */
.resultat-page { background: var(--gris); }

.resultat-container { max-width: 860px; margin: 0 auto; padding: 24px 16px 48px; }

.print-header { display: none; }
.print-footer { display: none; }

.resultat-card {
    border-radius: var(--radius); padding: 36px;
    text-align: center; margin-bottom: 24px; box-shadow: var(--shadow);
}
.resultat-card.reussi { background: var(--vert-pale); border: 2px solid #16A34A; }
.resultat-card.echoue { background: var(--rouge-pale); border: 2px solid #DC2626; }

.resultat-statut {
    font-size: 2rem; font-weight: bold; margin-bottom: 8px;
}
.reussi .resultat-statut { color: var(--vert); }
.echoue .resultat-statut { color: var(--rouge); }

.resultat-candidat {
    font-size: 1.3rem; font-weight: bold; color: var(--texte);
    margin-bottom: 24px;
}

.resultat-score-grid {
    display: flex; justify-content: center; gap: 32px; flex-wrap: wrap;
    margin-bottom: 20px;
}
.resultat-score-item { text-align: center; }
.score-valeur { font-size: 2rem; font-weight: bold; color: var(--bleu); }
.score-label  { font-size: 0.85rem; color: var(--texte-doux); margin-top: 4px; }

.resultat-meta { font-size: 0.82rem; color: var(--texte-doux); }

.resultat-actions { display: flex; gap: 12px; justify-content: center; margin-bottom: 32px; }

/* ── Détail questions ─── */
.detail-section h2 { font-size: 1.1rem; color: var(--bleu); margin-bottom: 16px;
                     padding-bottom: 8px; border-bottom: 2px solid var(--gris-bord); }

.detail-question {
    background: white; border-radius: 8px; margin-bottom: 12px;
    box-shadow: var(--shadow); overflow: hidden; border-left: 5px solid var(--gris-bord);
}
.detail-question.q-ok  { border-left-color: #16A34A; }
.detail-question.q-ko  { border-left-color: #DC2626; }

.detail-q-header {
    display: flex; gap: 12px; align-items: center; padding: 12px 16px;
    background: var(--gris); border-bottom: 1px solid var(--gris-bord);
    flex-wrap: wrap;
}
.detail-numero    { font-weight: bold; font-size: 0.9rem; color: var(--bleu); }
.detail-categorie { font-size: 0.82rem; color: var(--texte-doux); }
.detail-statut    { margin-left: auto; font-weight: bold; font-size: 0.88rem; }
.q-ok .detail-statut { color: var(--vert); }
.q-ko .detail-statut { color: var(--rouge); }

.detail-q-texte { padding: 14px 16px; font-size: 0.95rem; line-height: 1.5; }
.detail-image   { max-height: 200px; margin: 0 16px 12px; border-radius: 6px; }

.detail-reponses { padding: 0 16px 14px; display: flex; flex-direction: column; gap: 6px; }
.detail-reponse  { display: flex; gap: 10px; align-items: flex-start;
                   padding: 8px 12px; border-radius: 6px; font-size: 0.9rem; }

.detail-reponse.r-correcte   { background: #F0FDF4; }
.detail-reponse.r-selectionnee.r-correcte  { background: #DCFCE7; font-weight: bold; }
.detail-reponse.r-selectionnee:not(.r-correcte) { background: var(--rouge-pale); }

.r-icone       { min-width: 20px; font-size: 0.95rem; }
.r-label-correct { font-size: 0.78rem; color: var(--vert); font-style: italic;
                   white-space: nowrap; margin-left: 4px; }
.detail-legende  { padding: 6px 16px 12px; font-size: 0.78rem; color: var(--texte-doux); }

/* ── Impression ─── */
@media print {
    body { background: white !important; }
    .no-print { display: none !important; }
    .resultat-container { max-width: 100%; padding: 0; }

    .print-header {
        display: flex; justify-content: space-between;
        font-size: 0.8rem; color: var(--texte-doux);
        border-bottom: 1px solid var(--gris-bord);
        padding-bottom: 8px; margin-bottom: 16px;
    }
    .print-footer {
        display: block; margin-top: 32px;
        border-top: 1px solid var(--gris-bord); padding-top: 12px;
        font-size: 0.82rem; color: var(--texte-doux);
    }
    .print-footer p { margin-bottom: 8px; }

    .resultat-card { box-shadow: none; }
    .detail-question { box-shadow: none; break-inside: avoid; }
    .test-header, .test-nav, .finish-zone { display: none; }
}

/* ── Responsive ─── */
@media (max-width: 600px) {
    .test-nav { padding: 10px 12px; gap: 8px; }
    .nav-dots { max-width: 200px; }
    .resultat-score-grid { gap: 16px; }
    .score-valeur { font-size: 1.5rem; }
    .modal-actions { flex-direction: column; }
    .login-container { padding: 28px 20px; }
}
