/**
 * Debt Consolidation Calculator - Stylesheet
 * Module: css/styles.css
 * Palette: Slate / Indigo / Emerald FinTech Aesthetic
 */

:root {
  /* Slate Neutrals */
  --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;

  /* Brand Accents */
  --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;

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

  --bg-surface: #ffffff;
  --border-subtle: #e2e8f0;
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.08);

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

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

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

body {
  font-family: var(--font-body);
  color: var(--slate-700);
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* Header & Navigation */
.site-header {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--slate-200);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4.25rem;
  height: auto;
  padding: 0.5rem 0;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--slate-900);
  text-decoration: none;
}

.logo-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--emerald-600), var(--indigo-600));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.25);
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  background-color: var(--emerald-50);
  color: var(--emerald-700);
  border: 1px solid var(--emerald-200);
}

.brand-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--emerald-600);
}

.site-nav {
  display: flex;
  align-items: center;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  flex-wrap: wrap;
}

.nav-link {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--slate-600);
  text-decoration: none;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--slate-900);
  background-color: var(--slate-100);
}

.nav-link.active {
  color: var(--emerald-700);
  background-color: var(--emerald-50);
  font-weight: 600;
}

/* Structured Tools Dropdown */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  background-color: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate-700);
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-dropdown-btn:hover {
  background-color: var(--slate-200);
  color: var(--slate-900);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.4rem;
  width: 320px;
  background-color: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: 0.75rem;
  z-index: 200;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  display: block;
}

.dropdown-sector {
  margin-bottom: 0.65rem;
}

.dropdown-sector:last-child {
  margin-bottom: 0;
}

.dropdown-sector-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-400);
  padding: 0.2rem 0.5rem;
  display: block;
}

.dropdown-item {
  display: block;
  padding: 0.35rem 0.5rem;
  font-size: 0.82rem;
  color: var(--slate-700);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease;
}

.dropdown-item:hover {
  background-color: var(--slate-50);
  color: var(--emerald-600);
}

.dropdown-item.active {
  font-weight: 600;
  color: var(--emerald-700);
  background-color: var(--emerald-50);
}

/* Hero Section */
.hero-section {
  padding: 3rem 0 2rem;
  text-align: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: var(--emerald-50);
  border: 1px solid var(--emerald-100);
  color: var(--emerald-700);
  font-size: 0.825rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 9999px;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw + 1rem, 3.25rem);
  font-weight: 800;
  color: var(--slate-900);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
}

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

.hero-subtitle {
  font-size: clamp(1rem, 1.2vw + 0.5rem, 1.15rem);
  color: var(--slate-600);
  max-width: 720px;
  margin: 0 auto 1.5rem;
  line-height: 1.6;
}

/* Calculator Grid */
.calculator-section {
  padding: 1.5rem 0 3.5rem;
}

.calc-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: start;
}

@media (min-width: 1024px) {
  .calc-layout {
    grid-template-columns: 520px 1fr;
  }
}

.calc-card {
  background: var(--bg-surface);
  border-radius: 1.25rem;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xl);
  padding: 1.75rem;
}

@media (min-width: 640px) {
  .calc-card {
    padding: 2.25rem;
  }
}

.card-header {
  margin-bottom: 1.25rem;
}

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

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

/* Aggregate Indicators Bar */
.aggregate-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 0.75rem;
  padding: 0.85rem;
  margin-bottom: 1.25rem;
}

.agg-item {
  display: flex;
  flex-direction: column;
  text-align: center;
}

.agg-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--slate-500);
}

.agg-value {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--slate-900);
  margin-top: 0.15rem;
}

/* Dynamic Debt Rows */
.debts-container {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.debt-row-card {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: 0.75rem;
  padding: 1rem;
  transition: all var(--transition-fast);
}

.debt-row-card:hover {
  border-color: var(--indigo-200);
  box-shadow: var(--shadow-sm);
}

.debt-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
}

.debt-name-input {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--slate-900);
  border: 1px solid transparent;
  background: transparent;
  padding: 0.2rem 0.4rem;
  border-radius: 0.35rem;
  outline: none;
  width: 75%;
}

.debt-name-input:focus {
  background: var(--slate-50);
  border-color: var(--indigo-300);
}

.btn-remove-debt {
  background: none;
  border: none;
  color: var(--slate-400);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.35rem;
}

.btn-remove-debt:hover {
  color: var(--rose-600);
}

.debt-inputs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.field-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--slate-500);
  margin-bottom: 0.2rem;
  display: block;
}

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

.mini-affix {
  position: absolute;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--slate-400);
  pointer-events: none;
}

.mini-affix.prefix { left: 0.6rem; }
.mini-affix.suffix { right: 0.6rem; }

.mini-input {
  width: 100%;
  height: 2.35rem;
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: 0.5rem;
  font-family: var(--font-heading);
  font-size: 0.925rem;
  font-weight: 700;
  color: var(--slate-900);
  padding: 0 0.5rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.mini-input.has-prefix { padding-left: 1.4rem; }
.mini-input.has-suffix { padding-right: 1.4rem; }

.mini-input:focus {
  border-color: var(--indigo-500);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.btn-add-debt {
  width: 100%;
  height: 2.5rem;
  background: var(--slate-100);
  border: 1.5px dashed var(--slate-300);
  color: var(--slate-700);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
  transition: all var(--transition-fast);
}

.btn-add-debt:hover {
  background: var(--indigo-50);
  border-color: var(--indigo-300);
  color: var(--indigo-700);
}

/* Consolidation Loan Proposed Section */
.consolidation-box {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
  border: 1.5px solid var(--emerald-200);
  border-radius: 1rem;
  padding: 1.35rem;
  margin-bottom: 1.5rem;
}

.consolidation-box-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--slate-900);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.loan-input-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.term-selector {
  display: flex;
  gap: 0.4rem;
}

.term-pill {
  flex: 1;
  height: 2.35rem;
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: 0.5rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--slate-700);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.term-pill:hover {
  border-color: var(--emerald-300);
}

.term-pill.active {
  background: var(--emerald-600);
  border-color: var(--emerald-600);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.btn-submit {
  width: 100%;
  height: 3.5rem;
  background: linear-gradient(135deg, var(--emerald-600) 0%, var(--emerald-700) 100%);
  color: #ffffff;
  border: none;
  border-radius: 0.75rem;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
  transition: all var(--transition-base);
}

.btn-submit:hover {
  background: linear-gradient(135deg, var(--emerald-500) 0%, var(--emerald-600) 100%);
  transform: translateY(-2px);
}

/* Error Alert */
.error-alert-box {
  background: var(--rose-50);
  border: 1.5px solid var(--rose-600);
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1.25rem;
  display: none;
}

.error-alert-box.visible {
  display: block;
}

/* Results Section */
.results-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.verdict-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  border-radius: 1.25rem;
  padding: 1.5rem 1.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-lg);
}

.verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--emerald-200);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  margin-bottom: 0.5rem;
}

.verdict-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.25;
}

.verdict-desc {
  font-size: 0.9rem;
  color: var(--slate-300);
  margin-top: 0.35rem;
}

/* Side-by-Side Cards */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .comparison-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.strategy-column-card {
  background: #ffffff;
  border: 1.5px solid var(--border-subtle);
  border-radius: 1.25rem;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.strategy-column-card.current-card {
  border-color: var(--indigo-200);
}

.strategy-column-card.consolidated-card {
  border-color: var(--emerald-300);
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}

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

.strategy-name {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--slate-900);
}

.strategy-tag {
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 0.35rem;
}

.tag-indigo { background: var(--indigo-100); color: var(--indigo-700); }
.tag-emerald { background: var(--emerald-100); color: var(--emerald-700); }

.stat-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stat-label {
  font-size: 0.775rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: var(--slate-500);
}

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

.stat-sub {
  font-size: 0.8rem;
  color: var(--slate-500);
}

/* Visual Bar */
.comparison-visual-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 1rem;
  padding: 1.35rem;
}

.compare-bar-row {
  margin-bottom: 1rem;
}

.compare-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.compare-bar-track {
  height: 0.85rem;
  background: var(--slate-100);
  border-radius: 9999px;
  overflow: hidden;
}

.compare-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.fill-current { background: linear-gradient(90deg, var(--indigo-500), var(--indigo-600)); }
.fill-consolidated { background: linear-gradient(90deg, var(--emerald-500), var(--emerald-600)); }

/* Schedule Table */
.schedule-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 1.25rem;
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
}

.table-container,
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 0.75rem;
  border: 1px solid var(--slate-200);
  max-height: 400px;
  overflow-y: auto;
  margin-top: 1rem;
}

.amortization-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: left;
}

.amortization-table th {
  background: var(--slate-50);
  color: var(--slate-700);
  font-family: var(--font-heading);
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-bottom: 1.5px solid var(--slate-200);
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: nowrap;
}

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

.btn-export {
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  color: var(--slate-700);
  font-size: 0.825rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 0.5rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-export:hover {
  background: var(--slate-200);
  color: var(--slate-900);
}

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

.section-header {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 2.5rem;
}

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

.section-title {
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  font-weight: 800;
  color: var(--slate-900);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.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: 1rem;
  overflow: hidden;
  background: var(--slate-50);
  transition: all var(--transition-fast);
}

.faq-item:hover { border-color: var(--emerald-200); }
.faq-item[open] { background: #ffffff; border-color: var(--emerald-300); box-shadow: var(--shadow-sm); }

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

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

.faq-chevron {
  color: var(--emerald-600);
  transition: transform var(--transition-base);
  flex-shrink: 0;
  margin-left: 1rem;
}

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

.faq-answer {
  padding: 0 1.5rem 1.35rem;
  color: var(--slate-600);
  font-size: 0.95rem;
  line-height: 1.65;
}

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

.footer-bottom {
  padding-top: 2rem;
  border-top: 1px solid var(--slate-800);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .calc-layout {
    grid-template-columns: 1fr;
  }
  .verdict-banner {
    padding: 1.25rem 1rem;
  }
  .comparison-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .calc-card,
  .strategy-column-card,
  .consolidation-box {
    padding: 1.25rem 1rem;
    min-width: 0;
  }
  .debt-inputs-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .loan-input-group {
    grid-template-columns: 1fr;
  }
  .debt-row-card {
    padding: 0.85rem;
  }
}

@media (max-width: 480px) {
  .term-selector {
    flex-wrap: wrap;
  }
  .term-pill {
    min-height: 44px;
    min-width: 60px;
  }
  .btn-submit,
  .btn-add-debt,
  .btn-export {
    min-height: 44px;
    width: 100%;
  }
  .mini-input,
  .form-input {
    min-height: 44px;
  }
}
