/* ============================================================
   FINCALC v1.0 — Shared Calculator Framework
   Loaded ONCE, cached across the entire site.
   Replaces ~7,500 lines of duplicated CSS across 15 calculators.
   ============================================================ */

/* Design tokens — scoped so this never touches the rest of the site */
.fincalc{
  --fc-primary:#10b981;
  --fc-primary-dark:#059669;
  --fc-primary-light:#ecfdf5;
  --fc-accent:#f59e0b;
  --fc-accent-dark:#d97706;
  --fc-text:#111827;
  --fc-muted:#6b7280;
  --fc-bg:#f9fafb;
  --fc-card:#ffffff;
  --fc-border:#e5e7eb;
  --fc-track:#e5e7eb;
  --fc-radius:12px;
  --fc-radius-lg:16px;
  --fc-shadow:0 4px 16px rgba(0,0,0,.05);
  --fc-shadow-hero:0 10px 30px rgba(16,185,129,.22);

  font-family:system-ui,-apple-system,"Segoe UI",Roboto,Inter,sans-serif;
  color:var(--fc-text);
  line-height:1.5;
  max-width:960px;
  margin:0 auto;
  padding:16px;
}

/* Themes — apply via class="fincalc theme-orange" etc. */
.fincalc.theme-orange{--fc-primary:#ea580c;--fc-primary-dark:#c2410c;--fc-primary-light:#fff7ed}
.fincalc.theme-blue  {--fc-primary:#2563eb;--fc-primary-dark:#1d4ed8;--fc-primary-light:#eff6ff}
.fincalc.theme-indigo{--fc-primary:#4f46e5;--fc-primary-dark:#4338ca;--fc-primary-light:#eef2ff}
.fincalc.theme-purple{--fc-primary:#7c3aed;--fc-primary-dark:#6d28d9;--fc-primary-light:#f5f3ff}
.fincalc.theme-teal  {--fc-primary:#0d9488;--fc-primary-dark:#0f766e;--fc-primary-light:#f0fdfa}
.fincalc.theme-rose  {--fc-primary:#e11d48;--fc-primary-dark:#be123c;--fc-primary-light:#fff1f2}
.fincalc.theme-amber {--fc-primary:#d97706;--fc-primary-dark:#b45309;--fc-primary-light:#fffbeb}
.fincalc.theme-cyan  {--fc-primary:#0891b2;--fc-primary-dark:#0e7490;--fc-primary-light:#ecfeff}
.fincalc.theme-violet{--fc-primary:#6d28d9;--fc-primary-dark:#5b21b6;--fc-primary-light:#f5f3ff}

/* Scoped reset — only inside our wrapper */
.fincalc *,.fincalc *::before,.fincalc *::after{box-sizing:border-box}
.fincalc input,.fincalc button,.fincalc select{font-family:inherit}

/* Header */
.fc-head{text-align:center;margin-bottom:18px}
.fc-head h2{font-size:clamp(20px,3.4vw,26px);font-weight:800;margin:0 0 4px;color:var(--fc-text)}
.fc-head p{font-size:14px;color:var(--fc-muted);margin:0}

/* Layout — mobile first */
.fc-grid{display:grid;grid-template-columns:1fr;gap:16px}
@media(min-width:720px){.fc-grid{grid-template-columns:1.1fr .9fr}}

/* Card */
.fc-card{
  background:var(--fc-card);
  border:1px solid var(--fc-border);
  border-radius:var(--fc-radius-lg);
  padding:20px 18px;
  box-shadow:var(--fc-shadow);
}
.fc-card h3{
  font-size:15px;font-weight:700;margin:0 0 14px;
  padding-bottom:10px;border-bottom:2px solid var(--fc-bg);
}

/* Field */
.fc-field{margin-bottom:18px}
.fc-field-row{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;gap:8px;flex-wrap:wrap}
.fc-label{font-size:13px;font-weight:600;color:var(--fc-text);margin:0}

/* Pill input (right side of label) */
.fc-pill{
  display:inline-flex;align-items:center;gap:4px;
  background:var(--fc-primary-light);
  border:2px solid transparent;border-radius:999px;
  padding:4px 10px;transition:border-color .15s, box-shadow .15s;
}
.fc-pill:focus-within{
  border-color:var(--fc-primary);
  box-shadow:0 0 0 3px rgba(16,185,129,.15);
}
.fc-pill .prefix,.fc-pill .suffix{font-size:13px;font-weight:700;color:var(--fc-primary-dark)}
.fc-pill input{
  width:90px;border:0;background:transparent;outline:none;
  font-size:14px;font-weight:700;color:var(--fc-primary-dark);
  text-align:right;padding:2px;
}
.fc-pill input::-webkit-outer-spin-button,
.fc-pill input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}

/* Slider */
.fc-slider{
  -webkit-appearance:none;appearance:none;
  width:100%;height:6px;border-radius:3px;
  background:var(--fc-track);outline:none;cursor:pointer;
  margin:6px 0 2px;
}
.fc-slider::-webkit-slider-thumb{
  -webkit-appearance:none;appearance:none;
  width:20px;height:20px;border-radius:50%;
  background:#000;border:3px solid #fff;
  box-shadow:0 2px 8px rgba(0,0,0,.25);
  cursor:grab;
}
.fc-slider::-webkit-slider-thumb:active{cursor:grabbing;transform:scale(1.1)}
.fc-slider::-moz-range-thumb{
  width:20px;height:20px;border-radius:50%;
  background:#000;border:3px solid #fff;
  box-shadow:0 2px 8px rgba(0,0,0,.25);cursor:grab;
}
.fc-range-labels{display:flex;justify-content:space-between;font-size:11px;color:var(--fc-muted);margin-top:2px}

/* Toggle / segmented buttons */
.fc-toggles{display:flex;gap:6px;background:var(--fc-bg);padding:4px;border-radius:10px;margin-bottom:14px}
.fc-toggle{
  flex:1;padding:8px 10px;border:0;background:transparent;
  font-size:12px;font-weight:600;color:var(--fc-muted);
  border-radius:7px;cursor:pointer;text-align:center;
  transition:background .15s, color .15s, box-shadow .15s;
}
.fc-toggle.is-active{
  background:linear-gradient(135deg,var(--fc-primary),var(--fc-primary-dark));
  color:#fff;box-shadow:0 2px 8px rgba(16,185,129,.3);
}

/* Buttons */
.fc-btn{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  width:100%;padding:12px 16px;
  font-size:13px;font-weight:700;letter-spacing:.3px;
  border:0;border-radius:10px;cursor:pointer;
  transition:transform .15s, box-shadow .15s;
  text-transform:uppercase;
}
.fc-btn:active{transform:translateY(1px)}
.fc-btn-primary{
  background:linear-gradient(135deg,var(--fc-primary),var(--fc-primary-dark));
  color:#fff;box-shadow:0 4px 12px rgba(16,185,129,.3);
}
.fc-btn-primary:hover{box-shadow:0 6px 16px rgba(16,185,129,.4)}
.fc-btn-secondary{
  background:linear-gradient(135deg,#3b82f6,#2563eb);
  color:#fff;box-shadow:0 4px 12px rgba(59,130,246,.3);
}
.fc-btn-outline{background:#fff;color:var(--fc-text);border:1px solid var(--fc-border)}

/* Prominent affiliate / Apply Now CTA button */
.fc-cta{
  margin-top:14px;
  padding:15px 22px;
  font-size:14px;
  text-decoration:none;
  position:relative;
  overflow:hidden;
  box-shadow:0 6px 20px rgba(16,185,129,.35);
  transform:translateZ(0);
}
.fc-cta::before{
  content:"";position:absolute;inset:0;
  background:linear-gradient(120deg,transparent 30%,rgba(255,255,255,.35) 50%,transparent 70%);
  transform:translateX(-100%);
  animation:fc-shine 3s ease-in-out infinite;
  pointer-events:none;
}
.fc-cta:hover{
  box-shadow:0 10px 26px rgba(16,185,129,.5);
  transform:translateY(-2px);
}
@keyframes fc-shine{
  0%,30%{transform:translateX(-100%)}
  60%,100%{transform:translateX(100%)}
}

/* Hero result box */
.fc-hero{
  position:relative;overflow:hidden;
  background:linear-gradient(145deg,var(--fc-primary-dark),var(--fc-primary));
  color:#fff;border-radius:var(--fc-radius-lg);
  padding:24px 18px;text-align:center;
  box-shadow:var(--fc-shadow-hero);
}
.fc-hero::before{
  content:"";position:absolute;top:-50px;right:-50px;
  width:160px;height:160px;border-radius:50%;
  background:rgba(255,255,255,.07);pointer-events:none;
}
.fc-hero .lbl{font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;opacity:.9;margin:0 0 4px}
.fc-hero .val{font-size:clamp(26px,5vw,36px);font-weight:800;line-height:1.15;margin:0}
.fc-hero .sub{font-size:12px;opacity:.85;margin:4px 0 0}

/* Hero mini grid */
.fc-mini-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:18px;position:relative;z-index:1}
.fc-mini{background:rgba(255,255,255,.13);border-radius:10px;padding:10px;backdrop-filter:blur(8px)}
.fc-mini .lbl{font-size:10px;opacity:.85;margin:0;text-transform:uppercase;letter-spacing:.3px}
.fc-mini .val{font-size:15px;font-weight:700;margin:2px 0 0}

/* Standalone results grid (white cards) */
.fc-results{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:14px}
.fc-result-card{
  background:var(--fc-card);
  border:1px solid var(--fc-border);
  border-radius:10px;padding:12px;text-align:center;
}
.fc-result-card .lbl{font-size:10px;font-weight:600;letter-spacing:.4px;text-transform:uppercase;color:var(--fc-muted);margin:0 0 4px}
.fc-result-card .val{font-size:15px;font-weight:700;color:var(--fc-text);margin:0}

/* Breakdown bar */
.fc-bar{display:flex;height:10px;border-radius:5px;overflow:hidden;background:var(--fc-bg);margin:6px 0}
.fc-bar > .p{background:linear-gradient(90deg,var(--fc-primary),var(--fc-primary-dark));transition:width .4s}
.fc-bar > .i{background:linear-gradient(90deg,var(--fc-accent),var(--fc-accent-dark));transition:width .4s}
.fc-bar-legend{display:flex;justify-content:space-between;font-size:11px;color:var(--fc-muted);margin-top:4px}
.fc-bar-legend span::before{content:"";display:inline-block;width:8px;height:8px;border-radius:2px;margin-right:5px;vertical-align:middle}
.fc-bar-legend .p::before{background:var(--fc-primary)}
.fc-bar-legend .i::before{background:var(--fc-accent)}

/* Tip box */
.fc-tip{
  background:var(--fc-primary-light);
  border-left:3px solid var(--fc-primary);
  border-radius:8px;padding:10px 12px;margin-top:12px;
  font-size:12px;line-height:1.5;
}
.fc-tip strong{color:var(--fc-primary-dark)}

/* Table (schedule / comparison) */
.fc-table-wrap{max-height:260px;overflow:auto;border:1px solid var(--fc-border);border-radius:8px;margin-top:8px}
.fc-table{width:100%;border-collapse:collapse;font-size:11px;background:#fff}
.fc-table th{position:sticky;top:0;background:var(--fc-bg);padding:8px 6px;text-align:right;font-weight:700;font-size:10px;text-transform:uppercase;border-bottom:2px solid var(--fc-border)}
.fc-table th:first-child,.fc-table td:first-child{text-align:left}
.fc-table td{padding:8px 6px;border-bottom:1px solid var(--fc-bg)}
.fc-table tbody tr:nth-child(even){background:var(--fc-bg)}

/* Bottom sheet modal */
.fc-sheet-bg{
  position:fixed;inset:0;background:rgba(15,23,42,.45);
  display:none;align-items:flex-end;justify-content:center;z-index:9999;
}
.fc-sheet-bg.is-open{display:flex}
.fc-sheet{
  width:100%;max-width:720px;max-height:88vh;background:#fff;
  border-radius:18px 18px 0 0;padding:16px;
  box-shadow:0 -12px 30px rgba(15,23,42,.3);
  display:flex;flex-direction:column;
}
@media(min-width:720px){.fc-sheet-bg{align-items:center}.fc-sheet{border-radius:18px;margin-bottom:40px}}
.fc-sheet-head{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:10px}
.fc-sheet-title{font-size:15px;font-weight:700;margin:0}
.fc-sheet-close{border:0;background:transparent;font-size:22px;line-height:1;cursor:pointer;color:var(--fc-muted)}
.fc-sheet-body{flex:1;overflow:auto}
.fc-sheet-foot{display:flex;gap:8px;margin-top:10px}

/* Canvas (Chart.js) */
.fc-canvas-wrap{max-width:200px;margin:12px auto;aspect-ratio:1}
.fc-canvas-wrap canvas{width:100%!important;height:auto!important}

/* Footer note */
.fc-foot{text-align:center;font-size:11px;color:var(--fc-muted);margin-top:18px;padding-top:12px;border-top:1px solid var(--fc-border)}

/* ============================================================
   FinCalc — Lead capture (Download PDF) button + modal
   ============================================================ */
.fc-lead-btn{
  display:block;width:100%;margin-top:14px;padding:14px 18px;
  background:var(--fc-accent,#f59e0b);color:#1f1300;border:none;
  border-radius:12px;font-size:15px;font-weight:800;cursor:pointer;
  box-shadow:0 6px 18px rgba(245,158,11,.28);transition:transform .12s ease,filter .12s ease;
}
.fc-lead-btn:hover{filter:brightness(.97);transform:translateY(-1px)}
.fc-lead-btn::before{content:"\2B07\FE0F  "}

.fc-lead-overlay{
  position:fixed;inset:0;z-index:99999;display:none;
  background:rgba(15,23,42,.55);backdrop-filter:blur(2px);
  align-items:center;justify-content:center;padding:18px;
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
}
.fc-lead-overlay.is-open{display:flex;animation:fcFade .15s ease}
@keyframes fcFade{from{opacity:0}to{opacity:1}}
.fc-lead-modal{
  position:relative;width:100%;max-width:380px;background:#fff;border-radius:18px;
  padding:24px 22px 20px;box-shadow:0 24px 60px rgba(0,0,0,.3);animation:fcPop .18s ease;
}
@keyframes fcPop{from{transform:translateY(10px) scale(.98);opacity:0}to{transform:none;opacity:1}}
.fc-lead-x{position:absolute;top:12px;right:14px;border:none;background:none;font-size:24px;line-height:1;color:#9ca3af;cursor:pointer}
.fc-lead-x:hover{color:#374151}
.fc-lead-title{margin:0 0 4px;font-size:19px;font-weight:800;color:#111827}
.fc-lead-sub{margin:0 0 16px;font-size:13px;color:#6b7280;line-height:1.45}
.fc-lead-field{margin-bottom:12px}
.fc-lead-field label{display:block;font-size:12px;font-weight:700;color:#374151;margin-bottom:5px}
.fc-lead-field input{
  width:100%;padding:11px 13px;border:1px solid #d1d5db;border-radius:10px;font-size:15px;color:#111827;
}
.fc-lead-field input:focus{outline:none;border-color:#10b981;box-shadow:0 0 0 3px rgba(16,185,129,.15)}
.fc-lead-err{min-height:16px;margin:2px 0 8px;font-size:12px;font-weight:600;color:#dc2626}
.fc-lead-submit{
  width:100%;padding:13px;background:#10b981;color:#fff;border:none;border-radius:10px;
  font-size:15px;font-weight:800;cursor:pointer;transition:filter .12s ease;
}
.fc-lead-submit:hover{filter:brightness(.96)}
.fc-lead-submit:disabled{opacity:.7;cursor:default}
.fc-lead-consent{margin:12px 0 0;font-size:11px;color:#9ca3af;line-height:1.4;text-align:center}
