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

:root {
  --bg: #0a0a0f;
  --bg-card: #13131a;
  --bg-input: #1a1a24;
  --border: #2a2a3a;
  --text: #e4e4ec;
  --text-muted: #8888a0;
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.15);
  --accent-green: #22c55e;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;
  --accent-blue: #3b82f6;
  --accent-purple: #a855f7;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body { min-height: 100vh; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */
.header {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.tagline {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.tagline em {
  color: var(--primary-light);
  font-style: italic;
}

/* ─── Hero ───────────────────────────────────────────────────────────────── */
.hero {
  padding: 48px 0 32px;
  text-align: center;
}
.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #fff 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}
.hero-sub {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ─── Main Grid ──────────────────────────────────────────────────────────── */
.main-grid {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 28px;
  padding-bottom: 60px;
  align-items: start;
}

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.card h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}
.card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-muted);
}

/* ─── Input Card ─────────────────────────────────────────────────────────── */
.input-card {
  position: sticky;
  top: 20px;
}

.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--primary-glow);
  color: var(--primary-light);
  padding: 2px 8px;
  border-radius: 99px;
}

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

select, input[type="number"] {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
}
select:focus, input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-prefix, .input-suffix {
  position: relative;
  display: flex;
  align-items: center;
}
.input-prefix span {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}
.input-prefix input { padding-left: 28px; }

.input-suffix span {
  position: absolute;
  right: 14px;
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}
.input-suffix input { padding-right: 52px; }

/* ─── Mileage Slider ────────────────────────────────────────────────────── */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin: 8px 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 0 10px var(--primary-glow);
}
input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
}
.mileage-display {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.mileage-display input {
  width: 100px;
  text-align: center;
  font-weight: 600;
}
.mileage-display span {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.mileage-presets {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.preset-btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}
.preset-btn:hover {
  border-color: var(--primary);
  color: var(--primary-light);
}
.preset-btn.active {
  background: var(--primary-glow);
  border-color: var(--primary);
  color: var(--primary-light);
}

.ev-only, .gas-only {
  transition: all 0.3s;
}

/* ─── Calculate Button ───────────────────────────────────────────────────── */
.btn-calculate {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}
.btn-calculate:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}
.btn-calculate:active {
  transform: translateY(0);
}

/* ─── Results Area ───────────────────────────────────────────────────────── */
.results-area {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ─── Summary Cards ──────────────────────────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: all 0.3s;
}
.summary-card.total {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--bg-card), rgba(99,102,241,0.08));
}
.summary-label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.summary-value {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.summary-card.total .summary-value {
  background: linear-gradient(135deg, #fff, var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 1.75rem;
}

/* ─── Charts ─────────────────────────────────────────────────────────────── */
.chart-card { }
.chart-wrapper {
  position: relative;
  width: 100%;
  height: 300px;
}
.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: center;
}
.donut-wrapper {
  height: 250px;
}

.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
}
.breakdown-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 500;
}
.breakdown-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.breakdown-value {
  font-weight: 700;
  font-size: 0.95rem;
}
.breakdown-pct {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-left: 6px;
}

/* ─── Table ──────────────────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
th {
  text-align: right;
  padding: 10px 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
th:first-child { text-align: left; }
td {
  text-align: right;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--primary-light);
}
tfoot td {
  font-weight: 700;
  border-bottom: none;
  border-top: 2px solid var(--border);
  padding-top: 14px;
}

/* ─── Differentiators ────────────────────────────────────────────────────── */
.differentiators {
  padding: 60px 0;
  border-top: 1px solid var(--border);
}
.diff-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
.diff-item {
  text-align: center;
}
.diff-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--primary-glow);
  color: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.diff-item h4 {
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 1rem;
}
.diff-item p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}
.diff-item em {
  color: var(--primary-light);
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ─── Animations ─────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in {
  animation: fadeIn 0.4s ease-out forwards;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
  .input-card {
    position: static;
  }
}

@media (max-width: 768px) {
  .hero h1 { font-size: 1.75rem; }
  .hero-sub { font-size: 0.95rem; }
  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }
  .chart-row {
    grid-template-columns: 1fr;
  }
  .diff-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .card { padding: 20px; }
  .header-inner {
    flex-direction: column;
    gap: 4px;
  }
}

@media (max-width: 480px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .hero h1 { font-size: 1.5rem; }
  table { font-size: 0.75rem; }
  th, td { padding: 8px 6px; }
}
