/* ==========================================================================
   INTERACTIVE SERVICE AREA MAP (LEAFLET + OPENSTREETMAP)
   Matches high-converting emergency plumbing service radius & pinned hubs.
   ========================================================================== */

/* Service Area Map Card Container in Section 14 (#service-areas) */
.service-map-card {
  background: #ffffff;
  border: 1px solid var(--slate-200, #e2e8f0);
  border-radius: var(--radius-lg, 16px);
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.06), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  padding: 1.25rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

@media (min-width: 768px) {
  .service-map-card {
    border-radius: var(--radius-xl, 24px);
    padding: 1.5rem;
    margin-bottom: 2.5rem;
  }
}

.service-map-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--slate-200, #e2e8f0);
}

.service-map-status {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  color: var(--slate-800, #1e293b);
  font-weight: 600;
}

.service-map-status .radar-beacon {
  margin-right: 0.25rem;
}

.service-map-recenter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #f8fafc;
  border: 1px solid var(--slate-300, #cbd5e1);
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--slate-700, #334155);
  cursor: pointer;
  transition: all 0.2s ease;
}

.service-map-recenter-btn:hover {
  background: #ffffff;
  color: #0284c7;
  border-color: #0284c7;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.15);
}

.service-areas-leaflet-map {
  width: 100%;
  height: 480px;
  border-radius: var(--radius-md, 12px);
  overflow: hidden;
  border: 1px solid var(--slate-200, #e2e8f0);
  position: relative;
  z-index: 1;
  background: #f1f5f9;
}

@media (max-width: 640px) {
  .service-areas-leaflet-map {
    height: 380px;
  }
}

.service-map-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--slate-200, #e2e8f0);
}

.service-map-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.825rem;
  color: var(--slate-600, #475569);
  font-weight: 500;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.legend-pin-icon {
  width: 14px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
}

.legend-ring {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #0284c7;
  background: rgba(14, 165, 233, 0.2);
  display: inline-block;
}

/* Local Map in Section 8 (#local-norwalk) */
.sf-map-leaflet-frame {
  width: 100%;
  height: 280px;
  border-radius: var(--radius-md, 12px);
  overflow: hidden;
  position: relative;
  z-index: 1;
  background: #081124;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

@media (min-width: 640px) {
  .sf-map-leaflet-frame {
    height: 320px;
  }
}

/* Custom Marker Styling matching Leaflet blue pin standard */
.custom-leaflet-marker {
  background: transparent;
  border: none;
}

.marker-pin-wrap {
  position: relative;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
}

.marker-pin-wrap:hover {
  transform: scale(1.15) translateY(-3px);
  z-index: 1000 !important;
}

.marker-pulse-ring {
  position: absolute;
  top: 14px;
  left: 14px;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #00e5ff;
  opacity: 0.85;
  animation: markerPulse 2s infinite ease-out;
  pointer-events: none;
}

@keyframes markerPulse {
  0% {
    transform: translate(-50%, -50%) scale(0.6);
    opacity: 0.95;
  }
  100% {
    transform: translate(-50%, -50%) scale(2.2);
    opacity: 0;
  }
}

/* Custom Recenter Control in Bottom Right */
.leaflet-bar.leaflet-control-recenter {
  border: 2px solid rgba(0,0,0,0.2);
  box-shadow: none;
  background-clip: padding-box;
}

.leaflet-bar.leaflet-control-recenter a {
  background-color: #ffffff;
  border-bottom: none;
  width: 30px;
  height: 30px;
  line-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #334155;
  text-decoration: none;
  cursor: pointer;
  border-radius: 4px;
}

.leaflet-bar.leaflet-control-recenter a:hover {
  background-color: #f1f5f9;
  color: #0284c7;
}

/* Leaflet Attribution Bar Matching Image 1 */
.leaflet-container .leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  font-size: 11px;
  color: #334155;
  padding: 2px 6px;
  border-radius: 4px 0 0 0;
}

/* Modern Leaflet Popup Styling */
.custom-map-popup .leaflet-popup-content-wrapper {
  background: #0b1528;
  color: #f1f5f9;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
  padding: 0;
  overflow: hidden;
}

.custom-map-popup .leaflet-popup-tip {
  background: #0b1528;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.custom-map-popup .leaflet-popup-content {
  margin: 0;
  line-height: 1.4;
}

.map-popup-card {
  padding: 1rem 1.15rem;
  min-width: 250px;
  max-width: 310px;
}

.map-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.map-popup-title {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
}

.map-popup-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.4);
  white-space: nowrap;
}

.map-popup-sub {
  font-size: 0.8rem;
  color: #94a3b8;
  margin: 0 0 0.75rem 0;
  line-height: 1.4;
}

.map-popup-services {
  font-size: 0.775rem;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  margin-bottom: 0.85rem;
  border-left: 3px solid #0284c7;
}

.map-popup-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.map-popup-call {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: linear-gradient(135deg, #e11d48, #be123c);
  color: #ffffff !important;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.45rem 0.8rem;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
  flex: 1;
}

.map-popup-call:hover {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.4);
}

.map-popup-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: #38bdf8;
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.map-popup-link:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

/* Ensure tilt effect doesn't jitter map interaction */
.sf-map-3d-box {
  touch-action: pan-y;
}
