/* ============================================================
   COULEURS DE LA MARQUE — change ces 4 lignes pour coller
   à la charte graphique de MS Procédures.
   ============================================================ */
:root {
  --brand-primary: #3E9C85;   /* vert sarcelle MS Procédures */
  --brand-accent:  #E8A23B;   /* orange du logo              */
  --brand-dark:    #2E7A67;   /* vert foncé (survol)         */
  --brand-light:   #eef7f4;   /* fond vert très clair        */

  --text: #1a1a2e;
  --muted: #6b7280;
  --border: #d9def0;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(11,61,145,.12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, var(--brand-light), #ffffff);
  min-height: 100vh;
}

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 22px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.topbar img { height: 92px; max-width: 78vw; object-fit: contain; }

#app { max-width: 920px; margin: 0 auto; padding: 26px 16px 60px; }

/* --- Écrans --- */
.screen { display: none; animation: fade .35s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 30px 28px;
}
.center { text-align: center; }
h1 { color: var(--brand-primary); margin: 0 0 10px; }
h2 { color: var(--brand-primary); margin: 0 0 16px; }
h3 { color: var(--brand-dark); }
.lead { font-size: 1.15rem; }
.muted { color: var(--muted); }
.mt { margin-top: 26px; }
.opt { color: var(--muted); font-weight: 400; font-size: .85em; }

/* --- Choix du poste --- */
.choices { display: grid; gap: 14px; margin-top: 22px; }
.choice {
  display: flex; flex-direction: column; gap: 5px; text-align: center;
  padding: 16px 18px;
  border: 2px solid var(--brand-primary); border-radius: var(--radius);
  background: #fff; color: var(--brand-primary); cursor: pointer;
  transition: .18s;
}
.choice:hover { background: var(--brand-primary); color: #fff; transform: translateY(-2px); }
.choice-title { font-size: 1.05rem; font-weight: 700; }
.choice-desc { font-size: .86rem; font-weight: 400; opacity: .8; line-height: 1.35; }

/* --- Formulaires --- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .92rem; }
input, select, textarea {
  font: inherit; padding: 11px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: #fff; font-weight: 400;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(11,61,145,.15);
}
textarea { resize: vertical; min-height: 120px; }

/* La zone de réponse du test occupe toute la largeur */
#questionArea textarea { width: 100%; min-height: 160px; }

/* Document (images) de la question 8 — zone défilable */
.doc-frame {
  width: 100%; height: 60vh; min-height: 360px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 10px; margin-bottom: 16px;
  background: #fff; padding: 8px;
}
.doc-frame img { display: block; width: 100%; height: auto; margin-bottom: 8px; }

/* --- Boutons --- */
.actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; }
.actions:has(> :only-child) { justify-content: center; }
.btn-primary, .btn-ghost {
  padding: 13px 24px; font-size: 1rem; font-weight: 600;
  border-radius: 10px; cursor: pointer; transition: .18s; border: none;
}
.btn-primary { background: var(--brand-primary); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: #fff; color: var(--brand-primary); border: 1px solid var(--brand-primary); }
.btn-ghost:hover { background: var(--brand-light); }

.badge {
  display: inline-block; background: var(--brand-accent); color: var(--brand-dark);
  font-weight: 700; font-size: .8rem; padding: 5px 12px; border-radius: 999px; margin-bottom: 10px;
}

/* --- Formations dynamiques --- */
.formation {
  display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px;
  border: 1px dashed var(--border); border-radius: 12px; padding: 14px; margin-bottom: 12px;
  position: relative;
}
.formation .full { grid-column: 1 / -1; }
.formation .remove {
  align-self: start; background: #fff0f0; color: #c0392b; border: 1px solid #f3caca;
  border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 1.1rem;
}

.filename { color: var(--brand-primary); font-weight: 700; font-size: .82rem; }

.rules { text-align: left; line-height: 1.7; }
.rules li { margin-bottom: 8px; }

/* --- Test / chronomètre --- */
.test-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.timer { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--brand-primary); font-size: 1.2rem; }
.timer.danger { color: #c0392b; }
.timer-bar { height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; margin-bottom: 20px; }
#timerFill { height: 100%; width: 100%; background: var(--brand-primary); transition: width 1s linear; }
#timerFill.danger { background: #c0392b; }
.question-prompt { font-size: 1.15rem; font-weight: 600; margin-bottom: 14px; }

/* Faux document (Q8) */
.fake-doc {
  border: 1px solid var(--border); border-radius: 10px; padding: 20px;
  background: #fffef7; font-size: .95rem; line-height: 1.6; margin-bottom: 16px;
}
.fake-doc h4 { margin: 0 0 4px; }

.audio-controls { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }

/* Spinner + check */
.spinner {
  width: 46px; height: 46px; border: 5px solid var(--border);
  border-top-color: var(--brand-primary); border-radius: 50%;
  margin: 0 auto 18px; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.checkmark {
  width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 50%;
  background: #e8f7ee; color: #1e9e56; font-size: 2.4rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* --- Mobile --- */
@media (max-width: 620px) {
  .grid2, .formation { grid-template-columns: 1fr; }
  .card { padding: 22px 18px; }
  .actions { flex-direction: column-reverse; }
  .actions button { width: 100%; }
}


/* ---- Astérisque « champ obligatoire » ---- */
.req { color: #c0392b; font-weight: 700; }
.req-line { margin: 0 0 8px; font-size: .85rem; color: #666; }

/* ---- Poste sélectionné (choix multiple) ---- */
.choice.selected {
  background: var(--brand-primary);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(62,156,133,.25);
}
.choice.selected .choice-desc { opacity: .92; }

.btn-primary:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}

/* ---- Mention « une seule candidature » ---- */
.notice {
  margin-top: 18px;
  padding: 10px 14px;
  background: #fdf6e8;
  border-left: 4px solid var(--brand-accent, #E8A23B);
  border-radius: 8px;
  font-size: .88rem;
  color: #6b5324;
  text-align: left;
}

/* ---- Dictaphone (présentation orale) ---- */
.rec-box {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 16px; margin-bottom: 14px;
  border: 1px solid var(--border); border-radius: 12px; background: #fafafa;
}
.btn-rec {
  padding: 12px 20px; font-size: 1rem; font-weight: 600;
  border: 2px solid var(--brand-primary); border-radius: 10px;
  background: #fff; color: var(--brand-primary); cursor: pointer; transition: .18s;
}
.btn-rec:hover { background: var(--brand-primary); color: #fff; }
.btn-rec.recording { background: #c0392b; border-color: #c0392b; color: #fff; }
.rec-state { font-size: .9rem; font-weight: 600; color: #444; }
.rec-box audio { width: 100%; max-width: 420px; }
#recHint { font-size: .82rem; margin: 0; }

/* ---- Bouton de téléchargement (épreuve fichier) ---- */
.btn-download {
  display: inline-block; padding: 11px 20px; margin-bottom: 6px;
  background: var(--brand-primary); color: #fff; text-decoration: none;
  font-weight: 600; border-radius: 10px; transition: .18s;
}
.btn-download:hover { background: var(--brand-dark); }

/* ============================================================
   Spécifique à l'entraînement aux entretiens
   ============================================================ */
.score {
  background: var(--brand-light); color: var(--brand-dark);
  font-weight: 700; font-size: .9rem; padding: 4px 12px; border-radius: 999px;
}
.test-head { gap: 10px; }

.verdict {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-radius: 12px; font-weight: 700; font-size: 1.1rem;
  margin-bottom: 18px;
}
.verdict.ok { background: #e8f7ee; color: #1e7a45; border: 1px solid #b7e4c7; }
.verdict.ko { background: #fdf1e8; color: #a35a12; border: 1px solid #f3d7bb; }
.verdict span { font-size: 1.3rem; }

.box {
  padding: 12px 15px; border-radius: 10px; line-height: 1.6;
  margin-bottom: 6px; font-size: .96rem;
}
.box-neutral { background: #f6f7f9; border-left: 4px solid #c9cfda; white-space: pre-wrap; }
.box-attente { background: #fdf6e8; border-left: 4px solid var(--brand-accent); margin: 0 0 6px; padding-left: 34px; }
.box-attente li { margin-bottom: 5px; }
.box-modele { background: var(--brand-light); border-left: 4px solid var(--brand-primary); }
.box-avis  { background: #eef2ff; border-left: 4px solid #6b7ddb; }
.conseil { margin-top: 10px; font-weight: 600; color: #3b478f; }

#screen-feedback h3 {
  font-size: .95rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--brand-dark); margin: 20px 0 7px;
}

.big-score {
  font-size: 3rem; font-weight: 800; color: var(--brand-primary);
  margin: 6px 0 10px;
}

/* ---- Puces alignées en début de ligne ---- */
.rules { padding-left: 1.15em; margin-left: 0; }
.rules li { margin-bottom: 8px; }

/* ---- Bloc « le guide » sur la page d'accueil ---- */
.guide-bloc {
  margin-top: 22px; padding: 18px 20px; text-align: left;
  background: var(--brand-light); border: 1px solid #cfe6df; border-radius: 12px;
}
.guide-bloc h3 { margin: 0 0 8px; color: var(--brand-dark); }
.guide-bloc p { margin: 0 0 12px; }
.guide-liens { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 !important; }
.btn-download {
  display: inline-block; padding: 11px 20px; background: var(--brand-primary);
  color: #fff; text-decoration: none; font-weight: 600; border-radius: 10px; transition: .18s;
}
.btn-download:hover { background: var(--brand-dark); }
.btn-ghost-link {
  display: inline-block; padding: 11px 20px; background: #fff; color: var(--brand-primary);
  border: 1px solid var(--brand-primary); text-decoration: none; font-weight: 600;
  border-radius: 10px; transition: .18s;
}
.btn-ghost-link:hover { background: var(--brand-light); }

/* ---- Zone de réponse sur toute la largeur ---- */
#screen-question textarea { width: 100%; min-height: 170px; }

.consigne {
  background: #fdf6e8; border-left: 4px solid var(--brand-accent);
  padding: 9px 13px; border-radius: 8px; font-size: .89rem;
  color: #6b5324; margin: 0 0 12px;
}

/* ---- Dictaphone par question ---- */
.rec-box {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 14px 16px; margin-top: 12px;
  border: 1px solid var(--border); border-radius: 12px; background: #fafafa;
}
.btn-rec {
  padding: 11px 18px; font-size: .95rem; font-weight: 600;
  border: 2px solid var(--brand-primary); border-radius: 10px;
  background: #fff; color: var(--brand-primary); cursor: pointer; transition: .18s;
}
.btn-rec:hover { background: var(--brand-primary); color: #fff; }
.btn-rec.recording { background: #c0392b; border-color: #c0392b; color: #fff; }
.rec-state { font-size: .86rem; color: #555; flex: 1 1 220px; }
.rec-box audio { width: 100%; max-width: 420px; }

/* Correctif : le bloc micro s'affiche en ligne, pas en colonne */
#screen-question .rec-box { flex-direction: row; align-items: center; }
#screen-question .rec-state { flex: 1 1 200px; align-self: center; }

/* ---- Choix du mode (avec / sans chronomètre) ---- */
.chrono-choix { margin-top: 22px; text-align: left; }
.chrono-choix h3 { margin: 0 0 10px; color: var(--brand-dark); font-size: 1rem; }
.chrono-choix .choices { margin-top: 0; }
.choice.selected {
  background: var(--brand-primary); color: #fff;
  box-shadow: 0 0 0 3px rgba(62,156,133,.25);
}
.choice.selected .choice-desc { opacity: .92; }

/* ---- Auto-évaluation ---- */
.autoeval {
  margin-top: 26px; padding: 18px 20px;
  background: #fdf6e8; border: 1px solid #f0dcb8; border-radius: 12px;
}
.autoeval h3 { margin: 0 0 6px !important; color: #8a6412 !important; }
.autoeval p { margin: 0 0 14px; font-size: .93rem; color: #6b5324; }
.autoeval-boutons { display: flex; flex-wrap: wrap; gap: 12px; }
.btn-eval {
  flex: 1 1 240px; padding: 14px 18px; font-size: .97rem; font-weight: 600;
  border-radius: 10px; cursor: pointer; transition: .18s; background: #fff;
}
.btn-eval.oui { border: 2px solid var(--brand-primary); color: var(--brand-primary); }
.btn-eval.oui:hover, .btn-eval.oui.actif { background: var(--brand-primary); color: #fff; }
.btn-eval.non { border: 2px solid #c0392b; color: #c0392b; }
.btn-eval.non:hover, .btn-eval.non.actif { background: #c0392b; color: #fff; }

/* ---- Félicitations et contact ---- */
.contact-bloc {
  margin: 18px auto 6px; max-width: 460px; padding: 18px 20px;
  background: var(--brand-light); border: 1px solid #cfe6df; border-radius: 12px;
}
.contact-bloc .tel { font-size: 1.5rem; font-weight: 800; margin: 8px 0 12px; }
.contact-bloc .tel a { color: var(--brand-primary); text-decoration: none; }
.contact-bloc .attention {
  font-size: .87rem; color: #8a6412; background: #fdf6e8;
  padding: 10px 12px; border-radius: 8px; margin: 0; text-align: left;
}

/* ---- Options de suite après l'entraînement ---- */
.suite-options { margin: 24px 0 10px; text-align: left; }
.suite-options h3 { margin: 0 0 10px; color: var(--brand-dark); font-size: 1rem; text-align: center; }
.suite-options .choices { margin-top: 0; }

/* ---- Feux d'artifice ---- */
.feux { width: 100%; max-width: 460px; height: auto; border-radius: 14px; margin: 0 auto 10px; display: block; }

/* ---- Récapitulatif de fin ---- */
.recap-bloc {
  margin: 24px auto 10px; max-width: 560px; padding: 18px 20px; text-align: left;
  background: #f6f8fb; border: 1px solid var(--border); border-radius: 12px;
}
.recap-bloc h3 { margin: 0 0 6px; color: var(--brand-dark); font-size: 1rem; }
.recap-bloc p { margin: 0 0 14px; font-size: .9rem; color: #555; }
.recap-boutons { display: flex; flex-wrap: wrap; gap: 10px; }
.recap-boutons button { flex: 1 1 220px; cursor: pointer; font: inherit; font-weight: 600; }
.recap-etat { margin: 12px 0 0 !important; font-weight: 600; font-size: .88rem; }
.recap-etat.ok { color: var(--brand-primary); }
.recap-etat.ko { color: #c0392b; }

/* ---- Bouton de relecture du son ---- */
.btn-son {
  margin: 0 0 6px; padding: 7px 15px; font: inherit; font-size: .84rem; font-weight: 600;
  background: #fff; color: var(--brand-primary); border: 1px solid var(--brand-primary);
  border-radius: 999px; cursor: pointer; transition: .18s;
}
.btn-son:hover { background: var(--brand-light); }
