*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #FF6B35;
  --primary-dark: #ab3500;
  --teal: #006a60;
  --navy: #0A3D62;
  --bg: #f8f9fa;
  --surface: #ffffff;
  --text: #191c1d;
  --muted: #594139;
  --border: #e5e7eb;
  --shadow: 0 4px 24px rgba(0,0,0,.08);
  --radius: 12px;
  --sidebar-w: 380px;
}

html, body { height: 100%; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.mat {
  font-family: 'Material Symbols Outlined';
  font-size: 20px;
  line-height: 1;
  vertical-align: middle;
}

/* Header */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: 64px;
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 1px 8px rgba(0,0,0,.04);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 18px;
  color: var(--primary-dark);
  letter-spacing: -.03em;
}

.logo-icon {
  width: 36px; height: 36px;
  background: var(--primary-dark);
  color: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.header-stats {
  display: flex;
  gap: 20px;
  font-size: 13px;
  color: var(--muted);
}

.header-stats strong { color: var(--text); }

/* Layout */
.app-layout {
  display: flex;
  height: 100vh;
  padding-top: 64px;
}

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 500;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.map-panel {
  flex: 1;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}

/* Filters */
.filter-section {
  margin-bottom: 16px;
}

.filter-section h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 8px;
}

.search-input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='%23594139' viewBox='0 0 24 24'%3E%3Cpath d='M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E") 10px center no-repeat;
  outline: none;
  transition: border-color .15s;
}

.search-input:focus { border-color: var(--primary); }

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all .12s;
  user-select: none;
}

.chip:hover { border-color: var(--primary); color: var(--primary-dark); }
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.chip.country-chip.active { background: var(--navy); border-color: var(--navy); }

select.filter-select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  outline: none;
}

select.filter-select:focus { border-color: var(--primary); }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 13px;
}

.toggle {
  position: relative;
  width: 44px; height: 24px;
  background: var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background .2s;
}

.toggle.on { background: var(--primary); }

.toggle::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.toggle.on::after { transform: translateX(20px); }

/* Results list */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  font-size: 13px;
  font-weight: 600;
}

.sort-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  background: var(--surface);
}

.depot-list {
  max-height: 280px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}

.depot-card {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
}

.depot-card:hover, .depot-card.selected { background: #fff7ed; }

.depot-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.brand-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.depot-card h4 {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 2px;
}

.depot-card .meta {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.depot-card .distance {
  margin-left: auto;
  text-align: right;
  flex-shrink: 0;
}

.depot-card .distance strong {
  display: block;
  font-size: 14px;
  color: var(--teal);
}

.depot-card .distance span {
  font-size: 10px;
  color: var(--muted);
}

.depot-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg);
  color: var(--muted);
}

/* Map controls */
.map-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 800;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-btn {
  width: 40px; height: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all .12s;
  color: var(--text);
}

.map-btn:hover { background: var(--bg); border-color: var(--primary); }

.map-legend {
  position: absolute;
  bottom: 24px;
  left: 16px;
  z-index: 800;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  max-width: 220px;
  font-size: 11px;
}

.map-legend h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-airport {
  width: 12px; height: 12px;
  background: var(--navy);
  border: 2px solid #fff;
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--navy);
}

.ref-banner {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 800;
  background: var(--navy);
  color: #fff;
  padding: 8px 16px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow);
  display: none;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.ref-banner.visible { display: flex; }

.ref-banner button {
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
  width: 22px; height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

/* Leaflet overrides */
.leaflet-popup-content-wrapper {
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.leaflet-popup-content {
  margin: 12px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.4;
}

.popup-title { font-weight: 700; margin-bottom: 4px; }
.popup-brand { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.popup-dist { color: var(--teal); font-weight: 700; font-size: 13px; }

.depot-marker {
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}

.airport-marker {
  background: var(--navy);
  border: 2px solid #fff;
  border-radius: 3px;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
}

/* Mobile */
.mobile-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 28px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  box-shadow: 0 4px 16px rgba(255,107,53,.4);
  cursor: pointer;
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    width: 100%;
    min-width: unset;
    height: 55vh;
    border-right: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    transform: translateY(calc(100% - 56px));
    transition: transform .3s ease;
  }

  .sidebar.expanded { transform: translateY(0); }

  .sidebar-handle {
    display: flex;
    justify-content: center;
    padding: 10px;
    cursor: pointer;
  }

  .sidebar-handle::before {
    content: '';
    width: 40px; height: 4px;
    background: var(--border);
    border-radius: 2px;
  }

  .header-stats { display: none; }
  .map-legend { display: none; }
  .mobile-toggle { display: block; }
}

.empty-state {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.empty-state .mat { font-size: 32px; display: block; margin-bottom: 8px; opacity: .5; }

/* Campgrounds page — campground list above map (separate block sections) */
.camp-results-section,
.camp-map-section {
  display: block !important;
  position: static !important;
  order: unset !important;
  flex: none !important;
}
.camp-page .map-panel,
.camp-page .camp-map-wrap,
.camp-page #camp-map-panel {
  flex: none !important;
  order: unset !important;
}
