/* ═══════════════════════════════════════════════════════════════
   Dealer Locator – map-filter.css
   ═══════════════════════════════════════════════════════════════ */

/* ── Map wrapper ─────────────────────────────────────────────── */
.map-section-wrapper {
  display: flex;
  width: 100%;
  height: 100vh;
  margin-top: 0;
  /* map fills full viewport like hero sections on other pages */
}

/* ── Left panel ──────────────────────────────────────────────── */
.dealer-filter-panel {
  width: 320px;
  min-width: 280px;
  height: 100vh;
  overflow-y: auto;
  background-color: #0d0d0d;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 115px 24px 32px;
  /* top pushes content below sticky header */
  display: flex;
  flex-direction: column;
  gap: 22px;
  z-index: 10;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.dealer-filter-panel::-webkit-scrollbar {
  width: 4px;
}

.dealer-filter-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* ── Panel title ─────────────────────────────────────────────── */
.dealer-filter-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 20px;
}

.dealer-filter-title .panel-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #00afaa;
  margin: 0;
}

.dealer-filter-title .panel-heading {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0;
}

/* ── Filter groups ───────────────────────────────────────────── */
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.filter-group label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #a1a4aa;
}

.filter-group select {
  width: 100%;
  padding: 11px 36px 11px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #ffffff;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
  box-sizing: border-box;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a1a4aa' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.filter-group select option {
  background: #1a1a1a;
  color: #ffffff;
}

.filter-group select:focus {
  border-color: #00afaa;
  background-color: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 3px rgba(0, 175, 170, 0.15);
}

.filter-group select:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ── Search button ───────────────────────────────────────────── */
.dealer-search-btn {
  padding: 13px 20px;
  background: linear-gradient(90deg, #1e4488 0%, #00afaa 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  width: 100%;
  transition:
    opacity 0.2s ease,
    transform 0.15s ease;
}

.dealer-search-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.dealer-search-btn:active {
  transform: translateY(0);
}

/* ── Reset link ──────────────────────────────────────────────── */
.filter-reset {
  text-align: center;
  margin-top: -10px;
}

.filter-reset button {
  background: none;
  border: none;
  color: #a1a4aa;
  font-size: 12px;
  cursor: pointer;
  letter-spacing: 0.04em;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
}

.filter-reset button:hover {
  color: #ffffff;
}

/* ── Results area ────────────────────────────────────────────── */
/* No overflow here — the parent panel is the single scroll container */
.dealer-results {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding-top: 16px;
}

/* Result count badge */
.results-count {
  font-size: 11px;
  font-weight: 600;
  color: #00afaa;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 12px 0;
}

/* Empty / loading message */
.results-empty {
  font-size: 13px;
  color: #a1a4aa;
  margin: 0;
  line-height: 1.6;
  text-align: center;
  padding: 24px 0;
}

/* Icon above empty state message */
.results-empty-icon {
  display: block;
  margin: 0 auto 12px;
  opacity: 0.25;
}

/* ── Loading dots animation ──────────────────────────────────── */
.dl-loading {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  vertical-align: middle;
}

.dl-loading span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00afaa;
  display: inline-block;
  animation: dl-bounce 1.2s ease-in-out infinite;
}

.dl-loading span:nth-child(2) {
  animation-delay: 0.2s;
}

.dl-loading span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dl-bounce {

  0%,
  80%,
  100% {
    transform: scale(0.7);
    opacity: 0.4;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ── Dealer result list ──────────────────────────────────────── */
.results-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Dealer card ─────────────────────────────────────────────── */
.dealer-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.15s ease;
}

.dealer-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.dealer-card.active {
  background: rgba(0, 175, 170, 0.1);
  border-color: #00afaa;
}

/* Card header row: name + district badge */
.card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.dealer-card .card-name {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  line-height: 1.3;
  flex: 1;
}

.card-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #00afaa;
  background: rgba(0, 175, 170, 0.12);
  border: 1px solid rgba(0, 175, 170, 0.3);
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.dealer-card .card-address {
  font-size: 11px;
  color: #a1a4aa;
  margin: 0 0 5px 0;
  line-height: 1.5;
}

.dealer-card .card-phone {
  font-size: 11px;
  color: #a1a4aa;
  margin: 0 0 10px 0;
}

/* "View on Map" button inside card */
.card-view-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition:
    background 0.2s,
    border-color 0.2s;
  width: 100%;
  text-align: center;
}

.dealer-card:hover .card-view-btn,
.dealer-card.active .card-view-btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
}

/* ── Map container ───────────────────────────────────────────── */
.map-iframe-wrapper {
  flex: 1;
  min-width: 0;
  position: relative;
}

#map {
  width: 100%;
  height: 100vh;
}

/* ── Leaflet popup custom styles ─────────────────────────────── */
.dl-popup {
  font-family: inherit;
  padding: 4px 2px;
}

.dl-popup-name {
  font-size: 14px;
  font-weight: 700;
  color: #111;
  margin: 0 0 5px 0;
  line-height: 1.3;
}

.dl-popup-address {
  font-size: 12px;
  color: #555;
  margin: 0 0 5px 0;
  line-height: 1.5;
}

.dl-popup-phone {
  font-size: 12px;
  color: #333;
  margin: 0;
  font-weight: 600;
}

/* ── Mobile tab bar (hidden on desktop) ─────────────────────── */
.mobile-tab-bar {
  display: none;
}

/* ── Tablet (769px – 1024px) ─────────────────────────────────── */
@media (max-width: 1024px) and (min-width: 769px) {
  .dealer-filter-panel {
    width: 260px;
    min-width: 240px;
    padding: 115px 18px 28px;
    gap: 18px;
  }

  .dealer-filter-title .panel-heading {
    font-size: 18px;
  }
}

/* ── Phone (≤768px) — Tab-based layout ───────────────────────── */
@media (max-width: 768px) {

  /* Push <main> below the fixed/sticky header (~70px header + mt-30 = ~100px) */
  main {
    padding-top: 100px !important;
  }

  /* Tab bar */
  .mobile-tab-bar {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 100;
    background: #0d0d0d;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .mobile-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 14px;
    background: none;
    border: none;
    color: #a1a4aa;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition:
      color 0.2s,
      border-color 0.2s;
  }

  .mobile-tab.active {
    color: #ffffff;
    border-bottom-color: #00afaa;
  }

  /* Map section: side-by-side becomes tab panels */
  .map-section-wrapper {
    flex-direction: row;
    /* keep side-by-side, hide via JS */
    height: calc(100vh - 128px);
    /* 100vh - 80px header - 48px tab bar */
    overflow: hidden;
  }

  /* Panel fills full width when active */
  .dealer-filter-panel {
    width: 100%;
    min-width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 24px 20px 32px;
    border-right: none;
    gap: 18px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
  }

  /* Map fills full width when active */
  .map-iframe-wrapper {
    width: 100%;
    min-width: 100%;
    flex-shrink: 0;
    transition: transform 0.3s ease;
  }

  #map {
    height: 100%;
  }

  /* JS adds .show-map to wrapper to slide to map tab */
  .map-section-wrapper.show-map .dealer-filter-panel,
  .map-section-wrapper.show-map .map-iframe-wrapper {
    transform: translateX(-100%);
  }

  /* Touch-friendly controls */
  .filter-group select {
    padding: 13px 36px 13px 14px;
    font-size: 15px;
  }

  .dealer-search-btn {
    padding: 15px 20px;
    font-size: 14px;
  }

  .dealer-filter-title .panel-heading {
    font-size: 20px;
  }

  .dealer-card {
    padding: 14px;
  }

  .card-header-row {
    flex-wrap: wrap;
    gap: 6px;
  }

  .results-count {
    font-size: 12px;
  }

  .store-locator-section {
    margin-top: 100px !important;
  }
}

/* ── Small phones (≤480px) ───────────────────────────────────── */
@media (max-width: 480px) {
  .dealer-filter-panel {
    padding: 20px 16px 28px;
  }

  .dealer-filter-title .panel-heading {
    font-size: 18px;
  }
}

/* ── Map dealer counter badge ── */
.map-counter {
  position: absolute;
  top: 120px;
  right: 100px;
  z-index: 9999;
  background: #ffffff;
  border-radius: 12px;
  padding: 20px 36px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
  pointer-events: none;
}

.map-counter-number {
  font-family: "Courier New", Courier, monospace !important;
  font-size: 180px !important;
  font-weight: 900 !important;
  color: #0d0d0d !important;
  letter-spacing: -0.04em !important;
  line-height: 1 !important;
}

.map-counter-label {
  font-size: 20px;
  font-weight: 700;
  color: #a1a4aa;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* make sure the wrapper is position:relative for absolute child */
.map-iframe-wrapper {
  position: relative;
}