/* ==========================================================================
   DebtFlow - Emergency Fund & Runway Planner
   Module: css/styles.css
   Modern FinTech Design System (Inter + Plus Jakarta Sans)
   ========================================================================== */

:root {
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  --indigo-50: #eef2ff;
  --indigo-100: #e0e7ff;
  --indigo-200: #c7d2fe;
  --indigo-500: #6366f1;
  --indigo-600: #4f46e5;
  --indigo-700: #4338ca;

  --emerald-50: #ecfdf5;
  --emerald-100: #d1fae5;
  --emerald-200: #a7f3d0;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;

  --amber-50: #fffbeb;
  --amber-100: #fef3c7;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-700: #b45309;

  --rose-50: #fff1f2;
  --rose-100: #ffe4e6;
  --rose-500: #f43f5e;
  --rose-600: #e11d48;
  --rose-700: #be123c;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  background-color: var(--slate-50);
  color: var(--slate-800);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container, main, section {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header & Navigation styles provided centrally by /css/navbar.css */

/* Hero Section */
.hero-section {
  padding: 3rem 0 2rem;
  text-align: center;
  background: linear-gradient(180deg, #ffffff 0%, var(--slate-50) 100%);
  border-bottom: 1px solid var(--slate-200);
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--emerald-700);
  background-color: var(--emerald-50);
  border: 1px solid var(--emerald-200);
  margin-bottom: 1.25rem;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--slate-900);
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 0.85rem;
}

.hero-title .highlight {
  background: linear-gradient(135deg, var(--emerald-600), var(--indigo-600));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  max-width: 720px;
  margin: 0 auto 1.75rem;
  font-size: 1.05rem;
  color: var(--slate-600);
  line-height: 1.6;
}

/* Mode Switcher Tabs */
.mode-switcher-container {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.mode-switcher {
  display: inline-flex;
  padding: 0.35rem;
  background-color: var(--slate-200);
  border-radius: var(--radius-xl);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  gap: 0.25rem;
}

.mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  border: none;
  background: transparent;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--slate-600);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.mode-tab:hover {
  color: var(--slate-900);
}

.mode-tab.active {
  background-color: #ffffff;
  color: var(--slate-900);
  box-shadow: var(--shadow-sm);
}

.mode-tab svg {
  color: var(--slate-500);
  transition: color 0.2s ease;
}

.mode-tab.active svg {
  color: var(--emerald-600);
}

/* Mode Panels */
.mode-panel {
  display: none;
}

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

/* Main Grid Layout */
.calculator-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2rem;
  align-items: start;
  margin-bottom: 3rem;
}

/* Cards */
.calc-card {
  background-color: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  padding: 1.75rem;
}

.card-title-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--slate-100);
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--slate-900);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.card-subtitle {
  font-size: 0.85rem;
  color: var(--slate-500);
  margin-top: 0.15rem;
}

/* Expense Breakdown Subgrid */
.breakdown-section {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background-color: var(--slate-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
}

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

.breakdown-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--slate-700);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.breakdown-total-badge {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--emerald-700);
  background-color: var(--emerald-50);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--emerald-200);
}

.breakdown-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Form Controls */
.form-group {
  margin-bottom: 1.25rem;
}

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

.field-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 0.4rem;
}

.field-hint {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--slate-400);
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.input-affix {
  position: absolute;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--slate-400);
  pointer-events: none;
  user-select: none;
}

.input-affix.prefix {
  left: 0.85rem;
}

.input-affix.suffix {
  right: 0.85rem;
}

.text-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--slate-800);
  background-color: #ffffff;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  outline: none;
  transition: all 0.15s ease;
}

.text-input.has-prefix {
  padding-left: 1.9rem;
}

.text-input.has-suffix {
  padding-right: 2rem;
}

.text-input:focus {
  border-color: var(--emerald-600);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

/* Pill Selectors */
.pill-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  background-color: var(--slate-100);
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--slate-200);
}

.pill-btn {
  padding: 0.5rem 0.25rem;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate-600);
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.pill-btn:hover {
  color: var(--slate-900);
}

.pill-btn.active {
  background-color: #ffffff;
  color: var(--emerald-700);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

/* Toggle Switch (HYSA Boost) */
.toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.04), rgba(5, 150, 105, 0.04));
  border: 1.5px solid var(--indigo-100);
  border-radius: var(--radius-md);
  margin-top: 1.25rem;
}

.toggle-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toggle-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-sm);
  background-color: var(--indigo-100);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--indigo-600);
}

.toggle-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--slate-900);
}

.toggle-desc {
  font-size: 0.75rem;
  color: var(--slate-500);
}

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

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--slate-300);
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--emerald-600);
}

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

/* Mode A Outputs Card */
.results-card {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.75rem;
}

.goal-hero-box {
  background: linear-gradient(135deg, var(--slate-900), var(--slate-800));
  border-radius: var(--radius-md);
  padding: 1.75rem 1.5rem;
  color: #ffffff;
  text-align: center;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.goal-hero-box::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(5, 150, 105, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

.goal-hero-eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--emerald-300);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.goal-hero-amount {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin-bottom: 0.35rem;
}

.goal-hero-sub {
  font-size: 0.85rem;
  color: var(--slate-300);
}

/* Progress Gauge Bar */
.progress-block {
  margin-bottom: 1.5rem;
}

.progress-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.45rem;
  font-size: 0.85rem;
}

.progress-label-left {
  font-weight: 600;
  color: var(--slate-700);
}

.progress-label-right {
  font-weight: 700;
  color: var(--emerald-700);
}

.progress-track {
  height: 12px;
  background-color: var(--slate-100);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--slate-200);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--emerald-500), var(--emerald-600));
  border-radius: 9999px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  width: 25%;
}

/* Stat Grid */
.stat-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-box {
  background-color: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.stat-box-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.35rem;
}

.stat-box-value {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--slate-900);
}

.stat-box-sub {
  font-size: 0.75rem;
  color: var(--slate-500);
  margin-top: 0.2rem;
}

/* Timeline Banner */
.timeline-banner {
  background-color: var(--emerald-50);
  border: 1.5px solid var(--emerald-200);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.timeline-icon {
  color: var(--emerald-600);
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.timeline-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--emerald-900);
}

.timeline-desc {
  font-size: 0.82rem;
  color: var(--emerald-700);
  margin-top: 0.2rem;
  line-height: 1.4;
}

/* Mode B: Runway Specific Styles */
.runway-hero-box {
  border-radius: var(--radius-lg);
  padding: 2.25rem 1.75rem;
  text-align: center;
  color: #ffffff;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

.runway-hero-box.critical {
  background: linear-gradient(135deg, #991b1b, #7f1d1d);
}

.runway-hero-box.moderate {
  background: linear-gradient(135deg, #b45309, #92400e);
}

.runway-hero-box.solid {
  background: linear-gradient(135deg, #3730a3, #312e81);
}

.runway-hero-box.bulletproof {
  background: linear-gradient(135deg, #065f46, #064e3b);
}

.runway-hero-eyebrow {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}

.runway-months-display {
  font-family: var(--font-heading);
  font-size: 3.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 0.6rem;
}

.runway-status-badge {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 700;
  background-color: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  margin-bottom: 0.75rem;
}

.runway-status-desc {
  font-size: 0.88rem;
  opacity: 0.9;
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Quick Sync Button */
.btn-quick-sync {
  background: none;
  border: none;
  color: var(--indigo-600);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  text-decoration: underline;
  padding: 0;
}

.btn-quick-sync:hover {
  color: var(--indigo-700);
}

/* Schedule Table */
.schedule-section {
  margin-top: 3rem;
  margin-bottom: 4rem;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.section-heading {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--slate-900);
}

.btn-export-csv {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  background-color: #ffffff;
  color: var(--slate-700);
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.btn-export-csv:hover {
  background-color: var(--slate-50);
  color: var(--slate-900);
  border-color: var(--slate-400);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background-color: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

.data-table th {
  background-color: var(--slate-50);
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--slate-600);
  border-bottom: 1px solid var(--slate-200);
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--slate-100);
  color: var(--slate-700);
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background-color: var(--slate-50);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* FAQ Section */
.faq-section {
  padding: 4rem 0;
  background-color: #ffffff;
  border-top: 1px solid var(--slate-200);
}

.section-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.section-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--emerald-600);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--slate-900);
  letter-spacing: -0.02em;
}

.faq-list {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.faq-item {
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  background-color: #ffffff;
  overflow: hidden;
  transition: all 0.2s ease;
}

.faq-item[open] {
  border-color: var(--emerald-200);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.06);
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--slate-900);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-chevron {
  color: var(--slate-400);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.faq-item[open] .faq-chevron {
  transform: rotate(180deg);
  color: var(--emerald-600);
}

.faq-answer {
  padding: 0 1.25rem 1.25rem;
  font-size: 0.9rem;
  color: var(--slate-600);
  line-height: 1.6;
}

/* Footer */
.site-footer {
  background-color: var(--slate-900);
  color: var(--slate-400);
  padding: 3.5rem 0 2rem;
  border-top: 1px solid var(--slate-800);
}

/* Responsive */
@media (max-width: 900px) {
  .calculator-grid {
    grid-template-columns: 1fr;
  }

  .breakdown-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .hero-title {
    font-size: 2rem;
  }

  .calc-card,
  .results-panel-wrapper,
  .stat-summary-card {
    padding: 1.25rem 1rem;
    min-width: 0;
  }

  .pill-group {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-summary-grid {
    grid-template-columns: 1fr;
  }

  .mode-tab {
    padding: 0.5rem 0.85rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .pill-group {
    grid-template-columns: 1fr;
  }

  .pill-btn,
  .mode-tab {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .input-control {
    min-height: 44px;
  }

  .btn-export-csv {
    min-height: 44px;
    width: 100%;
  }
}

/* Print Styles */
@media print {
  .site-header,
  .mode-switcher-container,
  .btn-export-csv,
  .faq-section,
  .site-footer {
    display: none !important;
  }

  body {
    background-color: #ffffff;
    color: #000000;
  }

  .calc-card,
  .results-card {
    box-shadow: none;
    border: 1px solid #cccccc;
  }
}
