/* css/auto.css
 * Styles mobile-first de l'app publique d'auto-diagnostic.
 * Tokens de marque : SOURCE UNIQUE _tokens-base.css (partagée expert/demande).
 * L'app auto reste en mode clair uniquement (aucune surcharge sombre ici).
 */
@import url('_tokens-base.css');

* { margin: 0; padding: 0; box-sizing: border-box; }

/* ---- Icônes SVG inline (js/ui/icons.js) ---- */
.ico { display: inline-flex; vertical-align: -3px; flex: 0 0 auto; }
.ico svg { width: 100%; height: 100%; display: block; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ---- Topbar + progression ---- */
.auto-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--navy);
  color: #fff;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
}
.auto-topbar-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.auto-back-sedidiag {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .3px;
  color: rgba(255, 255, 255, .65);
  text-decoration: none;
  white-space: nowrap;
  transition: color .2s ease;
}
.auto-back-sedidiag:hover { color: #fff; }
.auto-brand {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .2px;
}
.auto-progress {
  margin-top: 10px;
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .18);
  overflow: hidden;
}
.auto-progress-bar {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: var(--blue-light);
  transition: width .3s ease;
}

/* ---- Layout ---- */
.auto-main {
  max-width: 540px;
  margin: 0 auto;
  padding: 22px 16px 48px;
}
.auto-screen-wrap { animation: auto-fade .25s ease; }
@keyframes auto-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.auto-screen { display: flex; flex-direction: column; gap: 14px; }

.auto-step-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--blue);
}
.auto-h1 { font-size: 26px; font-weight: 800; color: var(--navy); letter-spacing: -.4px; }
.auto-h2 { font-size: 21px; font-weight: 800; color: var(--navy); letter-spacing: -.3px; }
.auto-lead { font-size: 15px; color: var(--mid); }
.auto-help { font-size: 13.5px; color: var(--lt); }

/* ---- Accueil ---- */
.auto-hero { text-align: center; padding: 8px 0 4px; }
.auto-hero-icon { font-size: 44px; margin-bottom: 8px; }
.auto-bullets { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.auto-bullets li {
  position: relative;
  padding-left: 26px;
  font-size: 14px;
  color: var(--mid);
}
.auto-bullets li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--green);
  font-weight: 800;
}

/* ---- Buttons ---- */
.auto-btn {
  appearance: none;
  border: 0;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 700;
  padding: 14px 18px;
  cursor: pointer;
  transition: background .15s ease, opacity .15s ease, transform .05s ease;
}
.auto-btn:active { transform: translateY(1px); }
.auto-btn-primary {
  background: linear-gradient(135deg, var(--blue-light), var(--blue));
  color: #fff;
  box-shadow: 0 3px 10px rgba(41, 120, 181, .3);
}
.auto-btn-primary:hover { background: linear-gradient(135deg, #54A0DD, var(--blue-light)); }
.auto-btn-primary:disabled { background: var(--border); color: var(--lt); cursor: not-allowed; box-shadow: none; }
.auto-btn-secondary { background: var(--pale); color: var(--navy); }
.auto-btn-ghost { background: transparent; color: var(--mid); border: 1px solid var(--border); }
.auto-actions { display: flex; gap: 10px; }
.auto-actions .auto-btn { flex: 1; }

/* ---- Inputs / fields ---- */
.auto-input {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 14px;
}
.auto-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(41, 120, 181, .15); }
.auto-field { position: relative; }
.auto-field-label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--mid); }
/* Erreur inline sous un champ (révélée au blur via [hidden]). */
.field-error { color: var(--red); font-size: 12.5px; margin-top: 5px; font-weight: 500; }
.field-error[hidden] { display: none; }

/* ---- Address autocomplete ---- */
.auto-suggestions {
  list-style: none;
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 5;
}
.auto-suggestion { padding: 11px 14px; font-size: 14px; cursor: pointer; border-bottom: 1px solid #eef2f7; }
.auto-suggestion:last-child { border-bottom: 0; }
.auto-suggestion:hover { background: var(--pale); }
.auto-address-status {
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  background: var(--pale);
  border-radius: 8px;
  padding: 8px 12px;
}

/* ---- Chips (radio-like) ---- */
.auto-fieldset { border: 0; display: flex; flex-direction: column; gap: 8px; }
.auto-legend { font-size: 13px; font-weight: 700; color: var(--navy); }
.auto-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.auto-chip {
  appearance: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 9px 16px;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.auto-chip:hover { border-color: var(--blue); }
.auto-chip-on { background: var(--navy); color: #fff; border-color: var(--navy); }
.auto-chip-sub { font-size: 10.5px; font-weight: 600; opacity: .8; }

/* ---- Stepper (étape Occupation : occupants / mineurs / vulnérables) ---- */
.auto-stepper { display: inline-flex; align-items: center; gap: 10px; }
.auto-stepper-btn {
  appearance: none;
  font-family: inherit;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--navy);
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.auto-stepper-btn:hover { border-color: var(--blue); }
.auto-stepper-btn:active { background: var(--pale); }

/* Accessibilité clavier — anneau de focus visible sur tous les éléments
   interactifs de l'app auto (aucun n'en avait). */
.auto-chip:focus-visible,
.auto-stepper-btn:focus-visible,
.auto-cta:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}
.auto-chip:active { background: var(--pale); }
.auto-stepper-val {
  min-width: 56px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
}

/* ---- Conditional block ---- */
.auto-conditional { display: flex; flex-direction: column; gap: 8px; }
/* [hidden] doit l'emporter sur le display ci-dessus, sinon le bloc conditionnel
   (ex. « jusqu'où l'eau est montée ») reste visible même quand il est masqué. */
.auto-conditional[hidden] { display: none; }

/* ---- Checkboxes ---- */
.auto-checks { display: flex; flex-direction: column; gap: 4px; }
.auto-check {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 14px;
  font-size: 14.5px;
  cursor: pointer;
}
.auto-check input { width: 19px; height: 19px; margin-top: 1px; accent-color: var(--blue); flex: 0 0 auto; }
.auto-rgpd { font-size: 13px; color: var(--mid); }

/* ---- Rapport (iframe isolée — pas de fuite CSS globale) ---- */
.auto-rapport-frame { width: 100%; border: 0; min-height: 1200px; background: #EEF2F7; }

/* ---- « Et maintenant ? » — 3 cartes de service sous le rapport ---- */
.auto-next-steps { display: flex; flex-direction: column; gap: 8px; }
.auto-next-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -.2px;
  margin-bottom: 2px;
}
.auto-next-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  width: 100%;
}
.auto-next-card .auto-next-card-t { font-size: 15px; font-weight: 700; }
.auto-next-card .auto-next-card-sub { font-size: 12px; font-weight: 600; opacity: .85; }
/* Cartes 2-3 : informatives (pas des CTA) — fond blanc, bordure discrète. */
.auto-next-card-info {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
}
.auto-next-card-info .auto-next-card-t { color: var(--navy); font-size: 14px; }
.auto-next-card-info .auto-next-card-sub { color: var(--lt); }

/* Message d'envoi du rapport par email (capture de lead). Discret, success-ish. */
.auto-send-msg {
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
  background: var(--green-bg);
  border: 1px solid #BFE7D8;
  border-radius: 8px;
  padding: 9px 12px;
}
.auto-send-msg-warn {
  color: var(--amber);
  background: #FBF3E2;
  border-color: #ECD9A8;
}

/* Carte flash adresse (PPRI/PAPI/CatNat/vigilance Vigicrues), affichée sous le
   champ adresse dès que l'enrichissement renvoie au moins une donnée exploitable. */
.auto-flash {
  background: var(--pale);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--mid);
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}
.auto-flash-row b { color: var(--navy); }
.auto-flash-vigi {
  display: inline-block;
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
}
/* Mêmes couleurs que le bandeau vigilance du rapport. */
.auto-flash-vigi.vigi-1 { background: #00845A; }
.auto-flash-vigi.vigi-2 { background: #E8B500; }
.auto-flash-vigi.vigi-3 { background: #CC8500; }
.auto-flash-vigi.vigi-4 { background: #C92A2A; }
.auto-flash-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
}
.auto-flash-link:hover { text-decoration: underline; }

/* ---- Écran « Vos risques près de chez vous » (tableau de bord multirisques) ---- */
/* Hero INONDATION : pleine largeur, navy charte, données profondes (PPRI,
   CatNat, Vigicrues, nappe) — c'est la spécialité SEDIPEC, il domine la grille. */
.auto-risk-hero {
  background: linear-gradient(135deg, var(--navy), var(--navy-deep));
  color: #fff;
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
}
.auto-risk-hero-head { display: flex; align-items: center; gap: 9px; }
.auto-risk-hero-head .ico { color: #7FC8F8; }
.auto-risk-hero-title { font-size: 17px; font-weight: 800; letter-spacing: -.2px; }
.auto-risk-hero-tag {
  margin-left: auto;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
  background: var(--green);
  color: #fff;
  border-radius: 999px;
  padding: 3px 10px;
}
.auto-risk-hero-badges { display: flex; flex-direction: column; gap: 5px; }
.auto-risk-hero-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid rgba(255, 255, 255, .14);
  padding-top: 10px;
  font-size: 12.5px;
}
.auto-risk-hero-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.auto-risk-hero-row b { color: #fff; font-weight: 700; }
.auto-risk-hero-k { color: #9FB2C6; font-size: 11.5px; min-width: 132px; }
.auto-risk-hero-link { color: #7FC8F8; font-size: 11.5px; font-weight: 600; text-decoration: none; }
.auto-risk-hero-link:hover { text-decoration: underline; }

/* Grille des autres risques : 2 cartes par rangée (1 sur très petit écran). */
.auto-risk-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 380px) {
  .auto-risk-grid { grid-template-columns: 1fr; }
}
.auto-risk-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 13px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.auto-risk-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -.1px;
}
.auto-risk-card-head .ico { color: var(--blue); }
.auto-risk-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}
.auto-risk-line-k { color: var(--mid); }
.auto-risk-hero .auto-risk-line-k { color: #9FB2C6; }

/* Pastilles de statut : fort = rouge, modéré = ambre, faible = vert, inconnu = gris. */
.auto-risk-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}
.auto-risk-badge.niv-fort { background: var(--red); }
.auto-risk-badge.niv-moyen { background: var(--amber); }
.auto-risk-badge.niv-faible { background: var(--green); }
.auto-risk-badge.niv-inconnu { background: var(--lt); }

/* Séparateur des risques technologiques + lignes discrètes. */
.auto-risk-sep {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--mid);
  margin-top: 4px;
}
.auto-risk-absents { font-size: 12px; color: var(--lt); }
.auto-risk-indispo {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--amber);
  background: #FBF3E2;
  border: 1px solid #ECD9A8;
  border-radius: 8px;
  padding: 9px 12px;
}

/* CTA du tableau de bord : primaire (affiner) + secondaire (PDF immédiat). */
.auto-risques-ctas {
  display: flex;
  flex-direction: column;
  gap: 9px;
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(238, 242, 247, 0), var(--bg) 30%);
  padding: 12px 0 10px;
}
.auto-risques-ctas .auto-btn { width: 100%; }
.auto-cta-t { display: block; }
.auto-cta-sub { display: block; font-size: 12px; font-weight: 600; opacity: .85; }
.auto-pdf-msg {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--amber);
}
.auto-pdf-msg[hidden] { display: none; }
