/*
 * SBS Inscriptions. Deux parties : le formulaire en ligne (sfi-*), affiché
 * dans la page du thème, et l'exemplaire signé (fi-*), page autonome faite
 * pour l'impression en A4. Téléphone d'abord.
 */

/* ---------------- Formulaire ---------------- */
.sfi {
	--sfi-bleu: #073f82;
	--sfi-nuit: #0a2a52;
	--sfi-or: #c9a227;
	--sfi-ligne: #dde5ef;
	--sfi-doux: #f4f8fc;
	--sfi-rouge: #b42318;
	max-width: 820px;
	margin: 0 auto;
	color: #15233a;
	font-size: 16px;
}
.sfi *, .sfi *::before, .sfi *::after { box-sizing: border-box; }
.sfi fieldset { border: 1px solid var(--sfi-ligne); border-radius: 14px; padding: 18px 18px 8px; margin: 0 0 18px; background: #fff; min-width: 0; }
.sfi legend { font-weight: 800; font-size: 1.05rem; color: #fff; background: var(--sfi-nuit); padding: 6px 14px; border-radius: 8px; }
.sfi-grille2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.sfi-champ { margin: 0 0 14px; }
.sfi-champ label, .sfi-label { display: block; font-weight: 600; margin: 0 0 6px; }
.sfi input[type=text], .sfi input[type=tel], .sfi input[type=email], .sfi input[type=date] {
	width: 100%; min-height: 48px; padding: 10px 12px; font-size: 16px;
	border: 1.5px solid #b8c6d8; border-radius: 10px; background: #fff; color: inherit;
}
.sfi input:focus { outline: 3px solid rgba(11, 99, 201, .25); border-color: var(--sfi-bleu); }
.sfi-sous { font-weight: 600; margin: 10px 0 6px; }
.sfi-aide { font-size: 13px; color: #6b7a90; margin: 4px 0 0; }
.sfi-requis { color: var(--sfi-rouge); }
.sfi-option { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 10px; border: 1.5px solid var(--sfi-ligne); border-radius: 10px; margin: 0 0 8px; cursor: pointer; background: #fff; }
.sfi-option input { width: 20px; height: 20px; flex: 0 0 auto; accent-color: var(--sfi-bleu); }
.sfi-option:has(input:checked) { border-color: var(--sfi-bleu); background: #e8f1fb; }
.sfi-ligne-options { display: flex; flex-wrap: wrap; gap: 8px; }
.sfi-ligne-options .sfi-option { margin: 0; }
.sfi-bloc-ligne { display: grid; grid-template-columns: 28px repeat(5, 1fr); gap: 8px; align-items: end; padding: 10px; border: 1px dashed var(--sfi-ligne); border-radius: 10px; margin: 0 0 10px; }
.sfi-bloc-ligne:has(.sfi-mini:nth-of-type(4):last-child) { grid-template-columns: 28px repeat(4, 1fr); }
.sfi-numero { font-weight: 800; color: var(--sfi-bleu); align-self: center; }
.sfi-mini span { display: block; font-size: 12px; color: #6b7a90; margin-bottom: 4px; }
.sfi-mini input[type=text] { min-height: 44px; }
.sfi-erreur { color: var(--sfi-rouge); font-weight: 600; font-size: 14px; margin: 6px 0 0; }
.sfi-alerte { border: 2px solid var(--sfi-rouge); background: #fef3f2; color: var(--sfi-rouge); padding: 12px 14px; border-radius: 12px; margin: 0 0 18px; }
.sfi-engagement { background: var(--sfi-doux); border-left: 4px solid var(--sfi-or); padding: 12px 14px; border-radius: 8px; line-height: 1.5; }
.sfi-toile-cadre { border: 2px dashed #8aa0bc; border-radius: 12px; background: #fff; height: 180px; touch-action: none; position: relative; }
.sfi-toile-cadre::after { content: "Signez ici"; position: absolute; left: 14px; bottom: 10px; font-size: 12px; color: #9aa8bb; pointer-events: none; }
.sfi-toile { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.sfi-effacer { margin-top: 8px; min-height: 44px; padding: 8px 14px; border: 1.5px solid #b8c6d8; background: #fff; border-radius: 10px; font-size: 15px; cursor: pointer; }
.sfi-tuteur { border: 1px solid var(--sfi-ligne); border-radius: 12px; padding: 0 14px; margin: 0 0 14px; }
.sfi-tuteur summary { cursor: pointer; font-weight: 700; min-height: 48px; display: flex; align-items: center; }
.sfi-tuteur[open] { padding-bottom: 10px; }
.sfi-accord { margin-top: 6px; }
.sfi-envoyer { width: 100%; min-height: 56px; margin: 10px 0 14px; border: 0; border-radius: 999px; background: linear-gradient(135deg, #e6c04a, var(--sfi-or)); color: var(--sfi-nuit); font-size: 17px; font-weight: 800; cursor: pointer; }
.sfi-envoyer:disabled { opacity: .7; cursor: wait; }
/* Certificats : pas de niveau d'entrée, un rythme à choisir. Sans :has(), les deux blocs restent visibles. */
.sfi-certificats { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.sfi-papier { margin: 6px 0 12px; }
.sfi-papier a { color: var(--sfi-bleu); font-weight: 600; }
.sfi:has(input[name=formation]:checked) .sfi-rythme { display: none; }
.sfi:has(input[name=formation][value^="cert-"]:checked) .sfi-rythme { display: block; }
.sfi:has(input[name=formation][value^="cert-"]:checked) .sfi-niv { display: none; }
.sfi-piege { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 700px) {
	.sfi fieldset { padding: 14px 12px 4px; }
	.sfi-grille2, .sfi-certificats { grid-template-columns: 1fr; }
	.sfi-bloc-ligne, .sfi-bloc-ligne:has(.sfi-mini:nth-of-type(4):last-child) { grid-template-columns: 1fr 1fr; }
	.sfi-numero { grid-column: 1 / -1; }
	.sfi-bloc-ligne .sfi-mini:first-of-type { grid-column: 1 / -1; }
	.sfi-ligne-options .sfi-option { flex: 1 1 auto; }
}

/* ---------------- Exemplaire signé ---------------- */
.sfi-page { margin: 0; background: #eef3f9; font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: #15233a; }
.sfi-page *, .sfi-page *::before, .sfi-page *::after { box-sizing: border-box; }
.sfi-merci { max-width: 820px; margin: 16px auto; background: #ecfdf3; border: 2px solid #1da851; border-radius: 14px; padding: 16px 18px; }
.sfi-merci h1 { margin: 0 0 8px; font-size: 22px; color: #0a2a52; }
.sfi-pieces-merci { margin: 8px 0 0; padding-left: 20px; }
.sfi-pieces-merci li { margin: 4px 0; }
.sfi-barre { max-width: 820px; margin: 12px auto; display: flex; flex-wrap: wrap; gap: 10px; padding: 0 12px; }
.sfi-barre button, .sfi-barre a { flex: 1 1 220px; min-height: 50px; border-radius: 999px; font-size: 16px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer; }
.sfi-barre button { border: 0; background: #073f82; color: #fff; }
.sfi-barre-wa { background: #1da851; color: #fff; }
.sfi-barre-pdf { background: #073f82; color: #fff; }
.sfi-barre button.sfi-barre-imprimer { background: #fff; color: #073f82; border: 2px solid #073f82; }

.fiche--signee { max-width: 820px; margin: 0 auto 24px; background: #fff; border-radius: 14px; padding: 24px; font-size: 14px; line-height: 1.45; }
.fiche--signee .fi-entete { display: grid; grid-template-columns: 96px 1fr 100px; gap: 14px; align-items: center; border-bottom: 3px solid #c9a227; padding-bottom: 12px; }
.fiche--signee .fi-logo { width: 96px; height: auto; }
.fiche--signee .fi-ecole { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: #2b3a52; }
.fiche--signee .fi-ecole strong { font-size: 15px; color: #0a2a52; }
.fiche--signee .fi-photo { width: 100px; height: 125px; border: 1.5px dashed #6b7a90; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 11px; color: #6b7a90; }
.fiche--signee .fi-titre { font-size: 20px; margin: 16px 0 4px; color: #0a2a52; text-align: center; }
.fiche--signee .fi-note { text-align: center; font-size: 13px; color: #2b3a52; }
.fiche--signee h3 { font-size: 14px; margin: 16px 0 6px; padding: 4px 10px; background: #0a2a52; color: #fff; border-radius: 4px; }
.fiche--signee .fi-table { width: 100%; border-collapse: collapse; margin: 4px 0 8px; }
.fiche--signee .fi-table th, .fiche--signee .fi-table td { border: 1px solid #9fb0c6; padding: 6px 8px; text-align: left; vertical-align: top; }
.fiche--signee .fi-table tbody th, .fiche--signee .fi-table tr > th[scope=row] { width: 36%; background: #f4f8fc; font-weight: 600; }
.fiche--signee .fi-table thead th { background: #e8f1fb; font-size: 12px; }
.fiche--signee .fi-liste { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 24px; }
.fiche--signee .fi-liste li { display: flex; gap: 8px; margin: 3px 0; break-inside: avoid; }
.fiche--signee .fi-case { display: inline-block; width: 13px; height: 13px; border: 1.5px solid #15233a; border-radius: 2px; flex: 0 0 auto; margin-top: 3px; }
.fiche--signee .fi-choix { display: inline-flex; align-items: center; gap: 5px; margin-right: 14px; }
.fiche--signee .fi-engagement { background: #f4f8fc; border-left: 4px solid #c9a227; padding: 8px 12px; }
.fiche--signee .fi-signatures-bloc { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.fiche--signee .fi-sig { border: 1px solid #9fb0c6; border-radius: 6px; padding: 8px 10px; }
.fiche--signee .fi-sig p { margin: 2px 0; }
.fiche--signee .fi-sig-titre { font-weight: 700; }
.fiche--signee .fi-sig img { display: block; width: 100%; max-width: 320px; height: 110px; object-fit: contain; object-position: left center; }
.fiche--signee .fi-preuve { font-size: 10.5px; color: #6b7a90; word-break: break-all; }
.fiche--signee .fi-admin { margin-top: 14px; border: 2px solid #0a2a52; border-radius: 6px; padding: 6px 12px 10px; }
.fiche--signee .fi-sous { margin: 6px 0; }

@media (max-width: 700px) {
	.fiche--signee { padding: 14px; border-radius: 0; font-size: 13px; }
	.fiche--signee .fi-entete { grid-template-columns: 64px 1fr; }
	.fiche--signee .fi-logo { width: 64px; }
	.fiche--signee .fi-photo { display: none; }
	.fiche--signee .fi-liste { columns: 1; }
	.fiche--signee .fi-signatures-bloc { grid-template-columns: 1fr; }
	.fiche--signee .fi-grille { display: block; overflow-x: auto; }
}

@media print {
	@page { size: A4; margin: 12mm; }
	.sfi-page { background: #fff; }
	.sfi-ecran { display: none !important; }
	.fiche--signee { padding: 0; margin: 0; max-width: none; border-radius: 0; font-size: 10.5px; line-height: 1.3; }
	.fiche--signee .fi-entete { grid-template-columns: 70px 1fr 84px; padding-bottom: 6px; }
	.fiche--signee .fi-logo { width: 70px; }
	.fiche--signee .fi-photo { display: flex; width: 84px; height: 100px; }
	.fiche--signee .fi-titre { font-size: 16px; margin: 8px 0 2px; }
	.fiche--signee h3 { font-size: 12px; margin: 9px 0 4px; padding: 3px 8px; break-after: avoid; }
	.fiche--signee .fi-table th, .fiche--signee .fi-table td { padding: 3px 6px; }
	.fiche--signee h3, .fiche--signee .fi-table th, .fiche--signee .fi-entete, .fiche--signee .fi-engagement { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
	.fiche--signee .fi-liste { columns: 2; }
	.fiche--signee .fi-signatures-bloc { grid-template-columns: 1fr 1fr; }
	.fiche--signee .fi-sig img { height: 80px; }
	.fiche--signee .fi-saut { break-before: page; }
	.fiche--signee .fi-table, .fiche--signee .fi-admin, .fiche--signee .fi-signatures-bloc { break-inside: avoid; }
}
