/* ===== LEAFLET MAP OVERRIDES ===== */
#map {
  width: 100%;
  height: 100%;
  z-index: 0;
}

.leaflet-tile-pane {
  filter: saturate(0.7) brightness(0.95);
}

.leaflet-control-zoom {
  display: none;
}

.leaflet-popup-content-wrapper {
  border-radius: 16px !important;
  box-shadow: 0 8px 32px rgba(0, 104, 87, 0.18) !important;
  border: 1px solid rgba(0, 104, 87, 0.1) !important;
  padding: 0 !important;
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0 !important;
  min-width: 220px;
}

.leaflet-popup-tip-container {
  display: none;
}

.pulse-marker {
  border-radius: 50%;
  border: 3px solid white;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.pulse-marker:hover {
  transform: scale(1.2);
}

.pulse-marker.red {
  background: #b61722;
  animation: pulse-red 1.8s ease-in-out infinite;
}

.pulse-marker.orange {
  background: #f97316;
  animation: pulse-orange 1.8s ease-in-out infinite;
}

.pulse-marker.yellow {
  background: #fbbf24;
  animation: pulse-yellow 1.8s ease-in-out infinite;
}

.pulse-marker.green {
  background: #006857;
  animation: pulse-green 2.2s ease-in-out infinite;
}

.pulse-marker.blue {
  background: #2d5bff;
  animation: pulse-blue 1.8s ease-in-out infinite;
}

.pulse-marker.cyan {
  background: #06b6d4;
  animation: pulse-cyan 2s ease-in-out infinite;
}

/* Weather marker icon */
.weather-icon-marker {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.weather-icon-marker:hover {
  transform: scale(1.2);
}

.weather-icon-marker .material-symbols-outlined {
  font-size: 18px;
  color: white;
  font-variation-settings: 'FILL' 1, 'wght' 600;
}

.weather-sunny {
  background: linear-gradient(135deg, #f59e0b, #f97316);
}

.weather-cloudy {
  background: linear-gradient(135deg, #94a3b8, #64748b);
}

.weather-rainy {
  background: linear-gradient(135deg, #06b6d4, #0284c7);
}

.weather-storm {
  background: linear-gradient(135deg, #6366f1, #4338ca);
}

/* ===== POPUP CARD STYLE ===== */
.dengue-popup {
  padding: 16px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.dengue-popup .popup-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.dengue-popup .popup-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dengue-popup .popup-city {
  font-weight: 800;
  font-size: 14px;
  color: #191c1d;
}

.dengue-popup .popup-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.dengue-popup .popup-stats {
  font-size: 13px;
  color: #3d4945;
  font-weight: 500;
}

.dengue-popup .popup-stats span {
  font-weight: 700;
  color: #191c1d;
}

/* District permanent labels - first rule */
.district-label {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #064e3b !important;
  font-weight: 900 !important;
  text-shadow: 0 0 5px white, 0 0 5px white, 0 0 5px white;
  font-size: 11px !important;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* District permanent labels - second rule (overrides above if applicable) */
.district-label {
  background: white !important;
  border: none !important;
  border-radius: 4px !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  padding: 3px 8px !important;
  color: #334155 !important;
  text-shadow: none !important;
}

.district-label::before {
  display: none !important;
}

/* ===== NIRA PREMIUM POPUP & MARKER SYSTEM ===== */
.leaflet-popup-content-wrapper { padding: 0 !important; background: transparent !important; box-shadow: none !important; border-radius: 0 !important; border: none !important; overflow: visible !important; }
.leaflet-popup-content { margin: 0 !important; width: auto !important; line-height: inherit !important; overflow: visible !important; }
.leaflet-popup-tip-container { display: none !important; }
.leaflet-popup { margin-bottom: 20px !important; overflow: visible !important; }
.nira-leaflet-popup .leaflet-popup-content-wrapper { overflow: visible !important; }

.nira-popup-card {
  width: 300px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px !important;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.02);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: nira-card-entrance 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nira-popup-header { position: relative; width: 100%; height: 140px; background: #f1f5f9; overflow: hidden; }
.nira-popup-image { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.nira-popup-card:hover .nira-popup-image { transform: scale(1.06); }
.nira-popup-overlay { display: none; }
.nira-severity-badge { position: absolute; top: 10px; right: 10px; padding: 4px 10px; border-radius: 99px; font-size: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: white; backdrop-filter: blur(8px); z-index: 2; }
.severity-high { background: rgba(239, 68, 68, 0.95); box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3); }
.severity-medium { background: rgba(249, 115, 22, 0.95); box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3); }
.severity-low { background: rgba(34, 197, 94, 0.95); box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3); }

.nira-popup-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.nira-popup-title { font-size: 15px; font-weight: 700; color: #0f172a; line-height: 1.2; letter-spacing: -0.2px; margin: 0; }
.nira-popup-meta { display: flex; flex-direction: column; gap: 6px; }
.nira-meta-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #475569; font-weight: 500; }
.nira-meta-item .material-symbols-outlined { font-size: 15px; color: #64748b; flex-shrink: 0; }
.nira-ai-section { background: rgba(0, 104, 87, 0.03); border: 1px solid rgba(0, 104, 87, 0.08); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.nira-ai-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #006857; display: flex; align-items: center; gap: 4px; }
.nira-ai-value { font-size: 12px; font-weight: 500; color: #334155; line-height: 1.3; }
.nira-insight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.nira-insight-card { background: #f8fafc; padding: 6px 10px; border-radius: 8px; border: 1px solid #f1f5f9; display: flex; align-items: center; gap: 6px; }
.nira-insight-text { font-size: 11px; font-weight: 600; color: #475569; }
.nira-popup-actions { display: flex; gap: 6px; margin-top: 4px; }
.nira-btn { flex: 1; height: 32px; border-radius: 8px; border: none; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 4px; cursor: pointer; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
.nira-btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.nira-btn:active { transform: translateY(0); filter: brightness(0.95); }
.nira-btn-primary { background: #006857; color: white; box-shadow: 0 2px 6px rgba(0, 104, 87, 0.2); }
.nira-btn-secondary { background: #f1f5f9; color: #475569; }

/* MARKER FIX — Remove positioning context from container to let Leaflet handle it */
.nira-marker-container { overflow: visible !important; }
.nira-marker-wrapper { position: relative; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.nira-marker-core { position: absolute; width: 10px; height: 10px; border-radius: 50%; border: 2px solid white; box-shadow: 0 0 5px rgba(0,0,0,0.3); z-index: 2; }
.nira-marker-pulse { position: absolute; width: 100%; height: 100%; border-radius: 50%; opacity: 0; z-index: 1; }
.pulse-high { background: #ef4444; animation: nira-marker-breathing 1.2s ease-out infinite; }
.pulse-medium { background: #f97316; animation: nira-marker-breathing 2s ease-out infinite; }
.pulse-low { background: #22c55e; animation: nira-marker-breathing 3.5s ease-out infinite; }

/* Custom icon badge for Fogging / Lainnya map markers */
.nira-marker-icon-badge {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.nira-marker-icon-badge .material-symbols-outlined {
  font-size: 11px !important;
  color: white;
  font-variation-settings: 'FILL' 1;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Desktop layer button active state — override Tailwind text-slate-* on child spans */
.btn-layer-active span.text-slate-600,
.btn-layer-active span.text-slate-400,
.btn-layer-active span.text-slate-500 {
  color: white !important;
}

/* ---- Photo expand panel ---- */
.nira-popup-wrap { display: flex; flex-direction: row; align-items: stretch; }
.nira-photo-panel { width: 0; overflow: hidden; background: #0f172a; border-radius: 0 16px 16px 0; transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1); flex-shrink: 0; display: flex; }
.nira-photo-panel.open { width: 280px; }
.nira-photo-panel-inner { width: 280px; min-width: 280px; display: flex; flex-direction: column; }
.nira-photo-panel-img { width: 100%; flex: 1; object-fit: cover; display: block; min-height: 140px; }
.nira-photo-panel-caption { padding: 10px 12px; font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.6); display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,0.4); }
.nira-photo-expand-btn { position: absolute; bottom: 10px; left: 10px; z-index: 3; width: 30px; height: 30px; border-radius: 8px; border: none; background: rgba(0,0,0,0.55); color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); transition: background 0.2s; }
.nira-photo-expand-btn .material-symbols-outlined { font-size: 16px; }
.nira-photo-expand-btn:hover { background: rgba(0,104,87,0.9); }
.nira-popup-no-photo { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: #f1f5f9; color: #cbd5e1; }
.nira-popup-no-photo .material-symbols-outlined { font-size: 28px; }

.nira-popup-wrap:has(.nira-photo-panel.open) .nira-popup-card { border-radius: 16px 0 0 16px !important; }

/* ===== MOBILE RESPONSIVE MAP POPUPS ===== */
@media (max-width: 640px) {
  .nira-popup-card {
    width: 250px;
    border-radius: 12px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  }
  
  .nira-popup-header {
    height: 90px;
  }
  
  .nira-severity-badge {
    top: 8px;
    right: 8px;
    padding: 2px 8px;
    font-size: 8.5px;
  }
  
  .nira-photo-expand-btn {
    bottom: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    border-radius: 6px;
  }
  
  .nira-photo-expand-btn .material-symbols-outlined {
    font-size: 13px;
  }
  
  .nira-popup-body {
    padding: 10px 12px 12px;
    gap: 6px;
  }
  
  .nira-popup-title {
    font-size: 13px;
    font-weight: 800;
  }
  
  .nira-popup-meta {
    gap: 4px;
  }
  
  .nira-meta-item {
    font-size: 10.5px;
    gap: 6px;
  }
  
  .nira-meta-item .material-symbols-outlined {
    font-size: 13px;
  }
  
  .nira-ai-section {
    padding: 6px 8px;
    gap: 2px;
    border-radius: 8px;
  }
  
  .nira-ai-label {
    font-size: 8px;
    gap: 2px;
  }
  
  .nira-ai-label .material-symbols-outlined {
    font-size: 10px !important;
  }
  
  .nira-ai-value {
    font-size: 10px;
    line-height: 1.2;
  }
  
  .nira-insight-grid {
    gap: 4px;
  }
  
  .nira-insight-card {
    padding: 4px 6px;
    border-radius: 6px;
    gap: 4px;
  }
  
  .nira-insight-card .material-symbols-outlined {
    font-size: 10px !important;
  }
  
  .nira-insight-text {
    font-size: 9px;
  }
  
  .nira-popup-actions {
    gap: 4px;
    margin-top: 2px;
  }
  
  .nira-btn {
    height: 28px;
    font-size: 10.5px;
    border-radius: 6px;
    gap: 2px;
  }
  
  .nira-btn .material-symbols-outlined {
    font-size: 11px !important;
  }
  
  /* Photo expand panel inside leaflet popup on mobile */
  .nira-photo-panel.open {
    width: 180px;
  }
  
  .nira-photo-panel-inner {
    width: 180px;
    min-width: 180px;
  }
  
  .nira-photo-panel-img {
    min-height: 90px;
  }
  
  .nira-photo-panel-caption {
    padding: 6px 8px;
    font-size: 10px;
    gap: 4px;
  }
  
  .nira-photo-panel-caption .material-symbols-outlined {
    font-size: 10px !important;
  }
}

/* CUSTOM LEAFLET ATTRIBUTION FLAG: Indonesia (Red & White) */
.leaflet-control-attribution a svg {
  background: linear-gradient(to bottom, #E00016 50%, #FFFFFF 50%) !important;
  width: 12px !important;
  height: 8px !important;
  display: inline-block !important;
  vertical-align: middle !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
  box-sizing: border-box !important;
  border-radius: 1px !important;
}

.leaflet-control-attribution a svg path {
  fill: transparent !important;
  display: none !important;
}

