/* =========================================================
   Formulaire de devis multi-étapes — Calendrier Pompier
   (dépend de style.css pour les variables :root)
   ========================================================= */

.container--narrow { max-width: 820px; }

/* L'attribut [hidden] doit primer sur les display des .btn / panneaux */
.devis [hidden],
#devis-form[hidden],
#devis-success[hidden] { display: none !important; }

/* En-tête de page */
.devis-hero {
  background: linear-gradient(120deg, var(--navy-900) 0%, var(--navy-700) 60%, var(--blue-600) 120%);
  color: #fff;
  text-align: center;
  padding-block: 56px 48px;
}
.devis-hero .kicker {
  font-family: var(--font-display);
  font-style: italic; font-weight: 600;
  letter-spacing: 3px; text-transform: uppercase;
  color: var(--sky); font-size: .95rem;
}
.devis-hero h1 {
  font-style: italic; text-transform: uppercase;
  font-size: clamp(2rem, 5vw, 3.2rem); margin: 6px 0 10px;
}
.devis-hero p { color: #dceaf6; margin: 0 auto; max-width: 560px; }

.devis-section { background: var(--paper); }

/* ---------- Barre de progression ---------- */
.devis-steps {
  list-style: none; margin: 0 0 34px; padding: 0;
  display: flex; justify-content: space-between;
  counter-reset: step; position: relative;
}
.devis-steps::before {
  content: ""; position: absolute; top: 19px; left: 6%; right: 6%;
  height: 3px; background: #d7dfe6; z-index: 0;
}
.devis-steps li {
  position: relative; z-index: 1;
  flex: 1; text-align: center;
  font-family: var(--font-display); font-style: italic; font-weight: 600;
  font-size: .82rem; text-transform: uppercase; letter-spacing: .5px;
  color: #8aa0b2;
}
.devis-steps .dot {
  display: grid; place-items: center;
  width: 40px; height: 40px; margin: 0 auto 8px;
  border-radius: 50%; background: #fff; border: 3px solid #d7dfe6;
  color: #8aa0b2; font-size: 1.05rem; font-style: normal;
  transition: all .25s ease;
}
.devis-steps li.is-active .dot { border-color: var(--red); color: #fff; background: var(--red); transform: scale(1.06); }
.devis-steps li.is-done .dot { border-color: var(--blue-500); background: var(--blue-500); color: #fff; }
.devis-steps li.is-active { color: var(--navy-800); }
.devis-steps li.is-done { color: var(--blue-500); cursor: pointer; }
.devis-steps li em { font-style: italic; }

/* ---------- Carte formulaire ---------- */
.devis {
  background: #fff; border: 1px solid #e6ecf1;
  border-radius: 16px; padding: 34px 34px 26px;
  box-shadow: var(--shadow);
}
.devis-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.devis-step { border: 0; margin: 0; padding: 0; min-inline-size: auto; display: none; }
.devis-step.is-active { display: block; animation: devis-in .35s ease; }
@keyframes devis-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.devis-step > legend {
  font-family: var(--font-display); font-style: italic; font-weight: 700;
  text-transform: uppercase; color: var(--navy-800);
  font-size: 1.7rem; margin-bottom: 20px; padding: 0;
}

/* ---------- Étape 1 : cartes type ---------- */
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.type-card {
  position: relative; cursor: pointer;
  border: 2px solid #e2e9ef; border-radius: 14px; overflow: hidden;
  background: #fff; transition: border-color .2s, transform .15s, box-shadow .2s;
  display: flex; flex-direction: column;
}
.type-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.type-card input { position: absolute; opacity: 0; pointer-events: none; }
.type-card img { width: 100%; height: 190px; object-fit: cover; display: block; }
.type-card .type-body { padding: 16px 18px; }
.type-card .type-body strong {
  display: block; font-family: var(--font-display); font-style: italic;
  text-transform: uppercase; color: var(--navy-800); font-size: 1.3rem;
}
.type-card .type-body em { color: var(--muted); font-size: .9rem; font-style: normal; }
.type-card .type-check {
  position: absolute; top: 12px; right: 12px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--red); color: #fff; display: grid; place-items: center;
  font-weight: 700; opacity: 0; transform: scale(.6); transition: all .2s;
}
.type-card:has(input:checked) { border-color: var(--red); box-shadow: 0 0 0 3px rgba(226,35,26,.12); }
.type-card:has(input:checked) .type-check { opacity: 1; transform: scale(1); }

/* ---------- Champs ---------- */
.field { margin-bottom: 22px; }
.field > h3 {
  font-family: var(--font-display); font-style: italic; font-weight: 700;
  text-transform: uppercase; color: var(--navy-700);
  font-size: 1.1rem; margin: 0 0 12px;
}
.field > h3 small { color: var(--muted); font-weight: 400; text-transform: none; font-style: normal; letter-spacing: 0; }
.field label:not(.opt) { display: block; font-weight: 600; color: var(--navy-800); margin-bottom: 6px; font-size: .95rem; }
.field .req { color: var(--red); }

.devis input[type="text"],
.devis input[type="email"],
.devis input[type="tel"],
.devis input[type="number"],
.devis textarea {
  width: 100%; padding: 12px 14px;
  border: 1px solid #cdd8e1; border-radius: 9px;
  font: inherit; color: var(--ink); background: #fbfdfe;
  transition: border-color .18s, box-shadow .18s;
}
.devis input:focus, .devis textarea:focus {
  outline: 0; border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(43,111,168,.15); background: #fff;
}
.field--qty input { max-width: 220px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; }
.grid-2 .field { margin-bottom: 14px; }

/* ---------- Options sélectionnables ---------- */
.opt-row { display: flex; flex-wrap: wrap; gap: 12px; }
.opt { position: relative; cursor: pointer; user-select: none; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }

/* Pastilles (pages, grammage, feuillets) */
.opt--pill {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 78px; padding: 12px 16px;
  border: 2px solid #dbe3ea; border-radius: 10px; background: #fff;
  transition: all .18s ease;
}
.opt--pill b { display: block; width: 100%; text-align: center; font-family: var(--font-display); font-style: italic; font-size: 1.5rem; color: var(--navy-800); line-height: 1; }
.opt--pill i { display: block; width: 100%; text-align: center; font-style: normal; font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 3px; }
.opt--pill:hover { border-color: var(--blue-500); }
.opt--pill:has(input:checked) { border-color: var(--red); background: #fff5f4; box-shadow: 0 0 0 3px rgba(226,35,26,.1); }
.opt--pill:has(input:checked) b { color: var(--red); }

/* Cartes format (avec aperçu de proportion) */
.opt--shape {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: 132px; padding: 16px 12px;
  border: 2px solid #dbe3ea; border-radius: 12px; background: #fff;
  transition: all .18s ease;
}
.opt--shape .shape {
  display: block; background: linear-gradient(150deg, var(--blue-500), var(--navy-700));
  border-radius: 3px; box-shadow: 0 4px 10px -4px rgba(8,38,63,.5);
}
.shape--a4    { width: 74px; height: 52px; }   /* paysage A4 */
.shape--2432  { width: 54px; height: 72px; }   /* portrait 24x32 */
.shape--2323  { width: 62px; height: 62px; }   /* carré */
.shape--banc  { width: 82px; height: 60px; }   /* bancaire paysage */
.shape--mural { width: 38px; height: 76px; }   /* mural étroit */
.opt--shape b { display: block; width: 100%; text-align: center; font-family: var(--font-display); font-style: italic; font-size: 1.15rem; color: var(--navy-800); }
.opt--shape i { display: block; width: 100%; text-align: center; font-style: normal; font-size: .74rem; color: var(--muted); }
.opt--shape:hover { border-color: var(--blue-500); }
.opt--shape:has(input:checked) { border-color: var(--red); background: #fff5f4; box-shadow: 0 0 0 3px rgba(226,35,26,.1); }

/* Interrupteurs (options) */
.opt-row--toggles { flex-direction: column; align-items: stretch; }
.opt--toggle {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border: 2px solid #dbe3ea; border-radius: 10px; background: #fff;
  transition: all .18s ease; font-weight: 600; color: var(--navy-800);
}
.opt--toggle::before {
  content: ""; flex: none; width: 22px; height: 22px; border-radius: 6px;
  border: 2px solid #b9c6d1; background: #fff; transition: all .18s ease;
}
.opt--toggle:hover { border-color: var(--blue-500); }
.opt--toggle:has(input:checked) { border-color: var(--red); background: #fff5f4; }
.opt--toggle:has(input:checked)::before {
  background: var(--red); border-color: var(--red);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.2 3.2L13 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center;
}

/* Options illustrées (vignette + explication) */
.opt--illus { gap: 14px; padding: 12px 14px; align-items: center; }
.opt--illus > img {
  flex: none; width: 92px; height: 66px;
  object-fit: cover; border-radius: 7px;
  box-shadow: 0 4px 10px -5px rgba(8,38,63,.55);
  background: #eef3f7;
}
.opt--illus .opt-text { display: flex; flex-direction: column; gap: 2px; }
.opt--illus .opt-text b { color: var(--navy-800); font-size: 1.02rem; }
.opt--illus .opt-text small { font-weight: 400; color: var(--muted); font-size: .82rem; line-height: 1.35; }

/* ---------- Récapitulatif ---------- */
.devis-recap { display: grid; gap: 2px; margin-bottom: 20px; }
.devis-recap .row {
  display: grid; grid-template-columns: 190px 1fr; gap: 14px;
  padding: 12px 16px; background: var(--paper); border-radius: 8px;
}
.devis-recap .row:nth-child(odd) { background: #eef3f7; }
.devis-recap .k { font-family: var(--font-display); font-style: italic; font-weight: 700; text-transform: uppercase; color: var(--blue-600); font-size: .92rem; }
.devis-recap .v { color: var(--ink); }
.devis-recap .v.hl { font-weight: 700; }
.devis-consent { margin-top: 6px; }

/* ---------- Navigation ---------- */
.devis-nav { display: flex; align-items: center; gap: 12px; margin-top: 26px; padding-top: 22px; border-top: 1px solid #e6ecf1; }
.devis-nav-spacer { flex: 1; }
.btn-ghost-dark { background: transparent; color: var(--navy-700); border-color: #c3d0da; }
.btn-ghost-dark:hover { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }

/* ---------- Erreurs ---------- */
.devis-error { color: var(--red); font-weight: 600; margin: 14px 0 0; font-size: .95rem; min-height: 0; }
.devis-error:empty { display: none; }
.opt.has-error, .field.has-error input, .field.has-error textarea { border-color: var(--red) !important; }

/* ---------- Succès ---------- */
.devis-success { text-align: center; }
.devis-success-card {
  background: #fff; border-radius: 16px; padding: 48px 32px;
  box-shadow: var(--shadow); border: 1px solid #e6ecf1;
  animation: devis-in .4s ease;
}
.devis-success .check {
  width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 50%;
  background: linear-gradient(var(--blue-500), var(--navy-700)); color: #fff;
  display: grid; place-items: center; font-size: 2.4rem;
}
.devis-success h2 { font-style: italic; text-transform: uppercase; color: var(--navy-800); font-size: 2rem; }
.devis-success p { color: var(--muted); max-width: 460px; margin: 0 auto 24px; }

/* ---------- Responsive ---------- */
@media (max-width: 680px) {
  .devis { padding: 22px 18px; }
  .type-grid, .grid-2 { grid-template-columns: 1fr; }
  .devis-steps li em { display: none; }
  .devis-steps::before { left: 12%; right: 12%; }
  .opt--shape { width: calc(50% - 6px); }
}
