:root {
    --primary: #000091;
    --secondary: #E1000F;
    --bg: #f5f7f9;
    --text: #1e1e1e;
    --text-light: #575757;
    --radius: 16px;
    --success: #22c55e;
    --error: #ef4444;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); font-size: 18px; line-height: 1.4; }
.hidden { display: none !important; }

/* NAVIGATION */
.main-header {
    background: white; min-height: 70px; display: flex; justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05); position: sticky; top: 0; z-index: 100;
}
.header-content { width: 100%; max-width: 1100px; display: flex; justify-content: space-between; align-items: center; padding: 10px 20px; flex-wrap: wrap; }
.logo { font-weight: 800; cursor: pointer; color: var(--primary); font-size: 1.4rem; }
.nav-links { display: flex; flex-wrap: wrap; gap: 5px; }
.nav-links button { background: none; border: none; padding: 8px 12px; font-weight: 600; cursor: pointer; color: var(--text-light); font-size: 1.1rem; }
.nav-links button:hover { color: var(--primary); }

/* CONTENEUR & TITRES */
.container { max-width: 900px; margin: 30px auto; padding: 0 20px; }
.hero { text-align: center; margin-bottom: 40px; }
.hero h1 { font-size: 2.5rem; color: var(--primary); margin-bottom: 10px; font-weight: 800; }

/* GRILLE ACCUEIL */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.card {
    background: white; padding: 30px; border-radius: var(--radius); display: flex; flex-direction: column;
    justify-content: space-between; box-shadow: 0 4px 12px rgba(0,0,0,0.05); transition: 0.2s;
}
.card:hover { transform: translateY(-5px); }
.card-icon { font-size: 3rem; margin-bottom: 15px; }
.card h3 { font-size: 1.4rem; margin-bottom: 10px; color: var(--primary); }

/* THÈMES */
.grid-themes { display: grid; grid-template-columns: 1fr; gap: 15px; margin-top: 20px; }
.theme-btn {
    background: white; border: 2px solid #e2e8f0; padding: 22px; border-radius: 12px;
    font-size: 1.2rem; font-weight: 600; text-align: left; cursor: pointer;
    display: flex; justify-content: space-between; align-items: center; transition: 0.2s;
}
.theme-btn:hover { border-color: var(--primary); background: #f0f4ff; }

/* MODAL EXAMEN */
.modal-card { background: white; padding: 40px; border-radius: var(--radius); max-width: 500px; margin: auto; text-align: center; box-shadow: 0 10px 25px rgba(0,0,0,0.1); }
.rules-box { background: #f8fafc; padding: 20px; border-radius: 12px; margin: 25px 0; text-align: left; }
.rule { margin: 12px 0; font-size: 1.1rem; }

/* QUIZ INTERFACE */
.quiz-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.badge { background: #e8edff; color: var(--primary); padding: 6px 14px; border-radius: 20px; font-weight: 700; font-size: 0.85rem; }
.timer-display { font-weight: 800; color: var(--primary); font-size: 1.2rem; text-align: center;}

.progress-wrapper { margin-bottom: 30px; }
.progress-info { display: flex; justify-content: space-between; margin-bottom: 8px; font-weight: 600; font-size: 1.1rem; }
.progress-bar-bg { background: #e2e8f0; height: 10px; border-radius: 10px; overflow: hidden; }
.progress-bar-fill { background: var(--primary); height: 100%; width: 0%; transition: 0.4s; }

.question-text { font-size: 1.8rem; margin-bottom: 30px; font-weight: 800; color: var(--primary); line-height: 1.3; }
.answers-list { display: grid; gap: 12px; }
.answer-btn {
    background: white; border: 2px solid #eef0f2; padding: 20px; border-radius: 12px;
    font-size: 1.15rem; font-weight: 500; cursor: pointer; text-align: left; transition: 0.2s;
}
.answer-btn:hover:not(:disabled) { border-color: var(--primary); background: #f8faff; }
.answer-btn.correct { background: #dcfce7 !important; border-color: var(--success) !important; color: #166534; font-weight: 700; }
.answer-btn.incorrect { background: #fee2e2 !important; border-color: var(--error) !important; color: #991b1b; }

/* --- Footer du Quiz --- */
.quiz-footer {
    padding-top: 20px;
    border-top: 1px solid #edf2f7;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* BOUTONS */
.btn-primary { margin-top:1rem; background: var(--primary); color: white; border: none; padding: 16px 30px; border-radius: 10px; font-weight: 700; cursor: pointer; font-size: 1.1rem; }
.btn-secondary { margin-top:1rem; background: var(--secondary); color: white; border: none; padding: 16px 30px; border-radius: 10px; font-weight: 700; cursor: pointer; font-size: 1.1rem; }
.btn-ghost { margin-top:1rem; background: #eee; color: #333; border: none; padding: 16px 30px; border-radius: 10px; font-weight: 700; cursor: pointer; font-size: 1.1rem;}
.full-width { width: 100%; }

/* SCORE CIRCLE */
.result-card { background: white; padding: 50px; border-radius: 20px; text-align: center; }
.score-circle { width: 140px; height: 140px; border: 10px solid var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 30px auto; font-size: 2.2rem; font-weight: 900; color: var(--primary); }

/* TABLES */
.table-container {overflow-x: scroll; margin-top:1rem; background: white; border-radius: 12px; border: 1px solid #e2e8f0; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px; text-align: left; border-bottom: 1px solid #eee; }
th { background: #f8fafc; font-weight: 700; }

@media (max-width: 600px) {
    .hero h1 { font-size: 1.8rem; }
    .question-text { font-size: 1.4rem; }
}

/* --- SECTION PARAMÈTRES --- */
.settings-section {
    margin-top: 50px;
    padding: 30px;
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border: 1px solid #eee;
}

.settings-section h3 {
    margin-bottom: 20px;
    font-size: 1.2rem;
    color: var(--primary);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.setting-text p {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* --- STYLE DU SWITCH (BOUTON ON/OFF) --- */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px; width: 20px;
    left: 4px; bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(22px); }

/* --- SECTION REVUE DE FIN --- */
.review-container {
    margin-top: 30px;
    text-align: left;
    max-height: 400px; /* Scrollable si trop de questions */
    overflow-y: auto;
    padding-right: 10px;
    border-top: 2px solid #eee;
    padding-top: 20px;
}

.review-item {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-left: 5px solid;
}

.review-correct {
    background-color: #f0fdf4;
    border-left-color: var(--success);
}

.review-incorrect {
    background-color: #fef2f2;
    border-left-color: var(--error);
}

.review-q {
    margin-bottom: 8px;
    font-size: 1rem;
    color: var(--primary);
}

.review-ans {
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.txt-user { font-weight: 700; }
.txt-correct { font-weight: 700; color: var(--success); }

/* Personnalisation du scrollbar pour la revue */
.review-container::-webkit-scrollbar { width: 6px; }
.review-container::-webkit-scrollbar-thumb { background: #ccc; border-radius: 10px; }
