/* ── Vitta Calculator Design System ── */
/* Matches Vitta's mint/night/deep palette */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --mint:      #0ECE87;
  --mint-dim:  #0AAF73;
  --mint-glow: rgba(14,206,135,0.25);
  --night:     #07120E;
  --deep:      #0D1F18;
  --card:      #112218;
  --card-hover:#162E20;
  --border:    rgba(14,206,135,0.15);
  --border-h:  rgba(14,206,135,0.35);
  --muted:     rgba(255,255,255,0.45);
  --white:     #FFFFFF;
  --cream:     #F5F0E8;
  --red:       #FF6B6B;
  --blue:      #4ECDC4;
  --yellow:    #FFE66D;
  --purple:    #A78BFA;
  --display:   'Fraunces', serif;
  --sans:      'Plus Jakarta Sans', sans-serif;
  --mono:      'JetBrains Mono', 'Fira Code', monospace;
  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 8px 32px rgba(0,0,0,0.3);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--night);
  color: var(--white);
  overflow-x: hidden;
  min-height: 100vh;
}

/* ── Grain overlay ── */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.5;
}

/* ── NAV ── */
.calc-nav {
  position: sticky; top: 0;
  z-index: 100;
  padding: 14px 24px;
  display: flex; align-items: center; gap: 16px;
  backdrop-filter: blur(16px);
  background: rgba(7,18,14,0.85);
  border-bottom: 1px solid var(--border);
}
.calc-nav-logo {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--white);
  font-family: var(--display); font-weight: 700; font-size: 18px;
}
.calc-nav-logo img { width: 28px; height: 28px; border-radius: 8px; }
.calc-nav-sep { color: var(--muted); font-size: 14px; }
.calc-nav-title {
  font-size: 14px; font-weight: 600;
  color: var(--mint); letter-spacing: 0.5px;
}
.calc-nav-back {
  margin-left: auto;
  display: flex; align-items: center; gap: 6px;
  text-decoration: none; color: var(--muted);
  font-size: 13px; font-weight: 500;
  transition: color var(--transition);
}
.calc-nav-back:hover { color: var(--white); }

/* ── PAGE LAYOUT ── */
.calc-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.calc-header {
  text-align: center;
  margin-bottom: 48px;
}
.calc-header h1 {
  font-family: var(--display);
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 900;
  letter-spacing: -1px;
  margin-bottom: 12px;
}
.calc-header h1 em { font-style: italic; color: var(--mint); }
.calc-header p {
  color: var(--muted); font-size: 15px;
  max-width: 560px; margin: 0 auto;
  line-height: 1.65;
}

/* ── TWO COLUMN LAYOUT ── */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

/* ── CARDS ── */
.calc-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: all var(--transition);
}
.calc-card:hover {
  border-color: var(--border-h);
}
.calc-card-title {
  font-family: var(--display);
  font-size: 18px; font-weight: 700;
  margin-bottom: 24px;
  display: flex; align-items: center; gap: 10px;
}
.calc-card-title .icon { font-size: 22px; }

/* ── TAB VIEWS ── */
.calc-tabs {
  display: flex; gap: 4px;
  margin-bottom: 24px;
  background: rgba(14,206,135,0.06);
  border-radius: var(--radius-sm);
  padding: 4px;
}
.calc-tab {
  flex: 1;
  padding: 10px 16px;
  border: none; background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: all var(--transition);
}
.calc-tab:hover { color: var(--white); }
.calc-tab.active {
  background: var(--mint);
  color: var(--night);
}
.calc-tab-content { display: none; animation: fadeUp 0.4s ease; }
.calc-tab-content.active { display: block; }

/* ── INPUT GROUPS ── */
.input-group {
  margin-bottom: 24px;
}
.input-group:last-child { margin-bottom: 0; }

.input-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.input-label-text {
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,0.7);
}
.input-label-value {
  font-family: var(--mono);
  font-size: 16px; font-weight: 700;
  color: var(--mint);
  transition: transform 0.2s ease;
}
.input-label-value.bump {
  transform: scale(1.15);
}

/* ── RANGE SLIDERS ── */
.range-wrap {
  position: relative;
  height: 36px;
  display: flex; align-items: center;
}
.range-track {
  position: absolute;
  width: 100%; height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}
.range-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--mint-dim), var(--mint));
  border-radius: 3px;
  transition: width 0.1s ease;
}
input[type="range"].calc-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: transparent;
  position: relative;
  z-index: 2;
  cursor: pointer;
}
input[type="range"].calc-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--white);
  border: 3px solid var(--mint);
  box-shadow: 0 0 12px var(--mint-glow);
  cursor: grab;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}
input[type="range"].calc-range::-webkit-slider-thumb:hover {
  box-shadow: 0 0 20px var(--mint-glow);
  transform: scale(1.15);
}
input[type="range"].calc-range::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.25);
  box-shadow: 0 0 28px var(--mint-glow);
}
input[type="range"].calc-range::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--white);
  border: 3px solid var(--mint);
  box-shadow: 0 0 12px var(--mint-glow);
  cursor: grab;
}
.range-limits {
  display: flex; justify-content: space-between;
  margin-top: 4px;
  font-size: 11px; color: var(--muted);
}

/* ── TOGGLE SWITCHES ── */
.toggle-group {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.toggle-group:first-child { border-top: none; }
.toggle-info {
  display: flex; flex-direction: column; gap: 2px;
}
.toggle-label { font-size: 14px; font-weight: 600; }
.toggle-desc { font-size: 12px; color: var(--muted); }

.toggle-switch {
  position: relative;
  width: 48px; height: 26px;
  cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.12);
  border-radius: 13px;
  transition: background var(--transition);
}
.toggle-switch input:checked + .toggle-track {
  background: var(--mint);
}
.toggle-knob {
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: var(--white);
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.toggle-switch input:checked ~ .toggle-knob {
  transform: translateX(22px);
}

/* ── EXPANDABLE SECTIONS ── */
.expand-section {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 16px;
}
.expand-header {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer;
  font-size: 13px; font-weight: 600;
  color: var(--mint); padding: 8px 0;
  user-select: none;
}
.expand-header .arrow {
  transition: transform var(--transition);
  font-size: 12px;
}
.expand-header.open .arrow { transform: rotate(180deg); }
.expand-body {
  max-height: 0; overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  opacity: 0;
}
.expand-body.open {
  max-height: 600px;
  opacity: 1;
}

/* ── RESULT CARDS ── */
.result-hero {
  text-align: center;
  padding: 32px 20px;
  background: linear-gradient(135deg, rgba(14,206,135,0.1), rgba(14,206,135,0.03));
  border-radius: var(--radius);
  margin-bottom: 24px;
  border: 1px solid var(--border);
}
.result-hero-label {
  font-size: 12px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase;
  color: var(--mint); margin-bottom: 8px;
}
.result-hero-value {
  font-family: var(--display);
  font-size: clamp(32px, 6vw, 52px);
  font-weight: 900;
  color: var(--white);
  letter-spacing: -1px;
  transition: all 0.4s ease;
}
.result-hero-sub {
  font-size: 13px; color: var(--muted);
  margin-top: 4px;
}

.result-row {
  display: flex; justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.result-row:last-child { border-bottom: none; }
.result-row-label {
  font-size: 13px; color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.result-row-label .dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.result-row-value {
  font-family: var(--mono);
  font-size: 15px; font-weight: 600;
}

/* ── CHART CONTAINERS ── */
.chart-wrap {
  position: relative;
  margin: 20px 0;
  aspect-ratio: 1;
  max-height: 280px;
  margin-left: auto; margin-right: auto;
}
.chart-wrap canvas { width: 100% !important; height: 100% !important; }
.chart-wrap-wide {
  aspect-ratio: unset;
  max-height: 320px;
  height: 320px;
}

.chart-legend {
  display: flex; gap: 20px; justify-content: center;
  margin-top: 16px; flex-wrap: wrap;
}
.chart-legend-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
}
.chart-legend-dot {
  width: 10px; height: 10px; border-radius: 3px;
}

/* ── TABLE ── */
.calc-table-wrap {
  overflow-x: auto;
  margin-top: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.calc-table thead {
  background: rgba(14,206,135,0.08);
}
.calc-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600; font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--mint);
  white-space: nowrap;
}
.calc-table td {
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 13px;
  border-top: 1px solid rgba(255,255,255,0.04);
  white-space: nowrap;
}
.calc-table tr:hover td {
  background: rgba(14,206,135,0.03);
}

/* ── HUB CALCULATOR GRID ── */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.hub-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-decoration: none;
  color: var(--white);
  transition: all var(--transition);
  display: flex; flex-direction: column; gap: 12px;
}
.hub-card:hover {
  border-color: var(--border-h);
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.hub-card .icon { font-size: 32px; }
.hub-card h3 {
  font-family: var(--display);
  font-size: 18px; font-weight: 700;
}
.hub-card p {
  font-size: 13px; color: var(--muted);
  line-height: 1.55;
}
.hub-card .tag {
  display: inline-block; margin-top: auto;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  background: rgba(14,206,135,0.12); color: var(--mint);
}
.hub-card .tag.soon {
  background: rgba(255,255,255,0.08); color: var(--muted);
}

/* ── CONTEXT BANNER ── */
.context-banner {
  background: rgba(14,206,135,0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  margin-bottom: 28px;
  display: flex; align-items: center; gap: 12px;
  font-size: 13px; color: var(--muted);
}
.context-banner .icon { font-size: 18px; }
.context-banner strong { color: var(--mint); }
.context-banner a {
  color: var(--mint); text-decoration: underline;
  margin-left: auto; white-space: nowrap;
}

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.anim-fade { animation: fadeUp 0.5s ease both; }
.anim-fade-d1 { animation: fadeUp 0.5s ease 0.1s both; }
.anim-fade-d2 { animation: fadeUp 0.5s ease 0.2s both; }
.anim-fade-d3 { animation: fadeUp 0.5s ease 0.3s both; }
.anim-count { animation: countUp 0.4s ease both; }

/* ── FOOTER ── */
.calc-footer {
  border-top: 1px solid var(--border);
  padding: 28px 24px;
  text-align: center;
  margin-top: 60px;
}
.calc-footer a {
  color: var(--muted); text-decoration: none;
  font-size: 12px;
  transition: color var(--transition);
}
.calc-footer a:hover { color: var(--white); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .calc-grid {
    grid-template-columns: 1fr;
  }
  .calc-nav { padding: 12px 16px; }
  .calc-page { padding: 24px 16px 60px; }
  .calc-header { margin-bottom: 32px; }
  .result-hero { padding: 24px 16px; }
  .chart-wrap { max-height: 240px; }
  .chart-wrap-wide { height: 260px; }
}
