/* ============================================================
   ev-portal.css — Shared design system for ev2rule EV tools
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --brand:       #2563eb;
  --brand-dark:  #1d4ed8;
  --brand-light: #eff6ff;
  --accent:      #10b981;
  --accent-dark: #059669;
  --warn:        #f59e0b;
  --danger:      #ef4444;
  --text:        #0f172a;
  --text-2:      #475569;
  --text-3:      #94a3b8;
  --bg:          #ffffff;
  --surface:     #ffffff;
  --surface-2:   #f1f5f9;
  --border:      #e2e8f0;
  --border-2:    #cbd5e1;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow:      0 4px 16px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
  --shadow-lg:   0 20px 50px rgba(0,0,0,.10), 0 8px 20px rgba(0,0,0,.05);
  --radius:      16px;
  --radius-sm:   10px;
  --radius-lg:   24px;
  --transition:  .2s cubic-bezier(.4,0,.2,1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  min-height: 100vh;
}

/* ── Typography ───────────────────────────────────────────── */
h1 { font-size: clamp(28px,5vw,48px); font-weight: 800; letter-spacing: -.04em; line-height: 1.1; }
h2 { font-size: clamp(20px,3vw,30px); font-weight: 700; letter-spacing: -.03em; }
h3 { font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
h4 { font-size: 15px; font-weight: 600; }

/* ── Portal Nav ───────────────────────────────────────────── */
.ev-nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.ev-nav-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 8px; height: 64px;
}
.ev-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text); font-weight: 800;
  font-size: 20px; letter-spacing: -.04em; margin-right: 16px;
  flex-shrink: 0;
}
.ev-logo-bolt {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #7c3aed);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; box-shadow: 0 4px 12px rgba(37,99,235,.3);
}
.ev-logo span { color: var(--brand); }
.ev-logo em { color: #7c3aed; font-style: normal; }

.ev-nav-links {
  display: flex; align-items: center; gap: 2px; flex: 1;
  overflow-x: auto; scrollbar-width: none;
}
.ev-nav-links::-webkit-scrollbar { display: none; }

.ev-nav-link {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 10px;
  font-size: 13px; font-weight: 600; text-decoration: none;
  color: var(--text-2); white-space: nowrap;
  transition: all var(--transition);
}
.ev-nav-link:hover { background: var(--brand-light); color: var(--brand); }
.ev-nav-link.active { background: var(--brand); color: #fff; }
.ev-nav-link.news-link { color: var(--accent); }
.ev-nav-link.news-link:hover { background: #d1fae5; color: var(--accent-dark); }
.ev-nav-link .emoji { font-size: 15px; }

.ev-nav-right { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-shrink: 0; }

/* ── Page Shell ───────────────────────────────────────────── */
.ev-page { min-height: calc(100vh - 64px); }

.ev-container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.ev-container-wide { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* ── Buttons ──────────────────────────────────────────────── */
.ev-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: 12px; font: inherit;
  font-weight: 600; font-size: 14px; cursor: pointer;
  border: none; transition: all var(--transition);
  text-decoration: none; white-space: nowrap;
}
.ev-btn-brand {
  background: linear-gradient(135deg, var(--brand), #7c3aed);
  color: #fff; box-shadow: 0 4px 16px rgba(37,99,235,.3);
}
.ev-btn-brand:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(37,99,235,.4); }
.ev-btn-accent {
  background: linear-gradient(135deg, var(--accent), #0d9488);
  color: #fff; box-shadow: 0 4px 16px rgba(16,185,129,.3);
}
.ev-btn-accent:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(16,185,129,.4); }
.ev-btn-soft { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.ev-btn-soft:hover { background: var(--border); }
.ev-btn-outline { background: transparent; color: var(--brand); border: 2px solid var(--brand); }
.ev-btn-outline:hover { background: var(--brand-light); }
.ev-btn-sm { padding: 8px 16px; font-size: 13px; border-radius: 9px; }
.ev-btn-lg { padding: 16px 32px; font-size: 16px; border-radius: 14px; }
.ev-btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ── Cards ────────────────────────────────────────────────── */
.ev-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
  box-shadow: var(--shadow);
}
.ev-card-sm { padding: 20px; border-radius: var(--radius); }

/* ── Forms ────────────────────────────────────────────────── */
.ev-field { display: flex; flex-direction: column; gap: 6px; }
.ev-label {
  font-size: 12px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-2);
}
.ev-input, .ev-select {
  padding: 11px 14px; border: 1.5px solid var(--border-2);
  border-radius: 11px; font: inherit; font-size: 14px;
  color: var(--text); background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.ev-input:focus, .ev-select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.ev-select { cursor: pointer; }

.ev-range { width: 100%; accent-color: var(--brand); }
.ev-range-row { display: flex; align-items: center; gap: 14px; }
.ev-range-val { font-weight: 700; color: var(--brand); min-width: 60px; text-align: right; }

/* ── Result panels ────────────────────────────────────────── */
.ev-result {
  background: linear-gradient(135deg, var(--brand-light), #ede9fe);
  border: 1.5px solid var(--brand); border-radius: var(--radius-lg);
  padding: 28px; margin-top: 24px;
}
.ev-result-price { font-size: 42px; font-weight: 900; color: var(--brand); letter-spacing: -.04em; }
.ev-result-label { font-size: 13px; color: var(--text-2); font-weight: 600; margin-top: 4px; }

.ev-result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-top: 20px; }
.ev-result-stat {
  background: var(--surface); border-radius: var(--radius);
  padding: 16px; border: 1px solid var(--border);
}
.ev-result-stat-val { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -.03em; }
.ev-result-stat-label { font-size: 12px; color: var(--text-2); font-weight: 600; margin-top: 2px; }

/* ── Badges / Pills ───────────────────────────────────────── */
.ev-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.ev-badge-blue    { background: var(--brand-light); color: var(--brand-dark); }
.ev-badge-green   { background: #d1fae5; color: #065f46; }
.ev-badge-yellow  { background: #fef3c7; color: #92400e; }
.ev-badge-red     { background: #fee2e2; color: #991b1b; }
.ev-badge-purple  { background: #ede9fe; color: #5b21b6; }
.ev-badge-gray    { background: var(--surface-2); color: var(--text-2); }

/* ── Tool grid on home ────────────────────────────────────── */
.ev-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.ev-tool-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
  text-decoration: none; color: var(--text);
  box-shadow: var(--shadow); transition: all var(--transition);
  display: flex; flex-direction: column; gap: 14px;
  position: relative; overflow: hidden;
}
.ev-tool-card::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(37,99,235,.04));
  pointer-events: none;
}
.ev-tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand);
}
.ev-tool-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; flex-shrink: 0;
}
.ev-tool-card h3 { font-size: 17px; line-height: 1.2; }
.ev-tool-card p { font-size: 13px; color: var(--text-2); line-height: 1.6; flex: 1; }
.ev-tool-arrow { font-size: 20px; color: var(--brand); align-self: flex-end; }

/* ── Section headers ──────────────────────────────────────── */
.ev-section { padding: 64px 0; }
.ev-section-alt { background: var(--surface-2); }
.ev-section-header { margin-bottom: 40px; }
.ev-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px;
  background: var(--brand-light); color: var(--brand);
  font-size: 12px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; margin-bottom: 14px;
}
.ev-subtitle { font-size: 17px; color: var(--text-2); margin-top: 10px; line-height: 1.6; max-width: 600px; }

/* ── News deck ────────────────────────────────────────────── */
.ev-news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.ev-news-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: all var(--transition);
  text-decoration: none; color: var(--text);
  display: flex; flex-direction: column;
}
.ev-news-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.ev-news-img {
  height: 180px; background-size: cover; background-position: center;
  background-color: var(--brand-light);
  flex-shrink: 0;
}
.ev-news-body { padding: 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.ev-news-source { font-size: 11px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .06em; }
.ev-news-title { font-size: 16px; font-weight: 700; line-height: 1.3; letter-spacing: -.02em; }
.ev-news-desc { font-size: 13px; color: var(--text-2); line-height: 1.6; flex: 1; }
.ev-news-date { font-size: 12px; color: var(--text-3); }

/* ── Hero on tool pages ───────────────────────────────────── */
.ev-tool-hero {
  background: linear-gradient(135deg, var(--brand), #7c3aed);
  color: #fff; padding: 64px 0 48px;
}
.ev-tool-hero h1 { color: #fff; }
.ev-tool-hero .ev-subtitle { color: rgba(255,255,255,.8); }

/* ── Tables ───────────────────────────────────────────────── */
.ev-table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.ev-table { width: 100%; border-collapse: collapse; min-width: 500px; }
.ev-table th {
  background: var(--surface-2); padding: 12px 16px;
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-2); text-align: left;
  border-bottom: 1px solid var(--border);
}
.ev-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.ev-table tr:last-child td { border-bottom: 0; }
.ev-table tr:hover td { background: var(--brand-light); }

/* ── Comparison columns ───────────────────────────────────── */
.ev-compare-grid { display: grid; gap: 20px; }
.ev-compare-col {
  background: var(--surface); border: 2px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.ev-compare-col.winner { border-color: var(--accent); }
.ev-compare-head {
  background: linear-gradient(135deg, var(--brand-light), #ede9fe);
  padding: 20px; border-bottom: 1px solid var(--border);
}
.ev-compare-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--border); font-size: 14px; }
.ev-compare-row:last-child { border-bottom: 0; }
.ev-compare-row .ev-compare-label { color: var(--text-2); font-size: 12px; }
.ev-compare-row .ev-compare-val { font-weight: 700; }

/* ── Loading state ────────────────────────────────────────── */
.ev-loading { display: flex; align-items: center; gap: 12px; color: var(--text-2); padding: 40px 0; }
.ev-spinner {
  width: 24px; height: 24px; border: 3px solid var(--border);
  border-top-color: var(--brand); border-radius: 50%;
  animation: ev-spin .8s linear infinite;
}
@keyframes ev-spin { to { transform: rotate(360deg); } }

/* ── Toast / Alert ────────────────────────────────────────── */
.ev-alert {
  padding: 14px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  display: flex; align-items: flex-start; gap: 10px;
}
.ev-alert-info    { background: var(--brand-light); color: var(--brand-dark); border: 1px solid rgba(37,99,235,.2); }
.ev-alert-success { background: #d1fae5; color: #065f46; border: 1px solid rgba(16,185,129,.2); }
.ev-alert-warn    { background: #fef3c7; color: #92400e; border: 1px solid rgba(245,158,11,.2); }

/* ── Footer ───────────────────────────────────────────────── */
.ev-footer {
  background: #0f172a; color: #94a3b8;
  padding: 40px 0; margin-top: 80px;
  font-size: 13px;
}
.ev-footer-inner { max-width: 1280px; margin: 0 auto; padding: 0 24px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.ev-footer-logo { color: #fff; font-weight: 800; font-size: 17px; letter-spacing: -.03em; }
.ev-footer-logo span { color: #60a5fa; }
.ev-footer-logo em { color: #a78bfa; font-style: normal; }
.ev-footer p { color: #64748b; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .ev-container, .ev-container-wide { padding: 0 16px; }
  .ev-nav-inner { padding: 0 16px; }
  .ev-tools-grid { grid-template-columns: 1fr; }
  .ev-news-grid  { grid-template-columns: 1fr; }
  .ev-section { padding: 40px 0; }
  .ev-tool-hero { padding: 40px 0 32px; }
  .ev-card { padding: 20px; }
  .ev-result-price { font-size: 32px; }
}

/* ── Utility override ─────────────────────────────────────── */
.utility-status {
  color: #f97316 !important;
}

/* ── Ticker Component ─────────────────────────────────────── */
.ev-ticker-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.ev-ticker-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  font-size: 15px;
  box-shadow: var(--shadow-sm);
}
.ev-ticker-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-light);
  transform: scale(1.05);
}
.ev-ticker-wrap {
  width: 100%;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px 0;
  margin-bottom: 0;
  position: relative;
  display: flex;
  box-shadow: var(--shadow-sm);
}
.ev-ticker-wrap::-webkit-scrollbar {
  display: none;
}

@keyframes ev-ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ev-ticker {
  animation: ev-ticker-scroll 60s linear infinite;
  display: flex;
  flex-shrink: 0;
  gap: 16px;
  padding: 0 8px;
}
.ev-ticker:hover {
  animation-play-state: paused;
}
.ev-ticker-item {
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid var(--border-2);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ev-ticker-item:hover {
  background: var(--brand-light);
  color: var(--brand-dark);
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.15);
}

/* ── 75:25 Split Layout for Tool Pages ────────────────────── */
.ev-split-layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(280px, 1fr);
  gap: 24px;
  margin-top: 16px;
}
.ev-tool-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
}
.ev-tool-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ev-sidebar-title {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-2);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  padding-left: 4px;
}
.ev-sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 14.5px;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.ev-sidebar-link:hover {
  border-color: var(--brand);
  background: var(--brand-light);
  transform: translateX(4px);
}
.ev-sidebar-link.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand-dark);
  pointer-events: none;
}

@media (max-width: 1024px) {
  .ev-split-layout { grid-template-columns: 1fr; }
}

/* Override utility icons to orange */
.utility-icon { background: rgba(249,115,22,0.1) !important; }
.ev-bike-icon .bike-wheel, .ev-bike-icon .bike-handle { border-color: #f97316 !important; }
.ev-bike-icon .bike-frame, .ev-bike-icon .bike-seat { background: #f97316 !important; }
.ev-charger-icon .charger-body { border-color: #f97316 !important; }
.ev-charger-icon .charger-bolt { border-bottom-color: #f97316 !important; }
.ev-charger-icon .charger-cable { border-color: #f97316 !important; }
.ev-charger-icon .charger-tip { background: #f97316 !important; }
