/* ============================================================
   ServoSpy — Cockpit Clarity Design System v4
   Layout: compact header, list-left + map-right split on desktop
   ============================================================ */

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

:root {
  /* Base palette */
  --bg: #0a0a12;
  --bg-raised: #0f0f1c;
  --surface: #151524;
  --surface-2: #1c1c34;
  --surface-3: #24243e;
  --border: rgba(255, 255, 255, 0.06);
  --border-focus: rgba(0, 212, 170, 0.4);

  /* Text */
  --text: #eaeaf2;
  --text-secondary: #a8a8c0;
  --text-tertiary: #7a7a98;

  /* Accent */
  --accent: #00d4aa;
  --accent-dim: rgba(0, 212, 170, 0.15);
  --accent-glow: rgba(0, 212, 170, 0.25);

  /* Markup colours */
  --green: #00c853;
  --green-bg: rgba(0, 200, 83, 0.12);
  --green-border: rgba(0, 200, 83, 0.35);
  --yellow: #ffd600;
  --yellow-bg: rgba(255, 214, 0, 0.12);
  --yellow-border: rgba(255, 214, 0, 0.3);
  --red: #ff1744;
  --red-bg: rgba(255, 23, 68, 0.10);
  --red-border: rgba(255, 23, 68, 0.3);

  /* Typography */
  --font-display: 'Bricolage Grotesque', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'DM Mono', 'SF Mono', Consolas, monospace;

  /* Spacing & Layout */
  --header-h: 64px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Animation */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}


/* ---- Skip Link ---- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 10000;
  padding: 12px 20px;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 12px;
}

/* ---- Grain Texture Overlay ---- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

/* ---- Base ---- */
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(0, 212, 170, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(0, 212, 170, 0.02) 0%, transparent 50%);
}

#app {
  max-width: 640px;
  margin: 0 auto;
  position: relative;
}

/* When in split-view, #app goes full width */
.split-view#app,
.split-view #app {
  max-width: none;
}

/* ============================================================
   Global Focus-Visible Styles
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#location-input:focus-visible {
  outline: none;
  border-color: rgba(0, 212, 170, 0.5);
  box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.1), 0 0 20px rgba(0, 212, 170, 0.08);
  background: rgba(21, 21, 36, 0.9);
}

/* ============================================================
   Search Header — refined desktop bar
   ============================================================ */
#search-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(10, 10, 18, 0.82);
  backdrop-filter: blur(32px) saturate(1.6);
  -webkit-backdrop-filter: blur(32px) saturate(1.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding: env(safe-area-inset-top, 0) 0 0;
  box-shadow: 0 1px 0 rgba(0, 212, 170, 0.06), 0 8px 32px rgba(0, 0, 0, 0.3);
}

.search-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 24px;
  max-width: 640px;
  margin: 0 auto;
}

/* In split-view, header sticks left at a sensible width */
.split-view .search-inner {
  max-width: 640px;
  margin: 0;
}

/* ---- Brand ---- */
.brand {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
  color: var(--text);
  margin: 0;
  flex-shrink: 0;
  cursor: pointer;
  transition: opacity 0.2s;
}

.brand:hover {
  opacity: 0.85;
}

.brand-accent {
  color: var(--accent);
  text-shadow: 0 0 20px rgba(0, 212, 170, 0.3);
}

/* ---- Search Form (always visible, inline) ---- */
#search-form {
  flex: 1;
  min-width: 0;
}

/* ---- Fuel Toggle (Segmented Control) ---- */
.fuel-toggle {
  position: relative;
  display: flex;
  background: rgba(21, 21, 36, 0.8);
  border-radius: 10px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.fuel-btn {
  position: relative;
  z-index: 1;
  padding: 7px 16px;
  min-height: 34px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  border-radius: 7px;
  transition: color 0.25s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fuel-btn.active {
  color: var(--bg);
}

.fuel-slider {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  background: var(--accent);
  border-radius: 7px;
  transition: transform 0.35s var(--ease-spring);
  box-shadow: 0 2px 10px rgba(0, 212, 170, 0.3), 0 0 0 1px rgba(0, 212, 170, 0.1);
}

.fuel-toggle[data-active="DL"] .fuel-slider {
  transform: translateX(100%);
}

/* ---- Search Input ---- */
.typeahead-wrap {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
  transition: color 0.25s;
}

.typeahead-wrap:focus-within .search-icon {
  color: var(--accent);
}

.clear-btn {
  position: absolute;
  right: 36px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface-2);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.clear-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.clear-btn.hidden {
  display: none !important;
}

.gps-search-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color 0.25s, background 0.25s;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.gps-search-btn:hover {
  color: var(--accent);
  background: rgba(0, 212, 170, 0.08);
}

.gps-search-btn.hidden {
  display: none !important;
}

/* Shift GPS arrow icon to point north-east */
.gps-search-btn svg {
  transform: rotate(45deg);
}

#location-input {
  width: 100%;
  padding: 9px 66px 9px 36px;
  border: 1.5px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  background: rgba(21, 21, 36, 0.7);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  outline: none;
  transition: border-color 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out), background 0.3s;
  -webkit-appearance: none;
  min-height: 40px;
}

#location-input::placeholder {
  color: var(--text-tertiary);
  font-weight: 400;
}

#location-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  background: var(--bg-raised);
}

/* ---- Typeahead Dropdown ---- */
#suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  list-style: none;
  max-height: min(280px, 40vh);
  overflow-y: auto;
  z-index: 1001;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3);
  animation: dropdown-in 0.2s var(--ease-out);
  overscroll-behavior: contain;
}

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

#suggestions li {
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}

#suggestions li:last-child {
  border-bottom: none;
}

#suggestions li:hover,
#suggestions li.active {
  background: var(--surface-2);
}

#suggestions li.active {
  background: var(--accent-dim);
}

#suggestions li.no-results {
  color: var(--text-tertiary);
  font-size: 0.85rem;
  cursor: default;
  justify-content: center;
}

#suggestions li.suggestion-header {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  padding: 8px 16px 4px;
  cursor: default;
  min-height: auto;
  border-bottom: none;
}

#suggestions li.suggestion-header:hover {
  background: transparent;
}

#suggestions li .suburb-name {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
}

#suggestions li .suburb-name .match {
  color: var(--accent);
  font-weight: 700;
}

#suggestions li .suburb-postcode {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-tertiary);
  font-weight: 400;
  flex-shrink: 0;
}

/* ---- Search-active header state ---- */
#search-bar.search-active {
  border-bottom-color: rgba(0, 212, 170, 0.12);
  box-shadow: 0 1px 0 rgba(0, 212, 170, 0.08), 0 8px 40px rgba(0, 0, 0, 0.35);
}

#search-bar.search-active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 5%, rgba(0, 212, 170, 0.5) 50%, transparent 95%);
  opacity: 0.5;
  animation: search-line-in 0.6s var(--ease-out) both;
}

@keyframes search-line-in {
  from { transform: scaleX(0); opacity: 0; }
  to   { transform: scaleX(1); opacity: 1; }
}


/* ============================================================
   Landing — cheap fuel data loads immediately
   ============================================================ */
/* ---- Radius Selector ---- */
.radius-selector {
  position: relative;
  display: flex;
  background: rgba(21, 21, 36, 0.8);
  border-radius: 10px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.radius-selector.hidden {
  display: none !important;
}

.radius-label {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-tertiary);
  padding: 0 8px 0 10px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.radius-pill {
  position: relative;
  z-index: 1;
  padding: 7px 14px;
  min-height: 34px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 7px;
  transition: color 0.25s var(--ease-out), background 0.25s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.radius-pill.active {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 2px 10px rgba(0, 212, 170, 0.3), 0 0 0 1px rgba(0, 212, 170, 0.1);
}

.radius-pill:not(.active):hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}


/* Price tag row */
.card-price-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 8px;
}

.card-price-hero.price-tag {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  background: #f5f5f5;
  color: #333;
  padding: 6px 14px;
  border-radius: 8px;
  display: inline-flex;
  align-items: baseline;
  line-height: 1;
  margin: 0;
}

.price-dollar {
  color: #1b7a4a;
  margin-right: 1px;
}

.price-value {
  color: #333;
}

.price-tier {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.price-tier-cheapest {
  color: #2ecc71;
}

.price-tier-cheap {
  color: #58d68d;
}

.price-tier-average {
  color: #f39c12;
}

.price-tier-expensive {
  color: #e74c3c;
}

.price-tier-unavailable {
  color: #888;
  font-style: italic;
}

.price-tag-unavailable {
  background: #e0e0e0 !important;
}

.price-tag-unavailable .price-value {
  color: #999;
  font-size: 1.4rem;
  letter-spacing: 0.5px;
}

.station-unavailable {
  opacity: 0.65;
}

.map-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-tertiary);
  font-size: 0.85rem;
  text-align: center;
  padding: 24px;
}
.map-fallback-hint {
  margin-top: 8px;
  font-size: 0.75rem;
  opacity: 0.7;
}

/* ---- Quick Chips ---- */
.quick-chip {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 10px 18px;
  min-height: 44px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quick-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 12px rgba(0, 212, 170, 0.08);
}

.quick-chip:active {
  transform: scale(0.96);
}


/* ============================================================
   Station Rank Number
   ============================================================ */
.station-rank {
  position: absolute;
  top: 10px;
  right: 12px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-tertiary);
  opacity: 0.5;
  line-height: 1;
}

/* ============================================================
   Mobile Station Detail Bar
   ============================================================ */
.mobile-detail {
  display: none;
}
.mobile-detail.hidden {
  display: none !important;
}
@media (max-width: 899px) {
  .mobile-detail {
    display: block;
    position: sticky;
    top: var(--header-h, 56px);
    z-index: 998;
    background: rgba(15, 15, 28, 0.94);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-bottom: 1px solid var(--border);
    padding: 12px 14px;
    animation: detail-in 0.3s var(--ease-out) both;
  }
  .mobile-detail.hidden {
    display: none !important;
  }
  @keyframes detail-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .detail-inner {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .detail-price-col {
    flex-shrink: 0;
    text-align: center;
  }
  .detail-price-col .price-tag {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    background: #f5f5f5;
    color: #333;
    padding: 4px 10px;
    border-radius: 8px;
    display: inline-flex;
    align-items: baseline;
    line-height: 1;
  }
  .detail-price-col .price-dollar {
    color: #1b7a4a;
    margin-right: 1px;
  }
  .detail-price-col .price-tier {
    display: block;
    font-size: 0.68rem;
    margin-top: 3px;
  }
  .detail-info {
    flex: 1;
    min-width: 0;
  }
  .detail-name {
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .detail-addr {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
  }
  .detail-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 500;
  }
  .detail-drive {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text);
  }
  .detail-dist {
    color: var(--text-tertiary);
  }
  .detail-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
  }
  .detail-directions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    padding: 4px 8px;
  }
  .detail-dir-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e8f5f0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s var(--ease-out);
  }
  .detail-dir-icon svg {
    color: #1a7a5a;
  }
  .detail-directions:active .detail-dir-icon {
    background: #d0ede4;
  }
  .detail-dir-label {
    font-family: var(--font-body);
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.02em;
  }
}

/* ============================================================
   Results Bar (station count)
   ============================================================ */
#results-bar {
  position: sticky;
  top: var(--header-h, 56px);
  z-index: 999;
  background: rgba(12, 12, 22, 0.88);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  border-top: 1px solid rgba(0, 212, 170, 0.06);
}

#results-bar.hidden {
  display: none !important;
}

.results-bar-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.results-bar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* In split view, results bar spans full width */
.split-view .results-bar-inner {
  max-width: none;
}

/* ============================================================
   Split View — desktop: list 1/3 left, map 2/3 right
   ============================================================ */
#results-pane {
  display: flex;
  flex-direction: column;
}

.split-view #results-pane {
  flex-direction: row;
  height: calc(100dvh - var(--header-h, 56px) - 42px);
}

.split-view #list-container {
  width: 33.333%;
  min-width: 340px;
  max-width: 420px;
  flex-shrink: 0;
  overflow-y: auto;
  height: 100%;
  border-right: 1px solid var(--border);
}

.split-view #map-container {
  flex: 1;
  height: 100%;
  min-height: 0;
  position: relative;
}

/* Clicking list cards in split view */
.split-view .station-card {
  cursor: pointer;
  transition: background 0.15s var(--ease-out);
}

.split-view .station-card:hover {
  background: var(--surface-2);
}

.station-card.station-selected,
.station-card.best-deal.station-selected,
.station-card.station-selected:hover,
.station-card.best-deal.station-selected:hover {
  border-color: rgba(255, 255, 255, 0.8) !important;
  border-left-color: rgba(255, 255, 255, 0.8) !important;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.6), 0 0 16px 2px rgba(255,255,255,0.1);
  background: var(--surface-2);
}

/* ---- Sort Toggle ---- */
.sort-group {
  display: flex;
  gap: 4px;
}

.sort-btn {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 12px;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.sort-btn.active {
  border-color: var(--accent);
  color: var(--bg);
  background: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 212, 170, 0.25);
}

.sort-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.sort-btn:not(:disabled):hover {
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
}

#station-count {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
  white-space: nowrap;
  opacity: 0.8;
}


/* ============================================================
   Map
   ============================================================ */
#map-container {
  height: calc(100dvh - var(--header-h, 56px) - 40px);
  min-height: 350px;
  position: relative;
}

#map {
  position: absolute;
  inset: 0;
  height: 100%;
  width: 100%;
}

/* ---- Locate Button ---- */
.locate-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  transition-property: background, color, border-color, bottom;
  transition-duration: 0.2s;
  transition-timing-function: var(--ease-out);
  z-index: 1000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: all 0.2s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.locate-btn:hover {
  background: var(--surface-2);
  color: var(--accent);
  border-color: var(--accent);
}

.locate-btn.has-location {
  color: var(--accent);
}

/* Leaflet overrides — !important is required on properties where Leaflet sets
   inline styles (close button sizing, cluster marker styles). Without it,
   Leaflet's inline styles win due to specificity rules. */
.leaflet-popup-content-wrapper {
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border);
  padding: 0;
}

.leaflet-popup-tip {
  background: var(--surface);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.leaflet-popup.popup-with-route .leaflet-popup-content-wrapper,
.leaflet-popup.popup-with-route .leaflet-popup-tip {
  opacity: 0.88;
}

.leaflet-popup-content {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.5;
  min-width: 220px;
  max-width: calc(100vw - 40px);
}

.leaflet-popup-close-button {
  width: 32px !important;
  height: 32px !important;
  font-size: 20px !important;
  line-height: 32px !important;
  color: var(--text-tertiary) !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.leaflet-popup-close-button:hover {
  color: var(--text) !important;
}

.popup-card {
  padding: 14px 16px;
}

.popup-hover {
  padding: 10px 14px;
}

.popup-hover .popup-addr {
  margin-bottom: 0;
}

.popup-hero {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.popup-hero-drive {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  min-width: 2ch;
}

.popup-hero-dist {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.popup-name {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 2px;
  color: var(--text);
  padding-right: 20px;
}

.popup-addr {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.popup-price-row {
  justify-content: center;
}

.popup-directions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
  padding: 10px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  transition: background 0.15s;
  border-radius: 0 0 var(--radius) var(--radius);
  margin: 12px -16px -14px;
  padding: 10px 16px;
  min-height: 44px;
}

.popup-directions:hover {
  background: var(--accent-dim);
}

/* Marker cluster overrides */
.marker-cluster {
  background: rgba(100, 160, 220, 0.25) !important;
}

.marker-cluster div {
  background: #5b9bd5 !important;
  color: #fff !important;
  font-family: var(--font-mono) !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  width: 32px !important;
  height: 32px !important;
  margin-left: 4px !important;
  margin-top: 4px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.marker-cluster-small {
  background: rgba(100, 160, 220, 0.25) !important;
}

.marker-cluster-medium {
  background: rgba(100, 160, 220, 0.3) !important;
}

.marker-cluster-medium div {
  background: #5b9bd5 !important;
}

.marker-cluster-large {
  background: rgba(100, 160, 220, 0.35) !important;
}

.marker-cluster-large div {
  background: #4a8bc2 !important;
  color: #fff !important;
}

/* Price dot markers (used instead of circleMarker for cluster compatibility) */
.price-dot {
  background: none !important;
  border: none !important;
}

.price-dot div {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid;
  opacity: 0.85;
}

.price-dot-unavailable div {
  background: #222 !important;
  border-color: #fff !important;
  opacity: 0.7;
}

/* Animated route direction dot */
.route-dot-glow {
  filter: drop-shadow(0 0 6px #00d4aa) drop-shadow(0 0 12px rgba(0,212,170,0.4));
}

/* Person marker (search center / user location) */
.person-marker {
  background: none !important;
  border: none !important;
}

/* Pegman tray — sits in top-left of map */
/* Pegman location setter — inline in results bar, matches radius pills */
.pegman-tray {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px 7px 12px;
  background: rgba(0, 212, 170, 0.12);
  border: 1px solid rgba(0, 212, 170, 0.25);
  border-radius: 100px;
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: all 0.25s var(--ease-out);
  box-shadow: 0 0 16px rgba(0, 212, 170, 0.08);
  animation: pegman-attract 3s ease-in-out 1.5s 3;
}
@keyframes pegman-attract {
  0%, 100% { box-shadow: 0 0 16px rgba(0, 212, 170, 0.08); }
  50%      { box-shadow: 0 0 24px rgba(0, 212, 170, 0.15), 0 0 0 4px rgba(0, 212, 170, 0); }
}
.pegman-tray:hover {
  background: rgba(0, 212, 170, 0.18);
  border-color: rgba(0, 212, 170, 0.4);
  box-shadow: 0 0 24px rgba(0, 212, 170, 0.15);
  transform: translateY(-1px);
}
.pegman-tray:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 0 12px rgba(0, 212, 170, 0.1);
}
.pegman-tray.pegman-placing {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--accent);
  box-shadow: 0 0 20px rgba(0, 212, 170, 0.15), inset 0 0 12px rgba(0, 212, 170, 0.06);
  animation: none;
}
.pegman-tray.pegman-placing .pegman-tray-pulse {
  display: none;
}

.pegman-tray-icon {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  transition: transform 0.3s var(--ease-spring);
}
.pegman-tray:hover .pegman-tray-icon {
  transform: translateY(-1px);
}
.pegman-tray-icon svg {
  width: 14px;
  height: 14px;
  pointer-events: none;
}
.pegman-tray.pegman-placing .pegman-tray-icon {
  animation: pegman-bounce 0.8s var(--ease-spring) infinite alternate;
}
@keyframes pegman-bounce {
  from { transform: translateY(0); }
  to   { transform: translateY(-2px); }
}

.pegman-tray-pulse {
  display: none;
}

.pegman-tray-label {
  position: relative;
  z-index: 1;
  line-height: 1;
}

/* Cursor tooltip during placement mode */
.pegman-cursor-tooltip {
  position: absolute;
  z-index: 10000;
  pointer-events: none;
  background: rgba(15, 15, 28, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 100px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 212, 170, 0.15);
  white-space: nowrap;
}

.pegman-img {
  border-radius: 50%;
  border: 2px solid #333;
  filter: brightness(0.80);
  pointer-events: none;
}
.pegman-placed {
  cursor: grab;
}
.pegman-placed.leaflet-drag-target {
  cursor: grabbing;
}

.leaflet-container {
  background: var(--bg) !important;
  font-family: var(--font-body);
}
.leaflet-control-attribution {
  background: none !important;
  font-size: 0.55rem !important;
  color: rgba(255, 255, 255, 0.2) !important;
  text-shadow: none !important;
  padding: 2px 6px !important;
}
.leaflet-control-attribution a {
  color: rgba(255, 255, 255, 0.25) !important;
  text-decoration: none !important;
}
.leaflet-control-attribution .leaflet-attribution-flag {
  display: none !important;
}

/* ============================================================
   List View
   ============================================================ */
#list-container {
  padding: 12px 16px 40px;
}

/* Station Card */
.station-card {
  background: rgba(21, 21, 36, 0.85);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-left: 3px solid rgba(255, 255, 255, 0.05);
  transition: border-color 0.2s, transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
  animation: card-in 0.4s var(--ease-out) both;
  cursor: pointer;
  position: relative;
  content-visibility: auto;
  contain-intrinsic-size: auto 140px;
}

.station-card:hover {
  border-color: rgba(255, 255, 255, 0.08);
  border-left-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}

.station-card:active {
  transform: scale(0.995);
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Drive time row */
.card-hero {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.card-hero-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.card-hero-drive {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.card-hero-dist {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-weight: 400;
}

/* Drive time loading placeholder */
.drive-loading {
  display: inline-block;
  min-width: 5ch;
  color: var(--text-tertiary);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.card-info {
  margin-bottom: 8px;
}

.station-name {
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.station-address {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

/* Directions button on card */
.card-directions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  transition: background 0.25s var(--ease-out), color 0.2s;
  min-height: 48px;
  border-radius: 0 0 var(--radius) var(--radius);
  margin: 12px -20px -18px;
  background: rgba(0, 212, 170, 0.03);
}

.card-directions:hover {
  background: rgba(0, 212, 170, 0.1);
}

.card-directions:active {
  background: rgba(0, 212, 170, 0.16);
}

.card-directions svg {
  flex-shrink: 0;
}

/* Best deal indicator */
.station-card.best-deal {
  border-color: rgba(255, 255, 255, 0.06);
  background: linear-gradient(135deg, rgba(21, 21, 36, 0.9) 0%, rgba(0, 200, 83, 0.04) 100%);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.station-card.best-deal:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.best-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  color: #2ecc71;
}

.best-tag::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
  animation: best-pulse 2s ease-in-out infinite;
}

@keyframes best-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* ---- Load More Button ---- */
.load-more-btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  min-height: 48px;
  margin-top: 4px;
  margin-bottom: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.load-more-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}

/* ---- Results entrance ---- */
#results-bar,
#map-container,
#list-container {
  transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out);
}

.results-entering #results-bar {
  animation: results-bar-in 0.4s var(--ease-out) both;
}

.results-entering #map-container {
  animation: results-map-in 0.5s var(--ease-out) 0.1s both;
}

.results-entering #list-container {
  animation: results-list-in 0.5s var(--ease-out) 0.15s both;
}

@keyframes results-bar-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes results-map-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes results-list-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Results exit ---- */
.results-exiting #results-bar,
.results-exiting #map-container,
.results-exiting #list-container {
  animation: results-exit 0.3s var(--ease-out) forwards;
}

@keyframes results-exit {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(8px); }
}


/* ============================================================
   Loading
   ============================================================ */
#loading {
  padding: 48px 16px 24px;
}

.loading-content {
  text-align: center;
  margin-bottom: 32px;
}

.spinner {
  position: relative;
  width: 36px;
  height: 36px;
  margin: 0 auto 14px;
}

.spinner-ring {
  position: absolute;
  inset: 0;
  border: 2.5px solid var(--surface-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.spinner-ring-2 {
  inset: 5px;
  border-top-color: transparent;
  border-right-color: var(--accent);
  animation-duration: 1.4s;
  animation-direction: reverse;
  opacity: 0.4;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* Skeleton cards */
.skeleton-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 16px;
  max-width: 640px;
  margin: 0 auto;
}

.skeleton-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.sk-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sk-line {
  height: 12px;
  background: var(--surface-2);
  border-radius: 6px;
}

.sk-badge {
  width: 52px;
  height: 28px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.sk-w35 { width: 35%; }
.sk-w40 { width: 40%; }
.sk-w45 { width: 45%; }
.sk-w50 { width: 50%; }
.sk-w60 { width: 60%; }
.sk-w70 { width: 70%; }
.sk-w75 { width: 75%; }
.sk-w80 { width: 80%; }

/* ============================================================
   Error / Empty States
   ============================================================ */
#error, #empty {
  text-align: center;
  padding: 64px 24px;
  animation: state-in 0.4s var(--ease-out) both;
}

@keyframes state-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.state-illustration {
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

#error .state-illustration {
  color: var(--red);
}

.state-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

.state-desc {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  max-width: 260px;
  margin: 0 auto;
}

.retry-btn {
  margin-top: 16px;
  padding: 10px 24px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--accent);
  border-radius: 100px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}

.retry-btn:hover {
  background: var(--accent);
  color: var(--bg);
}

.empty-suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

/* ============================================================
   Mobile Control Bar — fixed dock, right-aligned for thumb reach
   ============================================================ */
.mobile-toolbar {
  display: none;
}
.mobile-toolbar.hidden {
  display: none !important;
}

.mobile-bar {
  background: linear-gradient(180deg, rgba(25, 25, 48, 0.95) 0%, rgba(21, 21, 36, 0.98) 100%);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35), 0 -1px 0 rgba(0, 212, 170, 0.04);
  padding: 10px 16px 10px 16px;
}

@media (max-width: 899px) {
  .mobile-toolbar {
    display: block;
    position: fixed;
    bottom: 28px;
    left: 0;
    right: 0;
    z-index: 900;
    background: var(--surface);
  }
}

/* ---- Rows ---- */
.bar-row {
  display: flex;
  align-items: center;
}
.bar-top-row {
  justify-content: space-between;
  padding: 2px 0 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
  margin-bottom: 8px;
  gap: 8px;
}
.bar-action-row {
  justify-content: center;
  gap: 8px;
  padding: 2px 0;
}

.bar-divider {
  width: 1px;
  align-self: stretch;
  margin: 6px 4px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  flex-shrink: 0;
}

/* ---- Bar fuel toggle ---- */
.island-fuel {
  position: relative;
  display: flex;
  padding: 3px;
  border-radius: 12px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.island-fuel .fuel-btn {
  position: relative;
  z-index: 1;
  padding: 7px 16px;
  min-height: 36px;
  flex: 1 1 0;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  border-radius: 9px;
  transition: color 0.25s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}
.island-fuel .fuel-btn.active {
  color: var(--bg);
}
.fuel-label-short { display: none; }
.fuel-label-long { display: inline; }
@media (max-width: 374px) {
  .fuel-label-short { display: inline; }
  .fuel-label-long { display: none; }
}
.island-fuel-slider {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  background: linear-gradient(135deg, #00d4aa, #00c49e);
  border-radius: 9px;
  transition: transform 0.3s var(--ease-spring);
  box-shadow: 0 2px 10px rgba(0, 212, 170, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.island-fuel[data-active="DL"] .island-fuel-slider {
  transform: translateX(100%);
}

/* ---- Radius pills ---- */
.island-radius-group {
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(21, 21, 36, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 3px;
}
.island-radius-group.hidden {
  display: none !important;
}
.island-radius {
  padding: 7px 14px;
  min-height: 34px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 7px;
  transition: color 0.25s var(--ease-out), background 0.25s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.island-radius.active {
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 212, 170, 0.3), 0 0 0 1px rgba(0, 212, 170, 0.1);
}
.island-radius:not(.active):active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.island-radius-label {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-tertiary);
  padding: 0 8px 0 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.island-radius-unit {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-tertiary);
  padding: 0 4px 0 0;
  letter-spacing: 0.03em;
  opacity: 0.7;
}

/* ---- Pegman inside bar ---- */
#mobile-pegman-slot {
}
.mobile-bar .pegman-tray {
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 212, 170, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  padding: 10px 16px 10px 12px;
  min-height: 44px;
  animation: none;
  font-size: 0.76rem;
  background: linear-gradient(135deg, #00d4aa, #00c49e);
  border: none;
  color: var(--bg);
  letter-spacing: 0.02em;
}
.mobile-bar .pegman-tray:hover {
  box-shadow: 0 4px 20px rgba(0, 212, 170, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.mobile-bar .pegman-tray-icon svg {
  width: 15px;
  height: 15px;
}

/* ---- View toggle ---- */
.view-toggle {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 3px;
  gap: 2px;
}
.view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  min-height: 40px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 9px;
  transition: color 0.2s var(--ease-out), background 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.view-btn svg {
  flex-shrink: 0;
  opacity: 0.45;
  transition: opacity 0.2s var(--ease-out);
}
.view-btn.active {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.view-btn.active svg {
  opacity: 1;
}
.view-btn:not(.active):active {
  background: rgba(255, 255, 255, 0.05);
}

/* ---- Placement drawer (expands above bar) ---- */
.placement-drawer {
  background: var(--accent-dim);
  border-top: 1px solid rgba(0, 212, 170, 0.2);
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s var(--ease-out);
}
.placement-drawer.hidden {
  display: none !important;
}
.placement-drawer.open {
  max-height: 80px;
}
.placement-drawer-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
}
.placement-pin {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 212, 170, 0.15);
  border-radius: 50%;
  color: var(--accent);
  animation: placement-pin-pulse 2s ease-in-out infinite;
}
@keyframes placement-pin-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.3); }
  50%      { box-shadow: 0 0 0 6px rgba(0, 212, 170, 0); }
}
.placement-text {
  flex: 1;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.35;
}
.placement-text small {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-top: 1px;
}
.placement-cancel {
  flex-shrink: 0;
  padding: 7px 14px;
  min-height: 34px;
  border: 1px solid rgba(0, 212, 170, 0.25);
  background: transparent;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.placement-cancel:active {
  background: rgba(0, 212, 170, 0.1);
}

/* Desktop: hide mobile toolbar and detail, refine header spacing */
@media (min-width: 900px) {
  .mobile-toolbar {
    display: none !important;
  }
  .mobile-detail {
    display: none !important;
  }
  .search-inner {
    gap: 16px;
    padding: 14px 28px;
  }
  .results-bar-inner {
    display: flex !important;
    padding: 10px 28px;
  }
  #results-radius-selector {
    display: flex !important;
  }
  .brand {
    font-size: 1.3rem;
  }
}
/* Mobile: bar is the control surface — hide desktop controls */
@media (max-width: 899px) {
  #pegman-tray-slot,
  #results-radius-selector,
  .results-bar-inner {
    display: none !important;
  }
  .fuel-toggle {
    display: none !important;
  }
  .locate-btn {
    display: none !important;
  }
}

/* ============================================================
   Footer
   ============================================================ */
#site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 800;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 6px 16px;
  pointer-events: auto;
}

/* Footer radius selector — hidden on desktop, shown in mobile map view */
#footer-radius-selector {
  display: none !important;
}
@media (max-width: 899px) {
  #footer-radius-selector {
    display: flex !important;
    justify-content: center;
    margin-bottom: 4px;
    background: transparent;
    border: none;
  }
  #footer-radius-selector.hidden {
    display: none !important;
  }
}

.footer-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.footer-nav a {
  font-family: var(--font-body);
  font-size: 0.68rem;
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-nav a:hover {
  color: var(--accent);
}

.footer-sep {
  color: var(--text-tertiary);
  opacity: 0.4;
  font-size: 0.68rem;
}

/* ============================================================
   Utility
   ============================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* SEO prerender block — visible to bots in HTML source, hidden from JS users */
#seo-prerender {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

/* ============================================================
   Mobile — map hidden, list only
   ============================================================ */
@media (max-width: 899px) {
  #app,
  .search-inner,
  .results-bar-inner {
    max-width: none;
  }

  /* Map hidden by default on mobile — toggled on via .mobile-map-view */
  #map-container {
    display: none !important;
  }
  .mobile-map-view {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - var(--header-h, 56px) - 140px);
  }
  .mobile-map-view #results-bar {
    flex-shrink: 0;
  }
  .mobile-map-view #main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .mobile-map-view #results-pane {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .mobile-map-view #map-container {
    display: block !important;
    flex: 1;
    min-height: 0;
    position: relative;
  }
  .mobile-map-view #list-container {
    display: none !important;
  }
  .mobile-map-view .mobile-detail {
    flex-shrink: 0;
  }

  /* Bottom padding for fixed bar + footer clearance */
  #list-container {
    padding-bottom: 130px;
  }

  /* Refined header on mobile */
  .search-inner {
    gap: 10px;
    padding: 10px 16px;
  }

  .brand {
    font-size: 1.15rem;
  }

  #location-input {
    font-size: 0.82rem;
    padding: 8px 62px 8px 32px;
    min-height: 36px;
    border-radius: 10px;
    background: rgba(21, 21, 36, 0.7);
    border-color: rgba(255, 255, 255, 0.06);
  }

  .search-icon {
    left: 11px;
    width: 14px;
    height: 14px;
  }

  .clear-btn {
    width: 28px;
    height: 28px;
  }

  /* Results bar: wrap radius + freshness to second row on mobile */
  .results-bar-inner {
    flex-wrap: wrap;
    gap: 6px 10px;
  }

  #station-count {
    display: none;
  }

  #results-radius-selector {
    margin-left: 0;
  }
}

/* Small mobile tweaks */
@media (max-width: 380px) {
  .brand {
    font-size: 0.95rem;
  }

  .fuel-btn {
    padding: 5px 8px;
    font-size: 0.7rem;
  }

  #location-input {
    font-size: 0.78rem;
    padding: 6px 58px 6px 28px;
    min-height: 32px;
  }

  .sort-group {
    gap: 2px;
  }

  .sort-btn {
    padding: 6px 8px;
    font-size: 0.68rem;
  }

  .leaflet-popup-content {
    min-width: 180px;
  }

  .popup-card {
    padding: 10px 12px;
  }

  .popup-price-row .price-tag {
    font-size: 1.6rem;
  }

  .popup-hero-drive {
    font-size: 1.15rem;
  }

  .popup-name {
    font-size: 0.78rem;
    padding-right: 16px;
  }

  .popup-addr {
    font-size: 0.68rem;
    margin-bottom: 6px;
  }

  .popup-directions {
    font-size: 0.72rem;
    padding: 8px 12px;
    margin: 8px -12px -10px;
    min-height: 40px;
  }

  .card-price-hero.price-tag {
    font-size: 1.4rem;
  }

  .station-card {
    padding: 12px 12px 12px 16px;
  }

  .card-directions {
    margin: 12px -12px -12px;
    padding: 10px 12px;
  }

  .station-name {
    font-size: 0.82rem;
  }

  .station-address {
    font-size: 0.7rem;
  }

  .card-hero-drive {
    font-size: 0.85rem;
  }

}

/* Very small screens */
@media (max-width: 320px) {
  .brand {
    font-size: 0.9rem;
  }

  .fuel-btn {
    padding: 5px 6px;
    font-size: 0.68rem;
  }

  .popup-price-row .price-tag {
    font-size: 1.4rem;
  }

  .popup-hero {
    gap: 6px;
    margin-bottom: 6px;
    padding-bottom: 6px;
  }

  .popup-hero-drive {
    font-size: 1rem;
  }

  .card-price-hero.price-tag {
    font-size: 1.25rem;
  }
}

/* Touch device hover prevention */
@media (hover: none) {
  .station-card:hover {
    border-color: rgba(255, 255, 255, 0.05);
    border-left-color: rgba(255, 255, 255, 0.05);
    box-shadow: none;
    transform: none;
  }

  .station-card.best-deal:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  }

  .quick-chip:hover {
    border-color: var(--border);
    color: var(--text-secondary);
    background: var(--surface);
    box-shadow: none;
  }

  .load-more-btn:hover {
    background: var(--surface);
    border-color: rgba(255, 255, 255, 0.1);
  }

  .locate-btn:hover {
    background: var(--surface);
    color: var(--text-secondary);
    border-color: var(--border);
  }

  .card-directions:hover {
    background: rgba(0, 212, 170, 0.03);
  }

  .popup-directions:hover {
    background: transparent;
  }
}

/* ============================================================
   Reduced Motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .logo-ring,
  .spinner-ring,
  .best-tag::before {
    animation: none !important;
  }

  .station-card {
    animation: none !important;
  }
}

/* Estimated drive times — keep white like all drive times */
.drive-time-estimated {
  color: #fff;
}

/* Data freshness color coding */
.freshness-ok { }
.freshness-warn { color: #f0a030 !important; }
.freshness-stale { color: #e84040 !important; }

/* Staleness warning banner */
.stale-banner {
  background: #2a1a00;
  color: #f0a030;
  text-align: center;
  padding: 6px 12px;
  font-size: 0.82rem;
  border-bottom: 1px solid rgba(240, 160, 48, 0.3);
}
