/* FuelFairy website: shared styles for the map page and the policy pages */
:root {
  --navy: #0A0F1E;
  --navy-2: #111827;
  --navy-3: #1F2937;
  --line: #E5E7EB;
  --text: #111827;
  --muted: #6B7280;
  --surface: #FFFFFF;      /* panels, cards, popups */
  --surface-2: #F9FAFB;    /* hover rows */
  --surface-3: #F3F4F6;    /* empty logo tiles */
  --accent-soft: #F0FDF4;  /* highlighted suggestion */
  --green: #22C55E;
  --green-dark: #16A34A;
  --amber: #F59E0B;
  --red: #EF4444;
  --bg: #F6F7F9;
  --radius: 10px;
  --header-h: 64px;
  color-scheme: light;
}

/* Dark theme: set on <html> by the inline script in each page's <head>, from
   the saved choice or the device setting */
:root[data-theme="dark"] {
  --line: #1F2937;
  --text: #F9FAFB;
  --muted: #9CA3AF;
  --surface: #111827;
  --surface-2: #172033;
  --surface-3: #1F2937;
  --accent-soft: #1C3324;
  --bg: #0A0F1E;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green-dark); }
button, input, select { font: inherit; }

/* ── Header ───────────────────────────────────────────── */
.site-header {
  height: var(--header-h);
  background: var(--navy);
  color: #F9FAFB;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: inherit; text-decoration: none; flex-shrink: 0;
}
.brand img { width: 40px; height: 40px; border-radius: 10px; }
.wordmark {
  font-family: 'Rajdhani', sans-serif; font-weight: 700;
  font-size: 26px; letter-spacing: 0.5px; line-height: 1;
}
.wordmark span { color: var(--green); }

.header-controls { flex: 1; display: flex; gap: 10px; max-width: 640px; margin: 0 auto; }
.search { position: relative; flex: 1; }
.search input {
  width: 100%; height: 40px; border-radius: 8px; border: 1px solid var(--navy-3);
  background: var(--navy-2); color: #F9FAFB; padding: 0 36px 0 38px; outline: none;
}
.search input::placeholder { color: #9CA3AF; }
.search input:focus { border-color: var(--green); }
.search input::-webkit-search-cancel-button { display: none; }
.search .icon { position: absolute; left: 12px; top: 11px; width: 18px; height: 18px; color: #9CA3AF; }
.search .clear {
  position: absolute; right: 6px; top: 6px; width: 28px; height: 28px;
  border: 0; background: none; color: #9CA3AF; cursor: pointer; display: none;
}
.suggestions {
  position: absolute; top: 46px; left: 0; right: 0; z-index: 20;
  background: var(--surface); color: var(--text); border-radius: 8px; overflow: hidden;
  box-shadow: 0 12px 32px rgba(0,0,0,0.18); display: none; list-style: none; margin: 0; padding: 0;
}
.suggestions li { padding: 11px 14px; cursor: pointer; border-top: 1px solid var(--line); font-size: 14px; }
.suggestions li:first-child { border-top: 0; }
.suggestions li:hover, .suggestions li.active { background: var(--accent-soft); }
.suggestions li.empty { color: var(--muted); cursor: default; }

.fuel-select {
  height: 40px; border-radius: 8px; border: 1px solid var(--navy-3);
  background: var(--navy-2); color: #F9FAFB; padding: 0 10px; cursor: pointer;
}

.store-buttons { display: flex; gap: 8px; flex-shrink: 0; }
.store-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 14px; border-radius: 8px;
  background: #000; color: #fff; text-decoration: none; border: 1px solid #3F3F46;
  line-height: 1.05; white-space: nowrap;
}
.store-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.store-btn small { display: block; font-size: 10px; opacity: 0.8; }
.store-btn strong { display: block; font-size: 15px; font-weight: 600; }
.store-btn:hover { border-color: var(--green); }
.store-btn.soon { opacity: 0.55; cursor: default; pointer-events: none; }

/* ── Map page layout ──────────────────────────────────── */
.map-layout { display: flex; height: calc(100vh - var(--header-h)); height: calc(100dvh - var(--header-h)); }
.sidebar {
  width: 360px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.sidebar-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.sidebar-head h1 { font-family: 'Rajdhani', sans-serif; font-size: 20px; margin: 0; letter-spacing: 0.3px; }
.sidebar-head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.station-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.station-list li {
  display: flex; gap: 12px; align-items: center; padding: 12px 16px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.station-list li:hover { background: var(--surface-2); }
.station-list .price { font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 22px; width: 64px; flex-shrink: 0; }
.station-list .info { flex: 1; min-width: 0; }
.station-list .name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.station-list .addr { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.station-list .logo, .pin .logo {
  width: 32px; height: 32px; border-radius: 6px; object-fit: contain; background: #fff; flex-shrink: 0;
}
.station-list .logo.blank { background: var(--surface-3); }
.pin .logo.blank { background: #F3F4F6; }
.list-message { padding: 28px 20px; text-align: center; color: var(--muted); font-size: 14px; }
.sidebar-foot { padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.sidebar-foot a { color: var(--muted); }

.map-wrap { flex: 1; position: relative; min-width: 0; }
#map { position: absolute; inset: 0; }
.map-notice {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 5;
  background: var(--navy); color: #fff; border-radius: 20px; padding: 8px 16px;
  font-size: 13px; font-weight: 600; box-shadow: 0 4px 14px rgba(0,0,0,0.2); display: none; white-space: nowrap;
}
.map-notice.show { display: block; }

/* Map pins: brand logo + price, like the app's side-by-side pins */
.pin {
  display: flex; align-items: center; height: 30px; border-radius: 7px; overflow: hidden;
  background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.3); cursor: pointer;
}
/* (no position here: MapLibre positions the marker element itself) */
.pin .logo { width: 30px; height: 30px; border-radius: 0; padding: 3px; }
.pin .amount { color: #fff; font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 15px; padding: 0 7px; height: 100%; display: flex; align-items: center; }
.pin.cheapest { outline: 2px solid var(--green); outline-offset: 1px; z-index: 2; }

.popup h3 { margin: 0 0 2px; font-size: 15px; }
.popup .addr { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.popup table { border-collapse: collapse; width: 100%; font-size: 13px; }
.popup td { padding: 3px 0; }
.popup td:last-child { text-align: right; font-weight: 600; }
.popup tr.selected td { color: var(--green-dark); }
.popup .updated { font-size: 11px; color: var(--muted); margin-top: 6px; }
.popup .directions { display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 600; }
.maplibregl-popup-content { border-radius: var(--radius); padding: 12px 14px; min-width: 210px; background: var(--surface); color: var(--text); }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--surface); }
.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: var(--surface); }
.maplibregl-popup-close-button { color: var(--muted); }

/* Theme toggle */
.theme-toggle {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--navy-3); background: var(--navy-2); color: #F9FAFB;
  display: inline-flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { border-color: var(--green); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }

.mobile-cta { display: none; }

/* ── Policy pages ─────────────────────────────────────── */
.doc { max-width: 760px; margin: 0 auto; padding: 36px 20px 64px; line-height: 1.6; }
.doc h1 { font-family: 'Rajdhani', sans-serif; font-size: 34px; margin: 0 0 4px; }
.doc .updated { color: var(--muted); margin: 0 0 28px; font-size: 14px; }
.doc h2 { font-size: 18px; margin: 30px 0 8px; }
.doc p, .doc li { font-size: 15px; }
.doc ul { padding-left: 22px; }
.doc .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 16px 0; }
.site-footer { border-top: 1px solid var(--line); padding: 20px; text-align: center; font-size: 13px; color: var(--muted); }
.site-footer a { color: var(--muted); margin: 0 8px; }

/* ── Phones ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .store-buttons { display: none; }
}
@media (max-width: 760px) {
  :root { --header-h: auto; }
  .site-header { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px; }
  .header-controls { flex-basis: 100%; max-width: none; order: 2; }
  .theme-toggle { margin-left: auto; width: 36px; height: 36px; }
  .wordmark { font-size: 22px; }
  .brand img { width: 34px; height: 34px; }
  .map-layout { flex-direction: column; height: auto; }
  .map-wrap { flex: none; height: 62vh; height: 62dvh; order: -1; }
  .sidebar { width: 100%; border-right: 0; padding-bottom: 76px; }
  .station-list { overflow: visible; }
  .mobile-cta {
    display: flex; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--navy);
    box-shadow: 0 -4px 16px rgba(0,0,0,0.25);
  }
  .mobile-cta .store-btn { flex: 1; justify-content: center; }
  .doc { padding-top: 24px; }
}

/* ── Suburb price pages ───────────────────────────────── */
.doc.wide { max-width: 980px; }
.crumbs { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.crumbs a { color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.suburb-links { line-height: 2; }
.suburb-list { columns: 3 220px; padding: 0; list-style: none; }
.suburb-list li { padding: 3px 0; break-inside: avoid; font-size: 14px; }
.suburb-list .muted { font-size: 12px; }
.card.highlight { border-color: var(--green); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.prices { border-collapse: collapse; width: 100%; font-size: 14px; }
table.prices th, table.prices td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.prices th:first-child, table.prices td:first-child { text-align: left; white-space: normal; min-width: 200px; }
table.prices th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); }
table.prices tr:last-child td { border-bottom: 0; }
table.prices td.best { color: var(--green-dark); font-weight: 700; }
:root[data-theme="dark"] table.prices td.best { color: var(--green); }
.app-cta { display: flex; align-items: center; gap: 16px; justify-content: space-between; flex-wrap: wrap; margin-top: 32px; }
.app-cta p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
