/* ============================================================
   EMI CALCULATOR — emi-calculator.css
   Design system matched to Revenue Forecaster reference
   Toolspot by Tradesala
   ============================================================ */

/* ── Page Layout ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 100px;
  position: relative;
  z-index: 1;
  /* Palette Overrides */
  --tool-red: #fb7185;
  --tool-red-soft: rgba(251, 113, 133, 0.12);
}

/* ── Tool Header ── */
.tool-header {
  padding: 56px 0 40px;
  animation: fadeUp 0.6s 0.1s cubic-bezier(0.16, 1, 0.3, 1) both;
  max-width: 760px;
}

/* ── Main Two-Column Grid ── */
.main-grid {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 24px;
  align-items: start;
  animation: fadeUp 0.6s 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.right-col {
  position: sticky;
  top: 80px;
}

/* ── Panel — matches reference ── */
.panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  padding: 28px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

/* Top specular line — reference panel::before */
.panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  pointer-events: none;
}

/* ── Panel Title — reference .panel-title ── */
.panel-title {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.40);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.title-line {
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

/* ── Input Groups (Slider rows) ── */
.input-group {
  margin-bottom: 28px;
}

.input-group:last-child {
  margin-bottom: 0;
}

.input-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
}

.input-header label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-3);
  flex: 1;
}

/* ── Value Badge ── */
.value-badge {
  background: var(--tool-red-soft);
  color: var(--tool-red);
  border: 1px solid rgba(251, 113, 133, 0.25);
  padding: 5px 13px;
  border-radius: 20px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  min-width: 80px;
  text-align: center;
}

/* ── Range Slider ── */
.slider-wrap {
  position: relative;
  padding-bottom: 4px;
}

.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 10px;
  outline: none;
  cursor: pointer;
  background: linear-gradient(to right, var(--tool-red) 0%, var(--tool-red) var(--fill, 40%),
    rgba(255, 255, 255, 0.1) var(--fill, 40%), rgba(255, 255, 255, 0.1) 100%);
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  background: #fff;
  border: 3px solid var(--tool-red);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15), 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.range-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: #fff;
  border: 3px solid var(--tool-red);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-3);
  font-weight: 500;
}

/* ── KPI Grid — 2×2 ── */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 0;
}

/* ── KPI Card — reference .kpi-card ── */
.kpi-card {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.3s, background 0.3s;
}

/* Colored top bar */
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 16px 16px 0 0;
}

.kpi-card.red::before     { background: linear-gradient(90deg, #f41212, #ff6060); }
.kpi-card.rose::before    { background: linear-gradient(90deg, #fb7185, #fecdd3); }
.kpi-card.crimson::before { background: linear-gradient(90deg, #991b1b, #ef4444); }
.kpi-card.green::before   { background: linear-gradient(90deg, #34d399, #6ee7b7); }
.kpi-card.amber::before   { background: linear-gradient(90deg, #f59e0b, #fcd34d); }
.kpi-card.purple::before  { background: linear-gradient(90deg, #a78bfa, #c4b5fd); }

.kpi-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
  line-height: 1.3;
}

.kpi-val {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(20px, 2.5vw, 26px);
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
  color: var(--text);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: auto;
  padding-top: 6px;
  line-height: 1.4;
}

/* ── Chart Wrap — reference .chart-wrap ── */
.chart-wrap {
  position: relative;
  width: 100%;
  height: 280px;
  border-radius: 16px;
  overflow: hidden;
}



/* ── Chart Legend — reference .chart-legend ── */
.chart-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 14px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Amortization Schedule ── */
.schedule-section {
  margin-top: 56px;
  animation: fadeUp 0.6s 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.schedule-sub {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 20px;
  line-height: 1.6;
}

.table-wrapper {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  overflow: hidden;
  overflow-x: auto;
  backdrop-filter: blur(12px);
  position: relative;
}

/* Specular top line on table wrapper too */
.table-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  pointer-events: none;
  z-index: 1;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

.schedule-table thead th {
  background: rgba(255, 255, 255, 0.03);
  padding: 14px 20px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--glass-border);
}

.schedule-table tbody td {
  padding: 12px 20px;
  border-bottom: 1px solid var(--glass-border);
  font-weight: 500;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  transition: background 0.15s;
}

.schedule-table tbody tr:last-child td { border-bottom: none; }

.schedule-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

.year-col    { font-weight: 700; color: var(--text); }
.interest-col{ color: #991b1b; }
.balance-col { color: var(--text-3); }

/* ── FAQ section ── */
#tool-faq { margin-top: 56px; }

/* ─────────────────────────────────────
   LIGHT MODE
───────────────────────────────────── */
body.light .panel {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(0, 0, 0, 0.10);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.04);
}

body.light .panel::before {
  background: linear-gradient(90deg, transparent, rgba(244, 18, 18, 0.15), transparent);
}

body.light .panel-title { color: rgba(0, 0, 0, 0.68); }
body.light .title-line  { background: rgba(0, 0, 0, 0.10); }

body.light .input-header label { color: #333; }

body.light .range-slider {
  background: linear-gradient(to right, var(--tool-red) 0%, var(--tool-red) var(--fill, 40%),
    rgba(0, 0, 0, 0.08) var(--fill, 40%), rgba(0, 0, 0, 0.08) 100%);
}

body.light .range-slider::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15), 0 2px 8px rgba(0, 0, 0, 0.15);
}

body.light .range-labels { color: #666; }

body.light .kpi-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.03);
}

body.light .kpi-label { color: #555; }
body.light .kpi-val   { color: #000; }
body.light .kpi-sub   { color: #666; }
body.light .kpi-card.kpi-hero .kpi-val { color: #c40000; }

body.light .legend-item { color: #333; }

body.light .table-wrapper {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(0, 0, 0, 0.10);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

body.light .schedule-table thead th {
  background: rgba(0, 0, 0, 0.02);
  color: #333;
  border-bottom-color: rgba(0, 0, 0, 0.10);
}

body.light .schedule-table tbody td {
  color: #333;
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

body.light .schedule-table tbody tr:hover td { background: rgba(0, 0, 0, 0.015); }
body.light .year-col     { color: #000; }
body.light .interest-col { color: #b91c1c; }
body.light .balance-col  { color: #666; }

/* ─────────────────────────────────────
   RESPONSIVE
───────────────────────────────────── */
@media (max-width: 1024px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .right-col {
    position: static;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 16px 80px;
  }

  .tool-header {
    padding: 40px 0 28px;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
  .panel {
    padding: 20px;
    border-radius: 20px;
  }

  .chart-wrap {
    height: 220px;
  }
}