/* ── Compound Interest Calculator ──────────────────────────────────────────
   All colour values reference global CSS variables from styles.css.
   Changing --amber in :root will update everything here automatically.
─────────────────────────────────────────────────────────────────────────── */

/* Amber value display used in field headers (rate %, years count) */
.compound-val-display {
  color: var(--text);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
  font-style: normal;
  margin-left: 2px;
}

/* Return rate + horizon row uses fixed header/control heights so slider tracks align. */
.compound-rate-horizon-row .field {
  margin-bottom: 0;
}

.compound-rate-horizon-row .field-header {
  min-height: 32px;
  margin-bottom: 7px;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: nowrap;
}

.compound-rate-field .field-header {
  gap: 8px;
}

.compound-rate-select {
  color: var(--text);
  border-color: var(--border-hi);
  padding: 6px 26px 6px 10px;
  min-height: 32px;
  line-height: 1.2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23e6edf7'/%3E%3C/svg%3E");
}

.compound-rate-select:hover {
  border-color: var(--text);
}

.compound-value-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-hi);
  border-radius: 6px;
  background: var(--surface);
  line-height: 1.2;
  white-space: nowrap;
}

/* ── Inflation controls in the projection box header ────────────────────── */
/* Button + fading % input on the same row — height never changes */
.compound-infl-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.compound-infl-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: 'Outfit', sans-serif;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}
.compound-infl-toggle:hover { border-color: var(--border-hi); color: var(--text); }
.compound-infl-toggle.active {
  border-color: var(--amber);
  background: rgba(245, 166, 35, 0.08);
  color: var(--amber);
}
.compound-infl-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  transition: background 0.15s;
}
.compound-infl-toggle.active .compound-infl-dot { background: var(--amber); }

/* Sliding-in % input — zero-width when inactive, visible when parent is .active */
.compound-infl-input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  width: 0;
  opacity: 0;
  pointer-events: none;
  transition: width 0.2s ease, opacity 0.2s ease, border-color 0.15s;
  /* fixed line-height so this never changes the row height */
  height: 26px;
}
.compound-infl-controls.active .compound-infl-input-wrap {
  width: 72px;
  opacity: 1;
  pointer-events: auto;
  border-color: var(--amber);
}
.compound-infl-prefix {
  padding: 0 6px;
  color: var(--amber);
  font-size: 11px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  border-right: 1px solid var(--border);
  line-height: 26px;
  flex-shrink: 0;
}
.compound-infl-input-wrap input {
  width: 38px;
  background: none;
  border: none;
  outline: none;
  padding: 0 6px;
  color: var(--text);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  line-height: 26px;
  -moz-appearance: textfield;
}
.compound-infl-input-wrap input::-webkit-outer-spin-button,
.compound-infl-input-wrap input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ── "real" inline badge on the Final Value card label ─────────────────── */
.compound-real-badge {
  display: inline-block;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
  background: rgba(245, 166, 35, 0.12);
  border: 1px solid rgba(245, 166, 35, 0.25);
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: middle;
  margin-left: 2px;
}

/* ── Milestones — fixed-height horizontal row ───────────────────────────── */
/* Height is always reserved; content never causes layout jumps. */
.compound-milestones {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  height: 42px;       /* fixed — never changes regardless of milestone count */
  overflow: hidden;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  box-sizing: content-box; /* padding-top + height stays constant */
}
.compound-milestone {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  color: var(--muted);
  padding: 0 10px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Highlighted number/value inside each milestone */
.compound-milestone-val {
  color: var(--amber);
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  white-space: nowrap;
}
/* Thin vertical separator between milestones */
.compound-milestone-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex-shrink: 0;
  align-self: center;
}
/* Warning milestone in spending mode */
.compound-milestone-warn { color: var(--red); }

/* ── Viz box — fills remaining viewport height ──────────────────────────── */
.compound-viz-box {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  padding-bottom: 16px; /* breathing room at bottom of chart/table */
}

/* ── Chart canvas area — grows to fill viz box ──────────────────────────── */
.compound-chart-area {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 8px 0 0;
}

/* ── Table area — flex fill with scroll shadow ──────────────────────────── */
.compound-table-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 0 0;
}
.compound-table-wrap {
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  overflow-y: auto;
  background:
    linear-gradient(var(--card) 20%, transparent)    center top    / 100% 36px no-repeat local,
    linear-gradient(transparent, var(--card) 80%)    center bottom / 100% 36px no-repeat local,
    radial-gradient(farthest-side at 50% 100%, var(--shadow-glow), transparent)
      center bottom / 100% 14px no-repeat scroll;
}
.compound-table-wrap::-webkit-scrollbar { width: 4px; height: 4px; }
.compound-table-wrap::-webkit-scrollbar-track { background: transparent; }
.compound-table-wrap::-webkit-scrollbar-thumb {
  background: var(--border-hi); border-radius: 4px;
}
.compound-table-wrap::-webkit-scrollbar-thumb:hover { background: var(--muted); }


/* ── Inflation toggle chip in the projection box header ─────────────────── */
.compound-infl-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: 'Outfit', sans-serif;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.compound-infl-toggle:hover { border-color: var(--border-hi); color: var(--text); }
.compound-infl-toggle.active {
  border-color: var(--amber);
  background: rgba(245, 166, 35, 0.08);
  color: var(--amber);
}
.compound-infl-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  transition: background 0.15s;
}
.compound-infl-toggle.active .compound-infl-dot { background: var(--amber); }

/* ── Collapsible inflation rate panel ───────────────────────────────────── */
/* Uses max-height transition so the panel reserves no space when collapsed,
   and the stat cards below never shift. */
.compound-infl-panel {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.22s ease, padding 0.22s ease;
  padding: 0;
}
.compound-infl-panel.open {
  max-height: 72px; /* enough for the input row */
  padding: 10px 0 14px;
}
.compound-infl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
/* Compact % input — prefix shows % on the left, value on right */
.compound-infl-input {
  width: 100px;
  flex-shrink: 0;
}
.compound-infl-input input {
  width: 100%;
  -moz-appearance: textfield;
}
.compound-infl-input input::-webkit-outer-spin-button,
.compound-infl-input input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ── "real" inline badge on the Final Value card label ─────────────────── */
.compound-real-badge {
  display: inline-block;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
  background: rgba(245, 166, 35, 0.12);
  border: 1px solid rgba(245, 166, 35, 0.25);
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: middle;
  margin-left: 2px;
}

/* ── Milestones — horizontal flex row ───────────────────────────────────── */
.compound-milestones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.compound-milestone {
  flex: 1;
  min-width: 130px;
  font-size: 11px;
  color: var(--muted);
  padding: 3px 12px;
  text-align: center;
  line-height: 1.5;
}
/* Highlighted number/value inside each milestone */
.compound-milestone-val {
  color: var(--amber);
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  white-space: nowrap;
}
/* Thin vertical separator between milestones */
.compound-milestone-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex-shrink: 0;
  align-self: center;
}
/* Warning milestone in spending mode */
.compound-milestone-warn { color: var(--red); }

/* ── Chart canvas area inside the viz box ───────────────────────────────── */
.compound-chart-area { height: 260px; padding: 16px 0 8px; }

/* ── Table area — scroll shadow + fills viewport ────────────────────────── */
/* Matches the scroll-shadow technique used in the wage calculator. */
.compound-table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 420px);
  min-height: 120px;
  background:
    /* Fade mask at top/bottom to hide rows behind the edge */
    linear-gradient(var(--card) 20%, transparent)    center top    / 100% 36px no-repeat local,
    linear-gradient(transparent, var(--card) 80%)    center bottom / 100% 36px no-repeat local,
    /* Shadow glows only visible when scrolled (scroll-attachment) */
    radial-gradient(farthest-side at 50% 100%, var(--shadow-glow), transparent)
      center bottom / 100% 14px no-repeat scroll;
}
.compound-table-wrap::-webkit-scrollbar { width: 4px; height: 4px; }
.compound-table-wrap::-webkit-scrollbar-track { background: transparent; }
.compound-table-wrap::-webkit-scrollbar-thumb {
  background: var(--border-hi); border-radius: 4px;
}
.compound-table-wrap::-webkit-scrollbar-thumb:hover { background: var(--muted); }

