/* ---------- Layout: el mapa ocupa todo, los paneles flotan encima ---------- */
.layout {
  display: block;
}

.map-wrap {
  position: relative;
  background: var(--bg);
  height: 82vh;
  min-height: 560px;
}

#map {
  width: 100%;
  height: 100%;
  background: #0d0806;
}

#map .leaflet-tile-pane {
  filter: grayscale(0.3) sepia(0.35) hue-rotate(320deg) brightness(0.55) contrast(1.05);
}

/* ---------- Ventanitas flotantes sobre el mapa ---------- */
.float-panel {
  position: absolute;
  top: 16px;
  z-index: 400; /* debajo del header (1100) pero encima de los controles de Leaflet */
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 260px;
  max-height: calc(100% - 32px);
  overflow-y: auto;
}

.float-left { left: 16px; }
.float-right { right: 16px; width: 280px; }

.card {
  background: rgba(28, 19, 13, 0.92);
  backdrop-filter: blur(6px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.card-label {
  margin: 0 0 10px 0;
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
}

/* ---------- Filtros: segmented control ---------- */
.btn-group {
  display: flex;
  gap: 4px;
  background: #0d0806;
  border: 1px solid var(--panel-border);
  border-radius: 9px;
  padding: 4px;
}

.btn-filter {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 9px 6px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.btn-filter:hover {
  color: var(--text);
  background: rgba(255, 122, 61, 0.08);
}

.btn-filter.active {
  background: linear-gradient(135deg, var(--accent-strong), var(--muy-fuerte));
  color: #fff;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(255, 61, 46, 0.35);
}

/* ---------- Leyenda ---------- */
.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 5px 0;
}

.legend-toggle {
  cursor: pointer;
}

.legend-toggle input {
  accent-color: var(--accent);
  cursor: pointer;
}

.legend-value {
  margin-left: auto;
  color: var(--text-faint);
  font-size: 12px;
}

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

.dot-fuerte { background: var(--fuerte); box-shadow: 0 0 6px rgba(255,176,32,0.6); }
.dot-muy-fuerte { background: var(--muy-fuerte); box-shadow: 0 0 6px rgba(255,61,46,0.6); }
.dot-nasa { background: #ff9130; box-shadow: 0 0 6px rgba(255,145,48,0.6); }
.dot-ia { background: #3da5ff; box-shadow: 0 0 6px rgba(61,165,255,0.6); }
.dot-comunidad { background: #a34dff; box-shadow: 0 0 6px rgba(163,77,255,0.6); }

.region-fixed {
  margin: 0;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.region-fixed::before { content: "📍"; }

/* ---------- Resumen ---------- */
.summary-card { gap: 0; }

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 9px 0;
  border-bottom: 1px solid var(--panel-border);
  color: var(--text-dim);
}

.summary-row:last-child { border-bottom: none; }

.summary-row strong { color: var(--text); font-size: 15px; }
.summary-row strong.danger { color: var(--muy-fuerte); }

.dept-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.dept-list li {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-dim);
}

.dept-list li span.count { color: var(--fuerte); font-weight: 700; }

.leaflet-popup-content-wrapper {
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  border: 1px solid var(--panel-border);
}
.leaflet-popup-tip { background: var(--panel); }

/* ---------- "Que esta pasando hoy" ---------- */
.today-summary {
  padding: 34px 40px 44px;
  border-top: 1px solid var(--panel-border);
  background: var(--bg-soft);
}

.today-title { margin: 0 0 14px 0; font-size: 23px; font-weight: 700; }

.today-text {
  max-width: 780px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.65;
  margin: 0 0 6px 0;
}

.today-updated { color: var(--text-faint); font-size: 12px; margin: 0 0 24px 0; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-width: 960px;
}

.stat-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 20px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--fuerte), var(--muy-fuerte));
}

.stat-top { display: flex; align-items: baseline; gap: 8px; }

.stat-number {
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 0 18px rgba(255, 122, 61, 0.25);
}

.stat-label {
  font-size: 11.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.stat-trend { font-size: 13px; font-weight: 700; }
.stat-trend.up { color: var(--muy-fuerte); }
.stat-trend.down { color: var(--live); }

.today-sources { margin-top: 24px; font-size: 12px; color: var(--text-faint); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .map-wrap { height: auto; min-height: 70vh; }
  .float-panel { position: static; width: auto; max-height: none; margin: 12px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .today-summary { padding: 24px 20px; }
}

#map .leaflet-top.leaflet-left {
  margin-left: 284px;
  margin-top: 6px;
}

@media (max-width: 900px) {
  #map .leaflet-top.leaflet-left { margin-left: 0; }
}