/* =====================================================
   Tu Futuro Finanzas — Shared calculator styles
   Used by all 45+ calculator pages.
   ===================================================== */

/* Sub-hero */
.calc-sub-hero {
  background: linear-gradient(180deg, var(--bg) 0%, #FFFBF0 100%);
  padding: 40px 0 24px;
  position: relative; overflow: hidden;
}
.calc-sub-hero::after {
  content: ""; position: absolute; top: -90px; right: -90px;
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(245,197,24,.25), transparent 65%);
  border-radius: 50%;
}
.calc-sub-hero .inner { position: relative; z-index: 1; max-width: 800px; }

/* Shell grid: inputs (left) + result (right, sticky) */
.calc-shell {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 30px;
  margin-top: 24px;
}
@media (max-width: 980px) { .calc-shell { grid-template-columns: 1fr; } }

.calc-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.calc-result-panel {
  position: sticky; top: 90px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}
@media (max-width: 980px) { .calc-result-panel { position: static; max-height: none; } }

/* Input groups */
.calc-group { margin-bottom: 30px; }
.calc-group:last-child { margin-bottom: 0; }
.calc-group h3 {
  font-family: var(--sans); font-weight: 800; font-size: .85rem;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--red); margin-bottom: 6px;
  padding-bottom: 8px; border-bottom: 2px solid var(--red-soft);
  display: flex; align-items: center; gap: 10px;
}
.calc-group h3 .ic {
  width: 28px; height: 28px; background: var(--red); color: #fff;
  border-radius: 7px; display: grid; place-items: center;
  font-size: .85rem; font-weight: 800;
}
.calc-group.alt h3 { color: #1F3A68; border-bottom-color: #C8D4E5; }
.calc-group.alt h3 .ic { background: #1F3A68; }
.calc-group .desc { color: var(--muted); font-size: .85rem; margin: 6px 0 16px; }

/* Input rows */
.calc-input {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line);
}
.calc-input:last-child { border-bottom: 0; }
.calc-input label {
  display: flex; align-items: center; gap: 8px;
  font-size: .92rem; font-weight: 500; color: var(--ink); flex: 1;
}
.calc-input label .help {
  color: var(--muted); cursor: help; font-size: .85rem;
  width: 18px; height: 18px; border: 1px solid var(--line); border-radius: 50%;
  display: inline-grid; place-items: center; font-weight: 700;
}
.calc-input label .help:hover { background: var(--yellow-wash); border-color: var(--yellow); }

.input-money, .input-pct, .input-num {
  display: inline-flex; align-items: center;
  border: 1.5px solid var(--line); border-radius: 8px;
  padding: 0 2px 0 10px;
  background: #fff;
  transition: border-color .18s, box-shadow .18s;
  width: 160px;
}
.input-money:focus-within, .input-pct:focus-within, .input-num:focus-within {
  border-color: var(--red); box-shadow: 0 0 0 3px rgba(213,43,30,.12);
}
.input-money .pre, .input-pct .post {
  color: var(--muted); font-weight: 600; padding: 0 4px;
}
.input-money input, .input-pct input, .input-num input {
  border: 0; outline: 0; padding: 9px 6px;
  font-family: var(--sans); font-size: .95rem; font-weight: 600;
  color: var(--ink); width: 100%; background: transparent;
  text-align: right;
}
.input-money input::-webkit-outer-spin-button,
.input-money input::-webkit-inner-spin-button,
.input-pct input::-webkit-outer-spin-button,
.input-pct input::-webkit-inner-spin-button,
.input-num input::-webkit-outer-spin-button,
.input-num input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.input-select {
  padding: 9px 12px; border: 1.5px solid var(--line);
  border-radius: 8px; font-family: var(--sans); font-size: .92rem;
  color: var(--ink); background: #fff; width: 160px; font-weight: 600;
}
.input-select:focus { outline: 0; border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(213,43,30,.12); }

/* Pill toggle for binary choices */
.pill-toggle {
  display: inline-flex; background: var(--bg);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 3px; gap: 2px;
}
.pill-toggle button {
  background: transparent; border: 0; padding: 6px 14px;
  font-family: var(--sans); font-size: .82rem; font-weight: 700;
  color: var(--navy); cursor: pointer; border-radius: 999px;
  transition: background .18s, color .18s;
}
.pill-toggle button.active { background: var(--red); color: #fff; }

/* Slider */
.input-slider {
  width: 100%; -webkit-appearance: none; height: 6px;
  background: linear-gradient(to right, var(--red) 0%, var(--red) var(--val, 0%), var(--line) var(--val, 0%));
  border-radius: 999px; outline: 0;
}
.input-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px;
  background: var(--red); border-radius: 50%; cursor: pointer;
  box-shadow: 0 2px 6px rgba(213,43,30,.4);
}
.input-slider::-moz-range-thumb {
  width: 18px; height: 18px; background: var(--red);
  border: 0; border-radius: 50%; cursor: pointer;
}

/* Meta row (age + state etc.) */
.meta-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin-bottom: 24px; padding-bottom: 22px; border-bottom: 1px solid var(--line);
}
@media (max-width: 480px) { .meta-row { grid-template-columns: 1fr; } }
.meta-row label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: .8rem; font-weight: 700; color: var(--muted);
  letter-spacing: 1px; text-transform: uppercase;
}
.meta-row select, .meta-row input {
  padding: 10px 12px; border: 1.5px solid var(--line);
  border-radius: 8px; font-family: var(--sans); font-size: .95rem;
  color: var(--ink); background: #fff;
}
.meta-row select:focus, .meta-row input:focus {
  outline: 0; border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(213,43,30,.12);
}

/* Subtotal rows */
.calc-subtotal {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; margin-top: 12px;
  background: var(--red-wash); border-radius: 8px;
  font-weight: 700;
}
.calc-subtotal.alt { background: #EBF0F9; }
.calc-subtotal .lbl { color: var(--navy); font-size: .85rem; letter-spacing: .5px; }
.calc-subtotal .val { font-family: var(--serif); font-size: 1.25rem; color: var(--red); font-weight: 800; }
.calc-subtotal.alt .val { color: #1F3A68; }

/* Result panel */
.result-hero { text-align: center; margin-bottom: 20px; }
.result-hero .lbl {
  font-size: .72rem; letter-spacing: 2px; text-transform: uppercase;
  font-weight: 700; color: var(--muted); margin-bottom: 6px;
}
.result-hero .num {
  font-family: var(--serif); font-weight: 800;
  font-size: clamp(2.2rem, 5.5vw, 2.8rem);
  line-height: 1; letter-spacing: -.02em;
  color: var(--red); margin-bottom: 8px;
  word-break: break-all;
}
.result-hero .num.negative { color: #1F3A68; }
.result-hero .sub { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.result-hero .verdict {
  display: inline-block; padding: 4px 12px;
  border-radius: 999px; font-size: .78rem; font-weight: 700;
}
.result-hero .verdict.good { background: #D8F5DF; color: #1D7339; }
.result-hero .verdict.warn { background: #FFF1C7; color: #8A6A00; }
.result-hero .verdict.bad  { background: #FFE0DD; color: var(--red-dark); }

/* Donut visualization */
.donut-wrap { display: grid; place-items: center; margin: 16px 0; }
.donut {
  width: 180px; height: 180px; border-radius: 50%;
  background: conic-gradient(var(--red) 0deg 0deg, #E7E6E1 0deg 360deg);
  display: grid; place-items: center; position: relative;
}
.donut::after {
  content: ""; position: absolute;
  width: 122px; height: 122px; border-radius: 50%;
  background: #fff;
}
.donut-label {
  position: relative; z-index: 1; text-align: center; line-height: 1.2;
}
.donut-label .pct {
  font-family: var(--serif); font-size: 1.6rem; font-weight: 800; color: var(--navy);
}
.donut-label .nm {
  font-size: .7rem; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; font-weight: 700;
}

/* Result breakdown stack */
.brk { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; }
.brk-row {
  display: flex; align-items: center; gap: 10px;
  font-size: .88rem;
}
.brk-row .dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.brk-row .nm { flex: 1; color: var(--ink); }
.brk-row .val { font-weight: 700; color: var(--navy); font-family: var(--serif); }

/* Benchmark bar */
.bench {
  margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line);
}
.bench .lbl {
  font-size: .72rem; letter-spacing: 2px; text-transform: uppercase;
  font-weight: 700; color: var(--muted); margin-bottom: 12px;
}
.bench .median-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; font-size: .85rem;
}
.bench .median-row .my { font-weight: 700; color: var(--red); }
.bench .median-row .median { color: var(--navy); font-weight: 600; }
.bench .bar-wrap {
  background: var(--bg); height: 12px; border-radius: 999px;
  overflow: hidden; position: relative;
}
.bench .bar-mine {
  height: 100%; background: linear-gradient(90deg, var(--red), var(--red-dark));
  border-radius: 999px; transition: width .4s ease;
}
.bench .bar-median-marker {
  position: absolute; top: -3px; bottom: -3px;
  width: 3px; background: var(--navy);
  border-radius: 2px;
}
.bench .legend {
  display: flex; justify-content: space-between;
  font-size: .72rem; color: var(--muted); margin-top: 6px;
}
.bench .pctile {
  margin-top: 12px; padding: 10px 14px;
  background: var(--yellow-wash); border-radius: 8px;
  text-align: center; font-size: .9rem; font-weight: 700; color: var(--navy);
}

/* Chart canvas wrapper */
.chart-wrap {
  margin: 20px 0; padding: 16px;
  background: var(--bg); border-radius: 12px;
}
.chart-wrap svg { width: 100%; height: auto; display: block; }

/* Time series chart (SVG-based) */
.ts-chart .grid-line { stroke: var(--line); stroke-width: 1; }
.ts-chart .axis-text { font-size: 10px; fill: var(--muted); font-family: var(--sans); }
.ts-chart .area-fill { fill: rgba(213,43,30,.12); }
.ts-chart .area-line { stroke: var(--red); stroke-width: 2; fill: none; }
.ts-chart .area-fill-2 { fill: rgba(31,58,104,.12); }
.ts-chart .area-line-2 { stroke: var(--navy); stroke-width: 2; fill: none; }

/* Result action buttons */
.result-actions { display: flex; gap: 8px; margin-top: 18px; }
.result-actions button {
  flex: 1; padding: 10px 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  font-family: var(--sans); font-size: .82rem; font-weight: 700;
  color: var(--navy); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: all .18s;
}
.result-actions button:hover {
  background: var(--red-wash); color: var(--red-dark); border-color: var(--red-soft);
}

/* Trust block (About + Assumptions + Sources) */
.trust-block {
  margin-top: 30px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden;
}
.trust-block > details { border-bottom: 1px solid var(--line); }
.trust-block > details:last-child { border-bottom: 0; }
.trust-block > details summary {
  padding: 18px 24px; cursor: pointer; font-weight: 700;
  color: var(--navy); font-size: .95rem; list-style: none;
  display: flex; align-items: center; gap: 12px;
}
.trust-block > details summary::-webkit-details-marker { display: none; }
.trust-block > details summary::before {
  content: "+"; color: var(--red); font-size: 1.3rem; font-weight: 800;
  width: 22px; display: inline-block;
}
.trust-block > details[open] summary::before { content: "−"; }
.trust-block > details summary .badge {
  margin-left: auto; font-size: .68rem; letter-spacing: 1px;
  text-transform: uppercase; font-weight: 800;
  padding: 3px 8px; border-radius: 999px;
  background: #D8F5DF; color: #1D7339;
}
.trust-block > details .body {
  padding: 0 24px 22px 56px;
  color: var(--text); font-size: .92rem; line-height: 1.65;
}
.trust-block > details .body ul { padding-left: 20px; margin: 8px 0; }
.trust-block > details .body ul li { margin-bottom: 6px; }
.trust-block > details .body a { color: var(--red); border-bottom: 1px dashed var(--red-soft); }

/* Coach + WF bridges */
/* =========================================================================
   Calculator bridges (Coach Futuro + Wells Fargo)
   Balanced, centered cards with the coach caption pill inline (not overlapping
   the headline) and CTAs pinned to the bottom for consistent height.
   ========================================================================= */
.calc-bridges {
  margin-top: 36px; display: grid; gap: 22px; grid-template-columns: 1fr 1fr;
  align-items: stretch;
}
@media (max-width: 880px) { .calc-bridges { grid-template-columns: 1fr; } }

.coach-side, .wf-side {
  border-radius: 18px; padding: 34px 32px 32px;
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  text-align: center;
}
@media (max-width: 880px) {
  .coach-side, .wf-side { padding: 28px 22px; }
}

.coach-side {
  background: linear-gradient(135deg, #FFFBF0 0%, #FFE8C7 100%);
  border: 1px solid #F5E0A0;
}
.coach-side::after {
  content: ""; position: absolute; top: -60px; right: -60px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(213,43,30,.16), transparent 65%);
  border-radius: 50%;
}
.coach-side img {
  width: 108px; aspect-ratio: 2 / 3; display: block; margin: 0 auto 8px;
  border-radius: 18px;
  object-fit: cover; object-position: center center;
  border: 4px solid #fff;
  box-shadow:
    0 0 0 3px rgba(245,197,24,.85),
    0 14px 28px rgba(11,23,48,.18);
  position: relative; z-index: 1;
}
/* Coach caption pill — inline flow so it can never overlap the headline */
.coach-side::before {
  content: attr(data-coach-caption);
  display: inline-block;
  align-self: center;
  margin: 0 auto 22px;
  background: #fff; color: var(--navy);
  font-family: var(--sans); font-weight: 800; font-size: .62rem;
  letter-spacing: 1.3px; text-transform: uppercase;
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line);
  box-shadow: 0 4px 10px rgba(11,23,48,.08);
  z-index: 2; white-space: normal; text-align: center;
  max-width: 90%;
  position: relative;
}
.coach-side h3, .wf-side h3 {
  font-family: var(--serif); font-weight: 800; font-size: 1.4rem;
  color: var(--navy); margin: 0 0 14px; line-height: 1.22;
  position: relative; z-index: 1;
}
.coach-side h3 .r, .wf-side h3 .y { color: var(--red); font-style: italic; }
.coach-side p, .wf-side p {
  color: var(--text); font-size: .95rem; line-height: 1.6;
  margin: 0 0 22px; position: relative; z-index: 1;
}
.coach-side .btn-primary, .wf-side .btn-yellow {
  position: relative; z-index: 1;
  align-self: center;
  margin-top: auto;
  padding: 12px 22px; font-size: .92rem;
  border-radius: 999px;
}

.wf-side {
  background: var(--navy); color: #fff;
  border: 1px solid var(--navy);
}
.wf-side::after {
  content: ""; position: absolute; bottom: -60px; left: -60px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(213,43,30,.35), transparent 65%);
  border-radius: 50%;
}
.wf-side h3 { color: #fff; }
.wf-side h3 .y { color: var(--yellow); }
.wf-side p { color: rgba(255,255,255,.85); }
.wf-side .eyebrow {
  align-self: center;
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18);
  padding: 6px 14px; border-radius: 999px;
  color: #fff;
  font-size: .66rem; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase;
  margin: 0 0 18px; position: relative; z-index: 1;
}
.wf-side .eyebrow img { height: 14px; width: auto; }
.wf-side .btn-yellow {
  background: var(--yellow); color: var(--navy); font-weight: 800;
  font-size: .92rem;
  display: inline-flex; align-items: center; gap: 6px;
}
.wf-side .btn-yellow:hover { background: #FFD63A; color: var(--navy); }

/* SEO long-form content */
.seo-content { max-width: 820px; margin: 50px auto 0; padding: 0 8px; }
.seo-content h2 {
  font-family: var(--serif); font-weight: 800; font-size: clamp(1.4rem, 2.2vw, 1.85rem);
  color: var(--navy); margin: 50px 0 14px; line-height: 1.2;
}
.seo-content h3 {
  font-family: var(--sans); font-weight: 700; font-size: 1.1rem;
  color: var(--navy); margin: 26px 0 8px;
}
.seo-content p { color: var(--text); margin-bottom: 14px; line-height: 1.7; font-size: 1rem; }
.seo-content ul { padding-left: 22px; margin-bottom: 16px; color: var(--text); }
.seo-content ul li { margin-bottom: 6px; line-height: 1.6; }
.seo-content table {
  width: 100%; border-collapse: collapse; margin: 16px 0;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.seo-content table th, .seo-content table td {
  padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line);
  font-size: .92rem;
}
.seo-content table th { background: var(--bg); font-weight: 700; color: var(--navy); font-size: .82rem; letter-spacing: .5px; text-transform: uppercase; }
.seo-content table td:last-child { text-align: right; font-weight: 700; color: var(--red); font-family: var(--serif); }
.seo-content .faq-item {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  margin-bottom: 10px; overflow: hidden;
}
.seo-content .faq-item summary {
  padding: 16px 20px; cursor: pointer; font-weight: 700;
  color: var(--navy); list-style: none;
  display: flex; align-items: center; justify-content: space-between;
}
.seo-content .faq-item summary::-webkit-details-marker { display: none; }
.seo-content .faq-item summary::after { content: "+"; color: var(--red); font-size: 1.3rem; font-weight: 800; }
.seo-content .faq-item[open] summary::after { content: "−"; }
.seo-content .faq-item .answer { padding: 0 20px 18px; color: var(--text); line-height: 1.65; }

/* Related calculators row */
.related-calcs { margin-top: 60px; }
.related-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-top: 20px;
}
@media (max-width: 880px) { .related-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .related-grid { grid-template-columns: 1fr; } }
.rel-card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; transition: all .2s; color: var(--ink);
  display: flex; flex-direction: column; gap: 8px;
}
.rel-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--red-soft); color: var(--ink); }
.rel-card .ic { font-size: 1.4rem; line-height: 1; }
.rel-card h4 { font-family: var(--sans); font-weight: 700; font-size: .95rem; color: var(--navy); }
.rel-card p { font-size: .8rem; color: var(--muted); margin: 0; }

/* Tooltip (bilingual) */
[data-tip], [data-tip-es], [data-tip-en] { position: relative; }
[data-tip]:hover::before,
html[lang="es"] [data-tip-es]:hover::before,
html[lang="en"] [data-tip-en]:hover::before {
  position: absolute; left: 0; bottom: calc(100% + 6px);
  background: var(--navy); color: #fff;
  padding: 8px 12px; border-radius: 6px; font-size: .78rem; font-weight: 500;
  max-width: 280px; width: max-content; line-height: 1.4;
  z-index: 100; box-shadow: var(--shadow-sm);
  letter-spacing: 0; text-transform: none;
  pointer-events: none;
}
[data-tip]:hover::before { content: attr(data-tip); }
html[lang="es"] [data-tip-es]:hover::before { content: attr(data-tip-es); }
html[lang="en"] [data-tip-en]:hover::before { content: attr(data-tip-en); }

/* Print: hide chrome, show clean result */
@media print {
  .site-header, footer.site, .calc-bridges, .seo-content, .related-calcs, .result-actions {
    display: none !important;
  }
  .calc-shell { grid-template-columns: 1fr; }
  .calc-result-panel { position: static; }
}
