/* ==========================================================================
   FoyerÉco — Formulaire devis (code en dur, envoi vers Kindilab)
   Tout est scopé sous .fe-devis pour ne pas interférer avec le reste du site.
   ========================================================================== */

.fe-devis {
  --fe-navy: #1f3f80;
  --fe-navy-dark: #172f61;
  --fe-ink: #001a29;
  --fe-muted: #5b6672;
  --fe-line: #d9e2ee;
  --fe-soft: #f4f8fa;
  --fe-green: #4aab3d;
  --fe-green-soft: #edf8eb;
  --fe-error: #d64545;
  --fe-radius: 14px;
  font-family: "Inter", sans-serif;
  color: var(--fe-ink);
  scroll-margin-top: calc(var(--header-h, 90px) + 16px);
}

.fe-devis *,
.fe-devis *::before,
.fe-devis *::after { box-sizing: border-box; }

.fe-form { margin: 0; }

/* Anti-spam */
.fe-hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Progression ---------- */
.fe-progress { margin-bottom: 22px; }
.fe-progress__meta {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  font-size: 13px; color: var(--fe-muted); margin-bottom: 8px;
}
.fe-progress__meta strong { color: var(--fe-navy); font-weight: 700; }
.fe-progress__hint { color: var(--fe-green); font-weight: 600; }
.fe-progress__track { height: 6px; background: #e8eef5; border-radius: 99px; overflow: hidden; }
.fe-progress__bar {
  display: block; height: 100%; width: 12.5%;
  background: linear-gradient(90deg, var(--fe-green), #358c2b);
  border-radius: inherit; transition: width .35s ease;
}

/* ---------- Étapes ---------- */
.fe-step { border: 0; margin: 0; padding: 0; min-width: 0; }
.fe-step + .fe-step { margin-top: 28px; }               /* sans JS : toutes visibles */
.fe-js .fe-step + .fe-step { margin-top: 0; }
.fe-js .fe-step:not(.is-active) { display: none; }
.fe-js .fe-step.is-active { animation: fe-in .3s ease both; }
@keyframes fe-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.fe-q {
  float: none; width: 100%; padding: 0; margin: 0 0 16px;
  font-family: "ClashGrotesk-Variable", "Inter", sans-serif;
  font-size: 22px; line-height: 1.25; font-weight: 600; color: var(--fe-ink);
  outline: none;
}

/* ---------- Cartes de choix ---------- */
.fe-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.fe-card {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 64px; padding: 14px 16px;
  background: #fff; border: 1.5px solid var(--fe-line); border-radius: var(--fe-radius);
  font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--fe-ink);
  cursor: pointer; user-select: none;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s ease;
}
.fe-card input {
  appearance: none; -webkit-appearance: none; flex: 0 0 auto;
  width: 20px; height: 20px; margin: 0; border-radius: 50%;
  border: 2px solid #b8c4d3; background: #fff; display: grid; place-content: center;
  transition: border-color .2s ease, background .2s ease;
}
.fe-card input::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff;
  transform: scale(0); transition: transform .15s ease;
}
.fe-card:hover { border-color: var(--fe-navy); box-shadow: 0 6px 18px rgba(31, 63, 128, .10); transform: translateY(-1px); }
.fe-card:has(input:checked) { border-color: var(--fe-green); background: var(--fe-green-soft); }
.fe-card input:checked { border-color: var(--fe-green); background: var(--fe-green); }
.fe-card input:checked::after { transform: scale(1); }
.fe-card:has(input:focus-visible) { outline: 3px solid rgba(31, 63, 128, .35); outline-offset: 2px; }

/* ---------- Champs coordonnées ---------- */
.fe-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 14px; }
.fe-field { min-width: 0; }
.fe-field--full { grid-column: 1 / -1; }
.fe-field > label { display: block; font-size: 13px; font-weight: 600; color: var(--fe-ink); margin-bottom: 6px; }
.fe-field abbr { text-decoration: none; color: var(--fe-error); border: 0; cursor: default; }

.fe-input {
  width: 100%; height: 48px; padding: 0 14px;
  font: inherit; font-size: 15px; color: var(--fe-ink);
  background: #fff; border: 1.5px solid var(--fe-line); border-radius: 10px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.fe-input::placeholder { color: #9aa6b2; }
.fe-input:focus { outline: none; border-color: var(--fe-navy); box-shadow: 0 0 0 4px rgba(31, 63, 128, .12); }

.fe-check { display: flex; align-items: flex-start; gap: 10px; font-size: 12.5px; line-height: 1.5; color: var(--fe-muted); cursor: pointer; }
.fe-check span { font-weight: 400; }
.fe-check input { flex: 0 0 auto; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--fe-green); cursor: pointer; }

/* ---------- Erreurs ---------- */
.fe-error { margin: 6px 0 0; font-size: 13px; font-weight: 500; color: var(--fe-error); min-height: 0; }
.fe-error:empty { display: none; }
.fe-has-error .fe-input { border-color: var(--fe-error); }
.fe-has-error .fe-card { border-color: rgba(214, 69, 69, .55); }
.fe-alert {
  margin: 18px 0 0; padding: 12px 14px; border-radius: 10px;
  background: #fdeeee; border: 1px solid #f5c2c2; color: #a12b2b; font-size: 14px;
}

/* ---------- Navigation ---------- */
.fe-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid #edf1f6; }
.fe-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 50px; padding: 0 26px; margin-left: auto;
  font: inherit; font-size: 15px; font-weight: 700; color: #fff;
  background: var(--fe-navy); border: 0; border-radius: 99px; cursor: pointer;
  box-shadow: 0 10px 24px rgba(31, 63, 128, .22);
  transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}
.fe-btn:hover { background: var(--fe-navy-dark); transform: translateY(-1px); }
.fe-btn:focus-visible { outline: 3px solid rgba(31, 63, 128, .35); outline-offset: 3px; }
.fe-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.fe-btn[hidden] { display: none; }
.fe-btn--ghost { margin-left: 0; color: var(--fe-navy); background: transparent; box-shadow: none; padding: 0 12px; }
.fe-btn--ghost:hover { background: var(--fe-soft); transform: none; }
.fe-btn--submit { background: var(--fe-green); box-shadow: 0 10px 24px rgba(74, 171, 61, .30); }
.fe-btn--submit:hover { background: #3d9532; }

/* Sans JS : seul le bouton d'envoi est utile. Avec JS : Suivant / Envoyer selon l'étape. */
.fe-form:not(.fe-js) [data-fe-next] { display: none; }
.fe-js:not(.is-last) [data-fe-submit] { display: none; }
.fe-js.is-last [data-fe-next] { display: none; }

.fe-spinner {
  display: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .45); border-top-color: #fff;
  animation: fe-spin .7s linear infinite;
}
.fe-form.is-sending .fe-spinner { display: inline-block; }
.fe-form.is-sending [data-fe-submit] { pointer-events: none; opacity: .85; }
@keyframes fe-spin { to { transform: rotate(360deg); } }

.fe-reassure { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 14px 0 0; font-size: 12.5px; color: var(--fe-muted); text-align: center; }
.fe-reassure svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; flex: 0 0 auto; }

/* ---------- Succès ---------- */
.fe-success { text-align: center; padding: 36px 12px; outline: none; }
.fe-success[hidden] { display: none; }
.fe-success__icon {
  width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 50%;
  display: grid; place-items: center; background: var(--fe-green-soft);
}
.fe-success__icon svg { width: 36px; height: 36px; fill: none; stroke: var(--fe-green); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.fe-success__title { font-size: 26px; margin: 0 0 8px; color: var(--fe-ink); }
.fe-success__text { margin: 0; color: var(--fe-muted); font-size: 15px; }

/* ---------- Mobile ---------- */
@media (max-width: 575.98px) {
  .fe-q { font-size: 19px; }
  .fe-cards { gap: 10px; }
  .fe-card { min-height: 58px; padding: 12px; font-size: 14px; }
  .fe-grid { grid-template-columns: 1fr; }
  .fe-btn { padding: 0 22px; }
  .fe-progress__hint { display: none; }
}
@media (max-width: 359.98px) {
  .fe-cards { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .fe-devis *, .fe-devis *::before, .fe-devis *::after { animation: none !important; transition: none !important; }
}
