/* ===== CSS Variables ===== */
:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --primary-light: #e8f0fe;
  --success: #34a853;
  --danger: #ea4335;
  --warning: #fbbc04;
  --text: #202124;
  --text-secondary: #5f6368;
  --text-light: #80868b;
  --bg: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-card: #ffffff;
  --border: #dadce0;
  --shadow: 0 1px 3px rgba(60,64,67,0.12), 0 1px 2px rgba(60,64,67,0.08);
  --shadow-lg: 0 4px 12px rgba(60,64,67,0.15), 0 2px 6px rgba(60,64,67,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 1200px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'SF Mono', 'Consolas', monospace;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-secondary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ===== Header ===== */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.site-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-logo svg { width: 28px; height: 28px; }

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.25rem 0;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
  text-decoration: none;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle svg { width: 24px; height: 24px; color: var(--text); }

/* ===== Main Content ===== */
main {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1rem;
  width: 100%;
}

/* ===== Hero (Homepage) ===== */
.hero {
  text-align: center;
  padding: 3rem 0 2rem;
}

.hero h1 {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* ===== Calculator Grid (Homepage) ===== */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}

.calc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.calc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
}

.calc-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.calc-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.calc-card p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ===== Calculator Page Layout ===== */
.calc-page {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.calc-page h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.calc-page .subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

/* Calculator Tool */
.calc-tool {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

/* Form */
.calc-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group select {
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.15);
}

.form-group input::placeholder {
  color: var(--text-light);
}

/* Calculate Button */
.btn-calculate {
  grid-column: 1 / -1;
  padding: 0.875rem 2rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 0.5rem;
}

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

.btn-calculate:active {
  transform: scale(0.98);
}

/* Results */
.calc-results {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: none;
}

.calc-results.visible {
  display: block;
}

.result-highlight {
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  text-align: center;
  margin-bottom: 1rem;
}

.result-highlight .label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-highlight .value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 0.25rem;
}

.result-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.result-item {
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.result-item .label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.result-item .value {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 0.125rem;
}

/* Amortization Schedule */
.amort-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: var(--primary);
  cursor: pointer;
  margin-top: 1rem;
  width: 100%;
  text-align: center;
}

.amort-toggle:hover { background: var(--bg-secondary); }

.amort-table-wrapper {
  display: none;
  margin-top: 1rem;
  overflow-x: auto;
}

.amort-table-wrapper.visible { display: block; }

.amort-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.amort-table th {
  background: var(--bg-secondary);
  padding: 0.625rem 0.75rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.amort-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.amort-table tr:hover td {
  background: var(--primary-light);
}

/* ===== SEO Content Section ===== */
.seo-content {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.seo-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.seo-block.full-width {
  grid-column: 1 / -1;
}

.seo-block h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.seo-block h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1rem 0 0.5rem;
  color: var(--text);
}

.seo-block p,
.seo-block li {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.seo-block ul {
  padding-left: 1.25rem;
}

.seo-block li { margin-bottom: 0.375rem; }

/* ===== Breadcrumb ===== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

.breadcrumb a { color: var(--text-secondary); }
.breadcrumb span { color: var(--text); font-weight: 500; }

/* ===== Footer ===== */
.site-footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 2rem 1rem;
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  font-size: 0.8125rem;
}

.footer-links a { color: var(--text-secondary); }
.footer-copy {
  font-size: 0.8125rem;
  color: var(--text-light);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.75rem; }

  .nav-links { display: none; }
  .nav-toggle { display: block; }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    box-shadow: var(--shadow);
  }

  .calc-form { grid-template-columns: 1fr; }
  .result-details { grid-template-columns: 1fr 1fr; }
  .seo-content { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.5rem; }
  .hero p { font-size: 0.9375rem; }
  .result-details { grid-template-columns: 1fr; }
  .calc-tool { padding: 1.25rem; }
  .footer-inner { flex-direction: column; }
  .comparison-grid { grid-template-columns: 1fr; }
}

/* ===== CTA / Affiliate Section ===== */
.cta-section {
  display: none;
  margin-top: 1.5rem;
}
.cta-section.visible { display: block; }
.cta-card {
  background: linear-gradient(135deg, #f0fdfa 0%, #e8f0fe 100%);
  border: 2px solid #0d9488;
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
}
.cta-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.cta-card h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.cta-card p { color: var(--text-secondary); margin-bottom: 1.25rem; font-size: 0.95rem; }
.cta-button {
  display: inline-block;
  padding: 0.875rem 2rem;
  background: #0d9488;
  color: white !important;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none !important;
  transition: background 0.2s;
}
.cta-button:hover { background: #0f766e; }

/* ===== Insurance Needs: Score Display ===== */
.score-display {
  text-align: center;
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.score-value {
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary);
}
.score-value.score-low { color: var(--danger); }
.score-value.score-mid { color: var(--warning); }
.score-value.score-high { color: var(--success); }
.score-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* ===== Status Cards (Insurance Needs) ===== */
.status-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.status-card {
  padding: 1rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid;
}
.status-card.status-covered { border-color: var(--success); background: #f0fdf4; }
.status-card.status-gap { border-color: var(--danger); background: #fef2f2; }
.status-card.status-review { border-color: var(--warning); background: #fffbeb; }
.status-card h4 { font-size: 0.9rem; margin-bottom: 0.25rem; }
.status-card p { font-size: 0.8rem; color: var(--text-secondary); margin: 0; }

/* ===== Comparison Grid (Deductible vs Premium) ===== */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
.comparison-column {
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.comparison-column.winner {
  border-color: var(--success);
  background: #f0fdf4;
}
.winner-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--success);
  color: white;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  margin-left: 0.5rem;
  vertical-align: middle;
}
.comparison-column h4 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}
.comparison-column .metric {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
}
.comparison-column .metric:last-child { border-bottom: none; }
.comparison-column .metric .val { font-weight: 600; }

/* ===== Cost Bar (Deductible visual) ===== */
.cost-bar {
  height: 24px;
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  margin: 0.5rem 0;
}
.cost-bar-fill {
  height: 100%;
  border-radius: 12px;
  transition: width 0.5s;
}
.cost-bar-fill.bar-a { background: var(--primary); }
.cost-bar-fill.bar-b { background: #0d9488; }

/* ===== Checkbox / Radio Groups ===== */
.checkbox-group, .radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.checkbox-item, .radio-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
}
.checkbox-item input, .radio-item input {
  width: auto;
}
.radio-group {
  flex-direction: column;
}

/* ===== Conditional Fields ===== */
.form-group.conditional { display: none; }
.form-group.conditional.show { display: flex; }

/* ===== Disclosure Notice ===== */
.affiliate-disclosure {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.75rem;
  font-style: italic;
}

/* ===== Cookie Consent ===== */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--text);
  color: #fff;
  padding: 0.875rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 9999;
  font-size: 0.875rem;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.15);
}
.cookie-banner p { margin: 0; }
.cookie-banner a { color: #8ab4f8; text-decoration: underline; }
.cookie-btn {
  background: #fff;
  color: var(--text);
  border: none;
  padding: 0.5rem 1.25rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}
.cookie-btn:hover { background: #e8e8e8; }
.cookie-banner.hidden { display: none; }
