/* ==========================================
   INTERACTIVE MAP WITH PULSING MARKERS
   ========================================== */

.map-container {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--sh-md);
  background: var(--gold-pale);
  margin-bottom: 2rem;
}

#interactive-map {
  width: 100%;
  height: 500px !important;
  z-index: 1;
}

/* Leaflet root: не обрізати підказку */
.custom-marker-icon,
.custom-marker-icon--with-label,
.leaflet-marker-icon {
  overflow: visible !important;
  background: transparent !important;
  border: none !important;
}

.location-marker-wrap {
  position: relative;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  justify-content: flex-end;
  width: 52px;
  height: 88px;
  pointer-events: auto;
}

.location-marker {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 3px solid var(--white);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.location-marker--pulsing {
  animation: pulse 2s ease-in-out infinite;
}

.location-marker-wrap:hover .location-marker {
  transform: scale(1.12);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  z-index: 1000;
}

.location-marker-wrap:hover .marker-image {
  opacity: 1;
  transform: scale(1.05);
}

.marker-image {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  opacity: 0.8;
  transition: all 0.3s ease;
}

.marker-label {
  margin-bottom: 6px;
  max-width: 200px;
  text-align: center;
  background: #1a2540;
  color: #fff;
  padding: 0.42rem 0.75rem;
  border-radius: 8px;
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-b);
  line-height: 1.2;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.35);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 1200;
}

.location-marker-wrap:hover .marker-label {
  opacity: 1;
  transform: translateY(0);
}

@keyframes pulse {
  0% {
    box-shadow: 0 4px 12px rgba(74, 95, 127, 0.4);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 4px 20px rgba(74, 95, 127, 0.7);
    transform: scale(1.05);
  }
  100% {
    box-shadow: 0 4px 12px rgba(74, 95, 127, 0.4);
    transform: scale(1);
  }
}

/* ── Leaflet popup wrapper ─────────────────────────────── */
.location-popup .leaflet-popup-content-wrapper {
  border-radius: 14px !important;
  background: rgba(240, 247, 255, 0.96) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  box-shadow: 0 16px 48px rgba(26, 58, 126, 0.22) !important;
  border: 1px solid rgba(200, 222, 239, 0.8) !important;
  padding: 0 !important;
  overflow: hidden;
  min-width: 220px;
}
.location-popup .leaflet-popup-tip-container { display: none; }
.location-popup .leaflet-popup-content { margin: 0 !important; width: 100% !important; }
.location-popup .leaflet-popup-close-button {
  top: 10px !important;
  right: 10px !important;
  width: 32px !important;
  height: 32px !important;
  line-height: 30px !important;
  font-size: 20px !important;
  font-weight: 700 !important;
  color: #fff !important;
  background: rgba(26, 58, 126, 0.88) !important;
  border-radius: 50% !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25) !important;
  padding: 0 !important;
  text-align: center !important;
  z-index: 30 !important;
}
.location-popup .leaflet-popup-close-button:hover {
  background: var(--btn-primary-hover) !important;
  color: #fff !important;
}

/* ── Popup inner layout ───────────────────────────────── */
.map-popup { position: relative; }

.map-popup__logo {
  position: absolute;
  top: 10px;
  left: 10px;
  right: auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.9);
  box-shadow: 0 2px 8px rgba(26,58,126,.25);
  z-index: 12;
}

.map-popup__image {
  width: 100%; height: 130px;
  object-fit: cover;
  display: block;
}

.map-popup__body {
  padding: 1rem 1.1rem 1.2rem;
}

.map-popup__title {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem; font-weight: 700;
  color: var(--navy);
  margin-bottom: .4rem;
}

.map-popup__desc {
  font-size: .8rem;
  color: #3a5070;
  line-height: 1.5;
  margin-bottom: .8rem;
}

.map-popup__btn {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  background: var(--btn-primary-bg, #4A6898);
  color: #fff !important;
  font-family: var(--font-b);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--r-pill, 999px);
  border: none;
  cursor: pointer;
  transition: background .2s, transform .18s var(--ease-bounce, ease);
  text-decoration: none !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}
.map-popup__btn:hover {
  background: var(--btn-primary-hover, #2A4878);
  color: #fff !important;
  transform: translateY(-1px);
}

/* Single location map (внизу страницы города) */
.single-location-map {
  padding: 5rem 2rem;
  background: var(--gold-pale);
  margin-top: 3rem;
}

.single-location-map__wrapper {
  max-width: 1200px;
  margin: 0 auto;
}

.single-location-map__title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 2rem;
  text-align: center;
}

.single-location-map__container {
  margin-bottom: 3rem;
}

#single-location-map {
  width: 100%;
  height: 600px !important;
  border-radius: 12px;
  box-shadow: var(--sh-md);
}

.single-location-marker--active {
  animation: pulse 1.5s ease-in-out infinite;
}

.single-location-marker--active .location-marker {
  transform: scale(1.5);
  box-shadow: 0 8px 30px rgba(74, 95, 127, 0.5);
}

.map-cities-navigation {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.city-nav-link {
  padding: 1rem;
  background: var(--white);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  text-align: center;
  text-decoration: none;
  color: var(--text-dark);
  font-weight: 500;
  transition: all 0.3s ease;
  cursor: pointer;
}

.city-nav-link:hover {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--white);
  transform: translateY(-4px);
  box-shadow: var(--sh-md);
}

.city-nav-link--active {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--white);
}

/* ── Секція [locations_map]: фон, фільтри регіонів, чіпи міст (будь-яка сторінка) ── */
.homepage-map {
  padding: 6rem 2rem;
  background: var(--peach);
}
.homepage-map__wrapper {
  max-width: var(--wrap);
  margin: 0 auto;
}
.homepage-map .section-title {
  margin-bottom: 2rem;
}
.map-regions-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
  justify-content: center;
}
.region-button {
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: var(--r-pill);
  font-family: var(--font-b);
  font-weight: 600;
  font-size: 0.8rem;
  background: var(--btn-primary-bg);
  color: var(--white);
  cursor: pointer;
  transition: filter 0.2s, transform 0.2s var(--ease-bounce), box-shadow 0.2s;
  letter-spacing: 0.02em;
  outline: 3px solid transparent;
  outline-offset: 2px;
}
.region-button:hover {
  filter: brightness(1.18);
  transform: translateY(-2px) scale(1.04);
}
.region-button.active {
  outline-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
}
.region-button--all {
  background: var(--gold);
  color: var(--text);
}
.region-button--all:hover {
  filter: brightness(1.08);
}
.region-button--all.active {
  background: var(--btn-primary-bg);
  color: #fff;
  outline-color: rgba(74, 104, 152, 0.45);
}
.map-locations h3 {
  font-family: var(--font-h);
  font-size: 1.05rem;
  color: var(--navy);
  margin-bottom: 1rem;
}
.locations-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.location-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.95rem;
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.22s var(--ease);
}
.location-chip:hover {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
  transform: translateY(-1px);
}
.location-chip--marker-only {
  opacity: 0.65;
  cursor: default;
}
.location-chip--marker-only:hover {
  background: var(--white);
  color: var(--text);
  border-color: var(--border);
  transform: none;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  #interactive-map,
  #single-location-map {
    height: 400px !important;
  }

  .location-marker {
    width: 40px;
    height: 40px;
  }

  .marker-label {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }

  .map-cities-navigation {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  #interactive-map,
  #single-location-map {
    height: 300px !important;
  }

  .location-marker {
    width: 35px;
    height: 35px;
  }

  .map-popup {
    max-width: 180px;
  }

  .map-cities-navigation {
    grid-template-columns: 1fr;
  }
}
