/* ─────────────────────────────────────────────────────────
   Simulateur d'aides · Expert Audit Énergétique
   ───────────────────────────────────────────────────────── */

/* Masquer le header du thème sur cette page */
body.page-template-page-simulateur .header { display: none !important; }

/* ── Shell ─────────────────────────────────────────────── */
.sim-page {
  min-height: 100vh;
  background: var(--cream);
  display: flex;
  flex-direction: column;
}

/* ── Topbar (logo + barre de progression) ──────────────── */
.sim-topbar {
  background: var(--navy);
  padding: 14px 40px;
  display: flex;
  align-items: center;
  gap: 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.sim-topbar-logo { display: flex; align-items: center; flex-shrink: 0; }
.sim-topbar-logo img { height: 38px; width: auto; }

.sim-prog-wrap { flex: 1; display: flex; flex-direction: row; align-items: center; gap: 12px; }

.sim-pct-lbl {
  font-family: 'Thunder', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--cream);
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: .05em;
}

.sim-prog-track {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,.18);
  border-radius: 3px;
  overflow: hidden;
}

.sim-prog-fill {
  height: 100%;
  background: var(--cream);
  border-radius: 3px;
  width: 0;
  transition: width .45s cubic-bezier(.4,0,.2,1);
}

.sim-step-lbl {
  font-family: 'Thunder', sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--green);
  text-align: center;
  margin: 0 0 48px;
  width: 100%;
}

/* ── Zone centrale ─────────────────────────────────────── */
.sim-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  justify-content: safe center;
  padding: 24px 24px 24px;
}

/* Étape finale (formulaire) : aligner vers le haut pour remonter le bloc */
.sim-body:has(.sim-step[data-step="9"].active) {
  justify-content: flex-start;
  padding-top: 48px;
}

.sim-steps { width: 100%; max-width: 800px; }

/* ── Step ──────────────────────────────────────────────── */
.sim-step { display: none; flex-direction: column; align-items: center; text-align: center; }

.sim-step.active {
  display: flex;
  animation: simIn .32s ease;
}

@keyframes simIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sim-eyebrow {
  font-family: 'Thunder', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 10px;
}

/* Masquer les sous-titres de catégorie dans les étapes quiz */
.sim-step > .sim-eyebrow { display: none; }

.sim-q {
  font-family: 'Thunder', sans-serif;
  font-size: clamp(28px, 6vw, 64px);
  font-weight: 800;
  color: var(--navy);
  line-height: 1.08;
  margin-bottom: 6px;
  text-wrap: balance;
  overflow-wrap: break-word;
  word-break: break-word;
}

.sim-q em { font-style: italic; color: var(--green); }

.sim-hint {
  font-size: 15px;
  font-weight: 400;
  color: var(--gray);
  margin-bottom: 26px;
}

/* ── Grille de choix ───────────────────────────────────── */
.sim-grid { display: grid; gap: 14px; width: 100%; margin-top: 26px; }
.sim-grid--2 { grid-template-columns: repeat(2, 1fr); }
.sim-grid--3 { grid-template-columns: repeat(3, 1fr); }

/* Étape travaux (7 choix) : flex pour centrer la dernière ligne */
.sim-grid--multi { display: flex; flex-wrap: wrap; justify-content: center; }
.sim-grid--multi .sim-card { flex: 0 1 calc((100% - 28px) / 3); }

.sim-card {
  position: relative;
  background: #fff;
  border: 2px solid #deded4;
  border-radius: 22px;
  padding: 32px 24px 26px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  min-height: 110px;
  transition: border-color .18s, background .18s, transform .16s, box-shadow .18s;
  font-family: 'Thunder', sans-serif;
  outline: none;
}

.sim-card:hover {
  border-color: var(--navy);
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(23,57,85,.13);
}

.sim-card.selected {
  background: var(--navy);
  border-color: var(--navy);
  box-shadow: 0 10px 32px rgba(23,57,85,.28);
  transform: translateY(-3px);
}

.sim-card.selected::after {
  content: '✓';
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 14px;
  font-weight: 900;
  color: var(--green);
}

.sim-card-icon { font-size: 48px; line-height: 1; }

.sim-card-text {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
}

.sim-card.selected .sim-card-text { color: #fff; }

.sim-card-sub {
  font-size: 15px;
  font-weight: 400;
  color: var(--gray);
  line-height: 1.35;
}

.sim-card.selected .sim-card-sub { color: rgba(255,255,255,.7); }

/* ── Code postal ───────────────────────────────────────── */
.sim-cp-block {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  width: 100%;
  max-width: 420px;
}

.sim-cp-input {
  flex: 1;
  height: 60px;
  border: 2px solid #deded4;
  border-radius: 14px;
  padding: 0 18px;
  font-family: 'Thunder', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--navy);
  background: #fff;
  text-align: center;
  letter-spacing: .18em;
  outline: none;
  transition: border-color .2s;
}

.sim-cp-input:focus  { border-color: var(--navy); }
.sim-cp-input.error  { border-color: #e53935; animation: shake .4s ease; }

.sim-cp-btn {
  height: 60px;
  padding: 0 28px;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-family: 'Thunder', sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s;
  white-space: nowrap;
}

.sim-cp-btn:hover { background: var(--green); }

/* ── Étape formulaire ──────────────────────────────────── */
.sim-form-hd { margin-bottom: 28px; }

.sim-form-badge { margin-bottom: 16px; }
.sim-form-badge img { height: 64px; width: auto; max-width: 100%; }

.sim-form {
  width: 100%;
  max-width: 580px;
  text-align: left;
}

.sim-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.sim-field { display: flex; flex-direction: column; gap: 5px; }

.sim-field label {
  font-family: 'Thunder', sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--navy);
}

.sim-field input {
  height: 52px;
  border: 2px solid #deded4;
  border-radius: 12px;
  padding: 0 16px;
  font-family: 'Thunder', sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--navy);
  background: #fff;
  outline: none;
  transition: border-color .2s;
}

.sim-field input:focus { border-color: var(--navy); }
.sim-field input:invalid:not(:placeholder-shown) { border-color: #e53935; }

.sim-submit-btn {
  display: block;
  width: 100%;
  height: 62px;
  margin-top: 10px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-family: 'Thunder', sans-serif;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  transition: background .2s, transform .15s;
}

.sim-submit-btn:hover  { background: #0d7840; transform: scale(1.01); }
.sim-submit-btn:active { transform: scale(.99); }

.sim-gdpr {
  font-size: 11px;
  color: var(--gray);
  text-align: center;
  margin-top: 10px;
  line-height: 1.5;
  font-weight: 400;
}

/* ── Navigation (précédent / suivant) ──────────────────── */
.sim-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px 32px;
}

.sim-nav.hidden { display: none; }

.sim-prev-btn,
.sim-next-btn {
  font-family: 'Thunder', sans-serif;
  font-size: 16px;
  font-weight: 700;
  padding: 12px 30px;
  border-radius: 50px;
  cursor: pointer;
  transition: all .18s;
  border: 2px solid transparent;
}

.sim-prev-btn {
  background: transparent;
  border-color: #c8c8b8;
  color: var(--gray);
}

.sim-prev-btn:hover       { border-color: var(--navy); color: var(--navy); }
.sim-prev-btn.invisible   { visibility: hidden; pointer-events: none; }

.sim-next-btn {
  background: var(--navy);
  color: #fff;
}

.sim-next-btn:hover  { background: var(--green); }
.sim-next-btn.hidden { display: none; }

/* ── Page de confirmation ──────────────────────────────── */
.sim-confirm {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.sim-confirm-inner { text-align: center; max-width: 520px; }

.sim-confirm-icon {
  font-size: 80px;
  color: var(--green);
  font-weight: 900;
  margin-bottom: 20px;
  line-height: 1;
}

.sim-confirm-inner h1 {
  font-family: 'Thunder', sans-serif;
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 16px;
  line-height: 1.1;
}

.sim-confirm-inner p {
  font-size: 17px;
  color: var(--gray);
  margin-bottom: 36px;
  line-height: 1.6;
  font-weight: 400;
}

/* ── Animations ────────────────────────────────────────── */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-8px); }
  40%     { transform: translateX(8px); }
  60%     { transform: translateX(-5px); }
  80%     { transform: translateX(5px); }
}

/* ── Indicateur revenus ────────────────────────────────── */
.sim-rev-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: block;
  flex-shrink: 0;
  margin-bottom: 6px;
}
.sim-card.selected .sim-rev-dot {
  box-shadow: 0 0 0 2px rgba(255,255,255,.5);
}

/* ── Sélecteur foyer fiscal (1 à 5) ─────────────────────── */
.sim-grid--foyer { grid-template-columns: repeat(5, 1fr); }
.sim-grid--foyer .sim-card {
  min-height: 96px;
  padding: 24px 10px 20px;
  gap: 6px;
}
.sim-grid--foyer .sim-card-icon {
  font-size: 44px;
  font-weight: 800;
  color: var(--navy);
}
.sim-grid--foyer .sim-card.selected .sim-card-icon { color: #fff; }
.sim-grid--foyer .sim-card-text { font-size: 15px; font-weight: 500; color: var(--gray); }
.sim-grid--foyer .sim-card.selected .sim-card-text { color: rgba(255,255,255,.8); }

/* ── Plafond de revenus affiché sous chaque tranche ─────── */
.sim-card-ceil {
  font-family: 'Thunder', sans-serif;
  font-size: 19px;
  font-weight: 700;
  color: #0d7840;
  background: rgba(18,158,83,.12);
  padding: 9px 22px;
  border-radius: 26px;
  line-height: 1.2;
  margin-top: 6px;
  white-space: nowrap;
}
.sim-card-ceil:empty { display: none; }

/* Couleurs par tranche, calquées sur la feuille des plafonds */
.sim-card[data-rev="tm"] .sim-card-ceil { background: rgba(139,195,74,.22); color: #4e7a12; }
.sim-card[data-rev="mo"] .sim-card-ceil { background: rgba(222,217,62,.32); color: #6f6700; }
.sim-card[data-rev="in"] .sim-card-ceil { background: rgba(226,162,60,.22); color: #a9670f; }
.sim-card[data-rev="su"] .sim-card-ceil { background: rgba(214,71,60,.16);  color: #bf392b; }

.sim-card.selected .sim-card-ceil { background: rgba(255,255,255,.18); color: #fff; }

/* ── Champ pleine largeur ──────────────────────────────── */
.sim-field--full { margin-bottom: 14px; }

/* ── Écran non éligible ────────────────────────────────── */
.sim-ineligible {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  max-width: 640px;
  padding: 48px 24px;
  animation: simIn .32s ease;
}
.sim-ineligible.active { display: flex; }

.sim-ineligible-icon { font-size: 64px; margin-bottom: 20px; line-height: 1; }

.sim-ineligible-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin-top: 32px;
}

/* ── Mobile ────────────────────────────────────────────── */
@media (max-width: 640px) {
  .sim-topbar { padding: 10px 16px; gap: 14px; }
  .sim-body   { padding: 28px 16px 0; }
  .sim-nav    { padding: 16px 16px 24px; }

  .sim-grid--2 { grid-template-columns: 1fr 1fr; }
  .sim-grid--3 { grid-template-columns: 1fr 1fr; }
  .sim-grid--foyer { grid-template-columns: repeat(3, 1fr); }
  .sim-grid--multi .sim-card { flex-basis: calc((100% - 14px) / 2); }

  .sim-form-row { grid-template-columns: 1fr; }
  .sim-ineligible-actions { flex-direction: column; align-items: stretch; }

  .sim-card { padding: 22px 16px 18px; }
  .sim-card-icon { font-size: 38px; }
  .sim-card-text { font-size: 20px; }

  .sim-step-lbl { font-size: 18px; margin-bottom: 28px; }

  .sim-submit-btn { font-size: 18px; height: 56px; }
}

@media (max-width: 380px) {
  .sim-grid--2,
  .sim-grid--3 { grid-template-columns: 1fr; }
  .sim-grid--multi .sim-card { flex-basis: 100%; }

  .sim-card { padding: 18px 14px 16px; min-height: 80px; }
  .sim-card-icon { font-size: 32px; }
  .sim-card-text { font-size: 18px; }

  .sim-q { font-size: clamp(24px, 7vw, 36px); }
}

@media (max-width: 320px) {
  .sim-topbar { padding: 8px 12px; gap: 10px; }
  .sim-body   { padding: 20px 12px 0; }
  .sim-nav    { padding: 12px 12px 20px; }
  .sim-form   { max-width: 100%; }
}
