/* Reusable 3D campus map (Mapbox) — mount via [data-campus-map-3d] */

.dtc-map3d {
  --dtc-map3d-accent: #00c1de;
  --dtc-map3d-accent-dark: #009fb8;
  --dtc-map3d-height: min(70vh, 640px);

  position: relative;
  width: 100%;
  height: var(--dtc-map3d-height);
  min-height: 420px;
  overflow: hidden;
  background: #e8eef3;
  border: 1px solid var(--dtc-border, #e5e5e5);
}

/* Logo-grid onder de kaart is vervangen door het overlay-paneel */
.dtc-map3d + .dtc-campus-tiles {
  display: none !important;
}

.dtc-map3d__viewport {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.dtc-map3d__viewport .mapboxgl-canvas {
  outline: none;
}

.dtc-map3d__pin {
  width: 11px;
  height: 11px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--dtc-map3d-accent);
  box-shadow: 0 1px 6px rgb(0 0 0 / 0.28);
  cursor: pointer;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease;
}

.dtc-map3d__pin--facility {
  width: 16px;
  height: 16px;
  background: #fff;
  border: 2px solid var(--dtc-map3d-accent);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.2);
}

/* Parkeren: grotere P-badge i.p.v. leeg bolletje */
.dtc-map3d__pin--parking {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--dtc-map3d-accent-dark);
  border: 2px solid #fff;
  color: #fff;
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.28);
}

.dtc-map3d__pin-glyph {
  font-family: "Montserrat", ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  pointer-events: none;
}

.dtc-map3d__pin:hover,
.dtc-map3d__pin.is-active {
  transform: scale(1.55);
  background: var(--dtc-map3d-accent-dark);
  box-shadow:
    0 0 0 8px rgb(0 193 222 / 0.38),
    0 4px 14px rgb(0 0 0 / 0.28);
  opacity: 1 !important;
  z-index: 2;
}

.dtc-map3d__pin--facility:hover,
.dtc-map3d__pin--facility.is-active {
  background: var(--dtc-map3d-accent);
  border-color: #fff;
}

.dtc-map3d__pin--parking:hover,
.dtc-map3d__pin--parking.is-active {
  transform: scale(1.28);
  background: var(--dtc-map3d-accent-dark);
  border-color: #fff;
  color: #fff;
}

.dtc-map3d__pin--station {
  position: relative;
  overflow: visible;
}

.dtc-map3d__pin-ns {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: 48px;
  max-width: none;
  height: auto;
  display: block;
  pointer-events: none;
  background: #fff;
  padding: 3px 4px;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.18);
}

/* Mapbox plakt mapboxgl-marker op het pin-element zelf (geen wrapper) */
.dtc-map3d__pin:focus-visible {
  outline: 2px solid var(--dtc-map3d-accent-dark);
  outline-offset: 3px;
}

.dtc-map3d__card {
  position: absolute;
  bottom: 16px;
  left: 16px;
  z-index: 10;
  width: min(320px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  overflow-y: auto;
  padding: 20px;
  background: rgb(255 255 255 / 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgb(255 255 255 / 0.4);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.12);
}

.dtc-map3d__card[hidden] {
  display: none !important;
}

.dtc-map3d__close {
  display: none;
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #5c5c5c;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

.dtc-map3d.is-directory .dtc-map3d__close {
  display: flex;
}

.dtc-map3d__close:hover,
.dtc-map3d__close:focus-visible {
  color: #0a0a0a;
}

.dtc-map3d__close:focus-visible {
  outline: 2px solid var(--dtc-map3d-accent);
  outline-offset: 1px;
}

.dtc-map3d.is-edit .dtc-map3d__card {
  width: min(360px, calc(100% - 32px));
}

.dtc-map3d.is-directory .dtc-map3d__card {
  width: min(248px, calc(100% - 32px));
  padding: 36px 14px 16px;
}

.dtc-map3d__dir-group + .dtc-map3d__dir-group {
  margin-top: 20px;
}

.dtc-map3d__dir-heading {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  color: #0a0a0a;
}

.dtc-map3d__dir-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dtc-map3d__dir-item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 76px;
  padding: 18px 14px;
  border: 0;
  background: #fff;
  text-decoration: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.dtc-map3d__dir-item:hover,
.dtc-map3d__dir-item.is-active,
.dtc-map3d__dir-item:focus-visible {
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--dtc-map3d-accent);
}

.dtc-map3d__dir-item:focus-visible {
  outline: none;
}

.dtc-map3d__dir-logo {
  max-width: 168px;
  max-height: 52px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.dtc-map3d__dir-name {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  color: #5c5c5c;
}

.dtc-map3d__title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  color: #0a0a0a;
}

.dtc-map3d__subtitle {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #5c5c5c;
}

.dtc-map3d__edit-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  min-height: 20px;
  margin: 6px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #c4c4c4;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-decoration: none;
  cursor: pointer;
  opacity: 0.55;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.dtc-map3d__edit-toggle:hover {
  opacity: 0.9;
  color: #8a8a8a;
}

.dtc-map3d__edit-toggle.is-active {
  opacity: 1;
  color: var(--dtc-map3d-accent);
}

.dtc-map3d__edit-toggle:focus-visible {
  opacity: 1;
  outline: 1px solid var(--dtc-map3d-accent);
  outline-offset: 2px;
}

.dtc-map3d__form {
  margin-top: 14px;
}

.dtc-map3d__hint {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.45;
  color: #5c5c5c;
}

.dtc-map3d__field {
  margin-bottom: 12px;
}

.dtc-map3d__field label {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5c5c5c;
}

.dtc-map3d__field input,
.dtc-map3d__field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e5e5e5;
  border-radius: 0;
  font-size: 14px;
  background: #fff;
  outline: none;
  transition: border-color 0.2s ease;
}

.dtc-map3d__field input:focus,
.dtc-map3d__field select:focus {
  border-color: var(--dtc-map3d-accent);
}

.dtc-map3d__field input[readonly] {
  background: #f4f4f5;
  color: #5c5c5c;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.dtc-map3d.is-edit .dtc-map3d__viewport {
  cursor: crosshair;
}

.dtc-map3d__save {
  width: 100%;
  padding: 11px 12px;
  border: none;
  background: var(--dtc-map3d-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.dtc-map3d__save:hover {
  background: var(--dtc-map3d-accent-dark);
}

.dtc-map3d.is-error .dtc-map3d__viewport {
  opacity: 0.35;
}

.dtc-map3d.is-error .dtc-map3d__subtitle {
  color: #8a1f1f;
}

.dtc-map3d__popup .mapboxgl-popup-content {
  padding: 14px 16px 16px;
  border-radius: 0;
  font-family: "Montserrat", ui-sans-serif, system-ui, sans-serif;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.12);
}

.dtc-map3d__popup .mapboxgl-popup-close-button {
  font-size: 18px;
  color: #5c5c5c;
}

.dtc-map3d__popup-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 700;
  color: #0a0a0a;
}

.dtc-map3d__popup-link {
  color: var(--dtc-map3d-accent-dark, #009fb8);
  font-size: 13px;
  font-weight: 600;
  word-break: break-all;
}

.dtc-map3d__popup-link:hover {
  color: var(--dtc-map3d-accent, #00c1de);
}

@media (max-width: 640px) {
  .dtc-map3d {
    --dtc-map3d-height: min(46vh, 340px);
    min-height: 260px;
  }

  .dtc-map3d__card {
    bottom: 10px;
    left: 10px;
    right: 10px;
    width: auto;
    max-height: calc(100% - 20px);
    padding: 12px 14px;
  }

  .dtc-map3d.is-directory .dtc-map3d__card {
    right: auto;
    width: min(220px, calc(100% - 20px));
    padding: 32px 12px 14px;
  }

  .dtc-map3d__dir-heading {
    font-size: 18px;
  }

  .dtc-map3d__dir-item {
    min-height: 64px;
    padding: 12px 10px;
  }

  .dtc-map3d__dir-logo {
    max-width: 132px;
    max-height: 40px;
  }

  .dtc-map3d__title {
    font-size: 14px;
    line-height: 1.25;
  }

  .dtc-map3d__subtitle {
    font-size: 12px;
    line-height: 1.4;
  }

  /* Grotere tap-targets voor pins */
  .dtc-map3d__pin {
    width: 14px;
    height: 14px;
    border-width: 2px;
  }

  .dtc-map3d__pin--facility {
    width: 20px;
    height: 20px;
  }

  .dtc-map3d__pin--parking {
    width: 32px;
    height: 32px;
  }

  .dtc-map3d__pin-ns {
    width: 36px;
    max-width: none;
  }

  .dtc-map3d__pin--parking .dtc-map3d__pin-glyph {
    font-size: 15px;
  }

  .dtc-map3d__pin--parking.is-active {
    transform: scale(1.2);
  }

  .dtc-map3d__pin.is-active {
    transform: scale(1.35);
  }

  /* Compactere Mapbox-controls */
  .dtc-map3d .mapboxgl-ctrl-top-right {
    top: 8px;
    right: 8px;
  }

  .dtc-map3d .mapboxgl-ctrl-group button {
    width: 32px;
    height: 32px;
  }
}

/* Touch: hover-pseudo’s niet laten “plakken”; selectie via .is-active */
@media (hover: none) {
  .dtc-map3d__pin:hover:not(.is-active) {
    transform: none;
    background: var(--dtc-map3d-accent);
    box-shadow: 0 2px 10px rgb(0 0 0 / 0.28);
  }

  .dtc-map3d__pin--facility:hover:not(.is-active) {
    background: #fff;
    border-color: var(--dtc-map3d-accent);
    box-shadow: 0 2px 8px rgb(0 0 0 / 0.2);
  }

  .dtc-map3d__pin--parking:hover:not(.is-active) {
    transform: none;
    background: var(--dtc-map3d-accent-dark);
    border-color: #fff;
    color: #fff;
    box-shadow: 0 2px 10px rgb(0 0 0 / 0.28);
  }
}
