/* ExamTiers — feuille de style unique, sans framework, adaptée au téléphone */

:root {
    --fond: #f4f6f8;
    --carte: #ffffff;
    --texte: #1d2733;
    --doux: #5d6b7a;
    --bordure: #d7dee6;
    --primaire: #0b6e4f;
    --primaire-fonce: #08513a;
    --danger: #b42318;
    --alerte: #b54708;
    --info: #175cd3;
    --rayon: 10px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--texte);
    background: var(--fond);
}

a { color: var(--primaire); }

h1 { font-size: 1.5rem; margin: .2em 0 .6em; }
h2 { font-size: 1.2rem; margin: 1.2em 0 .6em; }
h3 { font-size: 1.05rem; margin: 0; }

.conteneur { max-width: 1000px; margin: 0 auto; padding: 16px; }

/* Barre du haut */
.barre {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
    padding: 10px 16px; background: var(--primaire); color: #fff;
}
.barre a, .barre .lien { color: #fff; }
.barre nav { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.logo { font-weight: 700; text-decoration: none; font-size: 1.1rem; }
.logo small { font-weight: 400; opacity: .8; }

/* Cartes et mise en page */
.carte {
    background: var(--carte); border: 1px solid var(--bordure); border-radius: var(--rayon);
    padding: 16px; margin-bottom: 16px;
}
.etroite { max-width: 440px; margin-left: auto; margin-right: auto; }
.entete-page { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.grille-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.petit { font-size: .875rem; color: var(--doux); }
.aide { display: block; font-weight: 400; font-size: .85rem; color: var(--doux); }

/* Formulaires */
label { display: block; font-weight: 600; margin-bottom: 12px; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local],
input[type=file], select, textarea {
    display: block; width: 100%; margin-top: 4px; padding: 10px 12px;
    font: inherit; font-weight: 400; color: inherit;
    border: 1px solid var(--bordure); border-radius: 8px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primaire); outline-offset: 1px; }
label.case { display: flex; align-items: center; gap: 8px; font-weight: 400; }
fieldset { border: 1px solid var(--bordure); border-radius: 8px; margin: 0 0 12px; padding: 12px; }
legend { font-weight: 600; padding: 0 4px; }
.ligne-proposition { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ligne-proposition label.case { margin: 0; min-width: 48px; }
.ligne-proposition input[type=text] { margin: 0; }
form.en-ligne { display: inline; }

/* Boutons */
.bouton, button.bouton {
    display: inline-block; padding: 10px 18px; border: 0; border-radius: 8px;
    background: var(--primaire); color: #fff; font: inherit; font-weight: 600;
    text-decoration: none; cursor: pointer;
}
.bouton:hover { background: var(--primaire-fonce); }
.bouton.secondaire { background: #fff; color: var(--primaire); border: 1px solid var(--primaire); }
.bouton-danger, button.bouton-danger { background: var(--danger); }
button.lien { background: none; border: 0; padding: 0; font: inherit; color: var(--primaire); text-decoration: underline; cursor: pointer; }
.danger, button.lien.danger { color: var(--danger); }
details.danger summary { cursor: pointer; font-weight: 600; }

/* Alertes */
.alerte { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.alerte ul { margin: 0; padding-left: 18px; }
.alerte-succes { background: #ecfdf3; border-color: #abefc6; color: #067647; }
.alerte-erreur { background: #fef3f2; border-color: #fecdca; color: var(--danger); }
.alerte-info { background: #eff8ff; border-color: #b2ddff; color: var(--info); }
.alerte-attention { background: #fffaeb; border-color: #fedf89; color: var(--alerte); }

/* Tableaux */
.tableau-defilant { overflow-x: auto; background: var(--carte); border: 1px solid var(--bordure); border-radius: var(--rayon); margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--bordure); vertical-align: top; }
th { background: #eef2f5; font-size: .875rem; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.nombre, th.nombre { text-align: right; white-space: nowrap; }

.etiquette { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .78rem; font-weight: 600; vertical-align: middle; }
.etat-a_venir { background: #eff8ff; color: var(--info); }
.etat-ouvert { background: #ecfdf3; color: #067647; }
.etat-termine { background: #f2f4f7; color: var(--doux); }
.ok { color: #067647; font-weight: 600; }
.ko { color: var(--danger); font-weight: 600; }

dl.infos { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.infos dt { font-weight: 600; color: var(--doux); }
dl.infos dd { margin: 0; }
.lien-examen { font-family: ui-monospace, Consolas, monospace; margin-bottom: 6px; }

.propositions-admin { list-style: none; padding: 0; margin: 10px 0; }
.propositions-admin li { padding: 4px 8px; border-radius: 6px; }
.propositions-admin li.correcte { background: #ecfdf3; }
.question-admin .actions { margin-top: 6px; }

/* Aperçu d'import */
.apercu-erreur { border-left: 4px solid var(--danger); }

/* ---------- Côté étudiant ---------- */
body.etudiant .conteneur { max-width: 680px; }
.chrono-bloc { position: sticky; top: 0; z-index: 2; background: var(--fond); padding: 8px 0; }
.progression { display: flex; justify-content: space-between; font-size: .9rem; color: var(--doux); margin-bottom: 6px; }
.chrono {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums;
    padding: 8px; border-radius: var(--rayon); background: #ecfdf3; color: #067647;
}
.chrono.bientot { background: #fffaeb; color: var(--alerte); }
.chrono.urgent { background: #fef3f2; color: var(--danger); }
.jauge { height: 6px; background: var(--bordure); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.jauge span { display: block; height: 100%; background: currentColor; width: 100%; transition: width 1s linear; }
.chrono-bloc .jauge span { background: var(--primaire); }

.enonce { font-size: 1.15rem; font-weight: 600; white-space: pre-line; margin: 6px 0 16px; }
.choix { list-style: none; padding: 0; margin: 0 0 16px; }
.choix li { margin-bottom: 10px; }
.choix label {
    display: flex; align-items: flex-start; gap: 12px; margin: 0; padding: 14px;
    font-weight: 400; background: #fff; border: 2px solid var(--bordure); border-radius: var(--rayon); cursor: pointer;
    min-height: 52px;
}
.choix input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--primaire); }
.choix label:has(input:checked) { border-color: var(--primaire); background: #ecfdf3; }
.bouton-large { width: 100%; padding: 14px; font-size: 1.05rem; }
.bouton[disabled] { opacity: .6; cursor: wait; }
.note-finale { font-size: 2.6rem; font-weight: 800; color: var(--primaire); text-align: center; margin: 8px 0; }
.centre { text-align: center; }

@media (max-width: 640px) {
    .conteneur { padding: 12px; }
    .grille-2 { grid-template-columns: 1fr; }
    dl.infos { grid-template-columns: 1fr; }
    dl.infos dt { margin-top: 6px; }
    h1 { font-size: 1.3rem; }
}
