@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --bg-primary:    #0a0e17;
  --bg-secondary:  #111827;
  --bg-card-dark:  #161e2e;
  --bg-card-accent:#1a2744;
  --bg-card-light: #0f1a2e;
  --fg-primary:    #e8ecf4;
  --fg-secondary:  #8b95a8;
  --fg-muted:      #5a6478;
  --accent:        #22d3a7;
  --accent-glow:   rgba(34, 211, 167, 0.15);
  --accent-warm:   #f59e0b;
  --border:        rgba(255,255,255,0.06);
  --radius:        16px;
  --radius-sm:     10px;
}

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

body {
  background: var(--bg-primary);
  color: var(--fg-primary);
  font-family: 'DM Sans', sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  line-height: 1.15;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Nav ── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(10,14,23,0.92);
  backdrop-filter: blur(12px);
  z-index: 100;
}
.nav-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--fg-primary);
  letter-spacing: -0.5px;
}
.nav-logo span { color: var(--accent); }
.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #0a0e17;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 9px 20px;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
  text-decoration: none;
}
.nav-cta:hover { opacity: 0.88; text-decoration: none; }

/* ── Hero ── */
.hero {
  min-height: 88vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 80px 24px 60px;
  position: relative;
  background: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(34,211,167,0.07) 0%, transparent 70%),
              var(--bg-primary);
}
.hero-badge {
  display: inline-block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--accent);
  border: 1px solid rgba(34,211,167,0.3);
  padding: 8px 20px;
  border-radius: 100px;
  margin-bottom: 40px;
  text-transform: uppercase;
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  margin-bottom: 28px;
  letter-spacing: -2px;
}
.hero h1 .accent {
  background: linear-gradient(135deg, var(--accent) 0%, #14b8a6 50%, var(--accent-warm) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  max-width: 560px;
  font-size: 1.05rem;
  color: var(--fg-secondary);
  margin-bottom: 48px;
  line-height: 1.75;
}
.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 64px;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #0a0e17;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 14px 32px;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
}
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); text-decoration: none; }
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--fg-primary);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 13px 28px;
  border-radius: 100px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-decoration: none;
}
.btn-secondary:hover { border-color: rgba(255,255,255,0.18); background: rgba(255,255,255,0.04); text-decoration: none; }

/* ── Stats bar ── */
.hero-stats {
  display: flex;
  gap: 0;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 36px;
  flex-wrap: wrap;
  justify-content: center;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 28px;
}
.stat:not(:last-child) { border-right: 1px solid var(--border); }
.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -1px;
}
.stat-label {
  font-size: 0.78rem;
  color: var(--fg-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Section ── */
.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 24px;
}
.section-title {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  margin-bottom: 12px;
  letter-spacing: -1px;
}
.section-sub {
  color: var(--fg-secondary);
  font-size: 1rem;
  max-width: 500px;
  margin-bottom: 48px;
}

/* ── Cards ── */
.card {
  background: var(--bg-card-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.card-accent { background: var(--bg-card-accent); }
.card-grid {
  display: grid;
  gap: 20px;
}
.card-grid-3 { grid-template-columns: repeat(3, 1fr); }
.card-grid-2 { grid-template-columns: repeat(2, 1fr); }

/* ── Feature cards ── */
.feature-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-glow);
  border: 1px solid rgba(34,211,167,0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 16px;
}
.feature-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.feature-desc { font-size: 0.88rem; color: var(--fg-secondary); line-height: 1.65; }

/* ── Portfolio App (form + results) ── */
.app-shell {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.app-header {
  text-align: center;
  margin-bottom: 40px;
}
.app-header h2 { font-size: 2rem; letter-spacing: -1px; margin-bottom: 8px; }
.app-header p { color: var(--fg-secondary); font-size: 0.95rem; }

/* ── Steps ── */
.steps-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 40px;
}
.step-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-card-dark);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg-muted);
  flex-shrink: 0;
  position: relative;
}
.step-dot.active { background: var(--accent); color: #0a0e17; border-color: var(--accent); }
.step-dot.done { background: var(--bg-card-accent); border-color: var(--accent); color: var(--accent); }
.step-line {
  flex: 1;
  max-width: 80px;
  height: 1px;
  background: var(--border);
}
.step-line.done { background: var(--accent); opacity: 0.4; }
.step-label {
  position: absolute;
  top: 40px;
  white-space: nowrap;
  font-size: 0.72rem;
  color: var(--fg-muted);
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: 0.3px;
}
.step-dot.active .step-label { color: var(--accent); }

/* ── Form ── */
.form-section { margin-bottom: 32px; }
.form-label {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--fg-secondary);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: rgba(34,211,167,0.4);
}
.form-input::placeholder { color: var(--fg-muted); }
.form-select option { background: var(--bg-secondary); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 0.8rem; color: var(--fg-muted); margin-top: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Risk profile selector ── */
.risk-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.risk-option {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.risk-option:hover { border-color: rgba(34,211,167,0.3); }
.risk-option.selected { border-color: var(--accent); background: var(--bg-card-accent); }
.risk-option input { display: none; }
.risk-option-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.risk-option-desc { font-size: 0.72rem; color: var(--fg-muted); }

/* ── Fund search ── */
.fund-search-wrap { position: relative; }
.fund-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg-card-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 240px;
  overflow-y: auto;
  z-index: 50;
  display: none;
}
.fund-search-results.open { display: block; }
.fund-result {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.fund-result:last-child { border-bottom: none; }
.fund-result:hover { background: var(--bg-card-accent); }
.fund-result-name { font-size: 0.88rem; }
.fund-result-code { font-size: 0.75rem; color: var(--fg-muted); margin-top: 2px; }

/* ── Funds list ── */
.funds-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.fund-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.fund-item-info { flex: 1; }
.fund-item-name { font-size: 0.88rem; font-weight: 500; }
.fund-item-meta { font-size: 0.75rem; color: var(--fg-muted); margin-top: 2px; }
.fund-item-remove {
  background: none;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  line-height: 1;
  transition: color 0.1s;
}
.fund-item-remove:hover { color: #f87171; }

/* ── Results page ── */
.results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.metric-card {
  background: var(--bg-card-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.metric-label {
  font-size: 0.75rem;
  font-family: 'Space Grotesk', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fg-muted);
  margin-bottom: 8px;
}
.metric-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--fg-primary);
}
.metric-value.positive { color: var(--accent); }
.metric-value.negative { color: #f87171; }
.metric-sub { font-size: 0.8rem; color: var(--fg-muted); margin-top: 4px; }

/* ── Allocation bars ── */
.allocation-bar-wrap { margin-bottom: 12px; }
.allocation-bar-header {
  display: flex; justify-content: space-between;
  font-size: 0.82rem; margin-bottom: 6px;
}
.allocation-bar-label { color: var(--fg-secondary); font-weight: 500; }
.allocation-bar-pct { color: var(--fg-primary); font-weight: 600; }
.allocation-bar-track {
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 100px;
  overflow: hidden;
}
.allocation-bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.6s ease;
}
.bar-equity   { background: var(--accent); }
.bar-debt     { background: #60a5fa; }
.bar-hybrid   { background: var(--accent-warm); }
.bar-other    { background: var(--fg-muted); }

/* ── Fund table ── */
.fund-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.fund-table th {
  text-align: left;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fg-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.fund-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--fg-secondary);
  vertical-align: top;
}
.fund-table td:first-child { color: var(--fg-primary); font-weight: 500; }
.fund-table tr:last-child td { border-bottom: none; }
.return-positive { color: var(--accent); font-weight: 600; }
.return-negative { color: #f87171; font-weight: 600; }

/* ── AI Recommendation ── */
.recommendation-card {
  background: linear-gradient(135deg, var(--bg-card-accent) 0%, var(--bg-card-dark) 100%);
  border: 1px solid rgba(34,211,167,0.15);
  border-radius: var(--radius);
  padding: 28px;
  margin-top: 24px;
}
.recommendation-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.recommendation-text {
  font-size: 0.92rem;
  line-height: 1.75;
  color: var(--fg-secondary);
  white-space: pre-line;
}

/* ── Gaps ── */
.gap-list { display: flex; flex-direction: column; gap: 10px; }
.gap-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  border: 1px solid var(--border);
}
.gap-badge {
  font-size: 0.7rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.gap-badge.reduce { background: rgba(248,113,113,0.15); color: #f87171; }
.gap-badge.increase { background: var(--accent-glow); color: var(--accent); }
.gap-text { font-size: 0.82rem; color: var(--fg-secondary); }

/* ── Loading ── */
.loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state { text-align: center; padding: 60px 20px; }
.loading-state p { color: var(--fg-muted); font-size: 0.9rem; margin-top: 8px; }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 0.88rem;
  z-index: 999;
  transition: opacity 0.3s, transform 0.3s;
  max-width: 320px;
}
.toast.error { border-color: rgba(248,113,113,0.3); color: #f87171; }
.toast.success { border-color: rgba(34,211,167,0.3); color: var(--accent); }
.toast.hidden { opacity: 0; transform: translateY(8px); pointer-events: none; }

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 40px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--fg-muted);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav { padding: 16px 20px; }
  .hero { padding: 60px 20px 40px; }
  .card-grid-3 { grid-template-columns: 1fr; }
  .card-grid-2 { grid-template-columns: 1fr; }
  .results-grid { grid-template-columns: 1fr; }
  .risk-options { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .hero-stats { flex-direction: column; gap: 20px; padding: 24px; }
  .stat { border-right: none !important; border-bottom: 1px solid var(--border); padding-bottom: 16px; }
  .stat:last-child { border-bottom: none; }
  .fund-table { display: block; overflow-x: auto; }
}
