/* ============================================
   CRIME ZONE MAP — GLOBAL STYLES
   Dark Theme | Red Accent | Glassmorphism
   ============================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-deep:      #050507;
  --bg-dark:      #0a0a0f;
  --bg-card:      #0f0f18;
  --bg-glass:     rgba(15, 15, 30, 0.75);
  --border:       rgba(255, 32, 64, 0.15);
  --border-hover: rgba(255, 32, 64, 0.4);
  --red-primary:  #ff2040;
  --red-glow:     rgba(255, 32, 64, 0.35);
  --red-soft:     rgba(255, 32, 64, 0.12);
  --orange:       #ff6b00;
  --yellow:       #ffd700;
  --green:        #00ff88;
  --text-primary: #f0f0f8;
  --text-muted:   #8888aa;
  --text-dim:     #555570;
  --font-main:    'Inter', sans-serif;
  --font-title:   'Orbitron', sans-serif;
  --radius-sm:    8px;
  --radius-md:    14px;
  --radius-lg:    20px;
  --transition:   0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  height: 100%;
  font-family: var(--font-main);
  background: var(--bg-deep);
  color: var(--text-primary);
  overflow: hidden;
}

/* ─── BACKGROUND PARTICLES ─── */
.bg-particles {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  overflow: hidden;
}
.bg-particles::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(255,32,64,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 90%, rgba(255,32,64,0.04) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 50% 50%, rgba(255,107,0,0.03) 0%, transparent 70%);
}
.particle {
  position: absolute;
  width: 2px; height: 2px;
  border-radius: 50%;
  background: rgba(255, 32, 64, 0.6);
  animation: floatParticle linear infinite;
}

@keyframes floatParticle {
  0%   { transform: translateY(100vh) scale(0); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 0.3; }
  100% { transform: translateY(-20px) scale(1.5); opacity: 0; }
}

/* ─── HEADER ─── */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  background: rgba(5, 5, 10, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
}

.logo {
  display: flex; align-items: center; gap: 10px;
}
.logo-icon {
  animation: pulseLogo 2.5s ease-in-out infinite;
}
@keyframes pulseLogo {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(255,32,64,0.4)); }
  50%       { filter: drop-shadow(0 0 10px rgba(255,32,64,0.8)); }
}
.logo-text {
  font-family: var(--font-title);
  font-size: 20px; font-weight: 900; letter-spacing: 3px;
  color: var(--text-primary);
}
.logo-accent { color: var(--red-primary); }

.header-badge {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600; letter-spacing: 2px;
  color: var(--red-primary);
  border: 1px solid rgba(255,32,64,0.3);
  padding: 5px 12px; border-radius: 20px;
  background: rgba(255,32,64,0.06);
}
.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red-primary);
  box-shadow: 0 0 6px var(--red-primary);
  animation: blink 1.2s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.7); }
}

/* ─── LAYOUT ─── */
.main-layout {
  position: fixed;
  top: 60px; left: 0; right: 0; bottom: 0;
  display: flex;
  z-index: 1;
}

/* ─── CONTROL PANEL ─── */
.control-panel {
  width: 340px;
  min-width: 340px;
  height: 100%;
  background: rgba(8, 8, 16, 0.95);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  backdrop-filter: blur(20px);
  z-index: 100;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,32,64,0.3) transparent;
}
.control-panel::-webkit-scrollbar { width: 4px; }
.control-panel::-webkit-scrollbar-track { background: transparent; }
.control-panel::-webkit-scrollbar-thumb {
  background: rgba(255,32,64,0.3); border-radius: 4px;
}

.panel-inner { padding: 28px 22px 40px; }

.panel-title {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-title);
  font-size: 13px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--red-primary);
  margin-bottom: 6px;
  text-transform: uppercase;
}
.panel-subtitle {
  font-size: 12.5px; color: var(--text-muted); line-height: 1.6;
  margin-bottom: 26px;
}

/* ─── SEARCH FORM ─── */
.search-form { display: flex; flex-direction: column; gap: 16px; }

.input-group { display: flex; flex-direction: column; gap: 7px; }
.input-group label {
  font-size: 11.5px; font-weight: 600; letter-spacing: 1px;
  color: var(--text-muted); text-transform: uppercase;
}

.input-wrap {
  position: relative;
}
.input-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  pointer-events: none;
}
.input-wrap input {
  width: 100%; padding: 12px 14px 12px 40px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}
.input-wrap input::placeholder { color: var(--text-dim); }
.input-wrap input:focus {
  border-color: rgba(255,32,64,0.5);
  background: rgba(255,32,64,0.04);
  box-shadow: 0 0 0 3px rgba(255,32,64,0.08), inset 0 0 12px rgba(255,32,64,0.03);
}

.search-btn {
  margin-top: 6px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #cc0028, #ff2040, #ff4060);
  border: none; border-radius: var(--radius-sm);
  color: white; font-family: var(--font-main);
  font-size: 14px; font-weight: 700; letter-spacing: 0.5px;
  cursor: pointer;
  transition: var(--transition);
  position: relative; overflow: hidden;
}
.search-btn::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0; transition: var(--transition);
}
.search-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(255,32,64,0.4); }
.search-btn:hover::before { opacity: 1; }
.search-btn:active { transform: translateY(0); }

.all-india-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px;
  background: rgba(255, 96, 64, 0.08);
  border: 1px solid rgba(255, 96, 64, 0.35);
  border-radius: var(--radius-sm);
  color: #ff6040; font-family: var(--font-main);
  font-size: 13px; font-weight: 600; letter-spacing: 0.3px;
  cursor: pointer; transition: var(--transition);
}
.all-india-btn:hover {
  background: rgba(255, 96, 64, 0.15);
  border-color: rgba(255, 96, 64, 0.6);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(255,96,64,0.2);
}
.all-india-btn:active { transform: translateY(0); }

/* ─── FILTER SECTION ─── */
.filter-section { margin-top: 28px; }
.filter-title {
  font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--text-muted); text-transform: uppercase; margin-bottom: 12px;
}
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 12px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; transition: var(--transition);
  background: rgba(255,255,255,0.02);
}
.chip input { display: none; }
.chip:hover { border-color: rgba(255,32,64,0.35); color: var(--text-primary); }
.chip.active {
  border-color: rgba(255,32,64,0.5);
  background: rgba(255,32,64,0.1);
  color: var(--red-primary);
  box-shadow: 0 0 10px rgba(255,32,64,0.12);
}

/* ─── STATS SECTION ─── */
.stats-section {
  margin-top: 28px;
  background: rgba(255,32,64,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  animation: slideIn 0.4s ease-out;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.stats-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--text-muted); text-transform: uppercase; margin-bottom: 16px;
}

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }

.stat-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  text-align: center;
  transition: var(--transition);
}
.stat-card:hover { border-color: var(--border); transform: scale(1.02); }
.stat-card.danger { border-color: rgba(255,0,64,0.2); background: rgba(255,0,64,0.05); }
.stat-card.warning { border-color: rgba(255,107,0,0.2); background: rgba(255,107,0,0.05); }
.stat-card.caution { border-color: rgba(255,215,0,0.2); background: rgba(255,215,0,0.05); }

.stat-value {
  font-family: var(--font-title);
  font-size: 22px; font-weight: 700; color: var(--text-primary);
  letter-spacing: 1px;
}
.stat-card.danger  .stat-value { color: #ff3060; }
.stat-card.warning .stat-value { color: var(--orange); }
.stat-card.caution .stat-value { color: var(--yellow); }
.stat-label { font-size: 10.5px; color: var(--text-dim); margin-top: 3px; letter-spacing: 0.5px; }


.risk-label {
  display: flex; justify-content: space-between;
  font-size: 11.5px; color: var(--text-muted); margin-bottom: 7px;
}
.risk-bar {
  height: 6px; border-radius: 4px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.risk-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, #00ff88, #ffd700, #ff6b00, #ff2040);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
}

/* ─── LEGEND ─── */
.legend {
  margin-top: 24px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.01);
}
.legend-title {
  font-size: 10.5px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--text-dim); text-transform: uppercase; margin-bottom: 12px;
}
.legend-item {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text-muted);
  margin-bottom: 9px;
  transition: var(--transition);
}
.legend-item:last-child { margin-bottom: 0; }
.legend-item:hover { color: var(--text-primary); }
.legend-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}

/* ─── MAP SECTION ─── */
.map-section {
  flex: 1; position: relative; overflow: hidden;
}

#map {
  width: 100%; height: 100%;
  background: #090910;
}

/* Leaflet overrides for dark theme */
.leaflet-container {
  background: #090910 !important;
  font-family: var(--font-main) !important;
}
.leaflet-control-attribution {
  background: rgba(0,0,0,0.7) !important;
  color: #555 !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: #888 !important; }
.leaflet-control-zoom a {
  background: rgba(10,10,20,0.9) !important;
  color: var(--text-primary) !important;
  border-color: var(--border) !important;
  transition: var(--transition) !important;
}
.leaflet-control-zoom a:hover {
  background: rgba(255,32,64,0.15) !important;
  color: var(--red-primary) !important;
}

/* ─── MAP OVERLAYS ─── */
.map-overlay {
  position: absolute; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 5, 10, 0.85);
  backdrop-filter: blur(6px);
  pointer-events: none;
}
.overlay-content { text-align: center; max-width: 320px; }
.overlay-icon { margin-bottom: 24px; animation: rotateTarget 8s linear infinite; }
@keyframes rotateTarget {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.overlay-icon svg { animation: counterRotate 8s linear infinite; }
@keyframes counterRotate {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(-360deg); }
}
.overlay-title {
  font-family: var(--font-title); font-size: 18px; font-weight: 700;
  color: var(--text-primary); margin-bottom: 12px; letter-spacing: 1px;
}
.overlay-text { font-size: 14px; color: var(--text-muted); line-height: 1.6; }

.loading-overlay {
  position: absolute; inset: 0; z-index: 600;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 5, 10, 0.9);
}
.loader-content { text-align: center; }
.loader-ring {
  width: 56px; height: 56px; margin: 0 auto 20px;
  border: 3px solid rgba(255,32,64,0.15);
  border-top-color: var(--red-primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-text {
  font-size: 13px; color: var(--text-muted); letter-spacing: 1px;
}
.dots::after {
  content: '';
  animation: dotAnim 1.4s steps(4, end) infinite;
}
@keyframes dotAnim {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
}

/* ─── MAP INFO BAR ─── */
.map-info-bar {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  z-index: 400;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: rgba(8,8,18,0.92);
  border: 1px solid var(--border);
  border-radius: 24px;
  backdrop-filter: blur(16px);
  font-size: 12.5px;
  animation: riseUp 0.4s ease-out;
}
@keyframes riseUp {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.map-location-tag {
  display: flex; align-items: center; gap: 6px;
  font-weight: 600; color: var(--text-primary);
}
.map-timestamp { color: var(--text-dim); border-left: 1px solid var(--border); padding-left: 16px; }

/* ─── CUSTOM LEAFLET MARKERS ─── */
.crime-marker {
  border-radius: 50%;
  cursor: pointer;
  animation: markerPulse 2.5s ease-in-out infinite;
}
@keyframes markerPulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50%       { transform: scale(1.2); opacity: 1; }
}

/* ─── LEAFLET POPUP DARK ─── */
.dark-popup .leaflet-popup-content-wrapper {
  background: rgba(10,10,22,0.97);
  border: 1px solid rgba(255,32,64,0.3);
  border-radius: 12px;
  color: var(--text-primary);
  box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 20px rgba(255,32,64,0.1);
}
.dark-popup .leaflet-popup-tip { background: rgba(10,10,22,0.97); }
.dark-popup .leaflet-popup-close-button { color: var(--text-muted) !important; }
.dark-popup .leaflet-popup-close-button:hover { color: var(--red-primary) !important; }

.popup-inner { padding: 4px; min-width: 180px; }
.popup-badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  margin-bottom: 10px;
}
.popup-badge.extreme { background: rgba(255,0,64,0.2); color: #ff3060; border: 1px solid rgba(255,0,64,0.3); }
.popup-badge.high    { background: rgba(255,107,0,0.2); color: #ff6b00; border: 1px solid rgba(255,107,0,0.3); }
.popup-badge.medium  { background: rgba(255,215,0,0.2); color: #ffd700; border: 1px solid rgba(255,215,0,0.3); }
.popup-name { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.popup-row {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text-muted);
  border-top: 1px solid rgba(255,255,255,0.05); padding-top: 8px; margin-top: 4px;
}
.popup-row span:last-child { color: var(--text-primary); font-weight: 500; }

/* ─── HOTSPOT CARD ─── */
.hotspot-card {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px; padding: 10px 14px;
  background: rgba(255,32,64,0.06);
  border: 1px solid rgba(255,32,64,0.2);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.hotspot-lbl { color: var(--text-dim); font-weight: 600; }
.hotspot-name { color: var(--red-primary); font-weight: 700; font-size: 13px; }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .control-panel { width: 100%; min-width: 0; height: auto; max-height: 50vh; }
  .main-layout { flex-direction: column; }
  .map-section { flex: 1; height: 50vh; }
  .detail-panel { width: 100%; right: 0; left: 0; top: auto; bottom: 0; height: 70vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
}

/* ═══════════════════════════════════════════
   GEOLOCATION PROMPT
═══════════════════════════════════════════ */
.geo-prompt {
  position: fixed; inset: 0; z-index: 4000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(16px);
  animation: fadeIn 0.4s ease;
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }

.geo-card {
  width: min(420px, 92vw);
  background: linear-gradient(145deg, #08040f 0%, #0c0616 50%, #080410 100%);
  border: 1px solid rgba(255, 32, 64, 0.3);
  border-radius: 20px;
  padding: 36px 32px 28px;
  text-align: center;
  box-shadow:
    0 0 60px rgba(255, 0, 40, 0.15),
    0 0 120px rgba(255, 0, 40, 0.06),
    inset 0 1px 0 rgba(255,255,255,0.05);
  animation: cardSlideUp 0.5s cubic-bezier(0.4,0,0.2,1);
}
@keyframes cardSlideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* Radar animation */
.geo-radar {
  position: relative; width: 100px; height: 100px;
  margin: 0 auto 24px;
}
.geo-radar-ring {
  position: absolute; border-radius: 50%;
  border: 1px solid rgba(255,32,64,0.4);
  top: 50%; left: 50%; transform: translate(-50%,-50%);
}
.r1 { width: 100%; height: 100%; animation: radarPing 2.4s ease-out infinite; }
.r2 { width: 70%;  height: 70%;  animation: radarPing 2.4s ease-out infinite 0.5s; }
.r3 { width: 40%;  height: 40%;  animation: radarPing 2.4s ease-out infinite 1s; }
@keyframes radarPing {
  0%   { opacity: 0.6; transform: translate(-50%,-50%) scale(0.8); }
  60%  { opacity: 0.3; }
  100% { opacity: 0;   transform: translate(-50%,-50%) scale(1.1); }
}
.geo-radar-sweep {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(255,32,64,0.3) 0deg, transparent 60deg);
  animation: radarSpin 2s linear infinite;
}
@keyframes radarSpin { to { transform: rotate(360deg); } }
.geo-radar-dot {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 12px; height: 12px; border-radius: 50%;
  background: #ff2040;
  box-shadow: 0 0 12px #ff2040, 0 0 24px rgba(255,32,64,0.5);
}

.geo-title {
  font-family: var(--font-title); font-size: 20px; font-weight: 800;
  color: var(--text-primary); letter-spacing: 1px; margin-bottom: 12px;
}
.geo-subtitle {
  font-size: 13.5px; color: var(--text-muted); line-height: 1.65;
  margin-bottom: 22px;
}

.geo-features {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 26px; text-align: left;
}
.geo-feat {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text-muted);
  background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05);
  border-radius: 8px; padding: 9px 14px;
  transition: var(--transition);
}
.geo-feat:hover { border-color: rgba(255,32,64,0.2); color: var(--text-primary); }
.geo-feat-icon { font-size: 16px; flex-shrink: 0; }

.geo-allow-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 15px;
  background: linear-gradient(135deg, #cc0028, #ff2040, #ff4060);
  border: none; border-radius: 12px;
  color: white; font-family: var(--font-main);
  font-size: 15px; font-weight: 700; letter-spacing: 0.3px;
  cursor: pointer; margin-bottom: 10px;
  box-shadow: 0 6px 24px rgba(255,32,64,0.4);
  transition: var(--transition);
}
.geo-allow-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(255,32,64,0.5);
}
.geo-allow-btn:active { transform: translateY(0); }

.geo-skip-btn {
  display: block; width: 100%; padding: 11px;
  background: transparent; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px; color: var(--text-muted);
  font-family: var(--font-main); font-size: 13px;
  cursor: pointer; margin-bottom: 16px;
  transition: var(--transition);
}
.geo-skip-btn:hover {
  border-color: rgba(255,255,255,0.2);
  color: var(--text-primary);
  background: rgba(255,255,255,0.03);
}

.geo-note {
  font-size: 11px; color: var(--text-dim);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}

/* ─── DETAIL PANEL ─── */
.detail-panel {
  position: fixed;
  top: 60px; right: -420px; bottom: 0;
  width: 400px;
  background: rgba(6, 6, 14, 0.97);
  border-left: 1px solid rgba(255,32,64,0.2);
  backdrop-filter: blur(24px);
  z-index: 1200;
  overflow-y: auto;
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,32,64,0.25) transparent;
}
.detail-panel::-webkit-scrollbar { width: 3px; }
.detail-panel::-webkit-scrollbar-thumb { background: rgba(255,32,64,0.25); border-radius: 4px; }
.detail-panel.open { right: 0; }

.dp-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px 14px;
  background: rgba(6, 6, 14, 0.98);
  border-bottom: 1px solid rgba(255,32,64,0.15);
}
.dp-header > div:first-child { flex: 1; }
.dp-state {
  font-family: var(--font-title); font-size: 16px; font-weight: 700;
  color: var(--text-primary); letter-spacing: 0.5px;
}
.dp-year { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.dp-level {
  font-size: 11px; font-weight: 700; letter-spacing: 0.8px;
  padding: 4px 10px; border-radius: 12px;
}
.dp-level.extreme { background: rgba(255,0,64,0.15); color: #ff3060; border: 1px solid rgba(255,0,64,0.3); }
.dp-level.high    { background: rgba(255,107,0,0.15); color: #ff6b00; border: 1px solid rgba(255,107,0,0.3); }
.dp-level.medium  { background: rgba(255,215,0,0.12); color: #ffd700; border: 1px solid rgba(255,215,0,0.25); }
.dp-close {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted); font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition); flex-shrink: 0;
}
.dp-close:hover { background: rgba(255,32,64,0.15); color: var(--red-primary); border-color: rgba(255,32,64,0.3); }

.dp-section { padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.dp-section-title {
  font-size: 11.5px; font-weight: 700; letter-spacing: 1px;
  color: var(--text-muted); text-transform: uppercase; margin-bottom: 14px;
  display: flex; align-items: center; gap: 6px;
}
.dp-source { font-weight: 400; text-transform: none; letter-spacing: 0; opacity: 0.7; font-size: 10px; }

/* Crime bars */
.dp-crime-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.dp-crime-label { font-size: 11.5px; color: var(--text-muted); width: 175px; flex-shrink: 0; }
.dp-crime-label span { margin-right: 4px; }
.dp-crime-bar-wrap { flex: 1; height: 5px; background: rgba(255,255,255,0.05); border-radius: 4px; overflow: hidden; }
.dp-crime-bar {
  height: 100%; border-radius: 4px;
  transition: width 0.9s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 0 6px currentColor;
}
.dp-crime-val { font-size: 12px; font-weight: 700; width: 40px; text-align: right; flex-shrink: 0; }

/* Victim age bars */
.dp-age-row { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.dp-age-lbl { font-size: 11px; color: var(--text-muted); width: 80px; flex-shrink: 0; }
.dp-age-barwrap { flex: 1; height: 14px; background: rgba(255,255,255,0.04); border-radius: 4px; overflow: hidden; }
.dp-age-bar { height: 100%; border-radius: 4px; width: 0%; }
.dp-age-num { font-size: 11px; color: var(--text-muted); width: 30px; text-align: right; flex-shrink: 0; }

/* Relationship bars */
.dp-rel-row { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.dp-rel-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dp-rel-label { font-size: 12px; color: var(--text-muted); width: 110px; flex-shrink: 0; }
.dp-rel-bar-wrap { flex: 1; height: 6px; background: rgba(255,255,255,0.04); border-radius: 4px; overflow: hidden; }
.dp-rel-bar { height: 100%; border-radius: 4px; }
.dp-rel-pct { font-size: 11.5px; font-weight: 600; width: 32px; text-align: right; flex-shrink: 0; }

/* Location cards */
.dp-locs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dp-loc-card {
  background: rgba(255,32,64,0.04); border: 1px solid rgba(255,32,64,0.12);
  border-radius: var(--radius-sm); padding: 10px 12px;
  cursor: pointer; transition: var(--transition);
}
.dp-loc-card:hover { background: rgba(255,32,64,0.1); border-color: rgba(255,32,64,0.3); transform: translateY(-1px); }
.dp-loc-pin { font-size: 14px; margin-bottom: 4px; }
.dp-loc-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.dp-loc-coords { font-size: 10px; color: var(--text-dim); margin-top: 2px; font-family: monospace; }

.dp-footer { padding: 14px 20px; }
.dp-note { font-size: 10px; color: var(--text-dim); line-height: 1.6; }

/* ─── MAP LABELS ─── */
.map-label {
  background: rgba(6,6,14,0.82); border: 1px solid;
  border-radius: 10px; padding: 2px 8px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
  display: flex; align-items: center; gap: 5px;
  white-space: nowrap; pointer-events: none;
  backdrop-filter: blur(6px);
}
.label-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.city-label {
  font-size: 10px; font-weight: 500; letter-spacing: 0.2px;
  white-space: nowrap; pointer-events: none;
  text-shadow: 0 0 8px rgba(0,0,0,0.9), 0 1px 2px rgba(0,0,0,0.8);
}

/* ─── TOOLTIP DARK ─── */
.dark-tooltip .leaflet-tooltip {
  background: rgba(8,8,18,0.97) !important;
  border: 1px solid rgba(255,32,64,0.3) !important;
  color: var(--text-primary) !important;
  border-radius: 8px !important;
  padding: 8px 12px !important;
  font-family: var(--font-main) !important;
  font-size: 12px !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
}
.sub-tooltip strong { display: block; color: var(--text-primary); margin-bottom: 4px; font-size: 13px; }

/* ─── POPUP EXTRAS ─── */
.popup-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 8px 0; }
.popup-sub { font-size: 10.5px; font-weight: 700; letter-spacing: 1px; color: var(--text-dim); text-transform: uppercase; margin-bottom: 7px; }
.popup-ages { display: flex; flex-direction: column; gap: 5px; margin-bottom: 4px; }
.age-bar-row { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.age-bar-row span:first-child { width: 70px; color: var(--text-muted); }
.age-bar { flex: 1; height: 6px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow:hidden; }
.age-fill { height: 100%; border-radius: 3px; }
.age-bar-row span:last-child { width: 26px; text-align: right; color: var(--text-muted); }
.popup-row.small { font-size: 11px; padding-top: 5px; margin-top: 2px; }
.popup-detail-btn {
  display: block; width: 100%; margin-top: 12px;
  padding: 8px; border: 1px solid rgba(255,32,64,0.35);
  background: rgba(255,32,64,0.08); border-radius: var(--radius-sm);
  color: var(--red-primary); font-family: var(--font-main);
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: var(--transition);
}
.popup-detail-btn:hover { background: rgba(255,32,64,0.18); border-color: rgba(255,32,64,0.6); }

/* ═══════════════════════════════════════════
   CRIMINAL PROFILES PANEL
═══════════════════════════════════════════ */
.criminal-panel {
  position: fixed;
  top: 60px; right: -480px; bottom: 0;
  width: 460px;
  background: linear-gradient(180deg, #06060e 0%, #0a0408 100%);
  border-left: 1px solid rgba(255,32,64,0.25);
  z-index: 1200;
  overflow-y: auto;
  transition: right 0.42s cubic-bezier(0.4, 0, 0.2, 1);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,32,64,0.3) transparent;
}
.criminal-panel::-webkit-scrollbar { width: 3px; }
.criminal-panel::-webkit-scrollbar-thumb { background: rgba(255,32,64,0.3); border-radius: 3px; }
.criminal-panel.open { right: 0; }

.cp-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 14px;
  background: rgba(6,4,10,0.98);
  border-bottom: 1px solid rgba(255,32,64,0.2);
  backdrop-filter: blur(20px);
}
.cp-header-left { display: flex; align-items: center; gap: 12px; }
.cp-header-icon { font-size: 24px; filter: drop-shadow(0 0 8px rgba(255,32,64,0.5)); }
.cp-title {
  font-family: var(--font-title); font-size: 15px; font-weight: 800;
  color: var(--red-primary); letter-spacing: 2px;
}
.cp-subtitle { font-size: 11px; color: var(--text-dim); letter-spacing: 0.5px; }
.cp-close-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,32,64,0.1); border: 1px solid rgba(255,32,64,0.3);
  color: var(--red-primary); font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.cp-close-btn:hover { background: rgba(255,32,64,0.25); transform: rotate(90deg); }

.cp-stats {
  display: flex; gap: 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.cp-stat-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 10px 6px;
  border-right: 1px solid rgba(255,255,255,0.05);
}
.cp-stat-item:last-child { border-right: none; }
.cp-stat-val {
  font-family: var(--font-title); font-size: 18px; font-weight: 700;
  color: var(--text-primary);
}
.cp-stat-item.danger .cp-stat-val { color: #ff3060; }
.cp-stat-item.warn   .cp-stat-val { color: #ff6b00; }
.cp-stat-item.caution .cp-stat-val { color: #ffd700; }
.cp-stat-lbl { font-size: 9px; color: var(--text-dim); letter-spacing: 0.8px; text-transform: uppercase; margin-top: 2px; }

.cp-notice {
  display: flex; align-items: center; gap: 8px;
  margin: 12px 18px; padding: 8px 12px;
  background: rgba(255,107,0,0.07); border: 1px solid rgba(255,107,0,0.2);
  border-radius: 6px; font-size: 10.5px; color: #ff8833; line-height: 1.5;
}

/* ─── Criminal Cards Grid ─── */
.cp-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; padding: 14px 16px;
}

.cp-card {
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,32,64,0.18);
  background: rgba(10,4,12,0.9);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
}
.cp-card:hover {
  border-color: rgba(255,32,64,0.5);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(255,32,64,0.2);
}

.cp-card-photo {
  position: relative; height: 130px;
  background-size: 300% auto;
  background-position: 0% 0%;
}
.cp-photo-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.7) 100%);
}
.cp-status-badge {
  position: absolute; top: 8px; right: 8px;
  font-size: 9px; font-weight: 800; letter-spacing: 1px;
  padding: 3px 8px; border-radius: 8px; border: 1px solid;
}
.cp-case-no {
  position: absolute; bottom: 8px; left: 8px;
  font-size: 9px; font-family: monospace; color: rgba(255,255,255,0.4);
  letter-spacing: 0.5px;
}

.cp-card-body { padding: 10px 12px; }
.cp-name { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 2px; }
.cp-alias { font-size: 10.5px; color: var(--text-dim); font-style: italic; margin-bottom: 6px; }
.cp-crime-type { font-size: 11px; font-weight: 600; margin-bottom: 5px; }
.cp-area { font-size: 10px; color: var(--text-dim); display: flex; gap: 4px; margin-bottom: 5px; }
.cp-age-row {
  display: flex; justify-content: space-between;
  font-size: 10.5px; color: var(--text-muted);
  border-top: 1px solid rgba(255,255,255,0.05); padding-top: 6px;
}
.cp-age-row strong { color: var(--text-primary); }

.cp-card-footer { padding: 0 12px 10px; }
.cp-view-btn {
  display: block; width: 100%; padding: 7px;
  background: rgba(255,32,64,0.08); border: 1px solid rgba(255,32,64,0.25);
  border-radius: 6px; color: var(--red-primary);
  font-size: 11px; font-weight: 600; cursor: pointer;
  transition: var(--transition); text-align: center;
}
.cp-view-btn:hover { background: rgba(255,32,64,0.2); border-color: rgba(255,32,64,0.5); }

.cp-footer-note {
  margin: 8px 16px 20px;
  font-size: 9.5px; color: var(--text-dim);
  text-align: center; letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════════
   CRIMINAL DETAIL MODAL (full-screen overlay)
═══════════════════════════════════════════ */
.criminal-modal {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(10px);
  opacity: 0; transition: opacity 0.3s ease;
}
.criminal-modal.open { opacity: 1; }

.cm-panel {
  position: relative;
  width: min(900px, 95vw); max-height: 90vh;
  background: linear-gradient(135deg, #06020c 0%, #0c0408 50%, #060210 100%);
  border: 1px solid rgba(255,32,64,0.35);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 0 60px rgba(255,0,40,0.2), 0 0 120px rgba(255,0,40,0.08);
  animation: modalEntrance 0.35s cubic-bezier(0.4,0,0.2,1);
}
@keyframes modalEntrance {
  from { transform: scale(0.92) translateY(24px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

/* Scan line animation */
.cm-scan-line {
  position: absolute; left: 0; right: 0; top: -4px;
  height: 4px;
  background: linear-gradient(90deg, transparent, #ff2040, transparent);
  animation: scanDown 1.2s linear;
  z-index: 100; pointer-events: none;
}
@keyframes scanDown {
  0%   { top: 0; opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* WANTED banner */
.cm-wanted-banner {
  background: linear-gradient(90deg, #ff0020, #cc0015, #ff0020);
  color: white; text-align: center;
  font-size: 11px; font-weight: 900; letter-spacing: 3px;
  padding: 7px;
  animation: wantedBlink 0.8s steps(1) infinite;
}
@keyframes wantedBlink {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.6; }
}

.cm-close {
  position: absolute; top: 14px; right: 16px; z-index: 200;
  background: rgba(255,32,64,0.15); border: 1px solid rgba(255,32,64,0.4);
  color: var(--red-primary); font-size: 12px; font-weight: 700;
  letter-spacing: 1px; padding: 7px 16px; border-radius: 6px;
  cursor: pointer; transition: var(--transition);
}
.cm-close:hover { background: rgba(255,32,64,0.3); }

.cm-body {
  display: flex; gap: 0;
  padding: 30px 28px 20px;
}

/* Photo column */
.cm-photo-col {
  flex-shrink: 0; width: 220px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding-right: 24px;
  border-right: 1px solid rgba(255,32,64,0.15);
}
.cm-photo {
  position: relative; width: 200px; height: 240px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid rgba(255,32,64,0.4);
  background-size: 300% auto;
  box-shadow: 0 0 30px rgba(255,0,40,0.3);
}
.cm-photo-frame {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.2) 60%, rgba(0,0,0,0.8) 100%);
}
.cm-photo-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  text-align: center; font-size: 9px; font-weight: 800;
  letter-spacing: 2px; padding: 6px;
  background: rgba(255,0,40,0.25); color: rgba(255,100,100,0.8);
  border-top: 1px solid rgba(255,32,64,0.3);
}
.cm-status-pill {
  width: 100%; text-align: center;
  font-size: 12px; font-weight: 800; letter-spacing: 2px;
  padding: 8px 16px; border-radius: 20px;
  border: 1px solid;
}
.cm-case-badge {
  font-size: 10px; color: var(--text-dim); font-family: monospace;
  text-align: center; letter-spacing: 1px;
}

/* Detail column */
.cm-detail-col { flex: 1; padding-left: 24px; overflow-y: auto; max-height: 60vh; }
.cm-name {
  font-family: var(--font-title); font-size: 22px; font-weight: 900;
  color: var(--text-primary); letter-spacing: 1px; margin-bottom: 4px;
}
.cm-alias { font-size: 14px; color: var(--text-muted); font-style: italic; margin-bottom: 16px; }
.cm-section-title {
  font-size: 10px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 10px;
  padding-bottom: 6px; border-bottom: 1px solid rgba(255,32,64,0.12);
}
.cm-row {
  display: flex; gap: 12px; align-items: flex-start;
  margin-bottom: 9px; font-size: 13px;
}
.cm-field { color: var(--text-dim); width: 100px; flex-shrink: 0; }
.cm-value { color: var(--text-primary); font-weight: 500; flex: 1; }
.cm-description {
  font-size: 13px; color: var(--text-muted);
  line-height: 1.7;
  background: rgba(255,32,64,0.04); border-left: 3px solid rgba(255,32,64,0.3);
  padding: 12px 14px; border-radius: 0 6px 6px 0;
}
.cm-status-detail {
  font-size: 13px; font-weight: 600; padding: 10px 14px;
  background: rgba(255,32,64,0.05); border: 1px solid rgba(255,32,64,0.15);
  border-radius: 8px;
}

.cm-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 28px;
  border-top: 1px solid rgba(255,255,255,0.05);
  font-size: 10px; color: var(--text-dim);
}
