.threat-map-panel {
  background: #0b0e14;
  border-radius: 8px;
  overflow: hidden;
}
.threat-map-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: #12151f;
  border-bottom: 1px solid #1e2330;
}
.live-badge {
  color: #ff4d4d;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1px;
}
.attack-counter {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: #cfd6e4;
}
.attack-counter .counter-item b { margin-left: 4px; }
.attack-counter .critical b { color: #ff2d2d; }
.attack-counter .high b     { color: #ff8c1a; }
.attack-counter .medium b   { color: #ffd11a; }
.attack-counter .low b      { color: #3ddc84; }
.attack-counter .countries b { color: #4ee1ff; }
.map-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 16px;
  background: #12151f;
  flex-wrap: wrap;
}
.filter-btn {
  background: #1e2330;
  color: #cfd6e4;
  border: 1px solid #2a3040;
  border-radius: 4px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}
.filter-btn:hover { background: #2a3040; }
.filter-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.map-time-select {
  margin-left: auto;
  background: #1e2330;
  color: #cfd6e4;
  border: 1px solid #2a3040;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
}
.threat-map-canvas {
  height: 420px;
  width: 100%;
  background: #05070a;
}
.map-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 8px 16px;
  font-size: 12px;
  color: #9aa4b8;
  background: #12151f;
  border-top: 1px solid #1e2330;
}
.map-legend .dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 5px;
}
.map-legend .critical { background: #ff2d2d; }
.map-legend .high     { background: #ff8c1a; }
.map-legend .medium   { background: #ffd11a; }
.map-legend .low      { background: #3ddc84; }
.map-legend .clean    { background: #4aa3ff; }
.map-legend .outbound { background: #e3b341; }
.map-legend .inbound  { background: #00e5ff; }

/* ---- attack feed (#latest-attacks-list) ---- */
.latest-attacks {
  padding: 10px 16px 14px;
  background: #12151f;
  border-top: 1px solid #1e2330;
}
.latest-attacks-title {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #6b7385;
  margin-bottom: 6px;
}
.latest-attacks ul { list-style: none; margin: 0; padding: 0; }
.latest-attacks li {
  font-size: 13px;
  color: #cfd6e4;
  padding: 3px 0;
}
.latest-attacks li .sev-critical { color: #ff2d2d; font-weight: 600; }
.latest-attacks li .sev-high     { color: #ff8c1a; font-weight: 600; }

#latest-attacks-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cw-feed-item {
  display: grid;
  grid-template-columns: 90px 60px 1fr 130px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  color: #cfd6e4;
  padding: 5px 8px;
  border-left: 3px solid transparent;
  border-radius: 3px;
  background: rgba(255,255,255,0.02);
  animation: feed-item-in 0.25s ease-out;
}
.cw-feed-item.cw-sev-critical { border-left-color: #ff2d2d; }
.cw-feed-item.cw-sev-high     { border-left-color: #ff8c1a; }
.cw-feed-country { color: #e8edf3; font-weight: 500; }
.cw-feed-sev { text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.03em; }
.cw-sev-critical .cw-feed-sev { color: #ff2d2d; }
.cw-sev-high .cw-feed-sev     { color: #ff8c1a; }
.cw-feed-ioc { color: #9aa4b8; font-family: monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-feed-time { color: #6b7385; text-align: right; font-size: 11px; }
@keyframes feed-item-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- top attackers by country (#top-attackers-list) ---- */
#top-attackers-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 16px;
  background: #12151f;
  border-top: 1px solid #1e2330;
}
.cw-top-row {
  display: grid;
  grid-template-columns: 90px 1fr 34px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #cfd6e4;
}
.cw-top-country { color: #e8edf3; }
.cw-top-bar {
  display: block;
  height: 6px;
  background: #1e2330;
  border-radius: 3px;
  overflow: hidden;
}
.cw-top-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #ff2d2d, #ff8c1a);
  border-radius: 3px;
}
.cw-top-count { text-align: right; color: #9aa4b8; }

/* pulsing marker for critical IOCs and agents */
.pulse-marker {
  animation: pulse-ring 1.4s ease-out infinite;
}
@keyframes pulse-ring {
  0%   { filter: drop-shadow(0 0 0px rgba(255,45,45,0.9)); }
  70%  { filter: drop-shadow(0 0 10px rgba(255,45,45,0)); }
  100% { filter: drop-shadow(0 0 0px rgba(255,45,45,0)); }
}
.agent-pulse-online {
  animation: pulse-green 1.6s ease-out infinite;
}
@keyframes pulse-green {
  0%   { filter: drop-shadow(0 0 0px rgba(34,197,94,0.9)); }
  70%  { filter: drop-shadow(0 0 8px rgba(34,197,94,0)); }
  100% { filter: drop-shadow(0 0 0px rgba(34,197,94,0)); }
}
.attack-arc {
  stroke-dasharray: 4, 8;
  animation: arc-flow 1.2s linear infinite;
}
@keyframes arc-flow {
  to { stroke-dashoffset: -12; }
}

/* ---- MapLibre GL popup (replaces the old .leaflet-popup-* rules) ----
   MapLibre does not use Leaflet's classes, so those old rules never
   applied to it - its default white popup was showing white-on-white
   text. These target MapLibre's real classes instead. */
.maplibregl-popup-content {
  background: #12151f;
  color: #cfd6e4;
  border: 1px solid #2a3040;
  border-radius: 6px;
  padding: 12px 14px;
  box-shadow: 0 0 20px rgba(78, 225, 255, 0.12);
}
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: #12151f; }
.maplibregl-popup-anchor-top .maplibregl-popup-tip    { border-bottom-color: #12151f; }
.maplibregl-popup-anchor-left .maplibregl-popup-tip   { border-right-color: #12151f; }
.maplibregl-popup-anchor-right .maplibregl-popup-tip  { border-left-color: #12151f; }
.maplibregl-popup-close-button {
  color: #9aa4b8;
  font-size: 16px;
  padding: 2px 6px;
}
.maplibregl-popup-close-button:hover {
  background: #1e2330;
  color: #fff;
}
.maplibregl-ctrl-group {
  background: #12151f !important;
  border: 1px solid #2a3040 !important;
}
.maplibregl-ctrl-group button {
  background: transparent !important;
}
.maplibregl-ctrl-icon { filter: invert(1) brightness(1.6); }

.cw-popup { min-width: 220px; }
.cw-popup .row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.cw-popup .row:last-child { border-bottom: none; }
.cw-popup .row span {
  color: #6b7385;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 10.5px;
}
.cw-popup .row b { color: #fff; font-weight: 600; text-align: right; }

/* ---- search box (#map-search) ---- */
#map-search {
  background: #1e2330;
  color: #cfd6e4;
  border: 1px solid #2a3040;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 12px;
  min-width: 180px;
}
#map-search::placeholder { color: #6b7385; }
#map-search:focus {
  outline: none;
  border-color: #2563eb;
}

/* ---- view mode buttons (dots / cluster / heatmap) ---- */
.viewmode-btn {
  background: #1e2330;
  color: #cfd6e4;
  border: 1px solid #2a3040;
  border-radius: 4px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}
.viewmode-btn:hover { background: #2a3040; }
.viewmode-btn.active {
  background: #4ee1ff;
  border-color: #4ee1ff;
  color: #0b0e14;
  font-weight: 600;
}

/* ---- globe toggle ---- */
#globe-toggle-btn {
  background: #1e2330;
  color: #cfd6e4;
  border: 1px solid #2a3040;
  border-radius: 4px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}
#globe-toggle-btn.active {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}

/* ---- attack replay bar ---- */
.replay-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: #12151f;
  border-top: 1px solid #1e2330;
}
#replay-play-btn {
  background: #1e2330;
  color: #cfd6e4;
  border: 1px solid #2a3040;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
#replay-play-btn.active { background: #2563eb; border-color: #2563eb; color: #fff; }
#replay-scrubber {
  flex: 1;
  accent-color: #4ee1ff;
}
#replay-time-label {
  font-size: 12px;
  color: #9aa4b8;
  min-width: 76px;
  text-align: right;
}

/* ---- legend (static markup, no JS) ---- */
.map-legend-box {
  position: absolute;
  bottom: 14px;
  left: 14px;
  background: rgba(18, 21, 31, 0.85);
  border: 1px solid #2a3040;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 11.5px;
  color: #cfd6e4;
  display: flex;
  flex-direction: column;
  gap: 5px;
  backdrop-filter: blur(4px);
  z-index: 5;
}
.map-legend-box .legend-row { display: flex; align-items: center; gap: 6px; }
.map-legend-box .legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.map-legend-box .legend-dot.critical { background: #ff2d2d; }
.map-legend-box .legend-dot.high     { background: #ff8c1a; }
.map-legend-box .legend-line { width: 14px; height: 2px; display: inline-block; }
.map-legend-box .legend-line.outbound { background: #e3b341; }
.map-legend-box .legend-line.inbound  { background: #00e5ff; }

.map-reset-btn {
  background: #1e2330;
  color: #cfd6e4;
  border: 1px solid #2a3040;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}
.map-reset-btn:hover { background: #2a3040; }