/*
 * questionnaire.css — PsyRisso Desktop
 * Styles spécifiques à la page publique Questionnaire (refonte, sans Hero).
 * Pas de mockup validé — structure alignée sur le standard des autres
 * pages (bande unique, cadre). Titre/consigne/progression/échelle restent
 * visibles au-dessus de la zone scrollable des questions (pas de vrai
 * sticky viewport, juste hors de la zone de scroll — même effet, plus
 * robuste dans une carte).
 *
 * Police : Calibri partout sauf le titre du questionnaire (Georgia,
 * cohérent avec le reste du site).
 */
:root {
  --font-heading: Georgia, 'Times New Roman', serif;
  --font-body: Calibri, Candara, Segoe, 'Segoe UI', Optima, Arial, sans-serif;
  --texte-muted: #3a3a3a;
  --gris-clair: var(--gris-fond);
  --ocre-border: var(--gris-sep);
  --dore-light: var(--creme);
  --dore-border: var(--gris-sep);
  --dore-dark: var(--dore);
}

.qst-page-wrap {
  font-family: var(--font-body);
}

.qst-h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: normal;
  color: var(--bleu);
  margin: 0 0 1rem;
}

.qst-bande {
  padding-top: 1rem;
}

/* ── Bloc fixe : consigne + progression + échelle ──
   Vrai sticky (colle au haut de la fenêtre pendant le scroll de la page),
   plus de scroll interne séparé pour la liste de questions — une seule
   zone de scroll (la page), pas de double-scroll imbriqué. */
.qst-fixe {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--blanc);
  margin: 0 -2.5rem 0.5rem;
  padding: 0.15rem 2.5rem 0.75rem;
  border-bottom: 2px solid var(--ocre);
}

.qst-instructions {
  font-size: 1rem;
  color: var(--texte-muted);
  background: var(--dore-light);
  border: 1px solid var(--dore-border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}

.qst-progress-text {
  font-size: 0.9rem;
  color: var(--texte-muted);
  margin-bottom: 0.4rem;
}
.qst-progress-bar {
  height: 6px;
  background: var(--dore-light);
  border-radius: 3px;
  overflow: hidden;
}
.qst-progress-fill {
  height: 100%;
  background: var(--dore);
  border-radius: 3px;
  transition: width 0.2s ease;
}

.qst-legende {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--gris-clair);
}
.qst-legende-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.88rem;
}
.qst-legende-valeur {
  font-weight: 700;
  color: var(--dore-dark);
  flex-shrink: 0;
}
.qst-legende-texte {
  color: var(--texte-muted);
}

/* ── Liste des questions (flux normal, pas de scroll interne) ── */
.qst-scroll-zone {
  padding-right: 0;
}

.qst-groupe-titre {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 500;
  color: var(--dore-dark);
  margin: 1.75rem 0 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--dore-border);
}
.qst-groupe-titre:first-child { margin-top: 0; }

.qst-item {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--gris-clair);
}
.qst-item-texte {
  font-size: 1.05rem;
  color: var(--bleu);
  margin-bottom: 0.75rem;
}
.qst-item-num {
  font-weight: 700;
  color: var(--ocre);
}

.qst-echelle {
  display: grid;
  gap: 8px;
}
.qst-echelle-opt {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 10px 4px;
  border: 1px solid var(--ocre-border);
  border-radius: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.qst-echelle-opt:hover { border-color: var(--dore); }
.qst-echelle-opt input[type="radio"] { display: none; }
.qst-echelle-opt:has(input:checked) {
  border-color: var(--dore);
  background: var(--dore-light);
}
.qst-echelle-valeur {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--bleu);
}

.qst-btn-valider {
  width: 100%;
  padding: 14px;
  background: var(--dore);
  color: var(--blanc);
  border: none;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
}
.qst-btn-valider:hover { background: var(--dore-dark); }
.qst-btn-valider:disabled {
  background: var(--gris-sep);
  color: var(--texte-muted);
  cursor: not-allowed;
  opacity: 0.7;
}
.qst-btn-valider:disabled:hover { background: var(--gris-sep); }

/* Toast au survol quand le bouton est désactivé (même principe que le
   sélecteur de palette du header) */
.qst-btn-wrap {
  position: relative;
  margin-top: 1.25rem;
}
.qst-btn-wrap .qst-btn-valider { margin-top: 0; }
.qst-btn-wrap::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 9px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bleu);
  color: var(--dore);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 40;
}
.qst-btn-wrap::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--bleu);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 40;
}
.qst-btn-wrap:has(.qst-btn-valider:disabled):hover::after,
.qst-btn-wrap:has(.qst-btn-valider:disabled):hover::before {
  opacity: 1;
  visibility: visible;
}

.qst-note-confidentialite {
  font-size: 0.85rem;
  color: var(--texte-muted);
  text-align: center;
  margin-top: 0.75rem;
}

.qst-erreur {
  font-size: 0.95rem;
  color: var(--texte-muted);
  text-align: center;
  padding: 3rem 0 1.5rem;
}
.qst-btn-retour {
  display: block;
  text-align: center;
  color: var(--dore-dark);
  text-decoration: none;
  font-size: 0.9rem;
}

/* ── Modale résultat ── */
.qst-resultat-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1500;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.qst-resultat-overlay.open { display: flex; }
.qst-resultat-modal {
  background: var(--blanc);
  border: 2px solid var(--dore);
  border-radius: 14px;
  max-width: 860px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-body);
}
.qst-resultat-modal-header {
  flex: 0 0 auto;
  background: var(--bleu);
  padding: 20px 52px 20px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  position: relative;
}
.qst-resultat-modal-header h3 {
  font-family: var(--font-heading);
  font-size: 19px;
  font-weight: normal;
  color: var(--dore);
  margin: 0;
}
.qst-resultat-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: rgba(255,255,255,0.12);
  border: none;
  color: var(--blanc);
  font-size: 16px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qst-resultat-modal-close:hover { background: rgba(255,255,255,0.22); }
.qst-resultat-export-btn {
  background: var(--dore);
  border: 1px solid var(--dore);
  color: var(--bleu);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 18px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  font-family: var(--font-body);
}
.qst-resultat-export-btn:hover:not(:disabled) {
  background: var(--dore-dark);
  box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}
.qst-resultat-export-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.qst-resultat-modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 24px 28px 28px;
}

.qst-resultat-texte {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--bleu);
}
.qst-resultat-texte h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 500;
  color: var(--bleu);
  margin: 1.25rem 0 0.6rem;
}
.qst-resultat-texte h3:first-child { margin-top: 0; }
.qst-resultat-texte p { margin: 0 0 0.85rem; }
.qst-resultat-texte strong { color: var(--bleu); font-weight: 600; }
.qst-resultat-texte table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0 1.25rem;
  font-size: 0.82rem;
}
.qst-resultat-texte th,
.qst-resultat-texte td {
  padding: 8px 12px;
  border: 1px solid var(--gris-clair);
  text-align: left;
}
.qst-resultat-texte th {
  background: var(--dore-light);
  color: var(--bleu);
  font-weight: 600;
  white-space: nowrap;
}
.qst-resultat-texte ul { margin: 0 0 0.85rem; padding-left: 1.25rem; }
.qst-resultat-texte li { margin-bottom: 0.35rem; }

.qst-resultat-footer {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--dore-border);
  text-align: center;
}
.qst-resultat-sep {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 0.85rem;
}
.qst-resultat-sep .qrs-line { height: 1px; width: 40px; background: var(--dore-border); }
.qst-resultat-sep .qrs-diamond { width: 6px; height: 6px; background: var(--dore); transform: rotate(45deg); }
.qst-resultat-cabinet {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--dore-dark);
  margin: 0 0 0.3rem;
}
.qst-resultat-adeli {
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--texte-muted);
  margin: 0;
}