/* ============================================================================
   WAZE ALERTS - Map Markers & Popups
   ============================================================================

   Styles for Waze alert markers and popups displayed on the Leaflet map.
   These alerts include police, road closures, accidents, hazards, etc.

   @see 05-waze-alerts.js for the WazeAlerts module
   @see 00-icons.js for window.wazeAlertIcons
   ============================================================================ */

/* ============================================================================
   ALERT MARKERS
   ============================================================================ */

/* Marker wrapper - overrides Leaflet default DivIcon styles */
.waze-alert-marker {
  background: none !important;
  border: none !important;
  overflow: visible !important;
}

/* Icon container - holds the SVG */
.waze-alert-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  transition: transform var(--transition-fast, 150ms) ease-out;
}

/* Scale up slightly on hover */
.waze-alert-marker:hover .waze-alert-icon {
  transform: scale(1.1);
}

/* Ensure SVG scales correctly to fit container */
.waze-alert-icon svg {
  display: block;
  width: auto !important;
  height: auto !important;
  max-width: none;
  max-height: none;
  overflow: visible !important;
}


/* ============================================================================
   ALERT POPUPS
   ============================================================================ */

/* Override Leaflet popup container for Waze alerts */
.waze-alert-popup-container .leaflet-popup-content-wrapper {
  background: var(--background-light, #ffffff);
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  padding: 0;
}

.waze-alert-popup-container .leaflet-popup-content {
  margin: 0;
  padding: 0;
}

.waze-alert-popup-container .leaflet-popup-tip {
  background: var(--background-light, #ffffff);
}

/* Popup content structure */
.waze-alert-popup {
  padding: var(--spacing-md, 16px);
  min-width: 150px;
  max-width: 250px;
  font-family: var(--font-sans, system-ui, sans-serif);
}

/* Header: type + time */
.waze-alert-popup__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--gap-sm, 8px);
  margin-bottom: var(--spacing-xs, 4px);
}

.waze-alert-popup__type {
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: var(--font-weight-semibold, 600);
  color: var(--text-inverse, #212529);
  line-height: var(--line-height-tight, 1.25);
}

.waze-alert-popup__time {
  font-size: var(--font-size-xs, 0.75rem);
  color: var(--text-muted, #8e8e8e);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Location */
.waze-alert-popup__location {
  font-size: var(--font-size-xs, 0.75rem);
  color: var(--text-secondary, #6c757d);
  margin-bottom: var(--spacing-sm, 8px);
  line-height: var(--line-height-normal, 1.5);
}

/* Description (if present) */
.waze-alert-popup__description {
  font-size: var(--font-size-xs, 0.75rem);
  color: var(--text-inverse, #212529);
  margin-bottom: var(--spacing-sm, 8px);
  padding-top: var(--spacing-sm, 8px);
  border-top: 1px solid var(--border-light, #e9ecef);
  line-height: var(--line-height-normal, 1.5);
}

/* Thumbs up / confirmations */
.waze-alert-popup__thumbs {
  font-size: var(--font-size-xs, 0.75rem);
  color: var(--color-success, #3dcc89);
  font-weight: var(--font-weight-medium, 500);
}


/* ============================================================================
   ALERT TYPE SPECIFIC COLORS (optional accents)
   ============================================================================ */

/* Police - blue accent */
.waze-alert-popup--police .waze-alert-popup__type {
  color: #1ab3ff;
}

/* Road Closed - orange accent */
.waze-alert-popup--road-closed .waze-alert-popup__type {
  color: #ff9100;
}

/* Accident - gray/red accent */
.waze-alert-popup--accident .waze-alert-popup__type {
  color: #dc3545;
}

/* Hazard - yellow/amber accent */
.waze-alert-popup--hazard .waze-alert-popup__type {
  color: #ffc400;
}


/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */

@media (max-width: 480px) {
  .waze-alert-popup {
    padding: var(--spacing-sm, 8px);
    min-width: 120px;
    max-width: 200px;
  }
  
  .waze-alert-popup__type {
    font-size: var(--font-size-xs, 0.75rem);
  }
}


/* ============================================================================
   LOADING STATE (optional - for future use)
   ============================================================================ */

.waze-alerts-loading {
  opacity: 0.7;
  pointer-events: none;
}

.waze-alerts-loading .waze-alert-icon {
  animation: waze-pulse 1.5s ease-in-out infinite;
}

@keyframes waze-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
