@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Color Palette */
  --bg-dark: #070a13;
  --bg-card: rgba(15, 22, 42, 0.65);
  --bg-card-hover: rgba(22, 32, 60, 0.8);
  --border-glass: rgba(255, 255, 255, 0.08);
  
  --accent-violet: #8b5cf6;
  --accent-violet-glow: rgba(139, 92, 246, 0.15);
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.15);
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.15);
  --accent-rose: #f43f5e;
  --accent-rose-glow: rgba(244, 63, 94, 0.15);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dark: #64748b;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(6, 182, 212, 0.08) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Typography & Layout Header */
header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 10, 19, 0.8);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 2rem;
  height: 2rem;
  color: var(--accent-violet);
  filter: drop-shadow(0 0 8px var(--accent-violet));
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(to right, var(--text-main), var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-badge {
  font-size: 0.65rem;
  font-weight: 600;
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-violet);
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  text-transform: uppercase;
}

/* Quick Summary Banner */
.summary-bar {
  display: flex;
  gap: 1.5rem;
}

.summary-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.summary-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.summary-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

/* Main Dashboard Grid */
.dashboard-container {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: calc(100vh - 73px);
}

/* Sidebar Inputs Panel */
.sidebar {
  border-right: 1px solid var(--border-glass);
  padding: 1.5rem;
  height: calc(100vh - 73px);
  overflow-y: auto;
  background: rgba(10, 15, 30, 0.4);
}

.section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title svg {
  width: 1rem;
  height: 1rem;
  color: var(--accent-violet);
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.input-group {
  margin-bottom: 1.25rem;
}

.input-group:last-child {
  margin-bottom: 0;
}

.input-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.input-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
}

.input-val-container,
.input-val-field {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.15);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(6, 182, 212, 0.25);
  text-align: right;
  font-family: var(--font-sans);
}

.input-val-field {
  width: 100px;
  outline: none;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.input-val-field:focus {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.25);
}

/* Hide spin buttons for numeric fields */
.input-val-field::-webkit-outer-spin-button,
.input-val-field::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.input-val-field[type=number] {
  -moz-appearance: textfield;
}

/* Custom Range Input */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
  margin: 0.5rem 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
  transition: transform var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.allocation-display {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.allocation-badge {
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
  padding: 0.35rem;
  border-radius: 6px;
  font-weight: 600;
  border: 1px solid var(--border-glass);
}

.allocation-badge.stocks {
  background: var(--accent-violet-glow);
  color: var(--accent-violet);
}
.allocation-badge.bonds {
  background: var(--accent-cyan-glow);
  color: var(--accent-cyan);
}
.allocation-badge.cash {
  background: var(--accent-emerald-glow);
  color: var(--accent-emerald);
}

/* Main Display Workspace */
.main-content {
  padding: 2rem;
  overflow-y: auto;
  height: calc(100vh - 73px);
}

/* Navigation Tabs */
.tabs-container {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 0.5rem;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  border-radius: 8px;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tab-btn svg {
  width: 1rem;
  height: 1rem;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  color: var(--text-main);
  background: var(--accent-violet-glow);
  border: 1px solid rgba(139, 92, 246, 0.3);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.1);
}

/* Tab Panels */
.tab-panel {
  display: none;
  animation: fadeIn var(--transition-normal);
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Stats Dashboard Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.stat-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.stat-card.violet::before { background: var(--accent-violet); }
.stat-card.cyan::before { background: var(--accent-cyan); }
.stat-card.emerald::before { background: var(--accent-emerald); }
.stat-card.rose::before { background: var(--accent-rose); }

.stat-header {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.stat-header svg {
  width: 1.2rem;
  height: 1.2rem;
}

.stat-card.violet svg { color: var(--accent-violet); }
.stat-card.cyan svg { color: var(--accent-cyan); }
.stat-card.emerald svg { color: var(--accent-emerald); }
.stat-card.rose svg { color: var(--accent-rose); }

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Visualization Canvas Cards */
.chart-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 18px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.chart-title {
  font-size: 1rem;
  font-weight: 700;
}

.chart-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 400px;
}

/* Milestone Timeline Elements */
.timeline-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.timeline-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 1.25rem;
  display: grid;
  grid-template-columns: 80px 1fr 180px;
  align-items: center;
  gap: 1rem;
  transition: background var(--transition-fast);
}

.timeline-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.timeline-age {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent-violet);
}

.timeline-info {
  display: flex;
  flex-direction: column;
}

.timeline-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.timeline-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.timeline-target {
  text-align: right;
  font-family: monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

/* Insights Panels */
.insight-box {
  background: rgba(139, 92, 246, 0.05);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.insight-icon {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--accent-violet);
  flex-shrink: 0;
}

.insight-text h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--text-main);
}

.insight-text p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Switch styling */
.switch-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-switch {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .3s;
  border-radius: 24px;
  border: 1px solid var(--border-glass);
}

.slider-switch:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-main);
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider-switch {
  background-color: var(--accent-violet);
}

input:checked + .slider-switch:before {
  transform: translateX(20px);
}

/* Drawer Overlay for mobile settings */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.drawer-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Header Controls Container */
.header-controls {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* Header settings trigger button (Adjust Inputs) */
.header-settings-btn {
  display: none; /* Hidden on desktop */
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 0.45rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
}

.header-settings-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

.header-settings-btn:active {
  transform: scale(0.95);
}

/* Mobile Navigation Dropdown */
.mobile-tab-dropdown-wrapper {
  display: none !important; /* Hidden on desktop */
  margin-bottom: 1.5rem;
}

.mobile-tab-dropdown {
  width: 100%;
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  cursor: pointer;
  outline: none;
  font-family: 'Inter', system-ui, sans-serif;
  transition: border-color 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.mobile-tab-dropdown:focus {
  border-color: var(--accent-violet);
}

/* Media Queries for Responsiveness */
@media (max-width: 1024px) {
  .dashboard-container {
    grid-template-columns: 1fr;
  }
  
  .summary-bar {
    display: none !important; /* Hide summary bar entirely on tablet/mobile */
  }

  .tabs-container {
    display: none !important; /* Hide old navigation tabs on tablet/mobile */
  }

  .mobile-tab-dropdown-wrapper {
    display: block; /* Show dropdown select navigation */
  }

  .header-settings-btn {
    display: flex; /* Show settings button in header */
  }
  
  /* Make sidebar a slide-out drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(25px);
    border-right: 1px solid var(--border-glass);
    border-bottom: none;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.6);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    padding: 1.5rem;
    height: 100dvh;
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  .sidebar-mobile-header {
    display: flex !important;
  }
  
  .main-content {
    height: auto;
    padding: 1.5rem 1rem;
  }
}

@media (max-width: 768px) {
  header {
    flex-direction: row; /* Keep logo and controls side by side */
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
  }

  .header-controls {
    gap: 0.75rem;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem;
  }
  
  .chart-wrapper {
    height: 320px !important;
  }
  
  .timeline-item {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 0.5rem;
  }
  
  .timeline-target {
    text-align: center !important;
  }
}

@media (max-width: 480px) {
  header {
    padding: 0.75rem 1rem;
  }

  .logo-text {
    font-size: 1.1rem !important;
  }

  .logo-badge {
    display: none; /* Hide badge on tiny screens to save space */
  }

  .header-settings-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr !important;
  }
  
  .chart-wrapper {
    height: 280px !important;
  }
}

/* Yearly Breakdown Table Styles */
.table-container-scroll {
  max-height: 550px;
  overflow-y: auto;
  border-radius: 14px;
}

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.breakdown-table th,
.breakdown-table td {
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--border-glass);
}

.breakdown-table th {
  background: #0f172a;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  z-index: 10;
}

.breakdown-table tr {
  transition: background var(--transition-fast);
}

.breakdown-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.035);
}

.breakdown-table td {
  color: var(--text-main);
}

/* Badge styling inside table */
.badge-status {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  text-transform: uppercase;
  border: 1px solid transparent;
  text-align: center;
}

.badge-status.accumulating {
  background: var(--accent-violet-glow);
  color: var(--accent-violet);
  border-color: rgba(139, 92, 246, 0.25);
}

.badge-status.retired {
  background: var(--accent-emerald-glow);
  color: var(--accent-emerald);
  border-color: rgba(16, 185, 129, 0.25);
}

.badge-status.milestone-coast {
  background: var(--accent-cyan-glow);
  color: var(--accent-cyan);
  border-color: rgba(6, 182, 212, 0.35);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

.badge-status.milestone-barista {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.35);
}

.badge-status.milestone-fire {
  background: var(--accent-emerald-glow);
  color: var(--accent-emerald);
  border-color: rgba(16, 185, 129, 0.45);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

.badge-status.failed {
  background: var(--accent-rose-glow);
  color: var(--accent-rose);
  border-color: rgba(244, 63, 94, 0.3);
}

/* Display Currency Toggle Buttons */
.currency-toggle-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: 18px;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
}

.currency-toggle-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.currency-toggle-btn.active {
  background: var(--accent-gradient);
  color: var(--text-main);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

