/**
 * Where to Buy — map + accordion layout
 */

#where-to-buy,
#where-to-buy *,
#where-to-buy *::before,
#where-to-buy *::after {
  box-sizing: border-box;
}

#where-to-buy {
  min-height: 60vh;
  overflow-x: clip;
}

#where-to-buy .container {
  max-width: 100%;
}

#where-to-buy .where-to-buy__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1rem, 2.5vw, 1.75rem);
  align-items: start;
}

#where-to-buy .where-to-buy__map {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: clamp(280px, 55vw, 400px);
  background-color: var(--bs-gray-200, #e9ecef);
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid #e0e0e1;
}

#where-to-buy .where-to-buy__map .leaflet-container {
  width: 100%;
  height: 100%;
  min-height: inherit;
  font-family: inherit;
  z-index: 1;
}

#where-to-buy .where-to-buy__sidebar {
  min-width: 0;
  width: 100%;
}

#where-to-buy .where-to-buy__accordion {
  width: 100%;
  min-width: 0;
}

#where-to-buy .where-to-buy__status {
  margin: 0;
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  color: #636367;
  background: #f6f7f9;
  border: 1px solid #e0e0e1;
  border-radius: 0.5rem;
}

#where-to-buy .where-to-buy__status--error {
  color: #842029;
  background: #f8d7da;
  border-color: #f5c2c7;
}

/* Accordion — aligned with site FAQ pattern */
#where-to-buy .accordion-wrapper .card-header button {
  font-size: clamp(0.8125rem, 2.2vw, 0.9375rem);
  color: #636367;
  padding: 1rem 1.25rem;
  line-height: 1.45;
  gap: 0.75rem;
}

#where-to-buy .accordion-wrapper .card-header button::before {
  display: none;
}

#where-to-buy .accordion-wrapper .card-header button:not(.collapsed) {
  color: var(--bs-primary) !important;
}

#where-to-buy .accordion-wrapper .card-header button:not(.collapsed) .chevron-icon::before {
  transform: rotate(180deg);
  transition: 0.4s;
}

#where-to-buy .accordion-item {
  border-color: #e0e0e1 !important;
  transition: border-color 0.2s;
  margin-bottom: 0.75rem;
}

#where-to-buy .accordion-item:last-child {
  margin-bottom: 0;
}

#where-to-buy .accordion-item:has(.show) {
  border-color: var(--bs-primary) !important;
}

#where-to-buy .accordion-item .chevron {
  background: transparent !important;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#where-to-buy .where-to-buy__category-title {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

#where-to-buy .where-to-buy__category-count {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--bs-primary);
  background: rgba(2, 56, 118, 0.08);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* Store list inside accordion */
#where-to-buy .where-to-buy__store-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

#where-to-buy .where-to-buy__store-item {
  border-top: 1px solid #e0e0e1;
}

#where-to-buy .where-to-buy__store-item.is-active .where-to-buy__store-btn {
  background: rgba(2, 56, 118, 0.06);
  border-left: 3px solid var(--bs-primary);
}

#where-to-buy .where-to-buy__store-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  width: 100%;
  padding: 0.875rem 1.25rem;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s;
}

#where-to-buy .where-to-buy__store-btn:hover,
#where-to-buy .where-to-buy__store-btn:focus-visible {
  background: rgba(2, 56, 118, 0.04);
  outline: none;
}

#where-to-buy .where-to-buy__store-btn:focus-visible {
  box-shadow: inset 0 0 0 2px var(--bs-secondary);
}

#where-to-buy .where-to-buy__store-name {
  font-size: clamp(0.8125rem, 2.2vw, 0.875rem);
  font-weight: 700;
  color: var(--bs-primary);
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

#where-to-buy .where-to-buy__store-address,
#where-to-buy .where-to-buy__store-hours {
  font-size: clamp(0.75rem, 2vw, 0.8125rem);
  color: #636367;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

#where-to-buy .where-to-buy__store-phone {
  font-size: clamp(0.75rem, 2vw, 0.8125rem);
  color: var(--bs-secondary);
  text-decoration: none;
  font-weight: 600;
}

#where-to-buy .where-to-buy__store-phone:hover {
  text-decoration: underline;
}

/* Map markers — pin shape so points are easy to spot on OSM tiles */
.where-to-buy__marker {
  background: transparent !important;
  border: none !important;
}

.where-to-buy__marker-pin {
  position: relative;
  display: block;
  width: 32px;
  height: 42px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

.where-to-buy__marker-pin::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  width: 26px;
  height: 26px;
  margin-left: -13px;
  background: #023876;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-sizing: border-box;
}

.where-to-buy__marker-dot {
  position: absolute;
  left: 50%;
  top: 7px;
  display: block;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  background: #fff;
  border-radius: 50%;
  z-index: 1;
}

.where-to-buy__marker--active .where-to-buy__marker-pin::before {
  background: #62c3f0;
  transform: rotate(-45deg) scale(1.12);
}

.where-to-buy__marker--active .where-to-buy__marker-dot {
  background: #023876;
}

/* Leaflet popup */
.where-to-buy__popup {
  font-size: 0.8125rem;
  line-height: 1.45;
  max-width: 240px;
}

.where-to-buy__popup-title {
  display: block;
  color: var(--bs-primary);
  margin-bottom: 0.35rem;
}

.where-to-buy__popup-address,
.where-to-buy__popup-hours {
  margin: 0 0 0.35rem;
  color: #636367;
  word-wrap: break-word;
}

.where-to-buy__popup-phone {
  margin: 0;
}

.where-to-buy__popup-phone a {
  color: var(--bs-secondary);
  font-weight: 600;
  text-decoration: none;
}

.where-to-buy__popup-phone a:hover {
  text-decoration: underline;
}

/* Map fallback */
#where-to-buy .where-to-buy__map-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: inherit;
  padding: 1.5rem;
  text-align: center;
  color: #636367;
}

#where-to-buy .where-to-buy__map-fallback p {
  margin: 0 0 0.5rem;
  font-size: clamp(0.8125rem, 2.2vw, 0.9375rem);
  max-width: 28rem;
}

#where-to-buy .where-to-buy__map-fallback-hint {
  font-size: 0.8125rem;
  color: var(--bs-primary);
  font-weight: 600;
}

/* Tablet */
@media (min-width: 576px) {
  #where-to-buy .where-to-buy__map {
    min-height: 360px;
  }
}

/* Desktop: map + sidebar side by side */
@media (min-width: 992px) {
  #where-to-buy .where-to-buy__layout {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  }

  #where-to-buy .where-to-buy__map {
    min-height: 560px;
  }

  #where-to-buy .where-to-buy__sidebar {
    max-height: 560px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  #where-to-buy .accordion-wrapper .card-header button {
    padding: 1rem 1.25rem;
  }
}

/* Small mobile QA (320px) */
@media (max-width: 359px) {
  #where-to-buy .where-to-buy__store-btn {
    padding: 0.75rem 1rem;
  }

  #where-to-buy .accordion-wrapper .card-header button {
    padding: 0.875rem 1rem;
  }

  #where-to-buy .where-to-buy__category-count {
    font-size: 0.6875rem;
  }
}
