/* ──────────────────────────────────────────────────────────────────────────
 * calculators.css — Additive sheet for calculator pages only.
 * Reuses every variable and class from style.css. Only adds patterns
 * specific to calculators (tabs, BMI scale, charts).
 * ──────────────────────────────────────────────────────────────────────── */

/* Two-column input grid, collapses on mobile */
.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 540px) {
  .input-grid {
    grid-template-columns: 1fr;
  }
}

/* Tiny unit toggle (cm/feet, kg/lbs, year/month) */
.unit-toggle {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px;
  margin-left: 8px;
  vertical-align: middle;
}
.unit-toggle button {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.unit-toggle button.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Tab bar — used by percentage calculator */
.tab-bar {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.tab-btn {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-radius: calc(var(--radius) - 4px);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

/* BMI scale visualization */
.bmi-scale {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    #3b82f6 0%, #3b82f6 22%,
    #10b981 22%, #10b981 47%,
    #f59e0b 47%, #f59e0b 70%,
    #ef4444 70%, #ef4444 100%
  );
  margin: 14px 0 8px;
}
.bmi-marker {
  position: absolute;
  top: -4px;
  width: 4px;
  height: 22px;
  background: var(--text);
  border-radius: 2px;
  transform: translateX(-2px);
  transition: left 0.3s ease;
}
.bmi-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Donut chart for loan breakdown */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.donut {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}
.donut-track {
  fill: none;
  stroke: var(--surface-2);
  stroke-width: 14;
}
.donut-fill {
  fill: none;
  stroke-width: 14;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dasharray 0.6s ease;
}
.donut-legend {
  display: grid;
  gap: 10px;
  flex: 1;
  min-width: 180px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
}
.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}
.legend-label {
  color: var(--text-muted);
}
.legend-value {
  margin-left: auto;
  font-weight: 700;
  color: var(--text);
}

/* Bar chart for investment year-by-year */
.bar-chart {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 16px;
}
.bar-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 0.84rem;
}
.bar-row .yr {
  color: var(--text-muted);
  font-weight: 600;
}
.bar-track {
  height: 22px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.bar-invested {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--primary-tint);
}
.bar-balance {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, #2563eb, #06b6d4);
  border-radius: 4px;
  transition: width 0.5s ease;
}
.bar-row .val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Simple result hero (large number + label) for BMI / percentage */
.big-result {
  text-align: center;
  padding: 24px 16px;
}
.big-result .num {
  font-size: clamp(2.4rem, 6vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.big-result .num.colored {
  color: var(--accent-color, var(--primary));
}
.big-result .tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  margin-top: 12px;
  background: var(--accent-bg, var(--primary-tint));
  color: var(--accent-color, var(--primary));
}
.big-result .sub {
  color: var(--text-muted);
  font-size: 0.94rem;
  margin-top: 12px;
  max-width: 480px;
  margin-inline: auto;
}
