/* style.css - compact popup + minimal map UI */

/* Base map fill */
html, body, #map {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: Inter, Roboto, "Segoe UI", Arial, sans-serif;
}

/* Search container (top-right) */
#search-container {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255,255,255,0.95);
  padding: 8px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(15,23,42,0.06);
  z-index: 1000;
  min-width: 200px;
  background: #edf7f1;
}

#search-input {
  width: 88%;
  padding: 8px 10px;
  border: 1px solid #e6e6e6;
  border-radius: 5px;
  font-size: 14px;
  outline: none;
}

/* ✅ Search suggestions */
#suggestions {
  position: absolute;
  margin-left: 2px;
  background: rgb(255, 255, 255);
  border: 1px solid #ccc;
  border-radius: 6px;
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
  width: 90%;
}

.suggestion-item {
  padding: 6px 10px;
  cursor: pointer;
}

.suggestion-item:hover {
  background: #eee;
}

/* Custom marker (small colored dot) */
.custom-marker {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.marker-RED { background: #ef4444 !important; }
.marker-GREEN { background: #16a34a !important; }
.marker-YELLOW { background: #f59e0b !important; }
.marker-UNKNOWN { background: #6b7280 !important; }

/* ✅ User location */
.user-location-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(0, 128, 255, 0.9);
  border: 2px solid white;
  box-shadow: 0 0 6px rgba(0,0,0,0.3);
}

/* ✅ Popup bubble */
.traffic-popup {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 8px;
  background: #001510;
  color: white;
  border-radius: 12px;
  font-family: Arial, sans-serif;
  font-size: 12px;
  min-width: 50px;
  text-align: center;
}

.traffic-bubble {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.traffic-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: gray;
  flex-shrink: 0;
}

.traffic-count {
  font-size: 16px;
  font-weight: bold;
}

.traffic-title {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ✅ Light colors */
.traffic-RED .traffic-dot { background: red; }
.traffic-GREEN .traffic-dot { background: limegreen; }
.traffic-YELLOW .traffic-dot { background: gold; }
.traffic-UNKNOWN .traffic-dot { background: gray; }

/* Leaflet popup wrapper tweaks - remove default frame to let our compact design show */
.leaflet-popup-content-wrapper {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}
.leaflet-popup-tip { display: none; }

/* Responsive tweaks */
@media (max-width: 600px) {
  #search-container { right: 8px; top: 8px; min-width: 160px; padding: 6px; }
  .traffic-count { font-size: 16px; padding-left: 18px; }
  .traffic-bubble { padding: 6px 8px 6px 12px; min-width: 60px; }
  .traffic-compact { min-width: 110px; gap: 8px; }
}

/* small utility */
.hidden { display: none !important; }

/* traffic-light marker styles */
.traffic-light-divicon { pointer-events: auto; }

/* wrapper for the visual traffic light */
.traffic-light-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px;
  border-radius: 6px;
  background: rgba(10,10,10,0.75);
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

/* default lamp (off) */
.traffic-light-icon .lamp {
  background: #444;
  opacity: 0.28;
  box-shadow: none;
  transition: opacity .18s ease, box-shadow .18s ease, transform .18s ease;
}

/* active states (full brightness + subtle glow + pulse) */
.traffic-light-icon.red .lamp.red { opacity: 1; background: #ef4444; box-shadow: 0 0 8px rgba(239,68,68,0.9); animation: tl-pulse 1.2s ease-in-out infinite; }
.traffic-light-icon.yellow .lamp.yellow { opacity: 1; background: #f59e0b; box-shadow: 0 0 8px rgba(245,158,11,0.9); animation: tl-pulse 1.4s ease-in-out infinite; }
.traffic-light-icon.green .lamp.green { opacity: 1; background: #16a34a; box-shadow: 0 0 8px rgba(22,163,74,0.9); animation: tl-pulse 1s ease-in-out infinite; }

/* ensure non-active lamps dim */
.traffic-light-icon.red .lamp:not(.red),
.traffic-light-icon.yellow .lamp:not(.yellow),
.traffic-light-icon.green .lamp:not(.green) {
  opacity: 0.25;
  filter: grayscale(60%);
}

/* pulse animation */
@keyframes tl-pulse {
  0% { transform: scale(1); box-shadow: 0 0 6px rgba(0,0,0,0.15); }
  50% { transform: scale(1.06); box-shadow: 0 0 12px rgba(0,0,0,0.25); }
  100% { transform: scale(1); box-shadow: 0 0 6px rgba(0,0,0,0.15); }
}

/* smaller touch-friendly on mobile */
@media (max-width: 600px) {
  .traffic-light-icon { padding: 3px; }
  .traffic-light-icon .lamp { transform-origin: center; }
}






