/* ==========================================
   VoltVoyage — The EV Range Reality Check
   style.css
   ========================================== */

/* ---------- CSS Custom Properties ---------- */
:root {
  --bg-body: #0d1117;
  --bg-panel: #161b22;
  --bg-panel-alt: #21262d;
  --bg-input: #0d1117;
  --border-subtle: #30363d;
  --border-focus: #00d2ff;
  
  --text-primary: #c9d1d9;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  
  --color-safe: #3fb950;
  --color-warning: #d29922;
  --color-danger: #f85149;
  --color-accent: #00d2ff;
  
  --color-winter: #58a6ff;
  --color-highway: #8957e5;
  --color-climate: #ff7b72;
  --color-degradation: #d2a8ff;
  --color-buffer: #d29922;

  --font-ui: 'Barlow', 'Segoe UI', system-ui, sans-serif;
  --font-condensed: 'Barlow Condensed', 'Barlow', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 8px 24px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 15px rgba(0, 210, 255, 0.2);
  --transition: 0.3s ease;
}

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

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

body {
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-body);
  min-height: 100vh;
}

/* ---------- Container ---------- */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Header ---------- */
.site-header {
  background: rgba(22, 27, 34, 0.85);
  border-bottom: 2px solid var(--border-subtle);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  filter: drop-shadow(0 0 8px rgba(0,210,255,0.4));
}

.logo-icon svg {
  width: 100%;
  height: 100%;
}

.logo-text h1 {
  font-family: var(--font-condensed);
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
  line-height: 1.1;
  text-shadow: 0 0 10px rgba(0,210,255,0.3);
}

.tagline {
  font-size: 0.75rem;
  color: var(--color-accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

/* ---------- Ad Placeholders ---------- */
.ad-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
  margin: 20px auto;
  background: rgba(33, 38, 45, 0.4);
  border-radius: var(--radius-sm);
}

.ad-mobile {
  width: 320px;
  height: 50px;
  max-width: 100%;
}

.ad-desktop {
  display: none;
  width: 728px;
  height: 90px;
  max-width: 100%;
}

@media (min-width: 768px) {
  .ad-mobile { display: none; }
  .ad-desktop { display: flex; }
}

/* ---------- Main Content ---------- */
.main-content {
  padding-top: 24px;
  padding-bottom: 60px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---------- Panels ---------- */
.panel {
  background: var(--bg-panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--bg-panel-alt);
  border-bottom: 1px solid var(--border-subtle);
}

.panel-icon {
  width: 24px;
  height: 24px;
  color: var(--color-accent);
}

.panel-icon svg {
  width: 100%;
  height: 100%;
}

.panel-header h2 {
  font-family: var(--font-condensed);
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}

.panel-body {
  padding: 24px;
}

/* ---------- Forms ---------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

input[type="number"] {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  transition: var(--transition);
  width: 100%;
  max-width: 300px;
}

input[type="number"]:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--shadow-glow);
}

/* ---------- Instructions ---------- */
.instructions {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* ---------- Toggle Cards ---------- */
.toggles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

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

.toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
}

.toggle-card:hover {
  border-color: rgba(255,255,255,0.2);
  background: #1c2128;
}

.toggle-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-icon {
  font-size: 1.5rem;
}

.toggle-text h3 {
  font-size: 1rem;
  color: #fff;
  font-weight: 600;
}

.toggle-text p {
  font-size: 0.8rem;
  color: var(--color-danger);
  font-family: var(--font-mono);
  font-weight: 600;
}

/* Switch styling */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 24px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-subtle);
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  transition: .4s;
  border-radius: 50%;
}

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

input:focus + .slider {
  box-shadow: 0 0 1px var(--color-accent);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

/* ---------- Waterfall Chart ---------- */
.waterfall-container {
  margin-bottom: 32px;
}

.waterfall-bar {
  display: flex;
  width: 100%;
  height: 36px;
  background: var(--bg-input);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  position: relative;
}

.bar-segment {
  height: 100%;
  transition: width 0.6s cubic-bezier(0.25, 1, 0.5, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: #111;
  overflow: hidden;
  white-space: nowrap;
}

.bar-epa { background: var(--color-safe); }
.bar-penalty.winter { background: var(--color-winter); }
.bar-penalty.highway { background: var(--color-highway); }
.bar-penalty.climate { background: var(--color-climate); }
.bar-penalty.degradation { background: var(--color-degradation); }
.bar-buffer { background: var(--color-buffer); }

.waterfall-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.epa-dot { background: var(--color-safe); }
.winter-dot { background: var(--color-winter); }
.highway-dot { background: var(--color-highway); }
.climate-dot { background: var(--color-climate); }
.degradation-dot { background: var(--color-degradation); }
.buffer-dot { background: var(--color-buffer); }

/* ---------- Summary Cards ---------- */
.summary-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 600px) {
  .summary-cards {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.summary-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
}

.highlight-card {
  border-color: var(--color-safe);
  background: rgba(63, 185, 80, 0.05);
  box-shadow: inset 0 0 20px rgba(63,185,80,0.1);
}

.summary-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 8px;
}

.summary-value {
  font-family: var(--font-condensed);
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
}

.summary-unit {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  opacity: 0.8;
  margin-top: 4px;
}

.text-muted .summary-value { color: var(--text-primary); }
.text-danger .summary-value { color: var(--color-danger); }
.text-safe .summary-value { color: var(--color-safe); }

.buffer-note {
  font-size: 0.7rem;
  color: var(--color-buffer);
  margin-top: 8px;
  font-weight: 600;
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

/* ---------- Utilities ---------- */
.mt-20 { margin-top: 20px; }
.logo-svg { color: var(--color-accent); }
.bar-epa { width: 100%; }
.bar-penalty, .bar-buffer { width: 0%; }

/* ═══════════════ AFFILIATE & SEO ═══════════════ */
.seo-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 2rem 0;
}
.seo-card h2 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}
.seo-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}
.affiliate-gear a {
    color: var(--color-accent);
    font-weight: 600;
    text-decoration: none;
}
.affiliate-gear a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}
