/* Responsive layout and map control fixes for dealer locator */

/* container layout */
#dealer-locator {
  display: flex;
  gap: 16px;
  align-items: stretch;
}

/* dealer list - desktop */
#dealer-list-container {
  width: 340px; /* sidebar width */
  min-width: 260px;
  max-width: 36%;
  overflow-y: auto;
  background: #fff;
  border-radius: 6px;
  padding: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* map container takes remaining space on desktop */
#map-container {
  flex: 1 1 auto;
  min-height: 600px;
}

/* the actual Leaflet map element */
#map {
  width: 100%;
  height: 100%;
  min-height: 600px;
  border-radius: 6px;
}

/* Mobile / small screens: stack and adjust sizing */
@media (max-width: 991px) {
  #dealer-locator {
    display: block;
  }
  #dealer-list-container {
    width: 100%;
    max-width: 100%;
    height: auto;
    margin-bottom: 10px;
    padding: 8px;
  }
  #map-container {
    width: 100%;
    min-height: 50vh;
  }
  #map {
    min-height: 50vh;
    height: 60vh;
  }
}

/* Very small phones */
@media (max-width: 480px) {
  #map {
    height: 56vh;
  }
  #dealer-list-container {
    padding: 6px;
    font-size: 14px;
  }
}

/* Collapsible list for mobile - add .collapsed on #dealer-list-container to hide it */
#dealer-list-container.collapsed {
  display: none;
}

/* Toggle button (shows on mobile) */
#toggle-dealers-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 12000;
  background: #fff;
  border: 0;
  border-radius: 4px;
  padding: 8px 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  font-weight: 600;
  cursor: pointer;
  display: none; /* shown via media query below */
}

/* show toggle on small screens */
@media (max-width: 991px) {
  #toggle-dealers-btn { display: block; }
}

/* Leaflet controls on mobile: make touch targets larger & ensure above navbar */
#map .leaflet-control {
  z-index: 11000 !important;
}
#map .leaflet-control-zoom a {
  width: 40px;
  height: 40px;
  line-height: 40px;
  font-size: 20px;
}

/* subtle style for dealer list items so mobile scrolling is nice */
.dealer-list-item {
  padding: 8px 6px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  cursor: pointer;
}
.dealer-list-item:last-child { border-bottom: none; }

/* ensure select inputs are full-width on mobile */
#state-filter, #type-filter, #dealer-filter {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 8px;
}