/* ─────────────────────────────────────────
   ROI Calculator — On Agency
   Design system mirrors on-agency-client-dashboard (dark mode)
───────────────────────────────────────── */

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

/* ── Design Tokens (dark theme — locked) ── */
:root {
  --bg:             #0a0a0a;
  --bg-1:           #111111;
  --bg-2:           #161616;
  --bg-3:           #1c1c1c;
  --bg-4:           #242424;
  --border:         rgba(255, 255, 255, 0.08);
  --border-hover:   rgba(255, 255, 255, 0.15);
  --text-primary:   #ededed;
  --text-secondary: #888888;
  --text-tertiary:  #505050;

  /* Blue accent — matches dashboard nav-active */
  --accent:         #3b82f6;
  --accent-dim:     rgba(59, 130, 246, 0.12);
  --accent-glow:    rgba(28, 89, 248, 0.22);
  --accent-text:    #89adff;
  --accent-border:  rgba(59, 130, 246, 0.40);

  /* Semantic colors */
  --green:          #22c55e;
  --green-dim:      rgba(34, 197, 94, 0.12);
  --green-border:   rgba(34, 197, 94, 0.22);
  --red:            #ef4444;
  --red-dim:        rgba(239, 68, 68, 0.12);
  --red-border:     rgba(239, 68, 68, 0.22);

  /* Layout */
  --nav-height:     60px;
  --max-width:      1100px;
  --section-gap:    80px;

  /* Component radii */
  --radius-card:    10px;
  --radius-badge:   6px;
  --radius-btn:     7px;
  --radius-input:   8px;
  --radius-pill:    8px;
}

/* ── Base ── */
html {
  scroll-behavior: smooth;
}

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

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ── Focus ── */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ═══════════════════════════════════
   NAVIGATION
═══════════════════════════════════ */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(10, 10, 10, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.02em;
  transition: opacity 0.15s;
}

.nav-logo:hover {
  opacity: 0.75;
}

.logo-text {
  color: var(--text-primary);
}

/* ═══════════════════════════════════
   BUTTONS
═══════════════════════════════════ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-btn);
  background: var(--accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-family: inherit;
  text-decoration: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s, transform 0.1s;
}

.btn-primary:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.btn-primary:active {
  opacity: 0.78;
  transform: translateY(0);
}

.btn-lg {
  padding: 14px 32px;
  font-size: 15px;
  border-radius: 9px;
  letter-spacing: -0.015em;
}

/* ═══════════════════════════════════
   HERO SECTION
═══════════════════════════════════ */
.hero {
  position: relative;
  padding: calc(var(--nav-height) + 72px) 28px 64px;
  text-align: center;
  overflow: hidden;
}

.hero-grid-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%);
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border-radius: 100px;
  background: var(--accent-glow);
  border: 1px solid var(--accent-border);
  color: var(--accent-text);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero-title {
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.12;
  color: var(--text-primary);
}

.hero-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 460px;
}

.desktop-br { display: block; }

/* ═══════════════════════════════════
   CALCULATOR SECTION
═══════════════════════════════════ */
.calculator-section {
  padding: 0 28px var(--section-gap);
}

.calculator-container {
  max-width: var(--max-width);
  margin: 0 auto;
}

.calculator-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}

/* ═══════════════════════════════════
   INPUTS COLUMN
═══════════════════════════════════ */
.inputs-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-group {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px 22px;
  transition: border-color 0.15s;
}

.input-group:focus-within {
  border-color: var(--border-hover);
}

.input-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 14px;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

/* ── Text Input ── */
.text-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  font-weight: 500;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  appearance: none;
  -moz-appearance: textfield;
}

.text-input::-webkit-outer-spin-button,
.text-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.text-input::placeholder {
  color: var(--text-tertiary);
  font-weight: 400;
}

.text-input:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.65);
  background: var(--bg-3);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.10);
}

/* ── Dollar Input ── */
.dollar-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  overflow: hidden;
}

.dollar-input-wrapper:focus-within {
  border-color: rgba(59, 130, 246, 0.65);
  background: var(--bg-3);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.10);
}

.dollar-prefix {
  padding: 11px 2px 11px 14px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  flex-shrink: 0;
  user-select: none;
}

.dollar-input {
  border: none;
  background: transparent;
  border-radius: 0;
  padding-left: 4px;
  box-shadow: none !important;
}

.dollar-input:focus {
  border: none;
  background: transparent;
  box-shadow: none;
}

/* ── Pill Buttons ── */
.pill-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  flex: 1;
  min-width: 100px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  text-align: center;
}

.pill:hover:not(.active) {
  border-color: var(--border-hover);
  background: var(--bg-3);
  color: var(--text-primary);
}

.pill.active {
  background: var(--accent-glow);
  border-color: var(--accent-border);
  color: var(--accent-text);
  font-weight: 600;
}

/* ── Business Type Cards ── */
.business-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.business-card {
  padding: 18px;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: var(--bg-2);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  user-select: none;
}

.business-card:hover:not(.active) {
  border-color: var(--border-hover);
  background: var(--bg-3);
}

.business-card.active {
  background: rgba(28, 89, 248, 0.10);
  border-color: var(--accent-border);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.15) inset;
}

.card-icon {
  font-size: 22px;
  line-height: 1;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.015em;
}

.card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.card-examples {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.6;
}

/* ── Close Rate Slider (conditional) ── */
.close-rate-group {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
  margin-top: -12px;
  transition:
    max-height 0.30s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.22s ease,
    padding 0.22s ease,
    border-width 0.22s ease,
    margin-top 0.22s ease;
}

.close-rate-group.visible {
  max-height: 200px;
  opacity: 1;
  padding-top: 20px;
  padding-bottom: 20px;
  border-width: 1px;
  margin-top: 0;
}

.slider-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-badge);
  background: var(--accent-glow);
  border: 1px solid var(--accent-border);
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  transition: background 0.15s;
  font-variant-numeric: tabular-nums;
}

.slider-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider-bound {
  font-size: 12px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  transition: opacity 0.15s;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
  transition: box-shadow 0.15s, transform 0.1s;
}

.slider::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.20);
  transform: scale(1.05);
}

.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

/* ═══════════════════════════════════
   RESULTS COLUMN
═══════════════════════════════════ */
.results-column {
  position: sticky;
  top: calc(var(--nav-height) + 20px);
}

.results-panel {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.results-header {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.results-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.results-subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ── Result Cards Grid ── */
.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.result-card {
  padding: 16px 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.result-card.result-loss {
  background: var(--red-dim);
  border-color: var(--red-border);
}

.result-card.result-gain {
  background: var(--green-dim);
  border-color: var(--green-border);
}

.result-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.3;
}

.result-card.result-loss .result-label { color: var(--red); opacity: 0.90; }
.result-card.result-gain .result-label { color: var(--green); opacity: 0.90; }

.result-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  transition: opacity 0.15s;
  font-variant-numeric: tabular-nums;
}

.result-card.result-loss .result-value { color: var(--red); }
.result-card.result-gain .result-value { color: var(--green); }

.result-value.updating {
  opacity: 0.5;
}

/* ── Breakeven Callout ── */
.breakeven-callout {
  background: var(--accent);
  border-radius: 9px;
  padding: 14px 18px;
  font-size: 13px;
  font-weight: 500;
  color: #ffffff;
  text-align: center;
  line-height: 1.55;
}

.breakeven-callout strong {
  font-weight: 700;
}

/* ═══════════════════════════════════
   BOTTOM CTA SECTION
═══════════════════════════════════ */
.cta-section {
  padding: var(--section-gap) 28px;
  background:
    radial-gradient(ellipse 70% 200px at 50% 0%, rgba(28, 89, 248, 0.12), transparent),
    linear-gradient(180deg, var(--bg) 0%, #090e1a 50%, var(--bg) 100%);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.cta-inner {
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.cta-title {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.15;
  color: var(--text-primary);
}

.cta-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* ═══════════════════════════════════
   FOOTER
═══════════════════════════════════ */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.footer-link {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-link:hover {
  color: var(--text-secondary);
}

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

  .results-column {
    position: static;
    top: auto;
  }

  .desktop-br {
    display: none;
  }

  .hero {
    padding: calc(var(--nav-height) + 48px) 20px 48px;
  }

  .calculator-section {
    padding: 0 20px 60px;
  }

  .top-nav {
    padding: 0 20px;
  }

  .site-footer {
    padding: 18px 20px;
  }

  .cta-section {
    padding: 60px 20px;
  }
}

@media (max-width: 560px) {
  .business-type-grid {
    grid-template-columns: 1fr;
  }

  .pill-group {
    flex-direction: column;
    gap: 6px;
  }

  .pill {
    min-width: unset;
    flex: none;
  }

  .hero-title {
    font-size: 26px;
  }

  .hero-subtitle {
    font-size: 14px;
  }

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

  .top-nav {
    padding: 0 16px;
  }

  .calculator-section {
    padding: 0 16px 48px;
  }

  .site-footer {
    flex-direction: column;
    gap: 8px;
    text-align: center;
    padding: 18px 16px;
  }

  .cta-section {
    padding: 48px 16px;
  }
}

@media (max-width: 380px) {
  .results-grid {
    grid-template-columns: 1fr;
  }

  .result-value {
    font-size: 24px;
  }
}
