/* Reset & Base */
html { scroll-behavior: smooth; }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

:root {
  --bg: #f8fafb;
  --surface: #ffffff;
  --border: #e2e6ed;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --text-secondary: #5f6775;
  --primary: #0d9488;
  --primary-hover: #0f766e;
  --primary-light: #f0fdfa;
  --success: #059669;
  --success-light: #ecfdf5;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --gold: #f59e0b;
  --silver: #6b7280;
  --bronze: #b45309;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}
.container-wide {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Screen reader only utility class */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sr-only-focusable:focus,
.sr-only-focusable:focus-visible {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* Header */
.header {
  background: linear-gradient(135deg, #134e4a 0%, #0d9488 100%);
  color: white;
  padding: 40px 0 32px;
  text-align: center;
}

.top-nav {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
}

.nav-link {
  color: rgba(255,255,255,0.82);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.nav-link:hover {
  color: white;
  background: rgba(255,255,255,0.1);
}

.nav-link.active {
  color: white;
  background: rgba(255,255,255,0.15);
}

/* Navigation dropdown */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(255,255,255,0.82);
  padding: 4px 8px;
  border-radius: var(--radius-sm, 4px);
  transition: all 0.2s;
}

.nav-dropdown-toggle:hover,
.nav-dropdown:hover .nav-dropdown-toggle {
  color: white;
  background: rgba(255,255,255,0.1);
}

.nav-dropdown-toggle[aria-expanded="true"] {
  color: white;
  background: rgba(255,255,255,0.15);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 280px;
  background: #134e4a;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 8px 0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  z-index: 100;
  margin-top: 4px;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown-toggle[aria-expanded="true"] + .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-group {
  padding: 4px 0;
}

.nav-dropdown-group + .nav-dropdown-group {
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: 4px;
  padding-top: 8px;
}

.nav-dropdown-heading {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.55);
  padding: 4px 16px 2px;
  user-select: none;
}

.nav-dropdown-link {
  display: block;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 400;
  padding: 6px 16px;
  transition: all 0.15s;
  white-space: nowrap;
}

.nav-dropdown-link:hover {
  color: white;
  background: rgba(255,255,255,0.1);
}

.nav-dropdown-link.active {
  color: white;
  background: rgba(255,255,255,0.15);
  font-weight: 600;
}

/* Mobile hamburger */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: white;
}

.nav-hamburger svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 768px) {
  .top-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    display: none;
  }

  .top-nav.open {
    display: flex;
  }

  .nav-hamburger {
    display: block;
    align-self: center;
  }

  .nav-dropdown-menu {
    position: static;
    transform: none;
    min-width: auto;
    border: none;
    box-shadow: none;
    background: rgba(0,0,0,0.15);
    border-radius: 4px;
    margin: 4px 0 0 0;
    padding: 4px 0;
  }

  .nav-dropdown:hover .nav-dropdown-menu {
    display: none;
  }

  .nav-dropdown.open .nav-dropdown-menu {
    display: block;
  }

  .nav-dropdown-toggle {
    width: 100%;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
  }

  .nav-link {
    padding: 8px 12px;
  }

  .nav-dropdown-link {
    padding: 8px 16px 8px 24px;
    font-size: 0.85rem;
  }
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: white;
  margin-bottom: 4px;
}

.logo-img {
  height: 48px;
  width: auto;
  border-radius: 6px;
}

.logo-text {
  font-size: 1.75rem;
  font-weight: 700;
}

.logo-text span {
  font-weight: 400;
  opacity: 0.85;
}

.tagline {
  font-size: 1rem;
  opacity: 0.8;
  font-weight: 400;
}

/* Steps */
.step {
  padding: 28px 0;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.step-number {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.step-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.step-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

/* Inputs */
.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.input-group label small {
  color: var(--text-secondary);
  font-weight: 400;
}

.input-with-prefix {
  position: relative;
}

.input-with-prefix .prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 1rem;
  pointer-events: none;
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s;
}

.input-with-prefix input {
  padding-left: 38px;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Global focus visible style for accessibility */
*:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* Toggle Bar */
.toggle-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.875rem;
  user-select: none;
  /* Ensure minimum tap target size */
  min-height: 44px;
  padding: 5px 0;
}

.toggle-label small {
  color: var(--text-secondary);
}

.toggle-label input[type="checkbox"] {
  display: none;
}

.toggle-switch {
  width: 44px; /* Increased for better tap target */
  height: 24px; /* Increased for better tap target */
  background: var(--border);
  border-radius: 12px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 20px; /* Increased size */
  height: 20px; /* Increased size */
  background: white;
  border-radius: 50%;
  top: 2px; /* Adjusted positioning */
  left: 2px; /* Adjusted positioning */
  transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.toggle-label input:checked + .toggle-switch {
  background: var(--primary);
}

.toggle-label input:checked + .toggle-switch::after {
  transform: translateX(20px); /* Adjusted for new size */
}

/* Method Grid */
.method-section {
  margin-bottom: 24px;
}

.method-section h3 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.method-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.method-card:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.method-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.method-card .method-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.method-card .method-detail {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.method-card .method-check {
  float: right;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  transition: all 0.2s;
}

.method-card.selected .method-check {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Radio Cards */
.payoff-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s;
  /* Ensure minimum tap target size */
  min-height: 44px;
}

.radio-card:hover {
  border-color: var(--primary);
}

.radio-card:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
}

.radio-card input {
  accent-color: var(--primary);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.radio-card-content {
  display: flex;
  flex-direction: column;
}

.radio-card-content strong {
  font-size: 0.9rem;
}

.radio-card-content span {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Buttons */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
  /* Minimum tap target size for mobile */
  min-height: 44px;
  min-width: 44px;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-large {
  width: 100%;
  padding: 16px;
  font-size: 1.1rem;
  border-radius: var(--radius);
  /* Larger tap target for primary actions */
  min-height: 50px;
}

.btn-small {
  padding: 8px 16px;
  font-size: 0.875rem;
  /* Ensure minimum tap target size */
  min-height: 44px;
  min-width: 44px;
}

.btn-ghost {
  background: none;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  /* Minimum tap target size for mobile */
  min-height: 44px;
  min-width: 44px;
}

.btn-ghost:hover {
  border-color: var(--text-secondary);
  color: var(--text);
}

.btn-add {
  background: none;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  width: 100%;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--primary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  /* Minimum tap target size for mobile */
  min-height: 44px;
}

.btn-add:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* Custom Form */
.custom-form {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 12px;
}

.custom-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.custom-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

/* Results */
.result-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  position: relative;
  transition: all 0.2s;
}

.result-card:first-child {
  border-color: var(--success);
  box-shadow: var(--shadow-lg);
}

.result-rank {
  position: absolute;
  top: -10px;
  left: 16px;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.rank-1 { background: var(--success); color: white; }
.rank-2 { background: var(--primary); color: white; }
.rank-3 { background: var(--silver); color: white; }
.rank-4, .rank-5 { background: var(--border); color: var(--text-secondary); }

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.result-name {
  font-weight: 700;
  font-size: 1.1rem;
}

.result-type {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.result-cost {
  text-align: right;
}

.result-total {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.result-savings {
  font-size: 0.8rem;
  color: var(--success);
  font-weight: 500;
}

.result-savings::before { content: "✓ "; }

.result-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.detail-item {
  display: flex;
  flex-direction: column;
}

.detail-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.detail-value {
  font-size: 0.95rem;
  font-weight: 600;
}

.detail-value.good { color: var(--success); }
.detail-value.warning { color: var(--warning); }
.detail-value.danger { color: var(--danger); }

/* Add icons for colorblind accessibility */
.detail-value.good::before { content: "✓ "; }
.detail-value.warning::before { content: "⚠️ "; }
.detail-value.danger::before { content: "❌ "; }

.result-notes {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--warning-light);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--warning);
}

.result-notes::before { content: "⚠️ "; }

.result-notes.good-note {
  background: var(--success-light);
  color: var(--success);
}

.result-notes.good-note::before { content: "✓ "; }

/* Mobile enhancements for result cards */
@media (max-width: 600px) {
  .result-card {
    padding: 16px;
  }
  
  .result-name {
    font-size: 1.2rem; /* Slightly larger on mobile for readability */
  }
  
  .result-total {
    font-size: 1.5rem; /* Larger on mobile for key numbers */
  }
  
  .result-details {
    grid-template-columns: 1fr 1fr; /* Two columns on mobile */
    gap: 10px;
  }
  
  .detail-label {
    font-size: 0.75rem; /* Slightly larger on mobile */
  }
  
  .detail-value {
    font-size: 1rem; /* Larger on mobile for better readability */
  }
}

/* Payoff Comparison */
.comparison-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 28px 0 14px;
}

/* Responsive table wrapper for horizontal scrolling on mobile */
.payoff-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.payoff-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: var(--surface);
  min-width: 500px; /* Ensure table doesn't compress on small screens */
}

.payoff-table thead {
  background: #f1f3f7;
}

.payoff-table th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  white-space: nowrap; /* Prevent header text from wrapping */
}

.payoff-table td {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  white-space: nowrap; /* Prevent cell content from wrapping */
}

.payoff-table tr.best-row td {
  background: var(--success-light);
  font-weight: 600;
}

/* Custom method tag */
.custom-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-top: 10px;
  margin-right: 8px;
  font-size: 0.85rem;
}

.custom-tag .remove-custom {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

/* Slider */
.slider-group {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.slider-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  margin-bottom: 14px;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  transition: transform 0.15s;
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
}

.slider-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preset-btn {
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  font-size: 0.8rem;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.preset-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.preset-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Scenario table inside result card */
.scenario-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-top: 12px;
}

.scenario-table th {
  text-align: left;
  padding: 6px 8px;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.scenario-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #f1f3f7;
}

.scenario-table tr.scenario-highlight td {
  background: var(--primary-light);
  font-weight: 600;
}

.scenario-table tr.scenario-danger td {
  color: var(--danger);
}

.scenario-table .scenario-label {
  font-weight: 500;
}

/* Availability badge */
.availability-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  margin-top: 4px;
}

.avail-anywhere { background: var(--success-light); color: var(--success); }
.avail-partner { background: var(--warning-light); color: var(--warning); }
.avail-both { background: #f0fdfa; color: var(--primary); }

/* Annual rewards & fee advice */
.annual-rewards-box {
  margin-top: 12px;
  padding: 12px 14px;
  background: #f8f9fb;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.annual-rewards-header {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.annual-rewards-header small {
  font-weight: 400;
  color: var(--text-secondary);
}

.annual-rewards-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.annual-rewards-stats span {
  color: var(--text-secondary);
}

.annual-rewards-stats strong {
  color: var(--success);
}

.fee-advice {
  font-size: 0.8rem;
  padding: 8px 10px;
  border-radius: 6px;
  line-height: 1.4;
}

.fee-advice.good-note {
  background: var(--success-light);
  color: var(--success);
}

.fee-advice.result-notes {
  background: var(--warning-light);
  color: var(--warning);
}

/* Affiliate apply button */
.btn-apply {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 20px;
  background: var(--success);
  color: white;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.2s;
  text-align: center;
}

.btn-apply:hover {
  background: #047857;
}

/* FTC Disclosure */
.disclosure {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: #f1f3f7;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* Site-wide disclosure banner */
.site-disclosure-banner {
  background: #fff8e6;
  border-bottom: 1px solid #ffd54f;
  padding: 12px 0;
  font-size: 0.85rem;
  text-align: center;
  color: #5d4037;
}

.site-disclosure-banner a {
  color: #e65100;
  text-decoration: underline;
  font-weight: 600;
}

.site-disclosure-banner a:hover {
  color: #bf360c;
}

.site-disclosure-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Credit Score CTA */
.cta-box {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--primary-light);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 20px;
}

.cta-box strong {
  font-size: 0.95rem;
}

.cta-box span {
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex: 1;
}

/* Empty state hints */
.empty-hint {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-style: italic;
  grid-column: 1 / -1;
  padding: 8px 0;
}

/* Utility */
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 600px) {
  .header { padding: 28px 0 24px; }
  .logo { font-size: 1.4rem; }
  .method-grid { grid-template-columns: 1fr; }
  .custom-form-grid { grid-template-columns: 1fr; }
  .result-header { flex-direction: column; gap: 8px; }
  .result-cost { text-align: left; }
  .result-details { grid-template-columns: 1fr 1fr; }
  .payoff-table { font-size: 0.75rem; }
  .payoff-table th, .payoff-table td { padding: 8px 10px; }
}

/* Tier headings */
.tier-heading {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 28px 0 4px;
  padding-top: 20px;
}

.tier-heading:first-child {
  margin-top: 0;
  padding-top: 0;
}

.tier-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 14px;
}

/* Scroll to results animation */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-card {
  animation: slideIn 0.3s ease-out;
}

.result-card:nth-child(2) { animation-delay: 0.05s; }
.result-card:nth-child(3) { animation-delay: 0.1s; }
.result-card:nth-child(4) { animation-delay: 0.15s; }
.result-card:nth-child(5) { animation-delay: 0.2s; }

/* Loading States and Skeleton Screens */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.8;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  margin-left: 10px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.skeleton {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--surface);
  border-radius: var(--radius);
  z-index: 10;
  display: none;
}

.skeleton.active {
  display: block;
}

.skeleton-bar {
  height: 16px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  border-radius: 4px;
  margin-bottom: 12px;
  animation: shimmer 1.5s infinite;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-bar {
    animation: none;
    background: #f0f0f0;
  }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-placeholder {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

/* Input Row Layout */
.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

@media (max-width: 600px) {
  .input-row {
    grid-template-columns: 1fr;
  }
}

/* Months Slider */
.months-display {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.25rem 0.625rem;
  border-radius: 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

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

.payoff-months-control {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.months-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--border, #e2e8f0);
  border-radius: 8px;
  background: var(--surface, #f8fafc);
  color: var(--text, #1e293b);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background .15s, border-color .15s, color .15s;
  padding: 0;
  line-height: 1;
}

.months-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary, #2563eb);
  color: var(--primary, #2563eb);
}

.months-btn:active {
  background: var(--primary, #2563eb);
  color: #fff;
  border-color: var(--primary, #2563eb);
}

.months-btn-minus {
  font-size: 1.2rem;
}

.months-btn-plus {
  font-size: 1rem;
}

.months-slider {
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

.months-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Quick Estimate */
.quick-estimate {
  background: linear-gradient(135deg, #f0fdfa 0%, #99f6e4 100%);
  border: 1.5px solid #bae6fd;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  animation: fadeIn 0.3s ease;
}

/* Results Section Skeleton */
#results-section {
  position: relative;
}

#results-skeleton {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 5;
  display: none;
}

#results-skeleton.active {
  display: block;
}

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

/* Results fade-in animation (skeleton transition) */
.results-ready {
  animation: fadeInResults 0.4s ease forwards;
}

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

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .results-ready {
    animation: none;
    opacity: 1;
  }
}

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

.estimate-row:last-of-type {
  margin-bottom: 0.375rem;
}

.estimate-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.estimate-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.estimate-note {
  font-size: 0.6875rem;
  color: #64748b;
  font-style: italic;
  margin-top: 0.375rem;
  padding-top: 0.375rem;
  border-top: 1px solid #bae6fd;
}

.select-large {
  font-size: 1rem;
  padding: 0.75rem 1rem;
}

/* Collapsible Section */
.step-header.collapsible {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.step-header.collapsible h2 {
  flex: 1;
  margin: 0;
}

.step-header.collapsible h2 span.selected-count {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: none;
  margin-left: 0.5rem;
}

.btn-expand {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-expand:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.methods-content {
  overflow: hidden;
  transition: all 0.3s ease;
}

.methods-content.collapsed {
  max-height: 0;
  opacity: 0;
  padding: 0;
}

.methods-content:not(.collapsed) {
  max-height: 2000px;
  opacity: 1;
  padding-top: 1rem;
}

/* Best Match Section */
.best-match-section {
  margin: 1.5rem 0 2rem;
}

.best-match-card {
  background: linear-gradient(135deg, #fff 0%, #ecfdf5 100%);
  border: 2px solid var(--success);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}

.best-match-card .result-card {
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
  animation: none;
}

.best-match-card .result-card:first-child {
  border: none;
}

.best-match-why {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--success-light);
  color: var(--success);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  margin-bottom: 1rem;
}

/* New Card Option */
.new-card-option {
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: linear-gradient(135deg, #f0fdfa 0%, #fff 100%);
  border: 2px solid #14b8a6;
  border-radius: var(--radius);
}

.new-card-option .tier-heading {
  margin-top: 0;
  padding-top: 0;
  color: #1e40af;
}

.new-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #ccfbf1;
  color: #1e40af;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

/* Alternatives Section */
.alternatives-section {
  margin: 2rem 0;
}

.alternatives-section .tier-heading {
  color: var(--text-secondary);
  font-size: 1rem;
}

#quick-payoff-section .tier-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

/* Other Periods Section */
.other-periods-section {
  margin: 2rem 0;
  padding-top: 1.5rem;
  border-top: 2px solid var(--border);
}

.other-periods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.period-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.period-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.period-card.selected {
  border-color: var(--success);
  background: var(--success-light);
}

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

.period-months {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--text);
}

.period-cost {
  font-weight: 700;
  font-size: 1rem;
  color: var(--success);
}

.period-cost.has-interest {
  color: var(--warning);
}

.period-best {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.period-payment {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Compact Results for Mobile */
@media (max-width: 600px) {
  .best-match-card {
    padding: 1rem;
  }
  
  .best-match-card .result-card {
    padding: 0;
  }
  
  .best-match-card .result-header {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .best-match-card .result-cost {
    text-align: left;
  }
  
  .best-match-card .result-total {
    font-size: 1.5rem;
  }
  
  .best-match-card .result-details {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  
  .new-card-option {
    padding: 1rem;
  }
  
  .new-card-option .result-card {
    padding: 0.75rem 0;
  }
  
  .alternatives-section .result-card {
    padding: 0.875rem;
  }
  
  .alternatives-section .result-header {
    flex-direction: column;
    gap: 0.375rem;
  }
  
  .alternatives-section .result-cost {
    text-align: left;
  }
  
  .alternatives-section .result-details {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding-top: 0.625rem;
    margin-top: 0.5rem;
  }
  
  .other-periods-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  
  .period-card {
    padding: 0.625rem;
  }
  
  .scenario-table {
    font-size: 0.7rem;
  }
  
  .scenario-table th,
  .scenario-table td {
    padding: 4px 6px;
  }
}

/* Credit Card APR Display */
.apr-comparison {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.8125rem;
}

.apr-comparison .apr-label {
  color: var(--text-secondary);
}

.apr-comparison .apr-value {
  font-weight: 700;
  color: var(--danger);
}

.apr-comparison .apr-vs {
  color: var(--text-secondary);
}

.apr-comparison .apr-bnpl {
  font-weight: 600;
  color: var(--success);
}

/* Quick Summary Cards (keeping for reference, now Best Match) */
.best-match-section {
  margin: 1.5rem 0 2rem;
}

/* Print Styles */
@media print {
  /* Hide navigation, footer, and other non-essential elements */
  .top-nav,
  .footer,
  .btn-add,
  .btn-expand,
  .btn-ghost,
  .btn-primary:not(.print-btn),
  .toggle-bar,
  .methods-content:not(.collapsed),
  .chart-section,
  .chart-toggle,
  .schedule-header,
  .filter-bar,
  .year-toggle-container,
  .crypto-toggle-section,
  .consolidation-card,
  #consolidation-results,
  #credit-score-cta,
  #affiliate-disclosure,
  .disclosure,
  .seo-content,
  .breadcrumbs,
  .step-header.collapsible .btn-expand,
  .print-btn {
    display: none !important;
  }
  
  /* Show all results content */
  .methods-content.collapsed {
    max-height: none !important;
    opacity: 1 !important;
    padding-top: 1rem !important;
  }
  
  /* Force black text on white background for readability */
  body,
  .header,
  .result-card,
  .payoff-table,
  .scenario-table,
  .period-card,
  .debt-summary,
  .spending-summary,
  .extra-payment-section,
  .consolidation-results-card,
  .recommendations,
  .milestone,
  .schedule-month,
  .article-header,
  .article-body,
  .article-meta,
  .seo-content {
    color: black !important;
    background: white !important;
    border-color: #000 !important;
  }
  
  /* Ensure text remains readable */
  body {
    font-size: 12pt;
    line-height: 1.4;
  }
  
  /* Set sensible margins */
  @page {
    margin: 0.75in;
  }
  
  /* Prevent breaking inside important elements */
  .result-card,
  .payoff-table,
  .scenario-table,
  .period-card,
  .debt-summary,
  .spending-summary,
  .consolidation-results-card,
  .milestone,
  .schedule-month,
  table tr {
    break-inside: avoid;
  }
  
  /* Show calculator inputs as summary at top */
  .input-group,
  .spending-category,
  .debt-card {
    border: 1px solid #000;
    padding: 8px;
    margin-bottom: 8px;
    page-break-inside: avoid;
  }
  
  /* Show link URLs after link text for external links */
  a[href^='http']::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    word-break: break-all;
  }
  
  /* Hide link URLs for navigation links */
  .top-nav a[href^='http']::after,
  .breadcrumbs a[href^='http']::after {
    content: '' !important;
  }
  
  /* Ensure tables display properly */
  .payoff-table,
  .scenario-table,
  .strategy-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10pt;
  }
  
  .payoff-table th,
  .payoff-table td,
  .scenario-table th,
  .scenario-table td,
  .strategy-comparison-table th,
  .strategy-comparison-table td {
    border: 1px solid #000;
    padding: 4px;
    text-align: left;
  }
  
  /* Show proper page title */
  .logo {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }
  
  /* Show Last updated stamp */
  .article-meta,
  #data-stamp-mount {
    font-size: 0.8rem;
    margin-bottom: 1rem;
  }
  
  /* Improve contrast for important elements */
  .result-card:first-child {
    border: 2px solid #000 !important;
  }
  
  .result-total,
  .step-header h2 {
    font-size: 1.3rem;
  }
  
  /* Keep one main chart per page if charts are printed */
  .chart-container {
    page-break-inside: avoid;
    margin-bottom: 1rem;
  }
  
  /* Show expand/collapse buttons as static text */
  .step-header.collapsible h2::after {
    content: " (Details)";
    font-size: 0.8rem;
    color: #666;
  }
}
/* ============================================ */
/* PWA Install Banner                           */
/* ============================================ */
#pwa-install-banner {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100% - 32px);
  padding: 10px 14px;
  background: #fff;
  color: #111;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.12);
  font-size: 0.9rem;
  animation: pwa-slide-up 240ms ease-out;
}
.pwa-install-text { font-weight: 500; }
.pwa-install-btn {
  border: 0;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
}
.pwa-install-accept { background: #0d9488; color: #fff; }
.pwa-install-accept:hover { background: #0f766e; }
.pwa-install-dismiss { background: #f3f4f6; color: #374151; }
.pwa-install-dismiss:hover { background: #e5e7eb; }
@keyframes pwa-slide-up {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@media (prefers-reduced-motion: reduce) {
  #pwa-install-banner { animation: none; }
}
@media print {
  #pwa-install-banner { display: none !important; }
}

/* Learn Page Styles */
.lead {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.learn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.learn-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s ease;
}

.learn-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.learn-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.learn-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

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

/* Page title in header */
.header-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  margin: 8px 0 4px;
}

/* Footer Grid */
.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-heading {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: center;
}

@media (max-width: 600px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}
