/* ═══════════════════════════════════════════════════════════════
   Quiz Ayiti — feuille de style commune
   Design épuré : fond clair, bordures fines, un accent bleu drapeau,
   liseré bicolore bleu/rouge comme signature.
   ═══════════════════════════════════════════════════════════════ */

:root {
    /* Couleurs */
    --ink: #131a2a;
    --muted: #5b6472;
    --bg: #fafbfc;
    --card: #ffffff;
    --line: #e4e7ec;
    --blue: #002395;
    --blue-dark: #001a70;
    --blue-soft: #eef1fb;
    --red: #d21034;
    --gold: #f1c40f;
    --green: #10b981;
    --white: #ffffff;

    /* Compatibilité avec les styles de pages existants */
    /* Accents unifiés : toutes les classes utilisent le bleu drapeau */
    --blue-light: #2e4bc6;
    --purple: #002395;
    --orange: #002395;
    --teal: #002395;
    --win: #002395;
    --gray-50: #fafbfc;
    --gray-100: #f2f4f7;
    --gray-200: #e4e7ec;
    --gray-300: #d0d5dd;
    --gray-400: #98a2b3;
    --gray-500: #667085;
    --gray-600: #475467;
    --gray-700: #344054;
    --gray-800: #1d2939;
    --gray-900: #101828;

    /* Rayons, ombres, transitions — volontairement discrets */
    --radius: 10px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-md: 0 1px 3px rgba(16, 24, 40, .07);
    --shadow-lg: 0 4px 12px rgba(16, 24, 40, .08);
    --shadow-xl: 0 8px 24px rgba(16, 24, 40, .10);
    --transition: .15s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.65;
    color: var(--ink);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

img { max-width: 100%; }
a { color: var(--blue); }

/* Icônes SVG (remplacent les emojis) */
.ico {
    width: 1.1em;
    height: 1.1em;
    vertical-align: -0.18em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}
/* ── Conteneur principal ────────────────────────────────────── */
.container,
main.container {
    width: 100%;
    max-width: 1060px;
    margin: 0 auto;
    padding: 2.25rem 1.25rem 3.5rem;
    flex: 1;
}

/* ── Footer ─────────────────────────────────────────────────── */
.footer {
    margin-top: auto;
    background: var(--white);
    border-top: 1px solid var(--line);
    position: relative;
    padding: 1.6rem 1.25rem;
    text-align: center;
    color: var(--blue);
    font-size: .88rem;
}
.footer::before {
    content: '';
    position: absolute;
    left: 0; right: 0; top: -1px;
    height: 2px;
    background: linear-gradient(to right, var(--blue) 0 50%, var(--red) 50% 100%);
    opacity: .5;
}
.footer a { color: var(--blue); text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer strong { color: var(--ink); }

/* ── Boutons génériques ─────────────────────────────────────── */
.btn, button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .6rem 1.15rem;
    border-radius: 8px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    font-size: .93rem;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-outline { background: var(--white); color: var(--ink); border-color: var(--line); }
.btn-outline:hover { border-color: var(--gray-400); }

/* ── Accessibilité ──────────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .container, main.container { padding: 1.5rem 1rem 2.5rem; }
}


/* ── Authentification ───────────────────────────────────────── */
.auth-wrap {
    max-width: 440px;
    margin: 3.5rem auto;
    padding: 0 1.25rem;
    flex: 1;
    width: 100%;
}
.auth-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 2.4rem 2rem;
    box-shadow: 0 18px 45px rgba(14, 26, 51, .08);
}
.auth-card h1 { font-family: 'Poppins', 'Inter', sans-serif; font-size: 1.6rem; font-weight: 800; margin-bottom: .4rem; letter-spacing: -.02em; }
.auth-card .auth-sub { color: var(--muted); font-size: .95rem; margin-bottom: 1.75rem; }
.form-group { margin-bottom: 1.15rem; }
.form-group label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .45rem; }
.form-group input, .form-group select {
    width: 100%;
    padding: .8rem .9rem;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    font: inherit;
    font-size: .95rem;
    background: var(--white);
    color: var(--ink);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(27, 83, 240, .12); }
.form-error { color: var(--red); font-size: .84rem; margin-top: .35rem; }
.auth-card .btn { width: 100%; padding: .85rem; margin-top: .5rem; border-radius: 999px; font-weight: 700; }
.auth-alt { text-align: center; margin-top: 1.4rem; font-size: .92rem; color: var(--muted); }
.auth-alt a { font-weight: 700; text-decoration: none; color: var(--blue); }
.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    border-radius: 8px;
    padding: .7rem .9rem;
    font-size: .9rem;
    margin-bottom: 1.1rem;
}
.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
    border-radius: 8px;
    padding: .7rem .9rem;
    font-size: .9rem;
    margin-bottom: 1.1rem;
}

/* ── Dashboard : grands boutons d'action ───────────────────────── */
.admin-big-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.admin-big-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .5rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1.4rem 1.3rem;
    text-decoration: none;
    color: var(--ink);
    transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.admin-big-btn:hover { border-color: var(--blue); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.admin-big-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border-radius: 10px;
    background: var(--blue-soft); color: var(--blue);
}
.admin-big-icon .ico { width: 22px; height: 22px; }
.admin-big-label { font-weight: 800; font-size: 1.05rem; }
.admin-big-sub { color: var(--muted); font-size: .82rem; }
.admin-big-btn-accent .admin-big-icon { background: #fdecee; color: var(--red); }

/* ── Dashboard ──────────────────────────────────────────────── */
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; flex-wrap: wrap; }
.dash-head h1 { font-size: 1.45rem; font-weight: 800; letter-spacing: -.01em; }
.dash-head .role-badge {
    display: inline-flex; align-items: center; gap: .4rem;
    background: var(--blue-soft); color: var(--blue);
    font-size: .8rem; font-weight: 600;
    padding: .3rem .7rem; border-radius: 20px;
}
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.kpi {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
}
.kpi .kpi-label { color: var(--muted); font-size: .82rem; font-weight: 500; display: flex; align-items: center; gap: .45rem; }
.kpi .kpi-value { font-size: 1.7rem; font-weight: 800; margin-top: .25rem; letter-spacing: -.02em; }
.dash-section { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.4rem; margin-bottom: 1.5rem; }
.dash-section h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem; }
.dash-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.dash-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: .8rem; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.dash-table td { padding: .6rem; border-bottom: 1px solid var(--gray-100); }
.dash-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .8rem; }
.dash-link {
    display: flex; align-items: center; gap: .7rem;
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: .9rem 1rem; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .93rem;
    transition: border-color var(--transition), background var(--transition);
}
.dash-link:hover { border-color: var(--blue); background: var(--blue-soft); }
.dash-link .ico { color: var(--blue); width: 20px; height: 20px; }

.dash-breadcrumb { color: var(--muted); font-size: .85rem; margin-bottom: .3rem; }
.dash-breadcrumb a { color: var(--muted); text-decoration: none; }
.dash-breadcrumb a:hover { color: var(--blue); }

.dash-section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.dash-section-head h2 { margin-bottom: 0; }
.dash-search { display: flex; gap: .4rem; }
.dash-search input {
    padding: .5rem .75rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: .88rem; min-width: 220px;
}

.matiere-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.25rem; }
.matiere-tab {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .5rem .9rem; border: 1px solid var(--line); border-radius: 20px;
    text-decoration: none; color: var(--muted); font-weight: 600; font-size: .85rem;
}
.matiere-tab:hover { border-color: var(--blue); color: var(--ink); }
.matiere-tab.active { background: var(--blue); border-color: var(--blue); color: var(--white); }
.matiere-tab-count { opacity: .75; font-weight: 500; }

.add-question summary {
    cursor: pointer; font-weight: 700; display: flex; align-items: center; gap: .5rem;
    color: var(--blue); list-style: none;
}
.add-question summary::-webkit-details-marker { display: none; }
.add-question[open] summary { margin-bottom: 1.1rem; }

.question-form .form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.question-form textarea {
    width: 100%; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 8px;
    font: inherit; font-size: .93rem; resize: vertical;
}
.answers-fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; margin: 1rem 0; }
.answers-fieldset legend { font-size: .82rem; font-weight: 600; color: var(--muted); padding: 0 .4rem; }
.answer-row { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.answer-row input[type="text"] { flex: 1; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: .9rem; }

.question-item { border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: .75rem; }
.question-item summary {
    cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    list-style: none; font-weight: 600; font-size: .93rem;
}
.question-item summary::-webkit-details-marker { display: none; }
.question-item-text { flex: 1; }
.question-item-meta { color: var(--muted); font-size: .78rem; font-weight: 500; white-space: nowrap; }
.question-item[open] summary { margin-bottom: 1rem; border-bottom: 1px solid var(--line); padding-bottom: .8rem; }
.question-item-actions { margin-top: .6rem; }
.question-delete-form { margin-top: .6rem; }

.btn-danger { color: var(--red); border-color: #f5c6cb; }
.btn-danger:hover { background: #fdecee; border-color: var(--red); }
.btn-icon-danger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
    background: var(--white); color: var(--red); cursor: pointer;
}
.btn-icon-danger:hover { background: #fdecee; border-color: var(--red); }

.dash-pagination { margin-top: 1.25rem; }
.dash-pagination nav { font-size: .85rem; }
