/* ==========================================================================
   WS-Karte: Interaktive Vektor-Autokarte mit Pflegemobil & Ortschaften
   Wagner & Steinbach Pflege GmbH
   ========================================================================== */

/* 1. Karten-Container & Layout */
.wsp-map-section {
  position: relative;
  width: 100%;
  margin: 0 auto;
}

.wsp-map-card {
  position: relative;
  background: #FAF7F4;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(55, 43, 37, 0.08);
  border: 1px solid rgba(140, 75, 62, 0.14);
}

.wsp-map-card.wsp-map-fullwidth {
  width: 100%;
}

.wsp-map-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: #ffffff;
  border-bottom: 1px solid rgba(140, 75, 62, 0.1);
  gap: 16px;
  flex-wrap: wrap;
}

.wsp-map-topbar-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #3A302A;
}

.wsp-map-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-grow: 1;
  max-width: 580px;
}

.wsp-map-search-wrapper {
  position: relative;
  flex-grow: 1;
  display: flex;
  align-items: center;
}

.wsp-map-search-input {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 42px;
  background: #F5EFEB;
  border: 1.5px solid transparent;
  border-radius: 22px;
  font-size: 0.92rem;
  color: #2B231E;
  transition: all 0.25s ease;
  outline: none;
}

.wsp-map-search-input:focus {
  background: #ffffff;
  border-color: #8C4B3E;
  box-shadow: 0 0 0 3px rgba(140, 75, 62, 0.15);
}

.wsp-map-search-icon {
  position: absolute;
  left: 14px;
  font-size: 1.1rem;
  color: #8C4B3E;
  pointer-events: none;
}

.wsp-ghost-text {
  position: absolute;
  left: 42px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 0.92rem;
  white-space: pre;
  display: flex;
}

.wsp-ghost-typed {
  visibility: hidden;
}

.wsp-ghost-suffix {
  color: #A87D6F;
  opacity: 0.65;
}

.wsp-search-clear-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #D9CFC7;
  border: none;
  color: #ffffff;
  font-size: 13px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.wsp-search-clear-btn:hover {
  background: #8C4B3E;
}

.wsp-autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #E8DFD8;
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(55, 43, 37, 0.12);
  z-index: 1000;
  max-height: 260px;
  overflow-y: auto;
}

.wsp-autocomplete-item {
  padding: 10px 16px;
  font-size: 0.9rem;
  color: #2B231E;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #F4EFEB;
  transition: background 0.15s;
}

.wsp-autocomplete-item:last-child {
  border-bottom: none;
}

.wsp-autocomplete-item:hover,
.wsp-autocomplete-item.active {
  background: #FAF2ED;
  color: #8C4B3E;
  font-weight: 600;
}

/* 2. SVG Karten-Bühne */
.wsp-map-stage-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #FAF7F4;
  touch-action: pan-y;
}

.wsp-map-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 750px;
  user-select: none;
}

/* Flüsse & Landschaft */
.wsp-map-river {
  fill: none;
  stroke: #A8D1E7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wsp-map-river-label {
  font-size: 10px;
  fill: #689BB7;
  font-style: italic;
  font-family: inherit;
}

/* Ortschaften (Spots) */
.wsp-map-spot {
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.wsp-map-spot .spot-circle {
  fill: #FFFFFF;
  stroke: #5A4E46;
  stroke-width: 1.8px;
  transition: stroke 0.2s, stroke-width 0.2s, transform 0.2s;
}

.wsp-map-spot .spot-label {
  font-size: 10px;
  font-weight: 600;
  fill: #2B231E;
  transition: fill 0.2s, font-size 0.2s, font-weight 0.2s;
  pointer-events: none;
  paint-order: stroke fill;
  stroke: #FAF7F4;
  stroke-width: 2.2px;
  stroke-linejoin: round;
}

.wsp-map-spot:hover .spot-circle {
  stroke: #8C4B3E;
  stroke-width: 2.4px;
}

.wsp-map-spot:hover .spot-label {
  fill: #8C4B3E;
  font-weight: 700;
}

.wsp-map-spot.matched .spot-circle {
  stroke: #8C4B3E;
  stroke-width: 2.8px;
}

.wsp-map-spot.matched .spot-label {
  fill: #8C4B3E;
  font-weight: 800;
  font-size: 11.5px;
}

.wsp-map-spot.dimmed {
  opacity: 0.35;
}

/* Kleinere Ortschaften: Standardmäßig dezent, voll sichtbar bei Treffer oder Persistenz */
.wsp-map-spot.spot-minor {
  display: none;
  opacity: 0;
}

.wsp-map-spot.spot-minor.is-revealed,
.wsp-map-spot.spot-minor.matched {
  display: block;
  opacity: 1;
}

/* ==========================================================================
   Persistente Anzeige gesuchter Ortschaften auf der Auto-Karte
   ========================================================================== */
.wsp-map-spot.is-searched-persistent {
  display: block !important;
  opacity: 1 !important;
  z-index: 40 !important;
}

.wsp-map-spot.is-searched-persistent .spot-label {
  display: block !important;
  opacity: 1 !important;
  font-weight: 700 !important;
  fill: #8C4B3E !important;
  font-size: 11.5px !important;
  paint-order: stroke fill;
  stroke: #ffffff;
  stroke-width: 3.2px;
  stroke-linejoin: round;
}

.wsp-map-spot.is-searched-persistent .spot-circle {
  stroke: #8C4B3E !important;
  stroke-width: 2.4px !important;
}

/* Hauptsitz Feilbingert */
.wsp-map-spot.spot-feilbingert .spot-circle-hq {
  fill: #8C4B3E;
  stroke: #FFFFFF;
  stroke-width: 2.2px;
}

.wsp-map-spot.spot-feilbingert .spot-label {
  font-weight: 800;
  font-size: 12px;
  fill: #8C4B3E;
}

/* 3. Modale Overlay-Fenster für Orts-Details */
.wsp-search-feedback.wsp-map-overlay {
  position: absolute;
  width: 310px;
  max-width: 90%;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 18px;
  box-shadow: 0 14px 34px rgba(55, 43, 37, 0.16);
  border: 1px solid rgba(140, 75, 62, 0.18);
  padding: 18px;
  z-index: 200;
  display: none;
  animation: wspFadeInScale 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes wspFadeInScale {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

.wsp-search-feedback.wsp-map-overlay.is-active {
  display: block;
}

/* Quadranten-Platzierung */
.wsp-search-feedback.wsp-map-overlay.is-active.quadrant-top-left {
  top: 18px;
  left: 18px;
}

.wsp-search-feedback.wsp-map-overlay.is-active.quadrant-top-right {
  top: 18px;
  right: 18px;
}

.wsp-search-feedback.wsp-map-overlay.is-active.quadrant-bottom-left {
  bottom: 18px;
  left: 18px;
}

.wsp-search-feedback.wsp-map-overlay.is-active.quadrant-bottom-right {
  bottom: 18px;
  right: 18px;
}

.wsp-overlay-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.wsp-overlay-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wsp-overlay-town-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #2B231E;
}

.wsp-overlay-dist-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 2px 8px;
  background: #FAF2ED;
  color: #8C4B3E;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid rgba(140, 75, 62, 0.2);
}

.wsp-overlay-close-btn {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  color: #8A7E76;
  cursor: pointer;
  padding: 0 4px;
}

.wsp-overlay-close-btn:hover {
  color: #8C4B3E;
}

.wsp-overlay-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.wsp-overlay-status-pill.green {
  background: #E8F5E9;
  color: #2E7D32;
}

.wsp-overlay-status-pill.yellow {
  background: #FFF8E1;
  color: #B45309;
}

.wsp-overlay-status-pill.white {
  background: #F5EFEB;
  color: #5A4E46;
}

.wsp-overlay-body {
  font-size: 0.88rem;
  line-height: 1.45;
  color: #4A3E37;
  margin-bottom: 14px;
}

.wsp-overlay-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wsp-overlay-btn-primary {
  display: block;
  text-align: center;
  padding: 9px 14px;
  background: #8C4B3E;
  color: #ffffff !important;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 10px;
  transition: background 0.2s;
}

.wsp-overlay-btn-primary:hover {
  background: #733c31;
}

.wsp-overlay-btn-secondary {
  display: block;
  text-align: center;
  padding: 8px 14px;
  background: #F4EFEB;
  color: #3A302A !important;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 10px;
  transition: background 0.2s;
}

.wsp-overlay-btn-secondary:hover {
  background: #EAE2DB;
}

/* 4. Animationen: Pflegemobil & Ripples */
.wsp-care-car {
  pointer-events: none;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.25));
}

.wsp-arrival-ripple {
  fill: none;
  stroke-width: 2.2;
  animation: wspRippleAnim 1.8s infinite cubic-bezier(0.2, 0.6, 0.35, 1);
  transform-origin: center;
}

.wsp-arrival-ripple.delay {
  animation-delay: 0.75s;
}

@keyframes wspRippleAnim {
  0% { r: 6; opacity: 0.9; }
  100% { r: 38; opacity: 0; }
}

/* 5. Legende / Fußzeile */
.wsp-map-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  padding: 14px 20px;
  background: #ffffff;
  border-top: 1px solid rgba(140, 75, 62, 0.1);
  font-size: 0.84rem;
  color: #5A4E46;
}

.wsp-map-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wsp-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.wsp-legend-dot.hq {
  background: #8C4B3E;
  border: 1.5px solid #ffffff;
  box-shadow: 0 0 0 1px #8C4B3E;
}

.wsp-legend-dot.status-green { background: #2E7D32; }
.wsp-legend-dot.status-yellow { background: #F59E0B; }
.wsp-legend-dot.status-white { background: #9E9E9E; }

/* 6. Wasserzeichen */
.wsp-map-watermark {
  position: absolute;
  top: 14px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  opacity: var(--ws-logo-opacity, 1.0);
}

.wsp-watermark-logo {
  height: 38px;
  width: auto;
}

.wsp-watermark-date {
  font-size: 0.78rem;
  font-weight: 600;
  color: #7A6B63;
}

/* 7. Zoom Controls */
.wsp-map-zoom-controls {
  position: absolute;
  bottom: 18px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 100;
}

.wsp-zoom-btn {
  width: 32px;
  height: 32px;
  background: #ffffff;
  border: 1px solid rgba(140, 75, 62, 0.2);
  border-radius: 8px;
  font-size: 1.1rem;
  line-height: 1;
  color: #3A302A;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.2s;
}

.wsp-zoom-btn:hover {
  background: #FAF2ED;
  color: #8C4B3E;
}

/* Fullscreen Mode */
.wsp-map-card.is-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-width: 100vw !important;
  z-index: 999999 !important;
  margin: 0 !important;
  border-radius: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  background: #FAF8F5 !important;
  box-shadow: none !important;
  padding: 10px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}
.wsp-map-card.is-fullscreen .wsp-map-topbar {
  flex-shrink: 0 !important;
  margin-bottom: 8px !important;
}
.wsp-map-card.is-fullscreen .wsp-map-stage-wrapper {
  flex: 1 1 auto !important;
  height: calc(100dvh - 80px) !important;
  min-height: 0 !important;
  width: 100% !important;
}
.wsp-map-card.is-fullscreen .wsp-svg-map {
  width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
}
.wsp-fullscreen-close-btn {
  display: none;
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 60;
  background: rgba(45, 35, 30, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
}
.wsp-map-card.is-fullscreen .wsp-fullscreen-close-btn {
  display: inline-flex !important;
}
.wsp-fullscreen-close-btn:hover {
  background: #8C4B3E;
  color: #ffffff;
  transform: translateY(-1px);
}
.wsp-zoom-btn.wsp-fullscreen-toggle svg {
  display: block;
}
.wsp-map-card.is-fullscreen .wsp-zoom-btn.wsp-fullscreen-toggle {
  background: #8C4B3E;
  color: #ffffff;
}

/* Responsive Anpassungen */
@media (max-width: 768px) {
  .wsp-map-topbar {
    padding: 12px 16px;
  }
  .wsp-map-controls {
    max-width: 100%;
  }
  .wsp-search-feedback.wsp-map-overlay {
    width: calc(100% - 24px) !important;
    left: 12px !important;
    right: 12px !important;
    bottom: 12px !important;
    top: auto !important;
    z-index: 99999 !important;
    box-shadow: 0 14px 40px rgba(45, 35, 30, 0.32) !important;
  }
  .wsp-search-feedback.wsp-map-overlay.is-active {
    display: flex !important;
    flex-direction: column !important;
  }
  .wsp-overlay-actions {
    position: relative !important;
    z-index: 100000 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    margin-top: 10px !important;
  }
  .wsp-overlay-btn-primary {
    width: 100% !important;
    text-align: center !important;
    box-sizing: border-box !important;
    padding: 12px 16px !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 14px rgba(140, 75, 62, 0.35) !important;
  }
  .wsp-overlay-btn-secondary {
    width: 100% !important;
    text-align: center !important;
    box-sizing: border-box !important;
    padding: 10px 14px !important;
    font-size: 0.88rem !important;
  }
  .wsp-map-footer {
    gap: 12px;
    font-size: 0.78rem;
    padding: 10px 14px;
  }
}
