/* =============================================================================
   Site candidat i-Concours : mise en page, à charger après iep-theme.css (thème commun avec le BackOffice).
   ========================================================================== */

/* ---------- Mise en page ---------- */
.fo-topbar { display: block; padding: 0; position: sticky; top: 0; z-index: 1030; height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--border); }
.fo-topbar .fo-wrap { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.fo-topbar .app-brand .logo-ic { height: 30px; }
.fo-topbar-title { font-size: .82rem; color: var(--text-muted); font-weight: 500; }
.fo-wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.fo-main { padding: 28px 0 40px; }
.fo-footer { border-top: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font-size: .72rem; line-height: 1.6; padding: 18px 0 26px; text-align: center; }
.fo-footer a { color: var(--text-muted); text-decoration: underline; }

/* En-tête de page */
.fo-page-head { margin-bottom: 20px; }
.fo-page-head .fo-kicker { font-size: .78rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--iep-bleu); margin-bottom: 4px; }
.fo-page-head h1 { font-size: 1.7rem; margin: 0 0 6px; }
.fo-page-head .fo-lead { color: var(--text-muted); max-width: 760px; margin: 0; }

/* ---------- Étapes de l'inscription ---------- */
.fo-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; list-style: none; padding: 0; margin: 0 0 26px; counter-reset: step; }
.fo-steps li { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); font-size: .82rem; color: var(--text-muted); font-weight: 500; }
.fo-steps li::before { counter-increment: step; content: counter(step); flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-muted); font-weight: 700; font-size: .78rem; }
.fo-steps li.done { color: var(--text); }
.fo-steps li.done::before { content: "✓"; background: var(--success-soft); color: var(--iep-vert); }
.fo-steps li.current { border-color: var(--iep-bleu); color: var(--iep-bleu); font-weight: 600; box-shadow: 0 0 0 3px var(--primary-ring); }
.fo-steps li.current::before { background: var(--iep-bleu); color: #fff; }
/* Liseré sous chaque étape (repris du site d’origine) : rouge pour les étapes franchies et l’étape en cours, gris ensuite */
.fo-steps { row-gap: 18px; margin-bottom: 30px; }
.fo-steps li::after { content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 4px; border-radius: 2px; background: var(--border); transition: background var(--ease); }
.fo-steps li.done::after, .fo-steps li.current::after { background: var(--iep-rouge); }

/* ---------- Cartes de section ---------- */
.fo-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 22px 24px; margin-bottom: 18px; }
.fo-card > h2, .fo-card-title { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; margin: 0 0 4px; }
.fo-card > h2 .bi, .fo-card-title .bi { color: var(--iep-bleu); font-size: 1.1rem; }
.fo-card .fo-card-sub { color: var(--text-muted); font-size: .84rem; margin: 0 0 16px; }
.fo-card-muted { background: #fbfaf8; }

/* Formulaires : libellé au-dessus du champ, grille responsive */
.fo-form .control-group { display: block; margin-bottom: 14px; }
.fo-form .control-label { display: block; text-align: left; padding: 0; margin-bottom: .3rem; }
.fo-form .controls > .form-control, .fo-form .controls > .form-select, .fo-form .controls > input[type="text"], .fo-form .controls > input[type="email"], .fo-form .controls > select { width: 100%; max-width: none; }
.fo-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 16px; }
.fo-grid > .c-12 { grid-column: span 12; }
.fo-grid > .c-8 { grid-column: span 8; }
.fo-grid > .c-6 { grid-column: span 6; }
.fo-grid > .c-4 { grid-column: span 4; }
.fo-grid > .c-3 { grid-column: span 3; }
.fo-meta { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--text-muted); background: var(--surface-2); border-radius: 999px; padding: 4px 12px; margin-bottom: 16px; }
.fo-meta strong { color: var(--text); }

/* Choix en cartes (mode de tarification, moyens de paiement) */
.fo-choice-group label.radio, .fo-choice { display: flex; align-items: flex-start; gap: 10px; width: 100%; margin: 0 0 10px; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; font-weight: 500; transition: border-color var(--ease), background var(--ease), box-shadow var(--ease); }
.fo-choice-group label.radio:hover, .fo-choice:hover { border-color: #b9b3a7; }
.fo-choice-group label.radio:has(input:checked), .fo-choice:has(input:checked) { border-color: var(--iep-bleu); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-ring); }
.fo-choice-group label.radio:has(input:disabled) { opacity: .7; cursor: not-allowed; }
.fo-choice-group input[type="radio"], .fo-choice input { margin-top: .2em; }
.fo-choice-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; }
.fo-check { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); }
.fo-check label { margin: 0; font-weight: 600; font-size: .875rem; }
.fo-note { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px 10px 18px; border-radius: var(--radius); border: 1px solid var(--msg-info-border); background: var(--msg-info-bg); color: var(--msg-info-text); font-size: .86rem; margin: 6px 0 14px; overflow: hidden; }
.fo-note::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--msg-info-bar); }
/* Convention : .fo-note (bleu, information) · .ok (vert) · .warn (orange, non bloquant) · .error (rouge, bloquant) */
.fo-note.ok { background: var(--msg-ok-bg); border-color: var(--msg-ok-border); color: var(--msg-ok-text); }
.fo-note.ok::before { background: var(--msg-ok-bar); }
.fo-note.warn { background: var(--msg-warn-bg); border-color: var(--msg-warn-border); color: var(--msg-warn-text); }
.fo-note.warn::before { background: var(--msg-warn-bar); }
.fo-note.error { background: var(--msg-error-bg); border-color: var(--msg-error-border); color: var(--msg-error-text); }
.fo-note.error::before { background: var(--msg-error-bar); }
.fo-note .bi { margin-top: 2px; }
.fo-subpanel { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 14px 16px 2px; margin: 8px 0 14px; }

/* Tableau des modules */
.fo-modules td, .fo-modules th { vertical-align: middle; }
.fo-modules td input[readonly] { border: 0; background: transparent; padding: 0; min-height: 0; height: auto; box-shadow: none; color: var(--text); width: 100%; text-align: inherit; pointer-events: none; }
.fo-modules td:first-child { width: 56px; text-align: center; }
.fo-modules input[type="checkbox"] { width: 1.25em; height: 1.25em; }
.fo-modules tr:has(input[type="checkbox"]:checked) { background: var(--primary-soft); }
.fo-modules .num { text-align: right; white-space: nowrap; }
.fo-modules .code { white-space: nowrap; font-weight: 600; }

/* Barre d'actions */
.fo-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 0 0; }
.fo-actions .btn-primary { min-width: 180px; }
.fo-actions-end { justify-content: flex-end; }

/* Choix de la préparation (accueil) */
.fo-preps { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 8px; }
.fo-prep { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); color: var(--text); transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease); }
a.fo-prep:hover { border-color: var(--iep-bleu); box-shadow: var(--shadow); transform: translateY(-1px); text-decoration: none; color: var(--text); }
.fo-prep h3 { font-family: var(--font-title); font-size: 1.1rem; margin: 0; color: var(--iep-anthracite); }
.fo-prep p { margin: 0; font-size: .85rem; color: var(--text-muted); }
.fo-prep .fo-prep-note { font-size: .8rem; color: var(--msg-info-text); background: var(--msg-info-bg); border-radius: var(--radius-sm); padding: 6px 9px; margin: 2px 0; }
.fo-prep .fo-prep-dates { font-size: .78rem; font-weight: 600; color: var(--iep-bleu); }
.fo-prep .fo-prep-cta { margin-top: auto; padding-top: 8px; font-size: .82rem; font-weight: 600; color: var(--iep-bleu); }
.fo-prep.is-closed { background: var(--surface-2); box-shadow: none; }
.fo-prep.is-closed .fo-prep-dates, .fo-prep.is-closed .fo-prep-cta { color: var(--text-muted); }
.fo-rich h2, .fo-rich h3, .fo-rich h4 { font-family: var(--font-ui); font-weight: 700; font-size: 1rem; margin: 1em 0 .4em; }
.fo-rich p { margin: 0 0 .6em; }
.fo-rich ul { padding-left: 1.3em; }

/* Identifiants (confirmation / remerciements) */
.fo-credentials { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 12px 0; }
.fo-credentials > div { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; background: var(--surface); }
.fo-credentials small { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.fo-credentials strong { font-family: "Cascadia Code", Consolas, monospace; font-size: 1rem; letter-spacing: .04em; }
.fo-doc-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 4px; }

/* Libellés de la modalité (saisis dans le BackOffice) */
.modality-note { border-radius: var(--radius); }

/* Blocs masqués (front.js les affiche avec jQuery .show(), d’où l’absence de !important) */
.fo-note.hidden, .fo-subpanel.hidden, .fo-card .hidden { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 767.98px) {
  .fo-wrap { padding: 0 14px; }
  .fo-main { padding-top: 18px; }
  .fo-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fo-steps li { font-size: .76rem; padding: 8px 10px; }
  .fo-card { padding: 18px 16px; }
  .fo-grid > [class^="c-"] { grid-column: span 12; }
  .fo-choice-group, .fo-credentials { grid-template-columns: minmax(0, 1fr); }
  .fo-topbar .logo-spb, .fo-topbar .sep, .fo-topbar-title { display: none; }
  .fo-actions .btn-primary { width: 100%; }
  .fo-page-head h1 { font-size: 1.4rem; }
}

/* Gestionnaire connecté comme le candidat (accès depuis la fiche du BackOffice) */
.fo-manager-bar { background: var(--msg-warn-bg, #fef1e1); border-bottom: 1px solid var(--msg-warn-border, #f6d3a6); color: var(--msg-warn-text, #7a4300); font-size: .88rem; }
.fo-manager-bar .fo-wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding-top: 8px; padding-bottom: 8px; }

/* Saisies assistées (js/iep-fo-inputs.js) : message d'erreur sous le champ */
.fo-input-error { color: var(--msg-error-text, #8d0c12); font-size: .82rem; margin-top: 4px; }
.fo-input-error[hidden] { display: none; }
input.is-invalid { border-color: var(--iep-rouge, #dd1019) !important; box-shadow: 0 0 0 3px rgba(221, 16, 25, .12) !important; }

/* Accueil (choixmodalite.html.twig) : une seule colonne de blocs, élargie et resserrée pour tenir sans ascenseur */
.fo-wrap:has(> .fo-single) { max-width: 1280px; }
.fo-main:has(.fo-single) { padding: 10px 0 10px; }
.fo-single .fo-page-head { margin-bottom: 8px; }
.fo-single .fo-page-head .fo-kicker { margin-bottom: 0; }
.fo-single .fo-page-head h1 { font-size: 1.4rem; margin-bottom: 0; }
.fo-single .fo-card { padding: 12px 22px; margin-bottom: 10px; }
.fo-single .fo-card > h2 { font-size: 1.05rem; }
.fo-single .fo-rich { font-size: .86rem; line-height: 1.32; }
.fo-single .fo-rich p, .fo-single .fo-rich ul { margin-bottom: .35rem; }
.fo-single .fo-rich h1, .fo-single .fo-rich h2, .fo-single .fo-rich h3, .fo-single .fo-rich h4 { margin: .2rem 0 .35rem; }
.fo-prep-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.fo-single .fo-prep { padding: 9px 14px; gap: 2px; }
.fo-single .fo-prep p { font-size: .8rem; line-height: 1.3; }
.fo-single .fo-prep h3 { font-size: 1.02rem; }
.fo-single .fo-page-head .fo-lead { font-size: .85rem; }
.fo-single .fo-inline-card > div > h2 { margin-bottom: 2px; }
.fo-inline-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; }
.fo-contact { margin: 2px 0 0; }
.fo-card-headline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; margin-bottom: 10px; }
.fo-card-headline h2 { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; margin: 0; }
.fo-card-headline h2 .bi { color: var(--iep-bleu); }
body:has(.fo-single) .fo-footer { font-size: .68rem; line-height: 1.45; padding: 10px 0 12px; }
body:has(.fo-single) .fo-footer .fo-wrap { max-width: 1280px; }
.fo-contact a { white-space: nowrap; }

/* Préparations ouvertes à l'inscription : fond bleu pastel (les fermées restent grisées, .is-closed) */
a.fo-prep { background: var(--msg-info-bg, #e6f1f8); border-color: var(--msg-info-border, #bcd8ec); }
a.fo-prep:hover { background: #dcebf6; }
