/*
 * FDT Theme — locations map page.
 */

.fdt-locations-map-page {
  position: relative;
  margin: 1.5rem 0;
}

.fdt-locations-map-search-note {
  margin: 0 0 0.75rem;
  padding: 0.6rem 0.9rem;
  background: #f6f6f2;
  border-radius: 0.375rem;
  font-size: 0.9rem;
  color: var(--fdt-dark-grey, #222);
}

.fdt-locations-map-search-note a {
  margin-left: 0.5rem;
  font-weight: 600;
  color: var(--fdt-dark-green, #1a3130);
}

.fdt-locations-map {
  width: 100%;
  height: 70vh;
  min-height: 25rem;
  border-radius: 0.5rem;
}

.fdt-locations-map-credit {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: #888;
  text-align: right;
}

/* ---- Map legend / filter dropdown ---- */
.fdt-locations-map-legend {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  font-family: var(--font-sans, sans-serif);
}

.fdt-locations-map-legend__toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: #fff;
  color: var(--fdt-dark-green, #1a3130);
  border: none;
  border-radius: 0.375rem;
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.2);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.fdt-locations-map-legend__toggle:hover,
.fdt-locations-map-legend__toggle:focus {
  background: #f6f6f2;
}

.fdt-locations-map-legend__overlay {
  display: none;
}

.fdt-locations-map-legend__panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  display: flex;
  flex-direction: column;
  /* Wide enough for 6 columns of category text; grows with content height
     instead of capping it — Pat wants no scrollbar on this panel, so the
     grid of columns is what keeps ~70 categories manageable, not a
     nested scroll area. Scales up further on big screens instead of
     capping at a fixed width, so columns aren't cramped. */
  width: min(90vw, 88rem);
  background: #fff;
  border-radius: 0.375rem;
  box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.25);
}

.fdt-locations-map-legend__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  padding: 0.6rem;
  border-bottom: 1px solid #eee;
}

.fdt-locations-map-legend__filter {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  border: 1px solid #ddd;
  border-radius: 0.25rem;
}

.fdt-locations-map-legend__close {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  line-height: 1;
  background: none;
  border: none;
  border-radius: 0.25rem;
  font-size: 1.25rem;
  color: var(--fdt-dark-grey, #222);
  cursor: pointer;
}

.fdt-locations-map-legend__close:hover,
.fdt-locations-map-legend__close:focus {
  background: #f6f6f2;
}

.fdt-locations-map-legend__bulk {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #eee;
}

.fdt-locations-map-legend__bulk-btn {
  padding: 0.2rem 0.6rem;
  background: var(--fdt-dark-green, #1a3130);
  border: 1px solid var(--fdt-dark-green, #1a3130);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
}

.fdt-locations-map-legend__bulk-btn:hover,
.fdt-locations-map-legend__bulk-btn:focus {
  background: #0e1e1d;
  border-color: #0e1e1d;
}

.fdt-locations-map-legend__list {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0 1.25rem;
  padding: 0.75rem;
}

.fdt-locations-map-legend__group {
  min-width: 0;
}

.fdt-locations-map-legend__group-header {
  display: block;
  width: 100%;
  padding: 0.3rem 0;
  margin-bottom: 0.15rem;
  background: none;
  border: none;
  border-bottom: 1px solid #eee;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--fdt-dark-green, #1a3130);
  text-align: left;
  /* A real header at 2+ columns — only becomes an interactive accordion
     toggle once the layout drops to a single column, see 768px below. */
  cursor: default;
}

.fdt-locations-map-legend__group-list {
  display: block;
}

.fdt-locations-map-legend__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.85rem;
  color: var(--fdt-dark-grey, #222);
  cursor: pointer;
}

.fdt-locations-map-legend__swatch {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---- Responsive ---- */
@media (max-width: 1400px) {}

@media (max-width: 1200px) {
  .fdt-locations-map-legend__list {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 992px) {}

@media (max-width: 768px) {
  .fdt-locations-map {
    height: 60vh;
  }

  .fdt-locations-map-legend {
    top: 0.5rem;
    right: 0.5rem;
  }

  /* Below desktop, the key becomes a full-width bottom sheet instead of a
     top-right dropdown — a 30+ item flat list has nowhere to overflow to
     in a narrow viewport, and a sheet is the standard mobile pattern for
     this kind of filter panel. */
  .fdt-locations-map-legend__overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 20;
  }

  .fdt-locations-map-legend__panel {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    /* No max-height / scrollbar here on purpose — the accordion below
       keeps every section collapsed by default, so the sheet's natural
       height stays small until Pat/a visitor opens a section. */
    border-radius: 0.75rem 0.75rem 0 0;
    z-index: 21;
  }

  .fdt-locations-map-legend__list {
    grid-template-columns: 1fr;
  }

  /* Below 768px, group headers become accordion toggles — each column
     collapses to just its header until tapped, which is what keeps ~70
     categories in a single column from turning into one long scroll. */
  .fdt-locations-map-legend__group-header {
    cursor: pointer;
    padding: 0.75rem 0;
    font-size: 0.9rem;
  }

  .fdt-locations-map-legend__group-header::after {
    content: '+';
    float: right;
    font-weight: 400;
  }

  .fdt-locations-map-legend__group.is-open .fdt-locations-map-legend__group-header::after {
    content: '−';
  }

  .fdt-locations-map-legend__group-list {
    display: none;
  }

  .fdt-locations-map-legend__group.is-open .fdt-locations-map-legend__group-list {
    display: block;
  }

  .fdt-locations-map-legend__header {
    padding: 0.85rem;
  }

  .fdt-locations-map-legend__filter {
    padding: 0.6rem 0.75rem;
    font-size: 1rem;
  }

  .fdt-locations-map-legend__close {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.5rem;
  }

  .fdt-locations-map-legend__bulk-btn {
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
  }

  .fdt-locations-map-legend__item {
    padding: 0.6rem 0;
    font-size: 0.95rem;
  }
}

@media (max-width: 576px) {
  .fdt-locations-map-legend__panel {
    max-height: 65vh;
  }
}
