/* =========================================
   BV Cities Map v2.6 – Schwarz/Weiß + hoher Kontrast
   – Kleiner, mittiger Touch-Hinweis nur auf mobilen Touch-Geräten
   – Toolbar rechts, Modal-Button, professioneller Look
   ========================================= */

#bv-cities-map-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
}

#bv-cities-map {
  width: 100%;
  height: 100vh;
  min-height: 300px;
  position: relative;
  border-radius: 0;
  overflow: hidden;
  background: #f0f2f5;
}

@media (max-width: 767px) {
  #bv-cities-map {
    height: 300px;
    min-height: 300px;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  #bv-cities-map {
    height: 400px;
    min-height: 400px;
  }
}

@media (min-width: 1024px) {
  #bv-cities-map {
    height: 100vh;
    min-height: 500px;
  }
}

/* --- Karten-Filter (wird durch Inline-Styles überschrieben) --- */
/* Standardwerte als Fallback */
.bv-map .leaflet-tile-pane {
  filter: contrast(108%) brightness(98%) saturate(105%);
}

.bv-map--mono .leaflet-tile-pane {
  filter: grayscale(100%) contrast(135%) brightness(92%);
}

/* --- Toolbar oben rechts (Desktop), unten rechts (Mobile) --- */
.bv-cities-toolbar {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 401;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

@media (max-width: 767px) {
  .bv-cities-toolbar {
    top: auto;
    bottom: 12px;
    flex-direction: column;
  }
}

.bv-btn {
  font: 500 13px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  border: 0;
  border-radius: 3px;
  padding: 9px 13px;
  min-height: 44px; /* WCAG 2.1 AA: Mindestgröße für Touch-Targets */
  min-width: 44px;
  cursor: pointer;
  background: #0f56c8; /* Dental-Blau */
  color: #fff;
  box-shadow: 0 3px 10px rgba(21, 85, 201, 0.28);
  transition: transform 0.08s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

.bv-btn:focus-visible {
  outline: 2px solid #0f56c8;
  outline-offset: 2px;
}

.bv-btn:hover {
  filter: brightness(0.96);
  box-shadow: 0 5px 14px rgba(21, 85, 201, 0.36);
}

.bv-btn:active {
  transform: translateY(1px);
}

.bv-stats {
  font-size: 13px;
  color: #0e2d69;
  background: #fff;
  border: 1px solid #d6e2ff;
  padding: 9px 13px;
  border-radius: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  white-space: nowrap;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Skeleton --- */
.bv-skeleton {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #e7edf7 25%, #f5f7fb 37%, #e7edf7 63%);
  background-size: 400% 100%;
  animation: bv-shimmer 1.2s infinite;
  z-index: 400;
  display: none;
}

@keyframes bv-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* --- Kleiner, mittiger Touch-Hinweis (nur Mobile) --- */
.bv-gesture-hint {
  position: absolute;
  z-index: 402;
  background: rgba(12, 19, 32, 0.85);
  color: #fff;
  border: 1px solid rgba(120, 140, 180, 0.3);
  border-radius: 14px;
  padding: 5px 8px;
  font: 600 11px/1 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  letter-spacing: 0.2px;
  box-shadow: 0 8px 20px rgba(0, 10, 30, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
  display: none; /* Standard: versteckt */
}

/* Auf Desktop: neben Zoom-Controls positionieren */
@media (min-width: 768px) {
  .bv-gesture-hint {
    left: auto;
    right: 10px;
    top: auto;
    bottom: 80px; /* Über den Zoom-Controls */
    transform: translate(0, 0) scale(0.98);
    display: block;
  }
  
  .bv-gesture-hint.is-visible {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  
  .bv-gesture-hint.is-fading {
    opacity: 0;
    transform: translate(0, 0) scale(0.98);
    transition: opacity 0.6s ease, transform 0.6s ease;
  }
}

/* Auf Mobile: zentriert */
@media (max-width: 767px) {
  .bv-gesture-hint {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.98);
    display: block;
  }
  
  .bv-gesture-hint.is-visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  
  .bv-gesture-hint.is-fading {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.98);
    transition: opacity 0.6s ease, transform 0.6s ease;
  }
}

/* --- Modal --- */
.bv-modal[hidden] {
  display: none;
}

.bv-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(8, 16, 34, 0.45);
  display: grid;
  place-items: center;
  padding: 2vw;
}

.bv-modal__dialog {
  width: min(1200px, 96vw);
  height: min(800px, 86vh);
  background: #fff;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(12, 30, 72, 0.3);
}

#bv-cities-map-modal {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.bv-modal__close {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 2;
  background: #ffffff;
  color: #0e2a57;
  border: 1px solid #e0e9ff;
}

/* --- Leaflet Controls --- */
.leaflet-control-container .leaflet-control {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  border: 1px solid #dce2ee;
  z-index: 400 !important; /* Reduziert von 1000+ um Navigation nicht zu überlagern */
}

.leaflet-control-zoom {
  z-index: 400 !important;
}

.leaflet-control-zoom a {
  background: #fff;
  color: #0f56c8;
}

.leaflet-control-zoom a:hover {
  background: #e9eef5;
}

.leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 10px;
  border: 1px solid #dce2ee;
  padding: 2px 6px;
  font-size: 11px;
}

/* --- Marker & Cluster (Farbcodiert) --- */
.bv-marker .bv-pin {
  display: inline-flex;
  width: 28px;
  height: 38px;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 1px 0 #fff) drop-shadow(0 3px 8px rgba(0, 0, 0, 0.2));
  transform-origin: 50% 100%;
  transition: transform 0.12s ease;
}

.bv-marker--premium .bv-pin {
  width: 32px;
  height: 42px;
  filter: drop-shadow(0 1px 0 #fff) drop-shadow(0 3px 8px rgba(250, 204, 21, 0.3));
}

.bv-marker .bv-pin svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.leaflet-marker-icon.bv-marker:hover .bv-pin {
  transform: translateY(-2px) scale(1.03);
}

/* Marker-Animationen */
@keyframes bv-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

@keyframes bv-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.bv-marker-pulse {
  animation: bv-pulse 1s ease infinite;
}

.bv-cluster-wrap {
  background: transparent;
  border: 0;
}

.bv-cluster {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #0f56c8;
  border: 3px solid #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 10px rgba(15, 86, 200, 0.5), 0 0 0 2px rgba(15, 86, 200, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.bv-cluster::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 86, 200, 0.3) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.bv-cluster:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 14px rgba(15, 86, 200, 0.6), 0 0 0 3px rgba(15, 86, 200, 0.3);
}

.bv-cluster:hover::before {
  opacity: 1;
}

.bv-cluster span {
  font: 700 16px/1 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  z-index: 1;
  position: relative;
}

/* Distanz-Marker entfernt - Entfernung wird jetzt im Popup angezeigt */

/* --- Popups --- */
.leaflet-popup.bv-popup .leaflet-popup-content-wrapper {
  border-radius: 12px;
  box-shadow: 0 14px 30px rgba(7, 22, 60, 0.2);
  border: 1px solid #dfe5f5;
  padding: 0;
}

.leaflet-popup.bv-popup .leaflet-popup-content {
  padding: 0;
  margin: 0;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: #0a1c3b;
}

.bv-popup-content {
  padding: 14px 16px;
  min-width: 200px;
}

.bv-popup-badge {
  margin-bottom: 8px;
}

.bv-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid;
}

.bv-badge--premium {
  background: #fef9c3;
  color: #854d0e;
  border-color: #facc15;
}

.bv-badge--business {
  background: #dbeafe;
  color: #1e40af;
  border-color: #60a5fa;
}

.bv-popup-title {
  display: block;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #0a1c3b;
  line-height: 1.3;
}

.bv-popup-distance {
  font-size: 12px;
  color: #64748b;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
  font-style: italic;
}

.bv-popup-addr,
.bv-popup-phone,
.bv-popup-rating {
  display: block;
  font-size: 13px;
  color: #64748b;
  margin-top: 6px;
  line-height: 1.5;
}

.bv-popup-link {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 16px;
  background: #0f56c8;
  color: #fff !important;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  transition: background 0.2s ease, transform 0.1s ease;
}

.bv-popup-link:hover {
  background: #0d4ba8;
  text-decoration: none;
  transform: translateY(-1px);
}

.bv-popup-link:active {
  transform: translateY(0);
}

.leaflet-popup.bv-popup .leaflet-popup-tip {
  background: #fff;
  border: 1px solid #dfe5f5;
}