/* Page questionnaire patient.
   Un seul fond blanc, une seule colonne : l'en-tête et les questions partagent le même bord
   gauche. Le bleu #4662A0 ne sert que d'accent (étoiles, numéros, boutons, progression). */
:root {
  --accent: #4662A0;
  --accent-hover: #3A5389;
  --accent-soft: #E9EEF8;
  --accent-faint: rgba(70, 98, 160, 0.16);
  --on-accent: #FFFFFF;
  --bg: #FFFFFF;
  --line: #DEE3EC;
  --field: #FFFFFF;
  --text: #1D2125;
  --text-2: #566176;
  --text-3: #8A919C;
  --star-off: #CDD4E0;
  --warn: #A4471B;
  --warn-soft: #FCEFE7;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #8DA6DA;
    --accent-hover: #A3B8E3;
    --accent-soft: #232B3B;
    --accent-faint: rgba(141, 166, 218, 0.2);
    --on-accent: #1D2125;
    --bg: #14171C;
    --line: #2C323C;
    --field: #1C2027;
    --text: #ECEEF2;
    --text-2: #A7AEBA;
    --text-3: #7D8592;
    --star-off: #3A414D;
    --warn: #F0A27A;
    --warn-soft: #2E1F18;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
main { flex: 1; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.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; }

.wrap { width: 100%; max-width: 600px; margin: 0 auto; padding: 0 20px; }
@media (min-width: 600px) { .wrap { padding: 0 24px; } }

/* ─── En-tête d'accueil (sur le fond de la page) ───────────────────── */
.hero { padding: 32px 0 40px; }
.hero .wrap { animation: rise 420ms var(--ease); }
@media (min-width: 600px) { .hero { padding: 72px 0 56px; } }
.hero.is-state { min-height: 52vh; }

.cabinet { margin-bottom: 40px; line-height: 1.3; }
.cabinet-name { font-weight: 600; }
.cabinet-practitioner { font-size: 14px; color: var(--text-3); }
@media (min-width: 600px) { .cabinet { margin-bottom: 56px; } }

h1 { font-size: 30px; line-height: 1.15; letter-spacing: -0.025em; font-weight: 700; margin: 0 0 16px; text-wrap: balance; }
@media (min-width: 600px) { h1 { font-size: 38px; } }
.lead { margin: 0; max-width: 32em; color: var(--text-2); font-size: 17px; line-height: 1.55; text-wrap: pretty; }

.state-icon {
  width: 52px; height: 52px; border-radius: 999px; display: grid; place-items: center;
  margin-bottom: 24px; background: var(--accent); color: var(--on-accent); font-size: 24px; font-weight: 700;
}

/* ─── Questions posées sur la page ──────────────────────────────────── */
.content { padding-top: 0; padding-bottom: 8px; }

.preview-banner {
  margin: 20px 0 0;
  padding: 10px 0 10px 14px;
  border-left: 3px solid var(--accent);
  color: var(--text-2);
  font-size: 14px;
}

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.q {
  position: relative;
  padding: 32px 0;
  border-bottom: 1px solid var(--line);
}
form > .q:first-child { border-top: 1px solid var(--line); }
fieldset.q legend { float: left; width: 100%; }
fieldset.q legend + * { clear: both; }
legend, .question-label {
  display: block; margin: 0 0 20px; padding: 0;
  font-size: 20px; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance;
}
@media (min-width: 600px) { legend, .question-label { font-size: 22px; } }
.question-help { font-size: 15px; line-height: 1.5; color: var(--text-2); margin: -10px 0 18px; clear: both; }
.required-mark { color: var(--text-3); font-weight: 400; font-size: 0.8em; }

/* Numéro au-dessus de la question, qui devient une coche */
.q-num {
  position: relative; margin: 0 0 14px;
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 999px;
  border: 1.5px solid var(--accent-faint);
  color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  transition: background-color 220ms var(--ease), border-color 220ms var(--ease), color 220ms var(--ease);
}
.q.is-answered .q-num { background: var(--accent); border-color: var(--accent); color: transparent; }
.q.is-answered .q-num::after { content: '✓'; position: absolute; color: var(--on-accent); font-size: 15px; }

/* Étoiles bleues MedAuto, avec le mot qui s'affiche à côté */
.rating { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
.stars { display: flex; gap: 0; position: relative; margin-left: -4px; }
.stars label {
  cursor: pointer; font-size: 42px; line-height: 1; color: var(--star-off);
  padding: 0 4px; border-radius: 8px; transition: color 140ms var(--ease), transform 140ms var(--ease);
}
.stars label.is-on { color: var(--accent); }
.stars label:hover { transform: translateY(-2px); }
.stars label.pop { animation: pop 360ms var(--ease); }
.stars input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 1px; }
.caption { color: var(--accent); font-weight: 600; font-size: 15px; }
.caption:not(:empty) { animation: slide 260ms var(--ease); }

.scale { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 4px; position: relative; clear: both; }
.scale label {
  display: grid; place-items: center; height: 40px; border-radius: 999px;
  cursor: pointer; font-weight: 600; font-size: 14px; color: var(--text-2);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background-color 140ms var(--ease), color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.scale label:hover { box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--accent); }
.scale input:checked + label { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.scale input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (max-width: 520px) { .scale { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; } }
.scale-legend { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-3); margin-top: 8px; }

.choices { display: flex; flex-wrap: wrap; gap: 8px; position: relative; clear: both; }
.choices label {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px;
  cursor: pointer; font-weight: 500; box-shadow: inset 0 0 0 1px var(--line);
  transition: background-color 140ms var(--ease), color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.choices label:hover { box-shadow: inset 0 0 0 1.5px var(--accent); }
.choices input:checked + label { background: var(--accent); color: var(--on-accent); box-shadow: none; font-weight: 600; }
.choices input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Zone de texte : on écrit sur une ligne, comme sur une feuille */
textarea {
  width: 100%; min-height: 96px; resize: vertical; padding: 4px 0 8px;
  border: 0; border-bottom: 1.5px solid var(--line); border-radius: 0; background: transparent;
  font-size: 17px; line-height: 1.6; transition: border-color 160ms var(--ease);
}
textarea::placeholder { color: var(--text-3); }
textarea:focus { outline: none; border-bottom-color: var(--accent); }
.counter { text-align: right; font-size: 13px; color: var(--text-3); margin-top: 6px; }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--text-2); cursor: pointer; margin: 16px 0 0; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }

/* ─── Barre d'envoi collée en bas de l'écran ────────────────────────── */
.submit-bar {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; flex-direction: column; gap: 12px;
  margin: 0 -20px; padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--line);
}
@media (min-width: 600px) { .submit-bar { margin: 8px -24px 0; padding-left: 24px; padding-right: 24px; } }
.progress-row { display: flex; align-items: center; gap: 12px; }
.progress { flex: 1; display: flex; gap: 4px; }
.progress span { flex: 1; height: 4px; border-radius: 999px; background: var(--line); transition: background-color 260ms var(--ease); }
.progress span.is-on { background: var(--accent); }
.progress-text { color: var(--text-3); font-size: 13px; font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 54px; padding: 0 24px; border-radius: 999px; border: 0;
  font-size: 16px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background-color 160ms var(--ease), opacity 160ms var(--ease), transform 160ms var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: progress; }
.btn-auto { width: auto; margin-top: 28px; }
.link-btn {
  display: inline-block; margin-top: 28px; padding: 0; background: none; border: 0; cursor: pointer;
  color: var(--accent); text-decoration: underline; text-underline-offset: 4px; font-size: 15px;
}

.errors { margin: 24px 0 0; padding: 12px 14px; border-left: 3px solid var(--warn); background: var(--warn-soft); color: var(--warn); font-size: 15px; }
.errors ul { margin: 0; padding-left: 18px; }

.skeleton { background: var(--accent-soft); border-radius: 8px; height: 14px; margin-bottom: 14px; }
.skeleton-title { height: 34px; width: 80%; }
.skeleton-line { width: 60%; }

.foot { padding: 28px 16px 32px; }

@media (max-width: 380px) {
  .stars label { font-size: 38px; padding: 0 2px; }
}

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes slide { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Étape 2 sur 2 : petit repère au-dessus du titre */
.step {
  display: inline-block; align-self: flex-start; margin-bottom: 14px; padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
}

.btn[hidden] { display: none; }
