/* Habillage DERA — partagé entre l'admin et les pages publiques */

:root {
  --navy: #0E2C7B;
  --navy-dark: #082058;
  --navy-tint: #EAEEF7;
  --teal: #2B9AAE;
  --teal-dark: #217986;
  --teal-tint: #E8F3F5;
  --sand: #F6F2E9;
  --sand-line: #E3DAC4;
  --ink: #1E1D1B;
  --ink-muted: #6B6A63;
  --white: #FFFFFF;
  --success: #2F6B3A;
  --success-tint: #E7F1E8;
  --danger: #A23B34;
  --danger-tint: #F8EAE8;
  --radius: 10px;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--white);
  margin: 0;
  padding: 0;
  line-height: 1.55;
}

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

.page-large { max-width: 1040px; }

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--navy);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 8px;
}
h1 { font-size: 2rem; margin-bottom: 24px; }
h2 { font-size: 1.3rem; margin-top: 32px; }
h3 { font-size: 1.05rem; }

p { color: var(--ink); }

a { color: var(--teal); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--teal-dark); }

.lien-retour {
  display: inline-block;
  margin-bottom: 24px;
  font-size: 0.9rem;
  color: var(--ink-muted);
  text-decoration: none;
}
.lien-retour:hover { color: var(--teal); }

.barre-haut {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.barre-haut a { font-size: 0.9rem; text-decoration: none; }

/* Filet décoratif, écho du trait sous "Développer · Évoluer · Réussir · Agir" */
.filet {
  width: 64px;
  height: 3px;
  background: var(--teal);
  border: none;
  margin: 4px 0 20px;
}

/* ---- Cartes et sections ---- */
.carte {
  background: var(--white);
  border: 1px solid var(--sand-line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

fieldset.carte { border: 1px solid var(--sand-line); }
legend {
  font-family: var(--font-display);
  color: var(--navy);
  font-size: 1.1rem;
  padding: 0 6px;
}

/* ---- Formulaires ---- */
label {
  display: block;
  font-weight: 500;
  margin: 14px 0 6px;
  font-size: 0.92rem;
  color: var(--ink);
}

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--sand-line);
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--white);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px var(--navy-tint);
}
textarea { resize: vertical; }

input[type="radio"] { width: auto; accent-color: var(--navy); }

.btn, button, input[type="submit"] {
  display: inline-block;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 11px 24px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover, button:hover, input[type="submit"]:hover { background: var(--navy-dark); }
.btn-discret {
  background: transparent;
  color: var(--navy);
  padding: 4px 0;
  text-decoration: underline;
}
.btn-discret:hover { background: transparent; color: var(--navy-dark); }

/* ---- Échelle de notation 1-5 : élément signature ---- */
.champ-echelle {
  display: flex;
  gap: 8px;
  margin: 4px 0 8px;
}
.champ-echelle label {
  margin: 0;
  font-weight: 600;
}
.champ-echelle input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.champ-echelle label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1.5px solid var(--sand-line);
  color: var(--navy);
  font-family: var(--font-display);
  font-size: 1.05rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.champ-echelle input[type="radio"]:checked + label,
.champ-echelle label:has(input:checked) {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

/* ---- Tableaux (admin) ---- */
table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th {
  text-align: left;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
  padding: 10px 12px;
  border-bottom: 2px solid var(--sand-line);
}
td { padding: 10px 12px; border-bottom: 1px solid var(--sand-line); font-size: 0.92rem; }
tr.inactif td { color: var(--ink-muted); }

.pastille {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.pastille-ok { background: var(--success-tint); color: var(--success); }
.pastille-off { background: var(--sand); color: var(--ink-muted); }

.btn-etat {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-body);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-etat-on { background: var(--success); color: var(--white); }
.btn-etat-on:hover { background: #24552E; }
.btn-etat-off { background: var(--sand); color: var(--ink-muted); }
.btn-etat-off:hover { background: var(--sand-line); color: var(--ink); }

/* ---- Messages ---- */
.message-ok { color: var(--success); background: var(--success-tint); padding: 12px 16px; border-radius: 8px; }
.message-ko { color: var(--danger); background: var(--danger-tint); padding: 12px 16px; border-radius: 8px; }

/* ---- Widgets de résultat (iframe) ---- */
.widget { padding: 4px 6px; }
.widget-titre {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--navy);
  line-height: 1.25;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.widget-chiffre {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--navy);
  border-bottom: 3px solid var(--teal);
  display: inline-block;
  width: 135px;
  padding-bottom: 2px;
}
.widget-libelle { color: var(--ink-muted); font-size: 0.85rem; margin-top: 6px; }
.widget-barre-ligne { margin: 10px 0; font-size: 0.85rem; color: var(--ink); }
.widget-barre-fond { background: var(--sand); border-radius: 4px; overflow: hidden; height: 12px; margin-top: 4px; }
.widget-barre-remplie { background: var(--navy); height: 100%; }

/* ---- Formulaire de connexion / création admin ---- */
.page-etroite { max-width: 380px; margin: 80px auto; padding: 0 24px; }

/* ==========================================================
   Parcours par étapes du formulaire public (une question à la fois)
   ========================================================== */
.page-stepper { padding-top: 108px; }

.barre-progression-fixe {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: var(--white);
  border-bottom: 1px solid var(--sand-line);
  padding: 14px 24px;
  z-index: 1000;
}
.barre-progression-conteneur { max-width: 620px; margin: 0 auto; }
.barre-progression-piste {
  height: 7px;
  background: var(--sand);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}
.barre-progression-remplissage {
  height: 100%;
  background: var(--navy);
  border-radius: 999px;
  width: 0%;
  transition: width .3s ease;
}
.barre-progression-texte {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--ink-muted);
  font-weight: 500;
}

.carte-etapes {
  background: var(--white);
  border: 1px solid var(--sand-line);
  border-radius: 16px;
  padding: 32px;
  min-height: 320px;
}

.form-step { display: none; }
.form-step.active { display: block; animation: dera-apparition .3s ease; }
@keyframes dera-apparition {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.question-label.obligatoire::after { content: ' *'; color: var(--danger); }
.question-label.facultative::after { content: ' (facultatif)'; color: var(--ink-muted); font-weight: 400; }

.question.en-erreur .champ-echelle label,
.question.en-erreur input,
.question.en-erreur textarea { border-color: var(--danger); }

.champ-conditionnel {
  display: none;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed var(--sand-line);
}
.champ-conditionnel.visible { display: block; }

.message-erreur-champ {
  display: none;
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 10px;
}
.message-erreur-champ.show { display: block; animation: dera-secousse .3s ease; }
@keyframes dera-secousse {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.navigation-etapes {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
}
.nav-btn {
  background: var(--white);
  color: var(--navy);
  border: 1.5px solid var(--sand-line);
}
.nav-btn:hover { background: var(--sand); }
.nav-btn:disabled { opacity: 0.4; cursor: default; background: var(--white); }

.bloc-succes {
  text-align: center;
  padding: 56px 24px;
  background: var(--white);
  border: 1px solid var(--sand-line);
  border-radius: 16px;
  animation: dera-apparition .4s ease;
}
.bloc-succes h2 { color: var(--success); font-size: 1.6rem; }

@media (max-width: 640px) {
  .page-stepper { padding-top: 92px; }
  .carte-etapes { padding: 22px; }
}

/* Cases à cocher et menus déroulants — habillage DERA (remplace le rendu système par défaut) */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  min-width: 22px;
  margin: 0 8px 0 0;
  border-radius: 6px;
  border: 1.5px solid var(--sand-line);
  background: var(--white);
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  flex-shrink: 0;
}
input[type="checkbox"]:hover { border-color: var(--teal); }
input[type="checkbox"]:checked {
  background: var(--navy);
  border-color: var(--navy);
}
input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 3px;
  width: 6px;
  height: 11px;
  border: solid var(--white);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  height: 46px;
  padding: 0 40px 0 14px;
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%232B9AAE' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 1px solid var(--sand-line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s;
}
select:hover { border-color: var(--teal); }
select:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px var(--navy-tint);
}

/* Bouton "copier le lien" (page d'accueil admin) */
.btn-copier {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  padding: 0;
  margin: 0 2px;
  background: var(--navy-tint);
  color: var(--navy);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  vertical-align: middle;
  transition: background .15s, color .15s;
}
.btn-copier:hover { background: var(--teal-tint); color: var(--teal-dark); }
.btn-copier svg { width: 14px; height: 14px; }
.btn-copier.copie { background: var(--success); color: var(--white); }
