/* app.css — Aurora Glass aesthetic for the Student Loan Strategy app */

:root {
  --bg-0: #0a0a1a;
  --bg-1: #0e0c24;
  --ink-0: #f5f3ff;
  --ink-1: rgba(245, 243, 255, 0.78);
  --ink-2: rgba(245, 243, 255, 0.55);
  --ink-3: rgba(245, 243, 255, 0.32);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --glass: rgba(255, 255, 255, 0.04);
  --glass-2: rgba(255, 255, 255, 0.06);
  --glass-hi: rgba(255, 255, 255, 0.10);

  --c-invest: oklch(0.78 0.18 175);   /* mint/teal */
  --c-overpay: oklch(0.74 0.17 295);  /* violet */
  --c-lump: oklch(0.78 0.16 60);      /* amber */
  --c-std: oklch(0.78 0.05 250);      /* cool grey */
  --c-warn: oklch(0.78 0.18 30);      /* rose */
  --c-good: oklch(0.80 0.18 145);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  --global-nav-h: 54px;

  --font-display: 'Geist', 'Inter Tight', system-ui, sans-serif;
  --font-body: 'Geist', system-ui, sans-serif;
  --font-mono: 'Geist Mono', 'JetBrains Mono', ui-monospace, monospace;
}

[data-theme="light"] {
  --bg-0: #f4f2ee;
  --bg-1: #ebe7df;
  --ink-0: #131124;
  --ink-1: rgba(19, 17, 36, 0.78);
  --ink-2: rgba(19, 17, 36, 0.55);
  --ink-3: rgba(19, 17, 36, 0.32);
  --line: rgba(19, 17, 36, 0.10);
  --line-2: rgba(19, 17, 36, 0.18);
  --glass: rgba(255, 255, 255, 0.45);
  --glass-2: rgba(255, 255, 255, 0.60);
  --glass-hi: rgba(255, 255, 255, 0.85);
}

[data-theme="aurora"] {
  --bg-0: #04101a;
  --bg-1: #061826;
  --c-invest: oklch(0.82 0.20 175);
  --c-overpay: oklch(0.78 0.20 305);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg-0);
  color: var(--ink-0);
  font-feature-settings: 'ss01', 'cv11', 'tnum';
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Aurora background ---------------------------------------------------- */
.aurora {
  position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
}
.aurora::before, .aurora::after, .aurora .blob {
  content: ''; position: absolute; border-radius: 50%;
  filter: blur(120px); opacity: 0.55; mix-blend-mode: screen;
}
.aurora::before {
  width: 60vw; height: 60vw; left: -10vw; top: -20vw;
  background: radial-gradient(circle, oklch(0.55 0.28 295) 0%, transparent 65%);
  animation: drift1 24s ease-in-out infinite alternate;
}
.aurora::after {
  width: 55vw; height: 55vw; right: -15vw; top: 10vh;
  background: radial-gradient(circle, oklch(0.55 0.24 195) 0%, transparent 65%);
  animation: drift2 30s ease-in-out infinite alternate;
}
.aurora .blob {
  width: 45vw; height: 45vw; left: 30vw; bottom: -20vw;
  background: radial-gradient(circle, oklch(0.55 0.20 25) 0%, transparent 65%);
  animation: drift3 36s ease-in-out infinite alternate;
}
[data-theme="light"] .aurora::before,
[data-theme="light"] .aurora::after,
[data-theme="light"] .aurora .blob { opacity: 0.30; mix-blend-mode: multiply; filter: blur(140px); }

@keyframes drift1 { 0% { transform: translate(0,0); } 100% { transform: translate(8vw, 6vh); } }
@keyframes drift2 { 0% { transform: translate(0,0); } 100% { transform: translate(-6vw, 8vh); } }
@keyframes drift3 { 0% { transform: translate(0,0); } 100% { transform: translate(4vw, -6vh); } }

/* App shell ----------------------------------------------------------- */
svg { max-width: 100%; }
.app {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px;
  gap: 24px;
}

.sidebar {
  position: sticky; top: calc(var(--global-nav-h, 54px) + 14px); align-self: start;
  background: var(--glass); backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px 14px;
  height: calc(100vh - var(--global-nav-h, 54px) - 52px);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-card);
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background:
    radial-gradient(circle at 30% 30%, oklch(0.85 0.18 295), transparent 60%),
    radial-gradient(circle at 70% 70%, oklch(0.85 0.18 195), transparent 60%),
    linear-gradient(135deg, oklch(0.4 0.15 295), oklch(0.4 0.15 195));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25), 0 6px 20px -8px oklch(0.6 0.2 295);
}

/* Rail nav — matches the suite sidebar pattern */
.rail-nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-height: 0; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-group-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-3); font-weight: 600; padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--radius-sm); cursor: pointer;
  color: var(--ink-2); font-size: 13.5px; font-weight: 500;
  border: 1px solid transparent; background: none; width: 100%; text-align: left;
  font-family: inherit; text-decoration: none;
  transition: background .14s, color .14s, box-shadow .14s;
}
.nav-item .ni-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--ink-3); transition: background .15s, box-shadow .15s, transform .15s;
}
.nav-item .ni-label { flex: 1; min-width: 0; }
.nav-item:hover { background: var(--glass-2); color: var(--ink-0); }
.nav-item:hover .ni-dot { background: var(--ink-2); }
.nav-item.active {
  background: var(--glass-hi); color: var(--ink-0); font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--c-overpay);
}
.nav-item.active .ni-dot {
  background: var(--c-invest); box-shadow: 0 0 9px var(--c-invest); transform: scale(1.1);
}
.nav-item .ni-tag {
  margin-left: auto; font-size: 9.5px; font-weight: 600; letter-spacing: .04em;
  padding: 2px 6px; border-radius: 999px; background: var(--glass-hi); color: var(--ink-2);
  text-transform: uppercase;
}

/* Pinned context-summary footer */
.rail-foot {
  margin-top: auto; padding: 13px 14px;
  border-radius: var(--radius); background: var(--glass-2); border: 1px solid var(--line);
}
.rail-foot-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--ink-3); font-weight: 600; margin-bottom: 9px;
}
.rail-foot-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 12px; }
.rail-foot-row span { color: var(--ink-2); }
.rail-foot-row b { font-weight: 600; color: var(--ink-0); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.rail-foot-row.hero { margin-top: 5px; padding-top: 8px; border-top: 1px solid var(--line); }
.rail-foot-row.hero b { font-size: 16px; color: var(--c-invest); }
.rail-foot-note { font-size: 9.5px; color: var(--ink-3); margin-top: 9px; }

/* Main area ----------------------------------------------------------- */
.main { min-width: 0; }
.topbar {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 6px 8px 22px;
}
.topbar h1 {
  font-family: var(--font-display); font-weight: 600; font-size: 32px;
  letter-spacing: -0.025em; margin: 0;
}
.topbar h1 .accent { background: linear-gradient(120deg, oklch(0.85 0.18 295), oklch(0.85 0.18 195)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar .sub { color: var(--ink-2); font-size: 14px; }
.topbar-actions { display: flex; gap: 8px; }

.btn {
  border: 1px solid var(--line-2); background: var(--glass);
  color: var(--ink-0); padding: 8px 14px; border-radius: 10px;
  font-family: inherit; font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--glass-2); border-color: var(--ink-3); }
.btn-primary {
  background: linear-gradient(135deg, oklch(0.55 0.22 295), oklch(0.55 0.22 195));
  border-color: transparent; color: white;
  box-shadow: 0 8px 24px -10px oklch(0.55 0.22 295);
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost { background: none; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { color: var(--ink-0); background: var(--glass-2); }

/* Glass card ---------------------------------------------------------- */
.card {
  background: var(--glass); backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 24px;
}
.card-pad-lg { padding: 32px; }
.card-pad-sm { padding: 18px; }
.card-title {
  font-family: var(--font-display); font-weight: 600; font-size: 17px;
  letter-spacing: -0.01em; margin: 0 0 4px;
}
.card-sub { font-size: 13px; color: var(--ink-2); margin: 0 0 18px; }

/* Numbers */
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.num-xl { font-size: 44px; font-weight: 500; }
.num-lg { font-size: 30px; font-weight: 500; }
.num-md { font-size: 20px; font-weight: 500; }

.label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); }

/* Strategy colored chips */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line-2); }
.chip .swatch { width: 8px; height: 8px; border-radius: 50%; }
.chip-invest .swatch { background: var(--c-invest); box-shadow: 0 0 8px var(--c-invest); }
.chip-overpay .swatch { background: var(--c-overpay); box-shadow: 0 0 8px var(--c-overpay); }
.chip-lump .swatch { background: var(--c-lump); box-shadow: 0 0 8px var(--c-lump); }
.chip-std .swatch { background: var(--c-std); }

/* Inputs */
.input-row { display: flex; flex-direction: column; gap: 6px; }
.input-row label { font-size: 12px; color: var(--ink-2); }
.input {
  background: var(--glass-2); border: 1px solid var(--line);
  color: var(--ink-0); padding: 10px 12px; border-radius: 10px;
  font-family: var(--font-mono); font-size: 14px; width: 100%;
  transition: border-color 0.15s, background 0.15s;
}
.input:focus { outline: none; border-color: var(--c-overpay); background: var(--glass-hi); }

.slider-row { display: flex; flex-direction: column; gap: 8px; }
.slider-row .head { display: flex; justify-content: space-between; align-items: baseline; }
.slider-row .head label { font-size: 12px; color: var(--ink-2); }
.slider-row .head .val { font-family: var(--font-mono); font-size: 14px; color: var(--ink-0); }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: 2px;
  background: var(--line-2);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: linear-gradient(135deg, oklch(0.85 0.18 295), oklch(0.85 0.18 195));
  cursor: pointer;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.05), 0 4px 12px -2px oklch(0.55 0.22 295);
  border: none;
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: oklch(0.85 0.18 245);
  cursor: pointer; border: none;
}

/* Segmented */
.seg {
  display: inline-flex; padding: 3px; background: var(--glass-2);
  border: 1px solid var(--line); border-radius: 12px; gap: 2px;
}
.seg button {
  background: none; border: none; color: var(--ink-2);
  font-family: inherit; font-size: 12px; padding: 6px 12px;
  border-radius: 9px; cursor: pointer; transition: all 0.15s;
}
.seg button:hover { color: var(--ink-0); }
.seg button.active { background: var(--glass-hi); color: var(--ink-0); box-shadow: inset 0 0 0 1px var(--line-2); }

/* Grids --------------------------------------------------------------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-hero { grid-template-columns: 1.4fr 1fr; gap: 16px; }
.grid-calc { grid-template-columns: 340px minmax(0, 1fr); gap: 16px; }
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; }

/* Strategy cards */
.strat-card { position: relative; padding: 20px; border-radius: var(--radius-lg); min-width: 0; }
.strat-card .num-lg { font-size: 26px; }
.strat-card .accent-bar { position: absolute; top: 0; left: 22px; right: 22px; height: 2px; border-radius: 0 0 2px 2px; }
.strat-card.is-best { border-color: transparent; box-shadow: inset 0 0 0 1.5px var(--c-invest), 0 12px 40px -16px var(--c-invest); }
.best-pill { position: absolute; top: -10px; right: 18px; background: var(--c-invest); color: #001a14; font-size: 10px; padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; }

/* Recommendation */
.reco {
  background:
    radial-gradient(ellipse at top left, oklch(0.4 0.22 295 / 0.25), transparent 60%),
    radial-gradient(ellipse at bottom right, oklch(0.4 0.22 175 / 0.25), transparent 60%),
    var(--glass);
}
.reco h2 {
  font-family: var(--font-display); font-weight: 500; font-size: 30px;
  letter-spacing: -0.025em; margin: 0 0 12px; text-wrap: balance;
}
.reco-headline {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(34px, 4.6vw, 60px);
  letter-spacing: -0.035em;
  line-height: 1.04;
  margin: 0 0 22px;
  text-wrap: balance;
  max-width: 22ch;
}
.reco-accent {
  background: linear-gradient(120deg, oklch(0.85 0.18 175), oklch(0.85 0.18 295));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-variant-numeric: tabular-nums;
}
[data-theme="light"] .reco-accent {
  background: linear-gradient(120deg, oklch(0.45 0.18 175), oklch(0.45 0.18 295));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
@media (max-width: 1100px) {
  .reco h2 { font-size: 24px; }
}
.reco p { color: var(--ink-1); font-size: 15px; line-height: 1.55; margin: 0; text-wrap: pretty; max-width: 65ch; }

/* Tooltips */
.tooltip {
  position: absolute; pointer-events: none;
  background: rgba(10, 10, 26, 0.92); backdrop-filter: blur(10px);
  border: 1px solid var(--line-2); border-radius: 10px;
  padding: 10px 12px; font-size: 12px; color: var(--ink-0);
  transform: translate(-50%, -110%); white-space: nowrap;
  box-shadow: 0 8px 24px -8px rgba(0,0,0,0.5);
  z-index: 10;
}
[data-theme="light"] .tooltip { background: rgba(255,255,255,0.96); color: var(--ink-0); }

/* Learn section */
.learn-card {
  padding: 28px; border-radius: var(--radius-lg);
  background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(28px);
}
.learn-card h3 { font-family: var(--font-display); font-weight: 600; font-size: 20px; margin: 0 0 10px; letter-spacing: -0.015em; }
.learn-card p { color: var(--ink-1); line-height: 1.6; font-size: 14px; margin: 0 0 12px; text-wrap: pretty; }
.learn-card ul { color: var(--ink-1); line-height: 1.6; font-size: 14px; margin: 0; padding-left: 20px; }
.learn-card li { margin-bottom: 6px; }
.learn-card .kicker { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--c-invest); margin: 0 0 8px; }

/* Animated counter */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; }

/* Sparkline */
.spark { display: block; width: 100%; height: 36px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs button {
  background: none; border: none; padding: 10px 14px;
  color: var(--ink-2); font-family: inherit; font-size: 13px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.tabs button:hover { color: var(--ink-0); }
.tabs button.active { color: var(--ink-0); border-bottom-color: var(--c-invest); }

/* Divider */
.div-h { height: 1px; background: var(--line); margin: 16px 0; }

/* Pill stat */
.pill-stat {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px; background: var(--glass-2); border-radius: 12px;
  border: 1px solid var(--line);
}
.pill-stat .label { margin-bottom: 2px; }
.pill-stat .num { font-size: 22px; }
.pill-stat .delta { font-size: 12px; color: var(--ink-2); font-family: var(--font-mono); }
.pill-stat .delta.up { color: var(--c-good); }
.pill-stat .delta.down { color: var(--c-warn); }

/* Plan picker */
.plan-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
@media (max-width: 1200px) {
  .plan-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.plan-pick {
  padding: 14px 12px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--glass-2);
  text-align: left; font-family: inherit; color: var(--ink-1);
  transition: all 0.15s;
}
.plan-pick:hover { background: var(--glass-hi); color: var(--ink-0); }
.plan-pick.active {
  background: var(--glass-hi); color: var(--ink-0);
  border-color: var(--c-overpay);
  box-shadow: 0 0 0 1px var(--c-overpay), 0 8px 24px -12px var(--c-overpay);
}
.plan-pick .plan-name { font-weight: 600; font-size: 14px; }
.plan-pick .plan-sub { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

/* Misc */
.muted { color: var(--ink-2); }
.balance-strip { display: flex; align-items: baseline; justify-content: space-between; padding: 7px 0; gap: 12px; }
.balance-strip > span:first-child { flex: 1 1 auto; min-width: 0; }
.balance-strip > span:last-child { flex: 0 0 auto; white-space: nowrap; }
.balance-strip + .balance-strip { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 13px; }

/* ====================================================================
   RESPONSIVE — tablet & mobile
   ==================================================================== */

/* Tablet / small laptop: collapse the sidebar into a horizontal rail under the nav */
@media (max-width: 900px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px;
    gap: 14px;
  }
  .sidebar {
    position: sticky;
    top: calc(var(--global-nav-h, 54px) + 6px);
    z-index: 60;
    height: auto;
    flex-direction: column;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
  }
  .rail-nav {
    flex-direction: row;
    align-items: center;
    gap: 4px;
    flex: 1 1 auto;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin: 0;
    padding: 0;
  }
  .rail-nav::-webkit-scrollbar { display: none; }
  .nav-group { flex-direction: row; align-items: center; gap: 4px; }
  .nav-group-label { display: none; }
  .rail-foot { display: none; }
  .nav-item {
    width: auto;
    white-space: nowrap;
    padding: 9px 13px;
    flex: 0 0 auto;
    min-height: 40px;
  }

  /* Stack the major two-pane layouts */
  .grid-calc,
  .grid-hero,
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Topbar reflows to a column */
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 2px 4px 10px;
  }
  .topbar h1 { font-size: 26px; }
  .topbar-actions { gap: 8px; }
  .topbar-actions .btn { flex: 1 1 auto; justify-content: center; }

  .card { padding: 18px; }
  .card-pad-lg { padding: 22px; }
}

/* Phone */
@media (max-width: 600px) {
  .app { padding: 10px; gap: 12px; }
  .nav-item { padding: 9px 12px; font-size: 13px; }

  .grid-2,
  .grid-4 { grid-template-columns: minmax(0, 1fr); }

  .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .topbar h1 { font-size: 22px; }
  .reco-headline { font-size: 28px; }
  .num-xl { font-size: 34px; }
  .num-lg { font-size: 26px; }
  .strat-card .num-lg { font-size: 24px; }

  /* Sensitivity table can scroll sideways if it must */
  .card table { font-size: 12px; }
}

/* Very small phones — keep the strategy cards readable */
@media (max-width: 380px) {
  .plan-grid { grid-template-columns: 1fr; }
}
