/* ============================================================
   SONAVIE — Simulateurs (simulateurs.css) — s'appuie sur base.css
   Les classes de composants reprennent l'ébauche, re-thématisées
   sur le design system. Le moteur de calcul (JS + IDs) est inchangé.
   ============================================================ */

.sim-page { background: var(--c-surface); }

/* ---- Bandeau hero du simulateur ---- */
.sim-hero {
  position: relative;
  background: var(--c-ink);
  padding: 32px 0 28px;
}
.sim-hero-inner { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.sim-hero h1 { font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem); color: #fff; letter-spacing: -0.015em; }
.sim-hero-sub { margin-top: 6px; font-size: var(--fs-sm); color: var(--on-dark-faint); font-variant-numeric: tabular-nums; }
.sim-hero-link {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  font-size: var(--fs-sm); font-weight: 700; color: var(--on-dark-soft);
  padding: 10px 18px; border: 1.5px solid var(--on-dark-line); border-radius: var(--r-sm);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.sim-hero-link:hover { background: rgba(255,255,255,0.1); color: #fff; border-color: rgba(255,255,255,0.4); }
.sim-hero-link svg { width: 15px; height: 15px; }

/* ---- Bascule Particuliers / Entreprises ---- */
.sim-switch { margin-top: var(--header-h); background: var(--c-blue-900); border-bottom: 1px solid var(--on-dark-line); position: relative; z-index: 2; }
.sim-switch .container { display: flex; gap: 0; }
.sim-switch a {
  padding: 13px 24px; font-size: var(--fs-sm); font-weight: 600; color: var(--on-dark-soft);
  border-bottom: 3px solid transparent; transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.sim-switch a:hover { color: #fff; background: rgba(255,255,255,0.07); }
.sim-switch a[aria-current="true"] { color: #fff; border-bottom-color: var(--c-red); background: rgba(255,255,255,0.08); }

/* ---- Onglets produits ---- */
.tabs-bar { background: var(--c-white); border-bottom: 1px solid var(--c-border); box-shadow: var(--sh-1); position: sticky; top: var(--header-h); z-index: 90; }
/* alias : le moteur bascule la classe .open sur le menu mobile */
.mobile-nav.open { transform: translateX(0); visibility: visible; }
/* alias : libellés min/max sous les sliders */
.slider-labels { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--c-text-faint); margin-top: 4px; }
.tabs-bar-inner { display: flex; overflow-x: auto; scrollbar-width: none; max-width: var(--container); margin: 0 auto; padding: 0 calc(var(--gutter) - 20px); }
.tabs-bar-inner::-webkit-scrollbar { display: none; }
.tab-btn {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 15px 20px; font-size: var(--fs-sm); font-weight: 700; color: var(--c-text-soft);
  border-bottom: 3px solid transparent; transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.tab-btn svg { width: 17px; height: 17px; }
.tab-btn:hover { color: var(--c-blue-900); background: var(--c-blue-50); }
.tab-btn.active { color: var(--c-blue-900); border-bottom-color: var(--c-blue); }

/* ---- Panneaux ---- */
.sim-panel { display: none; }
.sim-panel.active { display: block; animation: sim-fade 0.4s var(--ease); }
@keyframes sim-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.sim-wrap { max-width: var(--container); margin: 0 auto; padding: 30px var(--gutter) 72px; }
.sim-layout { display: grid; grid-template-columns: 400px 1fr; gap: 22px; align-items: start; }

/* ---- Cartes ---- */
.sim-card { background: var(--c-white); border: 1px solid var(--c-border); border-radius: var(--r-md); box-shadow: var(--sh-1); overflow: hidden; }
.sim-card-head { display: flex; align-items: center; gap: 13px; padding: 18px 22px; border-bottom: 1px solid var(--c-border-soft); }
.sim-card-icon { flex-shrink: 0; width: 42px; height: 42px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; background: var(--c-blue-50); color: var(--c-blue-700); }
.sim-card-icon svg { width: 22px; height: 22px; }
.sim-card-head h2 { font-family: var(--f-sans); font-size: 0.98rem; color: var(--c-blue-900); }
.sim-card-head p { font-size: var(--fs-xs); color: var(--c-text-soft); margin-top: 2px; }
.sim-card-body { padding: 22px; }

/* ---- Champs ---- */
.field-g { margin-bottom: 15px; }
.field-lbl { display: block; font-size: var(--fs-sm); font-weight: 700; color: var(--c-text); margin-bottom: 6px; }
.field-hint { font-weight: 400; font-size: var(--fs-xs); color: var(--c-text-soft); margin-left: 4px; }
.inp-w { position: relative; }
.inp-w input, .inp-w select {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--c-border); border-radius: var(--r-sm);
  font-size: 0.95rem; color: var(--c-text); background: var(--c-white); outline: none; appearance: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.inp-w input:focus, .inp-w select:focus { border-color: var(--c-blue); box-shadow: 0 0 0 3px rgba(0,150,199,0.14); }
.inp-w select { background-image: linear-gradient(45deg, transparent 50%, var(--c-text-soft) 50%), linear-gradient(135deg, var(--c-text-soft) 50%, transparent 50%); background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 13px) calc(50% - 2px); background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.inp-suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: var(--fs-xs); font-weight: 700; color: var(--c-text-faint); pointer-events: none; }
.inp-w input[type=number] { padding-right: 52px; font-variant-numeric: tabular-nums; }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---- Slider ---- */
.sldr-row { display: flex; align-items: center; gap: 13px; margin-top: 6px; }
.sldr-val { min-width: 60px; text-align: right; font-size: 1.05rem; font-weight: 700; color: var(--c-blue-700); font-variant-numeric: tabular-nums; }
input[type=range] { flex: 1; height: 5px; border-radius: 3px; background: var(--c-surface-2); outline: none; cursor: pointer; -webkit-appearance: none; appearance: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--c-blue); border: 3px solid #fff; box-shadow: var(--sh-2); cursor: pointer; transition: transform var(--t-fast); }
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.12); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--c-blue); border: 3px solid #fff; box-shadow: var(--sh-2); cursor: pointer; }
.sldr-labels { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--c-text-faint); margin-top: 4px; }

/* ---- Séparateur de section de formulaire ---- */
.sep { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--c-blue-700); margin: 18px 0 11px; padding-bottom: 6px; border-bottom: 1px solid var(--c-blue-50); }
.sep:first-child { margin-top: 0; }

/* ---- Encarts info / alerte ---- */
.info-box { background: var(--c-blue-50); border: 1px solid var(--c-blue-100); border-radius: var(--r-sm); padding: 12px 14px; font-size: var(--fs-sm); color: var(--c-text); line-height: 1.55; margin-bottom: 16px; }
.info-box strong { color: var(--c-blue-900); }
.warn-box { display: flex; gap: 10px; align-items: flex-start; background: var(--c-blue-50); border: 1px solid var(--c-blue-100); border-radius: var(--r-sm); padding: 12px 14px; font-size: var(--fs-sm); color: var(--c-text); line-height: 1.55; margin-bottom: 12px; }
.warn-box svg { flex-shrink: 0; width: 18px; height: 18px; color: var(--c-blue-700); margin-top: 1px; }

/* ---- Interrupteur ---- */
.tog-wrap { display: flex; align-items: center; gap: 12px; padding: 13px; background: var(--c-surface); border: 1.5px solid var(--c-border); border-radius: var(--r-sm); cursor: pointer; margin-bottom: 12px; user-select: none; transition: border-color var(--t-fast), background var(--t-fast); }
.tog-wrap:hover { border-color: var(--c-blue-100); }
.sw-track { flex-shrink: 0; width: 44px; height: 25px; border-radius: 13px; background: var(--c-border); position: relative; transition: background var(--t-fast); }
.sw-knob { position: absolute; top: 2px; left: 2px; width: 21px; height: 21px; border-radius: 50%; background: #fff; box-shadow: var(--sh-1); transition: left var(--t-fast); }
.sw-track.on { background: var(--c-blue); }
.sw-track.on .sw-knob { left: 21px; }
.tog-title { font-size: var(--fs-sm); font-weight: 700; color: var(--c-text); }
.tog-sub { font-size: var(--fs-xs); color: var(--c-text-soft); }

/* ---- Bouton calculer ---- */
.btn-calc {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 16px; padding: 14px; border-radius: var(--r-sm);
  background: var(--c-red); color: #fff; font-family: var(--f-sans); font-size: 0.95rem; font-weight: 700;
  transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.btn-calc:hover:not(:disabled) { background: var(--c-red-700); transform: translateY(-1px); box-shadow: 0 8px 20px -6px rgba(239,0,38,0.45); }
.btn-calc:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-calc.bleu { background: var(--c-red); }
.btn-calc.bleu:hover:not(:disabled) { background: var(--c-red-700); box-shadow: 0 8px 20px -6px rgba(239,0,38,0.45); }
.btn-calc svg { width: 17px; height: 17px; }
.spinner { display: none; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Résultats ---- */
.res-ph { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 56px 24px; text-align: center; color: var(--c-text-faint); }
.res-ph svg { width: 54px; height: 54px; opacity: 0.4; }
.res-ph p { max-width: 220px; font-size: var(--fs-sm); line-height: 1.55; }
.res-ok { display: none; }
.res-ok.show { display: block; }
.res-ph.hide { display: none; }

.res-hero { position: relative; overflow: hidden; border-radius: var(--r-sm); padding: 22px; margin-bottom: 14px; background: var(--c-blue-900); }
.res-hero.rouge { background: var(--c-red-700); }
.res-hero.vert { background: var(--c-blue-900); }
.res-hero.teal { background: var(--c-blue-900); }
.res-badge { position: absolute; top: 14px; right: 14px; font-size: var(--fs-xs); font-weight: 700; color: var(--on-dark-soft); background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.2); padding: 3px 11px; border-radius: var(--r-pill); }
.res-lbl { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--on-dark-faint); margin-bottom: 8px; }
.res-val { font-family: var(--f-serif); font-weight: 700; font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.3rem); line-height: 1.05; color: #fff; letter-spacing: -0.01em; margin-bottom: 5px; font-variant-numeric: tabular-nums; }
.res-sub { font-size: var(--fs-sm); color: var(--on-dark-faint); }

/* ---- Métriques ---- */
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.metric { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-sm); padding: 14px; transition: background var(--t-fast), border-color var(--t-fast); }
.metric:hover { background: var(--c-blue-50); border-color: var(--c-blue-100); }
.metric-lbl { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--c-text-soft); margin-bottom: 5px; }
.metric-val { font-family: var(--f-serif); font-weight: 700; font-size: 1.1rem; line-height: 1; color: var(--c-blue-900); font-variant-numeric: tabular-nums; }
.metric-val.vert { color: var(--c-blue-700); }
.metric-val.rouge { color: var(--c-red-700); }
.metric-sub { font-size: var(--fs-xs); color: var(--c-text-faint); margin-top: 4px; }

/* ---- Tableau de projection ---- */
.proj-tog { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; cursor: pointer; border-top: 1px solid var(--c-border); user-select: none; }
.proj-tog-lbl { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 700; color: var(--c-blue-700); }
.proj-arr { width: 7px; height: 7px; border-right: 2px solid var(--c-blue); border-bottom: 2px solid var(--c-blue); transform: rotate(45deg); transition: transform var(--t-fast); margin-left: 4px; }
.proj-tog.open .proj-arr { transform: rotate(-135deg); }
.proj-wrap { max-height: 0; overflow: hidden; transition: max-height 0.4s var(--ease); }
.proj-wrap.open { max-height: 480px; overflow-y: auto; border: 1px solid var(--c-border); border-radius: var(--r-sm); }
.ptable { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.ptable th { position: sticky; top: 0; background: var(--c-blue-900); color: #fff; padding: 9px 10px; text-align: right; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.ptable th:first-child { text-align: left; }
.ptable td { padding: 9px 10px; border-bottom: 1px solid var(--c-border-soft); text-align: right; }
.ptable td:first-child { text-align: left; font-weight: 600; color: var(--c-blue-900); }
.ptable tr:nth-child(even) td { background: var(--c-surface); }
.ptable tr:hover td { background: var(--c-blue-50); }
.ptable tr.term td { background: rgba(0,150,199,0.08); font-weight: 700; }

/* ---- Garanties / rentes duo ---- */
.garanties-duo, .rentes-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 13px; }
.gd-side, .rd-side { border: 1px solid var(--c-border); border-radius: var(--r-sm); overflow: hidden; }
.gd-head { padding: 9px; text-align: center; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #fff; }
.rd-head { padding: 9px 14px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #fff; }
.gd-head.vert, .rd-head.vert { background: var(--c-blue-700); }
.gd-head.rouge, .rd-head.rouge { background: var(--c-red); }
.gd-val { padding: 14px; text-align: center; background: var(--c-surface); font-family: var(--f-serif); font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.gd-val.vert { color: var(--c-blue-700); }
.gd-val.rouge { color: var(--c-red-700); }
.rd-val { padding: 14px; background: var(--c-surface); }
.rd-montant { font-family: var(--f-serif); font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.rd-montant.vert { color: var(--c-blue-700); }
.rd-montant.rouge { color: var(--c-red-700); }
.rd-desc { font-size: var(--fs-xs); color: var(--c-text-faint); margin-top: 3px; }

/* ---- Note ---- */
.note { margin-top: 10px; padding: 11px 14px; background: var(--c-surface); border: 1px solid var(--c-border-soft); border-radius: var(--r-sm); font-size: var(--fs-xs); color: var(--c-text-soft); line-height: 1.5; }

/* ---- CTA contact ---- */
.cta-box { margin-top: 14px; display: flex; gap: 13px; align-items: center; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-sm); padding: 16px; }
.cta-icon { flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; background: var(--c-red); color: #fff; display: flex; align-items: center; justify-content: center; }
.cta-icon svg { width: 19px; height: 19px; }
.cta-text h4 { font-family: var(--f-sans); font-size: var(--fs-sm); color: var(--c-blue-900); }
.cta-text p { font-size: var(--fs-xs); color: var(--c-text-soft); }
.cta-acts { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.cta-btn { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 700; padding: 8px 15px; border-radius: var(--r-sm); transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast); }
.cta-btn.p { background: var(--c-red); color: #fff; }
.cta-btn.p:hover { background: var(--c-red-700); }
.cta-btn.s { background: #fff; color: var(--c-blue-700); border: 1.5px solid var(--c-border); }
.cta-btn.s:hover { background: var(--c-blue-50); border-color: var(--c-blue); }

/* ---- Pied de simulateur ---- */
.sim-footer { max-width: var(--container); margin: 0 auto; padding: 18px var(--gutter); border-top: 1px solid var(--c-border); }
.sim-footer p { font-size: var(--fs-xs); color: var(--c-text-soft); line-height: 1.6; }
.sim-footer a { color: var(--c-blue-700); font-weight: 600; }

/* ---- Responsive ---- */
@media (max-width: 1000px) { .sim-layout { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .metrics { grid-template-columns: 1fr; } .garanties-duo, .rentes-duo { grid-template-columns: 1fr; } }
