/**
 * H&H Fleet — Locations Page Styles
 * Mobile-first, uses theme CSS custom properties from style.css
 */

/* ============================================
   HERO / SEARCH
   ============================================ */
.locations-page {
  padding-top: 80px; /* Clear fixed header */
}

.locations-hero {
  background: var(--hh-black);
  color: var(--hh-white);
  text-align: center;
  padding: clamp(2.5rem, 5vw, 4rem) 1rem clamp(2rem, 4vw, 3rem);
}

.locations-hero .eyebrow {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--hh-yellow);
  margin-bottom: 0.75rem;
}

.locations-hero .eyebrow::before,
.locations-hero .eyebrow::after {
  content: '';
  height: 1px;
  flex: 1;
  background: var(--hh-gray-700);
}

.locations-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.1;
  margin: 0 0 0.5rem;
}

.locations-hero-sub {
  color: var(--hh-gray-300);
  font-size: 1.05rem;
  margin: 0 0 1.5rem;
}

.loc-search-bar {
  display: flex;
  gap: 0.75rem;
  max-width: 600px;
  margin: 0 auto;
}

.loc-search-input-wrap {
  flex: 1;
  position: relative;
}

.loc-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--hh-gray-500);
  pointer-events: none;
}

#loc-search-input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.8rem;
  border: 2px solid var(--hh-gray-700);
  border-radius: 6px;
  background: var(--hh-black-soft);
  color: var(--hh-white);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: border-color var(--transition-fast);
  box-sizing: border-box;
}

#loc-search-input::placeholder {
  color: var(--hh-gray-500);
}

#loc-search-input:focus {
  outline: none;
  border-color: var(--hh-yellow);
  box-shadow: 0 0 0 3px var(--hh-yellow-glow);
}

#loc-use-location {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  padding: 0.85rem 1.25rem;
  font-size: 0.9rem;
}

#loc-use-location.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ============================================
   MOBILE TOGGLE
   ============================================ */
.loc-mobile-toggle {
  display: flex;
  position: sticky;
  top: 80px;
  z-index: 100;
  background: var(--hh-black-deep);
  border-bottom: 1px solid var(--hh-gray-700);
}

.loc-toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem;
  background: none;
  border: none;
  color: var(--hh-gray-500);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.loc-toggle-btn.is-active {
  color: var(--hh-yellow);
  border-bottom: 2px solid var(--hh-yellow);
}

/* ============================================
   SPLIT PANEL LAYOUT
   ============================================ */
.locations-body {
  display: flex;
  flex-direction: column;
  min-height: 60vh;
}

.locations-map-panel {
  display: none;
}

.locations-body.show-map .locations-map-panel {
  display: block;
}

.locations-body.show-map .locations-list-panel {
  display: none;
}

.locations-body.show-list .locations-map-panel {
  display: none;
}

.locations-body.show-list .locations-list-panel {
  display: block;
}

/* Default: show list on mobile */
.locations-list-panel {
  display: block;
}

#loc-map {
  width: 100%;
  height: 50vh;
  min-height: 320px;
  background: var(--hh-black-deep);
}

.loc-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--hh-gray-100);
  border-bottom: 1px solid var(--hh-gray-200);
  font-size: 0.85rem;
  color: var(--hh-gray-700);
  font-weight: 600;
}

#loc-cards-container {
  padding: 0.75rem;
}

/* ============================================
   LOCATION CARDS
   ============================================ */
.loc-card {
  display: flex;
  flex-direction: column;
  background: var(--hh-white);
  border: 1px solid var(--hh-gray-200);
  border-left: 3px solid transparent;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
}

.loc-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

.loc-card.is-active {
  border-left-color: var(--hh-yellow);
  box-shadow: 0 0 0 1px var(--hh-yellow), var(--shadow-card);
}

.loc-card-photo {
  height: 140px;
  overflow: hidden;
  background: var(--hh-gray-100);
}

.loc-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.loc-card-photo--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--hh-black-soft), var(--hh-black));
  color: var(--hh-gray-500);
}

.loc-card-body {
  padding: 1rem;
}

.loc-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.loc-card-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.2;
  margin: 0;
  color: var(--hh-black);
}

.loc-card-hq,
.loc-popup-hq {
  display: inline-block;
  background: var(--hh-yellow);
  color: var(--hh-black);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.15em 0.5em;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 0.4rem;
  letter-spacing: 0.05em;
}

/* Open / Closed dot */
.loc-status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.loc-status-dot--open {
  background: #16a34a;
  box-shadow: 0 0 4px rgba(22, 163, 74, 0.5);
}

.loc-status-dot--closed {
  background: #dc2626;
}

.loc-card-address {
  font-style: normal;
  font-size: 0.9rem;
  color: var(--hh-gray-700);
  line-height: 1.5;
  margin-bottom: 0.3rem;
}

.loc-card-phone {
  display: inline-block;
  color: var(--hh-black);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  margin-bottom: 0.4rem;
}

.loc-card-phone:hover {
  color: var(--hh-yellow-dark);
}

/* Hours toggle */
.loc-card-hours {
  margin-bottom: 0.5rem;
}

.loc-hours-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: none;
  padding: 0.25rem 0;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--hh-gray-700);
  cursor: pointer;
}

.loc-hours-toggle:hover {
  color: var(--hh-black);
}

.loc-hours-chevron {
  transition: transform var(--transition-fast);
}

.loc-card-week {
  display: none;
  margin-top: 0.5rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--hh-gray-200);
}

.loc-card-week.is-open {
  display: block;
}

.loc-card-week-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  padding: 0.2rem 0;
  color: var(--hh-gray-700);
}

.loc-card-week-row.is-today {
  font-weight: 700;
  color: var(--hh-black);
}

.loc-card-distance {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--hh-yellow-dark);
  margin-bottom: 0.6rem;
}

.loc-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Small button variant */
.btn--sm {
  padding: 0.55rem 1rem;
  font-size: 0.78rem;
}

/* ============================================
   MAP MARKERS & POPUPS
   ============================================ */
.loc-marker {
  background: none !important;
  border: none !important;
}

.loc-marker--active {
  z-index: 1000 !important;
}

/* Cluster icons */
.loc-cluster {
  background: none !important;
  border: none !important;
}

.loc-cluster-inner {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--hh-yellow);
  color: var(--hh-black);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Leaflet popup overrides */
.loc-popup-wrap .leaflet-popup-content-wrapper {
  background: var(--hh-black);
  color: var(--hh-white);
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.loc-popup-wrap .leaflet-popup-tip {
  background: var(--hh-black);
}

.loc-popup-wrap .leaflet-popup-close-button {
  color: var(--hh-gray-500) !important;
}

.loc-popup-wrap .leaflet-popup-close-button:hover {
  color: var(--hh-yellow) !important;
}

.loc-popup {
  padding: 0.25rem 0;
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.5;
}

.loc-popup-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  text-transform: uppercase;
  color: var(--hh-yellow);
  display: block;
  margin-bottom: 0.3rem;
}

.loc-popup-address {
  color: var(--hh-gray-300);
  margin-bottom: 0.3rem;
}

.loc-popup-phone {
  color: var(--hh-white);
  text-decoration: none;
  font-weight: 600;
  display: block;
  margin-bottom: 0.3rem;
}

.loc-popup-phone:hover {
  color: var(--hh-yellow);
}

.loc-popup-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--hh-gray-300);
}

.loc-popup-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.loc-popup-dot--open {
  background: #16a34a;
}

.loc-popup-dot--closed {
  background: #dc2626;
}

/* ============================================
   DESKTOP LAYOUT (1024px+)
   ============================================ */
@media (min-width: 1024px) {
  .loc-mobile-toggle {
    display: none;
  }

  .locations-body {
    flex-direction: row;
    height: calc(100vh - 80px);
  }

  .locations-map-panel {
    display: block !important;
    flex: 1;
    min-width: 0;
  }

  .locations-list-panel {
    display: flex !important;
    flex-direction: column;
    width: 440px;
    flex-shrink: 0;
    border-left: 1px solid var(--hh-gray-200);
    overflow: hidden;
  }

  #loc-cards-container {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
  }

  #loc-map {
    height: 100%;
    min-height: unset;
    position: sticky;
    top: 80px;
  }

  .loc-card {
    flex-direction: row;
  }

  .loc-card-photo {
    width: 140px;
    height: auto;
    min-height: 140px;
    flex-shrink: 0;
  }
}

/* ============================================
   LARGE DESKTOP (1400px+)
   ============================================ */
@media (min-width: 1400px) {
  .locations-list-panel {
    width: 500px;
  }
}

/* ============================================
   SMALL MOBILE (< 480px)
   ============================================ */
@media (max-width: 479px) {
  .loc-search-bar {
    flex-direction: column;
  }

  #loc-use-location {
    justify-content: center;
  }

  .loc-card-actions {
    flex-direction: column;
  }

  .loc-card-actions .btn {
    text-align: center;
  }
}
