/* ============================================================================
   Leaflet Map Customizations
   ============================================================================ */

/* Custom Marker Styles */
.custom-marker {
  background: transparent;
  border: none;
}

.marker-pin {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(2, 10, 18, 0.9);
  cursor: pointer;
  transition: transform 0.2s ease;
}

/* Alert markers - static, no animation */
.alert-marker .marker-pin {
  animation: none;
}

.marker-pin:hover {
  transform: scale(1.3);
}

.marker-pin.high {
  background: #ff4757;
  box-shadow: 0 0 15px rgba(255, 71, 87, 0.6);
}

.marker-pin.medium {
  background: #ffa502;
  box-shadow: 0 0 15px rgba(255, 165, 2, 0.6);
}

.marker-pin.low {
  background: #2ed573;
  box-shadow: 0 0 15px rgba(46, 213, 115, 0.6);
}

@keyframes markerPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7);
  }
  70% {
    box-shadow: 0 0 0 20px rgba(255, 71, 87, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 71, 87, 0);
  }
}

.marker-animate {
  animation: markerDrop 0.5s ease-out;
}

@keyframes markerDrop {
  0% {
    transform: translateY(-200px) scale(0);
    opacity: 0;
  }
  60% {
    transform: translateY(5px) scale(1.1);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Popup Customization */
.leaflet-popup-content-wrapper {
  background: linear-gradient(135deg, rgba(13, 31, 49, 0.98), rgba(9, 19, 32, 0.98)) !important;
  border: 1px solid rgba(0, 247, 255, 0.3) !important;
  border-radius: 12px !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6) !important;
}

.leaflet-popup-content {
  margin: 12px !important;
  font-family: "Space Grotesk", system-ui, sans-serif !important;
}

.leaflet-popup-tip {
  background: rgba(13, 31, 49, 0.98) !important;
  border: 1px solid rgba(0, 247, 255, 0.3) !important;
}

.popup-card h3 {
  color: var(--accent-color);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.popup-card p {
  color: var(--text-color);
  font-size: 0.85rem;
  margin: 0.3rem 0;
  line-height: 1.4;
}

.popup-card strong {
  color: var(--accent-color);
  font-weight: 600;
}

.threat-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.threat-badge.high {
  background: rgba(255, 71, 87, 0.2);
  color: #ff8a95;
  border: 1px solid rgba(255, 71, 87, 0.5);
}

.threat-badge.medium {
  background: rgba(255, 165, 2, 0.2);
  color: #ffb84d;
  border: 1px solid rgba(255, 165, 2, 0.5);
}

.threat-badge.low {
  background: rgba(46, 213, 115, 0.2);
  color: #6dffb9;
  border: 1px solid rgba(46, 213, 115, 0.5);
}

/* Map Legend */
.map-legend {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(13, 23, 33, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 247, 255, 0.2);
  border-radius: 12px;
  padding: var(--spacing-md);
  z-index: 1000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
}

.map-legend:hover {
  background: rgba(13, 23, 33, 0.98);
  border-color: rgba(0, 247, 255, 0.4);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 247, 255, 0.2);
  transform: translateY(-2px);
}

.map-legend h4 {
  color: var(--accent-color);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--spacing-sm);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin: 0.4rem 0;
  font-size: 0.85rem;
  color: var(--text-color);
}

.legend-marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(2, 10, 18, 0.9);
}

.legend-marker.high {
  background: #ff4757;
  box-shadow: 0 0 10px rgba(255, 71, 87, 0.5);
}

.legend-marker.medium {
  background: #ffa502;
  box-shadow: 0 0 10px rgba(255, 165, 2, 0.5);
}

.legend-marker.low {
  background: #2ed573;
  box-shadow: 0 0 10px rgba(46, 213, 115, 0.5);
}

/* Leaflet Control Styling */
.leaflet-control-zoom {
  border: 1px solid rgba(0, 247, 255, 0.2) !important;
  border-radius: 8px !important;
  overflow: hidden !important;
}

.leaflet-control-zoom a {
  background: rgba(13, 23, 33, 0.95) !important;
  border: none !important;
  color: var(--accent-color) !important;
  font-size: 18px !important;
  font-weight: bold !important;
  transition: background 0.2s ease !important;
}

.leaflet-control-zoom a:hover {
  background: rgba(0, 247, 255, 0.1) !important;
}

/* Alert Animation */
.alert-new {
  animation: alertSlideIn 0.5s ease-out;
}

@keyframes alertSlideIn {
  from {
    transform: translateX(-20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* No Data State */
.no-data {
  text-align: center;
  padding: var(--spacing-lg);
  color: var(--muted-text);
  font-style: italic;
  font-size: 0.9rem;
}

/* Wide Screen - Map fills entire viewport */
@media (min-width: 900px) {
  #map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    height: 100% !important;
  }

  .leaflet-container {
    width: 100% !important;
    height: 100% !important;
  }
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .map-legend {
    bottom: 10px;
    left: 10px;
    padding: var(--spacing-sm);
  }

  .map-legend h4 {
    font-size: 0.8rem;
  }

  .legend-item {
    font-size: 0.75rem;
  }

  .legend-marker {
    width: 12px;
    height: 12px;
  }
}
