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

:root {
  --bg:         #0f1117;
  --surface:    #1a1d27;
  --surface2:   #232738;
  --border:     #2e3347;
  --text:       #e8eaf0;
  --text-muted: #8b90a8;
  --amber:      #f59e0b;
  --blue:       #3b82f6;
  --violet:     #a78bfa;
  --green:      #22c55e;
  --red:        #ef4444;
  --radius:     12px;
  --section-gap: 40px;
  --page-gutter: 24px;
}

html { color-scheme: dark; }

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

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--page-gutter);
}

.main-content {
  padding: 32px var(--page-gutter) 56px;
}

.main-content > .tab-panel {
  padding-top: 12px;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  position: sticky;
  top: 0;
  background: rgba(15, 17, 23, 0.92);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.top-segments {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px;
}

.segment-btn {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.segment-btn:hover {
  color: var(--text);
}

.segment-btn.is-active {
  background: var(--surface2);
  color: var(--text);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { font-size: 22px; line-height: 1; }
.brand h1 { font-size: 17px; font-weight: 600; letter-spacing: -0.3px; }

.header-meta { display: flex; align-items: center; gap: 10px; }

.last-updated { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

.btn-refresh {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 11px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s;
}
.btn-refresh:hover { background: var(--border); }
.btn-refresh.spinning { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Shared typography */
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.section-head {
  margin-bottom: 18px;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--text);
  text-transform: none;
}

.section-desc {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Stat cards (hero + FX) */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  flex: 1;
  min-width: 0;
}

.stat-card.petrol { border-top: 3px solid var(--amber); }
.stat-card.diesel { border-top: 3px solid var(--blue); }
.stat-card.fx { border-top: 3px solid var(--violet); }

.fuel-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.fuel-price {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -1.5px;
  line-height: 1.05;
}
.stat-card.petrol .fuel-price { color: var(--amber); }
.stat-card.diesel .fuel-price { color: var(--blue); }

.fuel-unit {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.fuel-diff {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
  min-height: 1.2em;
}
.fuel-diff.up   { color: var(--red); }
.fuel-diff.down { color: var(--green); }
.fuel-diff.flat { color: var(--text-muted); }

/* Overview: Delhi + FX */
.overview {
  display: grid;
  gap: 28px;
  margin-bottom: var(--section-gap);
}

@media (min-width: 768px) {
  .overview {
    grid-template-columns: 1fr minmax(280px, 340px);
    align-items: start;
    gap: 20px;
  }
}

.hero-prices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.fx-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.fx-currency {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--violet);
  margin-bottom: 8px;
}

.fx-pair {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.fx-pair .fx-value {
  display: block;
  margin-top: 4px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}

.fx-meta {
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Sections */
.section {
  margin-bottom: var(--section-gap);
}

.section-chart {
  margin-bottom: 0;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

/* City grid */
.city-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.city-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
  transition: border-color 0.15s, transform 0.15s;
}
.city-card:hover {
  border-color: #3d4460;
  transform: translateY(-1px);
}

.city-card-head {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.city-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.city-state {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.city-prices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.city-fuel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 10px;
  border-left: 2px solid var(--border);
}
.city-fuel.petrol { border-left-color: var(--amber); }
.city-fuel.diesel { border-left-color: var(--blue); }

.city-fuel-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.city-fuel-value {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.city-fuel-value.muted {
  font-weight: 500;
  color: var(--text-muted);
}

/* Chart */
.chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px 24px;
  position: relative;
  height: 320px;
}

.trend-status {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  min-height: 1.2em;
}

.loading-msg {
  color: var(--text-muted);
  font-size: 14px;
  padding: 24px 0;
  grid-column: 1 / -1;
}

/* News + analysis panels */
.news-reason-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.pill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.pill-card-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.pill-card-value {
  font-size: 22px;
  font-weight: 700;
}

.news-list {
  display: grid;
  gap: 10px;
}

.news-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.news-item-link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

.news-item-link:hover {
  border-color: #3d4460;
  transform: translateY(-1px);
}

.news-item-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.news-source {
  font-size: 12px;
  color: var(--text-muted);
}

.news-impact {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.news-impact.increase { color: #fca5a5; }
.news-impact.decrease { color: #86efac; }
.news-impact.neutral { color: var(--text-muted); }

.news-title {
  display: inline-block;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  margin-bottom: 6px;
}

.news-title:hover {
  text-decoration: underline;
}

.news-summary {
  font-size: 14px;
  color: var(--text);
  line-height: 1.45;
}

.news-tags {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.news-tag {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: capitalize;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.analysis-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.analysis-card-title {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.analysis-card-value {
  font-size: 24px;
  font-weight: 700;
}

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

.analysis-ethanol {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.ethanol-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}

.ethanol-table {
  width: 100%;
  border-collapse: collapse;
}

.ethanol-table th,
.ethanol-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px 4px;
  text-align: left;
  font-size: 12px;
}

.ethanol-table th {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 0 28px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

/* Responsive */
@media (max-width: 767px) {
  .main-content { padding-top: 24px; }

  .top-segments {
    display: flex;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }

  .hero-prices,
  .fx-grid {
    grid-template-columns: 1fr;
  }

  .fuel-price { font-size: 38px; }

  .fx-pair .fx-value { font-size: 22px; }
}

@media (max-width: 480px) {
  :root { --page-gutter: 16px; }

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

  .brand h1 { font-size: 15px; }
}
