/**
 * PDIR Locations Map
 * Theme-agnostic styles.
 */
.pdir-map,
.pdir-map * {
  box-sizing: border-box;
}

.pdir-map {
  --pdir-gap: 20px;
  --pdir-radius: 6px;
  --pdir-border: 1px solid rgba(0, 0, 0, 0.1);
  --pdir-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --pdir-hover-bg: rgba(0, 0, 0, 0.04);
  --pdir-active-bg: rgba(0, 0, 0, 0.08);
  --pdir-height: 600px;

  margin: 0 0 var(--pdir-gap);
}

/**
 * Map canvas
 */
.pdir-map-element {
  width: 100%;
  height: var(--pdir-height);
  border-radius: var(--pdir-radius);
  overflow: hidden;
  border: var(--pdir-border);
  box-shadow: var(--pdir-shadow);
  background: rgba(0, 0, 0, 0.02);
}

/* Guard against host themes forcing max-width on canvas/img inside the map */
.pdir-map-element .maplibregl-canvas,
.pdir-map-element img {
  max-width: none !important;
}

/**
 * Layout — sidebar list + map
 */
.pdir-row.pdir-no-gutters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pdir-gap);
  margin: 0;
}

.pdir-col-sm-4 {
  flex: 1 1 100%;
  min-width: 0;
}

@media (min-width: 768px) {
  .pdir-col-sm-4 {
    flex: 0 0 320px;
  }

  .pdir-col-sm-4+.pdir-col-sm-8,
  .pdir-map-element-wrap {
    flex: 1 1 0;
    min-width: 0;
  }
}

/**
 * Markers list
 */
.pdir-map-markers {
  display: block;
  padding: 4px;
  margin: 0;
}

@media (min-width: 768px) {
  .pdir-map-markers {
    height: var(--pdir-height);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px;

    /* Firefox scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.25) transparent;
  }

  /* WebKit scrollbar */
  .pdir-map-markers::-webkit-scrollbar {
    width: 8px;
  }

  .pdir-map-markers::-webkit-scrollbar-track {
    background: transparent;
  }

  .pdir-map-markers::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
  }

  .pdir-map-markers::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.35);
  }
}

/**
 * Individual location cards
 */
.pdir-locations-archive-item {
  padding: 14px 16px;
  margin: 0 0 10px;
  border: var(--pdir-border);
  border-radius: var(--pdir-radius);
  background: transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.pdir-locations-archive-item:last-child {
  margin-bottom: 0;
}

.pdir-locations-archive-item:hover,
.pdir-locations-archive-item:focus-within {
  background: var(--pdir-hover-bg);
  border-color: rgba(0, 0, 0, 0.18);
}

.pdir-locations-archive-item.is-active,
.pdir-locations-archive-item[aria-selected="true"] {
  background: var(--pdir-active-bg);
  border-color: currentColor;
}

.pdir-locations-archive-item p {
  margin: 4px 0;
  line-height: 1.45;
}

.pdir-locations-archive-item a {
  text-decoration: none !important;
  transition: opacity 0.15s ease;
}

.pdir-locations-archive-item a:hover {
  opacity: 0.7;
}

.pdir-locations-archive-item img {
  display: block;
  max-width: 100%;
  height: auto;
  margin-bottom: 10px;
  border-radius: calc(var(--pdir-radius) - 2px);
}

/**
 * Reset link
 */
.pdir-reset-map {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.9em;
  opacity: 0.7;
  text-decoration: underline;
  cursor: pointer;
}

.pdir-reset-map:hover {
  opacity: 1;
}

/**
 * MapLibre popup
 */
.pdir-map-element .maplibregl-popup-content {
  padding: 12px 14px;
  border-radius: var(--pdir-radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  font-family: inherit;
}

.pdir-map-element .maplibregl-popup-content h3,
.pdir-map-element .maplibregl-popup-content strong {
  margin: 0 0 4px;
  font-size: 1em;
}
