/* ─────────────────────────────────────────────────────────────────
   CHARTE — Centre d'Imagerie TESLA (Cognac)
   Tokens, typo et patterns partagés entre le site cabinet
   (radiologiecognac.com/index.html) et les questionnaires patient
   (questionnaire-irm.html, scanner, etc.)

   Pour utiliser : <link rel="stylesheet" href="assets/charte.css">
   puis Fraunces + DM Sans via Google Fonts dans le <head>.
   ───────────────────────────────────────────────────────────────── */

:root {
  /* Palette (cf. DESIGN.md du site) */
  --ink:    #0E2A44;
  --ink2:   #1F3F5E;
  --mute:   #5B7286;
  --cream:  #F4EEE3;
  --paper:  #FAF6EE;
  --line:   #E5DCC9;
  --gold:   #B6925E;
  --sky:    #7AA9C6;
  --sage:   #9DB4A0;

  /* Sémantique : succès / alerte / erreur — pensées pour cohabiter
     avec la palette principale sans détonner. */
  --ok:      #6B8E5E;
  --ok-bg:   #EAF1E4;
  --warn:    #B68A2E;
  --warn-bg: #FBF2D9;
  --err:     #B0533B;
  --err-bg:  #FCE6DD;
}

/* ── Reset doux ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'DM Sans', system-ui, -apple-system, Segoe UI, sans-serif;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* ── Display Fraunces ────────────────────────────────────────────── */
.display {
  font-family: 'Fraunces', Georgia, serif;
  font-variation-settings: "opsz" 96, "SOFT" 30;
  letter-spacing: -0.02em;
  line-height: 1.02;
}
.display-italic {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 80;
}
.tnum { font-variant-numeric: tabular-nums; }

/* ── Liens ──────────────────────────────────────────────────────── */
.ulink {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(var(--gold), var(--gold));
  background-size: 100% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size .35s ease, padding .2s ease;
}
.ulink:hover { background-size: 100% 100%; padding: 0 4px; }

/* ── Boutons pill ────────────────────────────────────────────────── */
.btn-primary, .btn-ghost, .btn-gold {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 9999px;
  padding: 14px 26px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform .25s ease, background .25s ease, color .25s ease, border-color .25s ease;
  font-family: inherit;
}
.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover { background: #06192B; transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn-ghost:hover { background: var(--ink); color: var(--paper); }

.btn-gold {
  background: var(--gold);
  color: var(--ink);
}
.btn-gold:hover { background: var(--paper); color: var(--ink); }

.btn-primary:disabled, .btn-ghost:disabled, .btn-gold:disabled {
  opacity: 0.5; cursor: not-allowed; transform: none;
}

/* ── Champs de formulaire ────────────────────────────────────────── */
.field {
  width: 100%;
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  color: var(--ink);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 15px;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.field:hover { border-color: #CFC1A2; }
.field:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(182, 146, 94, 0.15);
}
.field:disabled, .field[readonly] {
  background: var(--cream);
  color: var(--mute);
  cursor: not-allowed;
}
.field::placeholder { color: #94A3B0; }
textarea.field { resize: vertical; min-height: 120px; line-height: 1.55; }
select.field {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%230E2A44' stroke-width='1.4' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.field-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink);
  margin-bottom: 8px;
  font-weight: 500;
}
.field-label .req { color: var(--gold); }
.field-hint { font-size: 12px; color: var(--mute); margin-top: 6px; }
.field-error {
  font-size: 12px;
  color: var(--err);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Checkbox custom ─────────────────────────────────────────────── */
.check {
  appearance: none;
  width: 18px; height: 18px;
  border: 1.5px solid var(--line);
  border-radius: 5px;
  background: #FFFFFF;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: border-color .2s ease, background .2s ease;
}
.check:hover { border-color: var(--gold); }
.check:checked {
  background: var(--ink);
  border-color: var(--ink);
}
.check:checked::after {
  content: "";
  position: absolute;
  left: 5px; top: 1.5px;
  width: 5px; height: 10px;
  border: solid #F4EEE3;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ── Pills Oui / Non ─────────────────────────────────────────────── */
.yn-group {
  display: inline-flex;
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 9999px;
  padding: 4px;
  gap: 2px;
  flex-shrink: 0;
}
.yn-opt { cursor: pointer; }
.yn-opt span {
  display: inline-block;
  padding: 7px 20px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--mute);
  transition: background .2s ease, color .2s ease;
}
.yn-opt:hover span { color: var(--ink); }
.yn-opt input { position: absolute; opacity: 0; pointer-events: none; }
.yn-opt input:checked + span {
  background: var(--ink);
  color: var(--paper);
}
.yn-opt input:focus-visible + span {
  box-shadow: 0 0 0 2px var(--gold);
}

/* ── Segmented radio cards (choix d'examen / région) ──────────── */
.seg-card { cursor: pointer; display: block; }
.seg-card-inner {
  display: flex; flex-direction: column; gap: 2px;
  border: 1px solid var(--line);
  background: #FFFFFF;
  border-radius: 14px;
  padding: 14px 16px;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.seg-card:hover .seg-card-inner { border-color: #CFC1A2; }
.seg-card input { position: absolute; opacity: 0; pointer-events: none; }
.seg-card input:checked + .seg-card-inner {
  border-color: var(--ink);
  background: var(--cream);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.seg-card input:focus-visible + .seg-card-inner {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ── Bloc contre-indication avec révélation conditionnelle ───── */
.ci-block { transition: border-color .25s ease, background .25s ease; }
.ci-block .cond-detail {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height .35s ease, opacity .25s ease .05s;
  border-top: 1px solid transparent;
}
.ci-block:has(input[value="oui"]:checked) .cond-detail,
.ci-block:has(input[value="OUI"]:checked) .cond-detail {
  max-height: 520px;
  opacity: 1;
  border-top-color: var(--line);
}
.ci-block:has(input[value="oui"]:checked),
.ci-block:has(input[value="OUI"]:checked) {
  border-color: rgba(182, 146, 94, 0.5);
  background: linear-gradient(180deg, #FFFFFF 0%, var(--cream) 140%);
}

/* ── Upload dropzone ─────────────────────────────────────────────── */
.upload-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1.5px dashed var(--line);
  border-radius: 18px;
  padding: 36px 24px;
  background: #FFFFFF;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
  text-align: center;
  position: relative;
}
.upload-zone:hover {
  border-color: var(--gold);
  background: var(--cream);
}
.upload-zone.has-file {
  border-style: solid;
  border-color: var(--ok);
  background: var(--ok-bg);
}
.upload-zone input[type="file"] { position: absolute; opacity: 0; inset: 0; cursor: pointer; }

.upload-mini {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line);
  border-radius: 9999px;
  padding: 9px 16px;
  font-size: 12.5px;
  color: var(--ink);
  background: #FFFFFF;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .2s ease, background .2s ease;
  position: relative;
}
.upload-mini:hover { border-color: var(--gold); background: var(--cream); }
.upload-mini input[type="file"] { position: absolute; opacity: 0; inset: 0; cursor: pointer; }

/* ── Notices / bandeaux ──────────────────────────────────────────── */
.notice {
  display: flex;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  border: 1px solid transparent;
}
.notice svg { flex-shrink: 0; margin-top: 1px; }
.notice.notice-ok    { background: var(--ok-bg);   border-color: rgba(107, 142, 94, 0.3); color: #3F5A36; }
.notice.notice-warn  { background: var(--warn-bg); border-color: rgba(182, 146, 94, 0.4); color: #6B5421; }
.notice.notice-err   { background: var(--err-bg);  border-color: rgba(176, 83, 59, 0.35); color: #7A3623; }
.notice.notice-info  { background: var(--cream);   border-color: var(--line);             color: var(--ink2); }

/* ── Section / card containers ───────────────────────────────────── */
.card-paper {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px 32px;
}
.card-cream {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 24px;
}

/* ── Numérotation grande typo pour étapes / sections ───────────── */
.form-section-num {
  font-family: 'Fraunces', Georgia, serif;
  font-variation-settings: "opsz" 144, "SOFT" 60;
  font-weight: 300;
  font-size: 48px;
  line-height: 1;
  color: var(--ink);
}

/* ── Stepper vertical (sidebar) ──────────────────────────────────── */
.step-list { position: relative; }
.step-list::before {
  content: "";
  position: absolute;
  left: 15px; top: 6px; bottom: 6px;
  width: 1px;
  background: var(--line);
}
.step-item { display: flex; align-items: flex-start; gap: 16px; }
.step-item .step-dot {
  position: relative; z-index: 1;
  width: 32px; height: 32px;
  border-radius: 9999px;
  background: linear-gradient(135deg, var(--cream), #FFFFFF);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 4px var(--paper);
  transition: background .25s ease, color .25s ease, border-color .25s ease;
  flex-shrink: 0;
}
.step-item.is-current .step-dot {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.step-item.is-done .step-dot {
  background: var(--gold);
  color: var(--paper);
  border-color: var(--gold);
}

/* ── Accessibilité — visually hidden ─────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── Animations utilitaires ──────────────────────────────────────── */
.reveal { opacity: 0; transform: translateY(14px); animation: rise .8s cubic-bezier(.2,.7,.2,1) forwards; }
.reveal.d1 { animation-delay: .05s; }
.reveal.d2 { animation-delay: .15s; }
.reveal.d3 { animation-delay: .25s; }
.reveal.d4 { animation-delay: .35s; }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }

/* ═════════════════════════════════════════════════════════════════
   PATTERNS ÉTENDUS QUESTIONNAIRES
   Couverture des classes spécifiques aux questionnaires autres
   que l'IRM (scanner, coroscanner, score calcique, infiltration,
   ostéodensito, consentements PRP/cytoponction). Sert de fallback
   quand le bloc <style> principal est remplacé par le head template.
   ═════════════════════════════════════════════════════════════════ */

/* ─── Modificateurs sémantiques sur .section-block ──────────────
   Toutes ces variantes (femmes, allergie, antecedents, anticoag,
   antiinfl, consignes, contraste, deuxieme, diabete, menopause,
   natispray, renale, sang, beta) gardent l'esthétique commune ;
   on signale juste leur nature via la couleur du gold/cream. */
.section-block.femmes .section-header,
.section-block.allergie .section-header,
.section-block.antecedents .section-header,
.section-block.consignes .section-header,
.section-block.contraste .section-header,
.section-block.diabete .section-header,
.section-block.menopause .section-header,
.section-block.natispray .section-header,
.section-block.renale .section-header,
.section-block.sang .section-header,
.section-block.beta .section-header,
.section-block.anticoag .section-header,
.section-block.antiinfl .section-header,
.section-block.deuxieme .section-header {
  background: var(--ink2);
}
/* Pastilles colorées simples (legacy : .green/.orange/.teal) */
.section-block.green .section-header,
.section-block.teal .section-header { background: var(--ink); }
.section-block.orange .section-header { background: var(--gold); color: var(--ink); }

/* ─── Cartes "fiche" (souvent patient info ou pré-instructions) ─ */
.fiche-block, .fiche-info, .info-block, .intro-box, .note-block,
.free-block, .telerad-block, .prescription-card {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 22px;
  margin-bottom: 16px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink2);
}
.fiche-block-title, .fiche-info-title, .info-title,
.info-section-title, .intro-title, .prescription-card-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.fiche-intro, .fiche-note, .prescription-card-note {
  font-size: 13px;
  color: var(--mute);
  font-style: italic;
}
.fiche-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.info-row {
  display: flex; gap: 10px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}
.info-row:last-child { border-bottom: none; }
.info-bold { font-weight: 600; color: var(--ink); }
.info-highlight {
  background: rgba(182, 146, 94, 0.15);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
}
.info-list {
  list-style: none;
  padding: 0;
  display: grid; gap: 6px;
}
.info-list li {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 13.5px;
  color: var(--ink2);
}
.info-list li::before {
  content: "·";
  color: var(--gold);
  font-weight: 700;
  font-size: 18px; line-height: 1;
  flex-shrink: 0;
  margin-top: -2px;
}

/* ─── Accordéon d'info (FAQ patient) ───────────────────────────── */
.info-accordion {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 16px;
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color .25s ease;
}
.info-accordion.open { border-color: var(--gold); }
.info-accordion-header {
  padding: 14px 18px;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.info-accordion-header:hover { background: var(--paper); }
.info-accordion-body {
  padding: 0 18px 16px;
  font-size: 13.5px;
  color: var(--ink2);
  line-height: 1.6;
}
.chevron {
  width: 14px; height: 14px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(45deg);
  transition: transform .25s ease;
}
.info-accordion.open .chevron { transform: rotate(-135deg); }

/* ─── Lignes de contre-indication coroscanner (checkbox + label) ── */
.ci-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  transition: background .15s ease;
}
.ci-row:last-child { border-bottom: none; }
.ci-row:hover { background: var(--paper); }
.ci-checkbox {
  accent-color: var(--ink);
  width: 18px; height: 18px;
  margin-top: 2px;
  cursor: pointer;
  flex-shrink: 0;
}
.ci-label {
  flex: 1;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  line-height: 1.5;
}

/* ─── Champs anthropométriques (score calcique : poids/taille) ──── */
.anthro-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.anthro-field {
  display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 180px;
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
}
.anthro-field label {
  font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--mute);
  flex-shrink: 0;
}
.anthro-field input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: transparent;
  font-variant-numeric: tabular-nums;
}
.anthro-unit {
  font-size: 12px;
  color: var(--mute);
  font-weight: 500;
}
.imc-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 9999px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.imc-badge::before {
  content: "IMC";
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--gold);
  font-weight: 600;
}

/* ─── Boîte créatinine (rappel iode) ───────────────────────────── */
.creatinine-box {
  background: var(--cream);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 14px;
  padding: 16px 20px;
  margin-top: 14px;
}
.creatinine-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 8px;
}

/* ─── Tarifs (infiltration / score) ────────────────────────────── */
.tarifs {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  margin: 12px 0;
}
.tarif-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.tarif-row:last-child { border-bottom: none; }
.tarif-label { color: var(--ink2); }
.tarif-price {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 17px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.tarif-non-remb {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-left: 8px;
}

/* ─── Boîte de résultat (score / calcul) ───────────────────────── */
.result-box {
  display: flex; align-items: center; gap: 16px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 18px;
  padding: 20px 26px;
  margin: 18px 0;
}
.result-icon {
  font-size: 28px;
  color: var(--gold);
  flex-shrink: 0;
}
.result-text {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 18px;
  line-height: 1.4;
}
.result-text strong {
  color: var(--gold);
  font-weight: 500;
}

/* ─── Validité de champs (vert/rouge sobre) ────────────────────── */
.valid {
  color: var(--ok, #6B8E5E);
  font-size: 12px; font-weight: 500;
}
.invalid {
  color: var(--err, #B0533B);
  font-size: 12px; font-weight: 500;
}

/* ─── Badge générique (consentements) ──────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 9999px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink);
}

/* ─── Bloc badge dans le header (logo + tagline) ───────────────── */
.header-badge {
  position: absolute;
  top: 18px; right: 18px;
  background: var(--gold);
  color: var(--ink);
  border-radius: 9999px;
  padding: 6px 14px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.16em;
}

/* ─── Sous-question avec retrait visuel ────────────────────────── */
.q-indent {
  margin-left: 24px;
  padding-left: 14px;
  border-left: 2px solid var(--line);
}

/* ─── Textarea stylée ──────────────────────────────────────────── */
.textarea-field {
  width: 100%;
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--ink);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  resize: vertical;
  min-height: 90px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.textarea-field:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(182, 146, 94, 0.15);
}

/* ─── Wrapper du bouton "Réinitialiser" ────────────────────────── */
.reset-btn-wrap {
  margin-top: 10px;
  text-align: right;
}
