/* ============================================================
   AI Implementation True Cost Calculator — Styles
   Light theme, professional, clean — optimized for readability
   Research: NN/g + Piepenbrock et al. (2013) confirms light mode
   outperforms dark for all ages, especially older professionals.
   ============================================================ */

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

:root {
  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #f8fafc;
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  --text: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --accent: #16a34a;
  --accent-hover: #15803d;
  --accent-light: #f0fdf4;
  --primary: #1e3a5f;
  --primary-hover: #172e4a;
  --primary-light: #eff6ff;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --navy: #1e3a5f;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.08);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font);
  background: var(--bg-subtle);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Hero --- */
.hero {
  padding: 80px 0 60px;
  text-align: center;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-bottom: 1px solid var(--border);
}

.hero-badge {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 100px;
  margin-bottom: 24px;
  letter-spacing: 0.5px;
  border: 1px solid rgba(22,163,74,0.15);
}

.hero h1 {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 20px;
  letter-spacing: -1px;
  color: var(--navy);
}

.hero h1 em {
  font-style: normal;
  color: var(--danger);
}

.hero-sub {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 32px;
  line-height: 1.7;
}

/* --- Stats Bar --- */
.stats-bar {
  background: var(--navy);
  color: #ffffff;
  padding: 24px 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-width: 800px;
}

.stat { text-align: center; }

.stat-number {
  font-size: 28px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.stat-label {
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  margin-top: 2px;
}

/* --- Calculator Section --- */
.calculator-section {
  padding: 60px 0;
}

.calculator-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}

/* --- Progress Bar --- */
.progress-bar {
  margin-bottom: 40px;
}

.progress-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0.4;
  transition: opacity 0.3s;
}

.step.active, .step.done {
  opacity: 1;
}

.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  transition: all 0.3s;
}

.step.active .step-num {
  background: var(--navy);
  color: white;
}

.step.done .step-num {
  background: var(--accent);
  color: white;
}

.step-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.step-line {
  width: 80px;
  height: 2px;
  background: var(--border);
  margin: 0 8px;
  margin-bottom: 22px;
}

/* --- Form Steps --- */
.form-step {
  display: none;
  animation: fadeIn 0.3s ease;
}

.form-step.active {
  display: block;
}

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

.form-step h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
  color: var(--navy);
}

.step-desc {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 32px;
}

/* --- Form Fields --- */
.field-group {
  margin-bottom: 24px;
}

.field-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.field-hint {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  font-family: var(--font);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
  background: #ffffff;
}

.input::placeholder {
  color: var(--text-dim);
}

.input-sm {
  width: 120px;
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.input-prefix {
  display: flex;
  align-items: center;
  gap: 0;
}

.input-prefix span {
  padding: 12px 0 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  color: var(--text-muted);
  font-size: 15px;
}

.input-prefix .input {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* --- Radio Cards --- */
.radio-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.radio-cards.vertical {
  grid-template-columns: 1fr;
}

.radio-card {
  position: relative;
  cursor: pointer;
}

.radio-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-card-content {
  padding: 16px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.radio-card-content:hover {
  border-color: #cbd5e1;
  background: var(--bg-card-hover);
}

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

.radio-card-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 2px;
  color: var(--text);
}

.radio-card-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* --- Toggle --- */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  cursor: pointer;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 26px;
  transition: 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle input:checked + .toggle-slider {
  background: var(--accent);
}

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

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--navy);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(30,58,95,0.25);
}

.btn-accent {
  background: var(--accent);
  color: white;
}

.btn-accent:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(22,163,74,0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: #cbd5e1;
  background: var(--bg-subtle);
}

.btn-lg {
  padding: 16px 32px;
  font-size: 17px;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* --- Results --- */
.results-section {
  animation: fadeIn 0.5s ease;
}

.result-hero {
  text-align: center;
  padding: 32px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.result-hero-label {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.result-hero-number {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 900;
  color: var(--danger);
  letter-spacing: -1px;
}

/* Vendor comparison */
.vendor-comparison {
  background: var(--danger-light);
  border: 1px solid rgba(220,38,38,0.15);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 32px;
}

.vc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.vc-badge {
  background: var(--danger);
  color: white;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
}

#vc-text {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 100px;
  align-items: center;
  gap: 12px;
}

.bar-row .bar-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.bar-track {
  height: 28px;
  background: #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 2px;
}

.bar-vendor { background: var(--danger); }
.bar-real { background: var(--navy); }
.bar-real-high { background: #374151; }

.bar-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Year Cards */
.year-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.year-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
}

.year-card-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.year-card-amount {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.year-card-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Success gauge */
.success-section {
  margin-bottom: 32px;
}

.success-section h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--navy);
}

.success-gauge { margin: 12px 0; }

.gauge-track {
  height: 32px;
  background: #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
}

.gauge-fill {
  height: 100%;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: white;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.gauge-fill.gauge-red { background: linear-gradient(90deg, #dc2626, #ef4444); }
.gauge-fill.gauge-yellow { background: linear-gradient(90deg, #d97706, #f59e0b); }
.gauge-fill.gauge-green { background: linear-gradient(90deg, #16a34a, #22c55e); }

.gauge-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Risks */
.risks-section, .recs-section {
  margin-bottom: 32px;
}

.risks-section h3, .recs-section h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--navy);
}

.risk-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-left: 4px solid var(--danger);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px 20px;
  margin-bottom: 12px;
}

.risk-card.medium {
  border-left-color: var(--warning);
}

.risk-card.low {
  border-left-color: var(--accent);
}

.risk-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.risk-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 100px;
  text-transform: uppercase;
}

.risk-badge.high { background: rgba(220,38,38,0.1); color: #dc2626; }
.risk-badge.medium { background: rgba(217,119,6,0.1); color: #d97706; }
.risk-badge.low { background: rgba(22,163,74,0.1); color: #16a34a; }

.risk-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.risk-card-impact {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.risk-card-mitigation {
  font-size: 12px;
  color: var(--accent);
}

/* Recommendation cards */
.rec-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-left: 4px solid var(--navy);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px 20px;
  margin-bottom: 12px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.rec-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: var(--navy);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
}

.rec-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

/* CTA Section */
.cta-section {
  text-align: center;
  padding: 40px 0;
  border-top: 1px solid var(--border);
  margin-top: 32px;
}

.cta-section h3 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--navy);
}

.cta-section > p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 32px;
}

.cta-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  text-align: left;
}

.cta-card {
  background: var(--bg-subtle);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  position: relative;
}

.cta-card-premium {
  border-color: var(--accent);
  background: var(--accent-light);
}

.cta-popular {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 16px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cta-price {
  font-size: 36px;
  font-weight: 900;
  margin-bottom: 4px;
  color: var(--text);
}

.cta-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-muted);
}

.cta-features {
  list-style: none;
  margin-bottom: 24px;
}

.cta-features li {
  font-size: 13px;
  color: var(--text-muted);
  padding: 5px 0;
  padding-left: 20px;
  position: relative;
}

.cta-features li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

.cta-card .btn {
  width: 100%;
}

/* Recalc */
.recalc {
  text-align: center;
  padding: 24px 0 0;
}

/* --- Modal --- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

.modal-content h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--navy);
}

.modal-content p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 40px 0;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 14px;
  background: var(--bg);
}

.footer-small {
  font-size: 11px;
  margin-top: 4px;
}

/* --- Gated Content --- */
.gated-blur {
  position: relative;
  filter: blur(5px);
  -webkit-filter: blur(5px);
  pointer-events: none;
  user-select: none;
}

.gated-overlay {
  margin-top: -60px;
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 24px;
}

.gated-overlay-content {
  background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
  border: 2px dashed #94a3b8;
  border-radius: 12px;
  padding: 24px 32px;
  display: inline-block;
}

.gated-lock-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.gated-overlay-text {
  color: #475569;
  font-size: 14px;
  line-height: 1.5;
}

.gated-teaser {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  margin-top: 12px;
}

.gated-lock {
  font-weight: 700;
  color: #1e3a5f;
  font-size: 14px;
}

.gated-text {
  color: #64748b;
  font-size: 13px;
  margin-top: 4px;
}

.rec-card.blurred {
  opacity: 0.6;
}

/* --- Comparison Table --- */
.comparison-section {
  margin: 32px 0;
  padding: 24px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.comparison-section h3 {
  color: #1e3a5f;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.comparison-table th {
  background: #1e3a5f;
  color: white;
  padding: 10px 14px;
  text-align: center;
  font-weight: 600;
  font-size: 13px;
}

.comparison-table th:first-child {
  text-align: left;
}

.comparison-table th.selected-approach {
  background: #2563eb;
}

.comparison-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  text-align: center;
  font-size: 13px;
}

.comparison-table td:first-child {
  text-align: left;
}

.comparison-table td.selected-approach {
  background: #eff6ff;
}

.comparison-table tr:hover td {
  background: #f1f5f9;
}

.comparison-table tr:hover td.selected-approach {
  background: #dbeafe;
}

.comparison-insight {
  margin-top: 16px;
  padding: 16px;
  background: white;
  border-left: 4px solid #2563eb;
  border-radius: 0 8px 8px 0;
  font-size: 14px;
  line-height: 1.6;
  color: #334155;
}

.comparison-insight em {
  color: #64748b;
  font-size: 13px;
}

/* --- Free Resources --- */
.free-resources-section {
  margin: 24px 0;
  padding: 20px 24px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
}

.free-resources-section h3 {
  color: #166534;
  font-size: 16px;
  margin-bottom: 12px;
}

.free-resource-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.free-resource-list li {
  padding: 6px 0 6px 20px;
  position: relative;
  font-size: 13px;
  color: #374151;
  line-height: 1.5;
}

.free-resource-list li::before {
  content: "\2192";
  position: absolute;
  left: 0;
  color: #16a34a;
  font-weight: 700;
}

/* --- Modal Note --- */
.modal-note {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 8px;
  margin-bottom: 0;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .calculator-card { padding: 24px 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .radio-cards { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .year-cards { grid-template-columns: 1fr; }
  .cta-cards { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 80px 1fr 80px; }
  .hero { padding: 48px 0 32px; }
  .step-line { width: 40px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-number { font-size: 22px; }
  .step-label { display: none; }
  .step-line { margin-bottom: 0; }
}
