/* Startseite: Karte der Orte mit Unterkünften (backend/includes/frontend/homepage-map.php) */

/* Abstände oben und unten kommen von den Abschnitten davor (.unterkuenfte-teaser) und danach (.review-section) */
.am-map-wrap {
  position: relative;
}

.am-map {
  height: 560px;
  border: 1px solid #e6e6e6;
  border-radius: 19px;
  background-color: #f2efe9;
  font-family: Figtree_Google, Georgia, sans-serif;
  z-index: 0; /* Leaflet-Ebenen unter Navigation/Cookie-Banner halten */
}

@media screen and (max-width: 991px) {
  .am-map {
    height: 480px;
  }
}

@media screen and (max-width: 767px) {
  .am-map {
    height: 400px;
  }
}

/* Bis zur Zustimmung zu OpenStreetMap: unscharfes Bild der Karte mit Hinweis (wie .wnh-booking-* in
   apartment-detail.css). Liegt über der Karte, bis deren erste Kacheln geladen sind. */
.am-consent {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  border-radius: 19px;
  background-color: #f2efe9;
}

.am-consent-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.04); /* unscharfe Ränder abschneiden */
}

.am-consent-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-color: rgba(250, 241, 237, .35);
}

.am-consent-notice {
  max-width: 540px;
  padding: 28px 30px;
  border-radius: 16px;
  background-color: #fff;
  box-shadow: 0 12px 40px rgba(51, 51, 51, .14);
  text-align: center;
}

.am-consent-icon {
  display: block;
  margin: 0 auto 10px;
  color: #f7a720;
}

.am-consent-title {
  margin-bottom: 8px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  color: #000;
}

.am-consent-text {
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.6;
}

.am-consent-text a,
.am-consent-always a {
  color: inherit;
  text-decoration: underline;
}

.am-consent-always {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: #8a8a8a;
}

.am-consent-always a {
  white-space: nowrap;
}

/* Mit Zustimmung (.is-auto) statt des Hinweises nur eine Ladeanzeige, bis die Kacheln da sind */
.am-consent-autoload {
  display: none;
  margin: 0;
  padding: 10px 18px;
  border-radius: 999px;
  background-color: #fff;
  box-shadow: 0 6px 24px rgba(51, 51, 51, .12);
  font-size: 14px;
  line-height: 1.4;
  color: #333;
}

.am-map-wrap.is-auto .am-consent-autoload {
  display: block;
}

.am-map-wrap.is-auto .am-consent-notice {
  display: none;
}

.am-consent-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: .5em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -.15em;
  animation: am-consent-spin .8s linear infinite;
}

@keyframes am-consent-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .am-consent-spinner {
    animation-duration: 2.4s;
  }
}

@media screen and (max-width: 479px) {
  .am-consent-overlay {
    padding: 14px;
  }

  .am-consent-notice {
    padding: 22px 20px;
  }

  .am-consent-text {
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.5;
  }
}

/* Kacheln leicht entsättigen, damit die Orte hervorstechen */
.am-map .leaflet-tile-pane {
  filter: saturate(.7) brightness(1.02);
}

/* Bei Browser-Zoom bzw. Bildschirmskalierung (z. B. 120 %) und bei Zoom-Zwischenstufen liegen die
   Kacheln auf Bruchteilen von Bildschirmpixeln: Zwischen ihnen blitzen helle Striche durch.
   Leaflet setzt dafür mix-blend-mode: plus-lighter – zusammen mit dem Filter oben addiert das die
   Kanten aber zu hellen Strichen. Stattdessen normal überblenden und die Kacheln einen halben Pixel
   überlappen lassen. */
.am-map .leaflet-tile {
  width: 256.5px !important;
  height: 256.5px !important;
  mix-blend-mode: normal !important;
}

/* Hinweis "Zum Zoomen zuerst in die Karte klicken" beim Scrollen über der Karte */
.am-hint {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 1000;
  padding: 10px 16px;
  border-radius: 6px;
  background-color: rgba(0, 0, 0, .78);
  color: #fff;
  font-size: 14px;
  pointer-events: none;
  white-space: nowrap;
}

.am-hint[hidden] {
  display: none;
}

/* Popup eines Orts */
.am-leaflet-popup .leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .22);
}

.am-leaflet-popup .leaflet-popup-content {
  margin: 0;
  width: 260px !important;
  font-family: Figtree_Google, Georgia, sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

.am-leaflet-popup a.leaflet-popup-close-button {
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, .92);
  color: #000;
  font: 20px/28px Tahoma, Verdana, sans-serif;
  text-align: center;
}

.am-popup-body {
  padding: 12px 14px 14px;
}

.am-popup-title {
  color: #000;
  font-size: 16px;
  font-weight: 700;
}

.am-popup-facts {
  margin-top: 6px;
  color: #6b6b6b;
  font-size: 13px;
}

.am-popup-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.am-leaflet-popup a.am-popup-button {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 4px;
  background-color: var(--secondary, #f7a720);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transition: background-color .2s;
}

.am-leaflet-popup a.am-popup-button:hover {
  background-color: #e0950e;
}

/* Schrift der Pillen, größer je mehr Unterkünfte (placeLabelSize() in homepage-map-scripts.php) */
.am-place-label {
  color: #183247;
  font-family: Figtree_Google, Georgia, sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}

.am-place-label.is-m {
  font-size: 15px;
}

.am-place-label.is-l {
  font-size: 17px;
}

.am-place-label.is-xl {
  font-size: 19px;
}

/* Pille mit Anzahl, Haus-Symbol und Name, auf dem Ort zentriert */
.am-place-pill-icon {
  width: 0;
  height: 0;
}

.am-place-pill {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background-color: #fff;
  box-shadow: 0 0 0 4px rgba(247, 167, 32, .3), 0 2px 10px rgba(0, 0, 0, .25);
  transform: translate(-50%, -50%);
  white-space: nowrap;
  cursor: pointer;
  transition: transform .15s;
}

.am-place-pill-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 2em;
  height: 2em;
  padding: 0 8px;
  border-radius: 999px;
  background-color: var(--secondary, #f7a720);
  color: #fff;
}

.am-place-pill-house {
  width: .95em;
  height: .95em;
  flex-shrink: 0;
}

.am-place-pill-icon:hover .am-place-pill {
  transform: translate(-50%, -50%) scale(1.06);
}

/* Überlappt die Pille eines größeren Orts: nur die Anzahl, Name beim Darüberfahren */
.am-place-pill.is-compact {
  gap: 0;
  padding: 4px;
}

.am-place-pill.is-compact .am-place-pill-name {
  display: none;
}

.am-place-pill-icon:hover .am-place-pill.is-compact {
  gap: 8px;
  padding: 4px 12px 4px 4px;
}

.am-place-pill-icon:hover .am-place-pill.is-compact .am-place-pill-name {
  display: inline;
}
