*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #FF6B35;
  --primary-dark: #ab3500;
  --bg: #f8f9fa;
  --surface: #ffffff;
  --text: #191c1d;
  --muted: #594139;
  --border: #e5e7eb;
  --shadow: 0 4px 16px rgba(0,0,0,.06);
  --radius: 10px;
  --map-h: 380px;
}

html, body { height: 100%; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body.erv-depot-embed { overflow: visible; height: auto; }

.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;
}

/* Hub hero */
.depot-hero {
  margin-bottom: 20px;
  padding: 4px 0 8px;
}

.depot-hero-kicker {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #006a60;
  margin-bottom: 8px;
}

.depot-hero-title {
  font-size: clamp(1.65rem, 3.2vw, 2.15rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.12;
  color: var(--text);
  margin-bottom: 10px;
}

.depot-hero-lead {
  font-size: 15px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 62ch;
  margin-bottom: 18px;
}

.depot-hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  max-width: 520px;
}

.depot-stat {
  background: linear-gradient(145deg, #fff 0%, #f8fafc 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.depot-stat strong {
  display: block;
  font-size: 1.25rem;
  font-weight: 900;
  color: #0A3D62;
  line-height: 1.2;
}

.depot-stat span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 4px;
}

/* Country tabs */
.depot-country-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  padding: 4px 0;
}

.depot-country-tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.depot-country-tab:hover {
  border-color: #fdba74;
  box-shadow: 0 4px 14px rgba(255, 107, 53, 0.12);
}

.depot-country-tab.is-active {
  border-color: var(--primary);
  background: linear-gradient(135deg, #fff7ed 0%, #fff 100%);
  box-shadow: 0 4px 16px rgba(255, 107, 53, 0.18);
}

.depot-country-tab-flag {
  font-size: 1.35rem;
  line-height: 1;
}

.depot-country-tab-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.depot-country-tab-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.depot-country-tab-meta {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

/* Welcome state */
.depot-welcome {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 8px 0 20px;
  margin-bottom: 4px;
  text-align: left;
}

.depot-welcome-inner {
  max-width: none;
  margin: 0;
}

.depot-welcome-title {
  font-size: clamp(1.15rem, 2.5vw, 1.45rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 6px;
}

.depot-welcome-lead {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 18px;
  max-width: 68ch;
}

.depot-country-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.depot-country-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 220px;
  padding: 0;
  border: none;
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  background: #111;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s, box-shadow 0.2s;
}

.depot-country-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.depot-country-card-bg {
  position: absolute;
  inset: 0;
  background-image: var(--country-img);
  background-size: cover;
  background-position: center;
  transform: scale(1.02);
  transition: transform 0.35s ease;
}

.depot-country-card:hover .depot-country-card-bg {
  transform: scale(1.08);
}

.depot-country-card-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.55) 55%, rgba(0, 0, 0, 0.82) 100%);
}

.depot-country-card-content {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding: 18px 18px 16px;
  color: #fff;
}

.depot-country-card-flag {
  font-size: 1.6rem;
  line-height: 1;
  margin-bottom: 6px;
  display: block;
}

.depot-country-card-name {
  display: block;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.depot-country-card-tagline {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.4;
  margin-top: 4px;
}

.depot-country-card-stats {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 8px;
}

.depot-country-card-cta {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  color: #72d8c8;
  margin-top: 10px;
}

/* Fleet networks */
.depot-fleet-showcase {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.fleet-network-card {
  background: linear-gradient(145deg, #fff 0%, #f8fafc 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.fleet-network-title {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 4px;
}

.fleet-network-sub {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 12px;
}

.fleet-brand-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fleet-brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #374151;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 5px 10px 5px 8px;
}

.fleet-brand-pill--live {
  border-color: #a7f3d0;
  background: #f0fdf9;
}

.fleet-brand-pill--network {
  opacity: 0.72;
  border-style: dashed;
}

.fleet-brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.fleet-brand-badge {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #047857;
  background: #d1fae5;
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 2px;
}

.depot-map-heading {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.depot-map-section {
  margin-top: 4px;
}

/* AI / citation block */
.depot-ai-readable {
  margin-top: 40px;
  padding: 24px 26px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.65;
  color: #374151;
}

.depot-ai-readable h2 {
  font-size: 1rem;
  font-weight: 800;
  color: #111827;
  margin: 0 0 12px;
}

.depot-ai-readable h3 {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin: 20px 0 8px;
}

.depot-ai-readable ul {
  margin: 0;
  padding-left: 1.25rem;
}

.depot-ai-readable code {
  font-size: 12px;
  background: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
}

#erv-depot-finder:not(.depot-country-active) .depot-toolbar-row,
#erv-depot-finder:not(.depot-country-active) .depot-toolbar-row--distance {
  opacity: 0.92;
}

/* Scoped embed — beat theme overrides */
#erv-depot-finder {
  position: relative;
  z-index: 10;
  isolation: isolate;
  font-family: 'Inter', system-ui, sans-serif;
}

#erv-depot-finder input,
#erv-depot-finder select,
#erv-depot-finder button {
  pointer-events: auto !important;
  -webkit-appearance: auto;
  appearance: auto;
}

#erv-depot-finder select.erv-depot-sel,
#erv-depot-finder select.erv-depot-sort {
  -webkit-appearance: menulist;
  appearance: menulist;
  cursor: pointer;
  opacity: 1 !important;
}

/* Toolbar — full-width grid */
.depot-toolbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 12px;
  width: 100%;
}

.depot-toolbar-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  margin-top: 12px;
  width: 100%;
}

.depot-toolbar-row--distance {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  grid-template-columns: 2fr 1.5fr 0.75fr auto;
}

.depot-field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.depot-field--xs,
.depot-field--sm,
.depot-field--md,
.depot-field--search {
  width: 100%;
  min-width: 0;
}

.search-input {
  width: 100%;
  max-width: none;
  padding: 11px 14px 11px 40px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  min-height: 46px;
  font-family: inherit;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' 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") 12px center no-repeat;
  outline: none;
}

.search-input:focus { border-color: var(--primary); }

#erv-depot-finder select.erv-depot-sel,
#erv-depot-finder select.erv-depot-sort {
  width: 100%;
  padding: 10px 28px 10px 12px;
  min-height: 46px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

#erv-depot-finder select.erv-depot-sel:focus,
#erv-depot-finder select.erv-depot-sort:focus { border-color: var(--primary); }

#erv-depot-finder select.erv-depot-sel:disabled {
  opacity: .65;
  cursor: not-allowed;
  background: var(--bg);
}

.depot-btn {
  padding: 10px 18px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  min-height: 46px;
  width: 100%;
}

.depot-btn:hover { border-color: var(--primary); }
.depot-btn.active { background: #fff7ed; border-color: var(--primary); color: var(--primary-dark); }

#erv-depot-finder.map-click-active .map-panel--compact { cursor: crosshair; }

/* Main: depots grid + map below */
.depot-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.depot-list-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.depot-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
  width: 100%;
}

.depot-card {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: background .1s, border-color .1s, box-shadow .1s;
  height: 100%;
}

.depot-card:hover,
.depot-card.selected {
  background: #fff7ed;
  border-color: #fdba74;
  box-shadow: var(--shadow);
}

.depot-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.brand-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.depot-card-body { flex: 1; min-width: 0; }

.depot-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.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);
}

.depot-address {
  display: block;
  font-size: 11px;
  color: #374151;
  line-height: 1.4;
  margin-top: 4px;
}

.depot-address-link {
  color: #1a73e8;
  text-decoration: none;
}

.depot-address-link:hover { text-decoration: underline; }

.phone-note {
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
}

.depot-phone {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #006a60;
  text-decoration: none;
  margin-top: 3px;
}

.depot-phone:hover { text-decoration: underline; }

.depot-maps-link,
.maps-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #1a56db;
  text-decoration: none;
  margin-top: 6px;
  padding: 6px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.depot-maps-link:hover,
.maps-link:hover {
  background: #dbeafe;
  text-decoration: none;
}

.popup-contact { margin-top: 6px; font-size: 11px; color: #374151; line-height: 1.45; }
.popup-contact .depot-phone { color: #006a60; font-weight: 600; }
.popup-contact .depot-maps-link { color: #1a73e8; font-weight: 600; }

.dist-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e0f2fe;
  color: #0369a1;
  white-space: nowrap;
  flex-shrink: 0;
}

.depot-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg);
  color: var(--muted);
}

/* Map — full width below depot grid */
.map-panel--compact {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #e5e7eb;
  width: 100%;
  height: var(--map-h);
  min-height: var(--map-h);
}

#erv-depot-map {
  width: 100%;
  height: 100%;
}

.ref-banner {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 800;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 60px);
}

.ref-banner button {
  border: none;
  background: none;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0 2px;
}

.map-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 800;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.map-btn {
  width: 32px; height: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  color: var(--text);
  padding: 0;
  font-size: 15px;
}

.map-btn:hover { border-color: var(--primary); }

/* Leaflet */
.leaflet-popup-content-wrapper { border-radius: 8px; }
.leaflet-popup-content {
  margin: 10px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  line-height: 1.4;
}

.popup-title { font-weight: 700; margin-bottom: 3px; }
.popup-brand { color: var(--muted); font-size: 11px; }
.popup-dist { font-size: 11px; color: #0369a1; font-weight: 600; margin-top: 4px; }

.depot-marker {
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}

.ref-marker {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #0369a1;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 960px) {
  .depot-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .depot-toolbar-row,
  .depot-toolbar-row--distance { grid-template-columns: 1fr; }
  .map-panel--compact { height: 280px; min-height: 280px; }
  .depot-hero-stats { grid-template-columns: repeat(2, 1fr); max-width: 100%; }
  .depot-country-tabs { gap: 6px; }
  .depot-country-tab { flex: 1 1 calc(50% - 6px); min-width: 140px; }
  .depot-fleet-showcase { grid-template-columns: 1fr; }
  .depot-country-cards { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .depot-list { grid-template-columns: 1fr; }
  .depot-country-tab-meta { white-space: normal; }
}
