/* ============================================================
   CyberVulnDB — Cybersecurity Intelligence Dashboard
   Terminal-inspired Cyber Aesthetic
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --bg-primary: #050508;
  --bg-secondary: #0a0c10;
  --bg-card: #0d1018;
  --bg-elevated: #12161f;
  --text-primary: #e4e4e7;
  --text-secondary: #9ca3af;
  --text-muted: #52525b;
  --border: #1f222d;
  --border-light: #2a2e3a;
  
  --accent-cyan: #00ffd5;
  --accent-cyan-dim: rgba(0, 255, 213, 0.15);
  --accent-green: #39ff14;
  --accent-red: #ff2d55;
  
  --critical: #ff2d55;
  --critical-glow: rgba(255, 45, 85, 0.4);
  --high: #ff9500;
  --high-glow: rgba(255, 149, 0, 0.3);
  --medium: #ffcc00;
  --medium-glow: rgba(255, 204, 0, 0.3);
  --low: #30d158;
  --info: #64d2ff;
  
  --ransomware: #ff375f;
  --apt: #bf5af2;
  --cve: #ffcc00;
  
  --glow-cyan: 0 0 20px rgba(0, 255, 213, 0.3);
  --glow-critical: 0 0 15px rgba(255, 45, 85, 0.4);
  
  --shadow: 0 4px 30px rgba(0,0,0,0.5);
  --shadow-card: 0 8px 32px rgba(0,0,0,0.4);
  --radius: 6px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  height: 100%;
  font-family: 'IBM Plex Mono', monospace;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  font-size: 13px;
  line-height: 1.5;
}

/* Scanline overlay effect */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  pointer-events: none;
  z-index: 9998;
}

/* Subtle vignette */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 0%, rgba(0,0,0,0.3) 100%);
  pointer-events: none;
  z-index: 9997;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-green);
  text-shadow: 0 0 8px var(--accent-cyan);
}

/* ── App Shell ───────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  z-index: 1;
}

/* ── Header ──────────────────────────────────────────────── */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 56px;
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 1000;
  position: relative;
}

#header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
  opacity: 0.3;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--bg-card);
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: var(--glow-cyan);
  animation: iconPulse 3s ease-in-out infinite;
}

@keyframes iconPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(0, 255, 213, 0.3); }
  50% { box-shadow: 0 0 16px rgba(0, 255, 213, 0.5); }
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 45, 85, 0.1);
  color: var(--critical);
  border: 1px solid rgba(255, 45, 85, 0.3);
  border-radius: 3px;
  padding: 4px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.live-badge.cyber {
  background: rgba(0, 255, 213, 0.08);
  color: var(--accent-cyan);
  border-color: rgba(0, 255, 213, 0.3);
}

.live-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-cyan);
  border-radius: 50%;
  animation: blink 1.2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.header-center {
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 500px;
  margin: 0 30px;
}

.search-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
  font-size: 12px;
}

#search-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 10px 14px 10px 38px;
  font-size: 0.8rem;
  width: 100%;
  font-family: inherit;
  outline: none;
  transition: all var(--transition);
}

#search-input::placeholder { 
  color: var(--text-muted); 
  font-style: italic;
}

#search-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px var(--accent-cyan-dim), var(--glow-cyan);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1;
  transition: all var(--transition);
}

.icon-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  transform: translateY(-1px);
}

/* ── Main Layout ─────────────────────────────────────────── */
#main {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ── Sidebar ─────────────────────────────────────────────── */
#sidebar {
  width: 400px;
  min-width: 340px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}

#sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg, var(--accent-cyan), transparent);
  opacity: 0.2;
}

#sidebar.collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
}

/* ── Tab Navigation ──────────────────────────────────────── */
.sidebar-tabs {
  display: flex;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: 6px 6px 0;
  gap: 3px;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 12px 6px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tab-btn:hover {
  color: var(--text-secondary);
  background: rgba(255,255,255,0.02);
}

.tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
  background: rgba(0, 255, 213, 0.05);
}

.tab-btn span {
  font-size: 10px;
}

/* ── Panels ──────────────────────────────────────────────── */
.panel {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.panel.active {
  display: flex;
  animation: fadeSlideIn 0.3s ease;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-card);
}

.panel-header h3 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: -0.01em;
}

.panel-header select {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 5px 10px;
  font-size: 0.68rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath fill='%2388929e' d='M0 0l4 5 4-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 22px;
}

.panel-header select:hover,
.panel-header select:focus {
  border-color: var(--accent-cyan);
  color: var(--text-primary);
  box-shadow: 0 0 0 1px var(--accent-cyan);
}

.panel-header select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 4px 8px;
}

/* ── Threat Lists ─────────────────────────────────────────── */
.threat-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.threat-list::-webkit-scrollbar { 
  width: 6px; 
}
.threat-list::-webkit-scrollbar-track { 
  background: var(--bg-primary); 
}
.threat-list::-webkit-scrollbar-thumb { 
  background: var(--border); 
  border-radius: 3px;
}
.threat-list::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

.threat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.threat-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  transition: all var(--transition);
}

.threat-card.cve::before { 
  background: var(--cve); 
  box-shadow: 0 0 10px var(--cve);
}
.threat-card.ransomware::before { 
  background: var(--ransomware);
  box-shadow: 0 0 10px var(--ransomware);
}
.threat-card.news::before { 
  background: var(--info);
  box-shadow: 0 0 10px var(--info);
}
.threat-card.apt::before { 
  background: var(--apt);
  box-shadow: 0 0 10px var(--apt);
}

.threat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 255, 255, 0.1);
  border-color: var(--accent-cyan);
}

.threat-card:hover::before {
  width: 4px;
}

.threat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.threat-card-type {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: 'Space Grotesk', sans-serif;
}

.threat-card.cve .threat-card-type { 
  color: var(--cve); 
  text-shadow: 0 0 8px rgba(255, 204, 0, 0.3);
}
.threat-card.ransomware .threat-card-type { 
  color: var(--ransomware);
  text-shadow: 0 0 8px rgba(255, 45, 85, 0.3);
}
.threat-card.news .threat-card-type { 
  color: var(--info);
  text-shadow: 0 0 8px rgba(100, 210, 255, 0.3);
}
.threat-card.apt .threat-card-type { 
  color: var(--apt);
  text-shadow: 0 0 8px rgba(191, 90, 242, 0.3);
}

.threat-card-date {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: 'IBM Plex Mono', monospace;
}

.threat-card-title {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.threat-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* ── Severity Badges ─────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: 'Space Grotesk', sans-serif;
}

.badge.kev-badge {
  background: rgba(255, 45, 85, 0.25);
  color: #ff375f;
  border: 1px solid rgba(255, 45, 85, 0.5);
  animation: kevPulse 2s ease-in-out infinite;
}

@keyframes kevPulse {
  0%, 100% { box-shadow: 0 0 5px rgba(255, 45, 85, 0.3); }
  50% { box-shadow: 0 0 15px rgba(255, 45, 85, 0.6); }
}

/* ── EPSS Badges ─────────────────────────────────────────── */
.badge.epss-badge {
  font-variant-numeric: tabular-nums;
}

.badge.epss-badge.epss-critical {
  background: rgba(255, 45, 85, 0.2);
  color: #ff375f;
  border: 1px solid rgba(255, 45, 85, 0.4);
}

.badge.epss-badge.epss-high {
  background: rgba(255, 149, 0, 0.15);
  color: #ff9500;
  border: 1px solid rgba(255, 149, 0, 0.35);
}

.badge.epss-badge.epss-medium {
  background: rgba(255, 204, 0, 0.12);
  color: #ffcc00;
  border: 1px solid rgba(255, 204, 0, 0.25);
}

.badge.epss-badge.epss-low {
  background: rgba(142, 142, 147, 0.12);
  color: #8e8e93;
  border: 1px solid rgba(142, 142, 147, 0.25);
}

.badge.epss-badge.epss-percentile {
  background: rgba(100, 210, 255, 0.1);
  color: var(--info);
  border: 1px solid rgba(100, 210, 255, 0.2);
}

/* ── EPSS Detail (modal) ─────────────────────────────────── */
.epss-detail {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.epss-detail-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.epss-description {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.badge.critical {
  background: rgba(255, 45, 85, 0.15);
  color: var(--critical);
  border: 1px solid rgba(255, 45, 85, 0.3);
  box-shadow: 0 0 8px var(--critical-glow);
}

.badge.high {
  background: rgba(255, 149, 0, 0.12);
  color: var(--high);
  border: 1px solid rgba(255, 149, 0, 0.25);
}

.badge.medium {
  background: rgba(255, 204, 0, 0.1);
  color: var(--medium);
  border: 1px solid rgba(255, 204, 0, 0.2);
}

.badge.low {
  background: rgba(48, 209, 88, 0.1);
  color: var(--low);
  border: 1px solid rgba(48, 209, 88, 0.2);
}

.badge.info {
  background: rgba(100, 210, 255, 0.1);
  color: var(--info);
  border: 1px solid rgba(100, 210, 255, 0.2);
}

/* ── Map Container ───────────────────────────────────────── */
#map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg-primary);
}

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

/* ── Map Controls ───────────────────────────────────────── */
.map-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.map-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1;
  transition: all var(--transition);
  box-shadow: var(--shadow);
}

.map-btn:hover { 
  background: var(--bg-elevated);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  transform: translateY(-2px);
}

/* ── Leaflet Overrides ───────────────────────────────────── */
.leaflet-container {
  background: #030305 !important;
  font-family: 'IBM Plex Mono', monospace !important;
}

.leaflet-control-zoom {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-color: var(--border) !important;
  width: 32px !important;
  height: 32px !important;
  line-height: 30px !important;
  font-size: 16px !important;
}

.leaflet-control-zoom a:hover {
  background: var(--bg-elevated) !important;
  color: var(--accent-cyan) !important;
}

.leaflet-control-zoom-in {
  border-bottom: 1px solid var(--border) !important;
}

.leaflet-popup-content-wrapper {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-card) !important;
}

.leaflet-popup-tip { 
  background: var(--bg-card) !important; 
}

.leaflet-popup-content {
  margin: 14px 16px !important;
  font-size: 0.75rem !important;
  min-width: 220px;
}

.leaflet-popup-close-button {
  color: var(--text-muted) !important;
}

.leaflet-popup-close-button:hover {
  color: var(--accent-cyan) !important;
}

/* ── Custom Markers ──────────────────────────────────────── */
.marker-wrapper {
  background: transparent !important;
  border: none !important;
}

.custom-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.custom-marker:hover { 
  transform: scale(1.3); 
  border-color: var(--accent-cyan);
}

.marker-cve { 
  background: var(--cve); 
  width: 22px; 
  height: 22px;
  color: #000;
}
.marker-ransomware { 
  background: var(--ransomware); 
  width: 26px; 
  height: 26px; 
}
.marker-apt { 
  background: var(--apt); 
  width: 30px; 
  height: 30px; 
}

/* Pulsing ring animation for APT markers */
.marker-pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid;
  opacity: 0;
  animation: markerPulse 2.5s ease-out infinite;
  pointer-events: none;
}

@keyframes markerPulse {
  0% { width: 30px; height: 30px; opacity: 0.6; }
  100% { width: 60px; height: 60px; opacity: 0; }
}

/* Map labels for APT country names */
.map-label-wrapper {
  background: transparent !important;
  border: none !important;
}

.map-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
  text-shadow: 0 0 6px rgba(0,0,0,0.8), 0 0 12px rgba(0,0,0,0.5);
  white-space: nowrap;
  pointer-events: none;
}

/* Attack flow lines */
.attack-flow-line {
  animation: flowDash 20s linear infinite;
}

@keyframes flowDash {
  to { stroke-dashoffset: -100; }
}

.attack-target-dot {
  animation: targetPulse 2s ease-in-out infinite;
}

@keyframes targetPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

/* Cyber-styled map popups */
.cyber-popup .leaflet-popup-content-wrapper {
  background: rgba(13, 16, 24, 0.95) !important;
  border: 1px solid rgba(0, 255, 213, 0.3) !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 20px rgba(0, 255, 213, 0.1) !important;
  backdrop-filter: blur(12px);
}

.cyber-popup .leaflet-popup-tip {
  background: rgba(13, 16, 24, 0.95) !important;
  border: 1px solid rgba(0, 255, 213, 0.2) !important;
}

.cyber-popup .leaflet-popup-content {
  margin: 0 !important;
  padding: 0 !important;
}

.map-popup-content {
  padding: 14px 16px;
  font-family: 'IBM Plex Mono', monospace;
  min-width: 200px;
}

.popup-type-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px 8px;
  border-radius: 3px;
  margin-bottom: 8px;
  font-family: 'Space Grotesk', sans-serif;
}

.popup-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e4e4e7;
  margin-bottom: 6px;
  font-family: 'Space Grotesk', sans-serif;
}

.popup-country {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: #9ca3af;
  margin-bottom: 4px;
}

.popup-flag {
  font-size: 1rem;
}

.popup-aliases {
  font-size: 0.65rem;
  color: #52525b;
  font-style: italic;
  margin-bottom: 6px;
}

.popup-detail {
  font-size: 0.7rem;
  color: #9ca3af;
  margin-bottom: 3px;
}

.popup-label {
  color: #52525b;
  font-weight: 600;
}

.popup-severity {
  font-weight: 700;
  font-size: 0.75rem;
}

.popup-score {
  font-weight: 700;
  color: #e4e4e7;
  margin-left: 8px;
}

.popup-desc {
  font-size: 0.68rem;
  color: #6b7280;
  line-height: 1.4;
  margin-top: 6px;
}

/* Cyber tooltip */
.cyber-tooltip {
  background: rgba(13, 16, 24, 0.9) !important;
  border: 1px solid rgba(0, 255, 213, 0.3) !important;
  border-radius: 4px !important;
  color: var(--accent-cyan) !important;
  font-family: 'IBM Plex Mono', monospace !important;
  font-size: 0.7rem !important;
  padding: 4px 10px !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5) !important;
}

.cyber-tooltip::before {
  border-top-color: rgba(0, 255, 213, 0.3) !important;
}

/* Map radar sweep overlay */
#map-container::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 300px;
  height: 300px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(0, 255, 213, 0.03) 30deg,
    transparent 60deg
  );
  animation: radarSweep 8s linear infinite;
  pointer-events: none;
  z-index: 400;
  opacity: 0.5;
}

@keyframes radarSweep {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ── Status Bar ──────────────────────────────────────────── */
#status-bar {
  height: 28px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 24px;
  font-size: 0.65rem;
  color: var(--text-muted);
  flex-shrink: 0;
  font-family: 'IBM Plex Mono', monospace;
}

#status-bar .status-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

#status-bar .status-item::before {
  content: '›';
  color: var(--accent-cyan);
}

/* ── Loading Overlay ─────────────────────────────────────── */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

#loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  position: relative;
}

.spinner::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 1px solid transparent;
  border-top-color: var(--accent-green);
  border-radius: 50%;
  animation: spin 1.2s linear infinite reverse;
}

@keyframes spin { 
  to { transform: rotate(360deg); } 
}

.loading-text {
  color: var(--text-secondary);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

/* Typing cursor effect */
.loading-text::after {
  content: '_';
  animation: cursor 0.8s step-end infinite;
}

@keyframes cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-overlay.hidden { 
  display: none; 
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 580px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-card), 0 0 40px rgba(0, 255, 213, 0.1);
  animation: modalIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
  from { 
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to { 
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--bg-primary);
  color: var(--critical);
}

.modal-body {
  padding: 16px 20px 20px;
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  font-family: 'Space Grotesk', sans-serif;
}

.modal-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.modal-description {
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* KEV Banner */
.kev-banner {
  background: linear-gradient(90deg, rgba(255, 45, 85, 0.15), rgba(255, 45, 85, 0.05));
  border: 1px solid rgba(255, 45, 85, 0.3);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.kev-banner .kev-icon {
  font-size: 20px;
  animation: kevPulse 1.5s ease-in-out infinite;
}

.kev-banner span {
  color: var(--critical);
}

.kev-date {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Modal Sections */
.modal-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.modal-section:last-of-type {
  border-bottom: none;
}

.modal-section h4 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-family: 'Space Grotesk', sans-serif;
}

/* CPE Tags */
.cpe-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cpe-tag {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.65rem;
  color: var(--text-secondary);
  font-family: 'IBM Plex Mono', monospace;
}

/* CVSS Vector */
.cvss-vector {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: 'IBM Plex Mono', monospace;
  display: inline-block;
}

/* Modal Links */
.modal-references {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-link {
  color: var(--accent-cyan);
  font-size: 0.75rem;
  word-break: break-all;
  transition: color var(--transition);
}

.modal-link:hover {
  color: var(--accent-green);
}

/* Modal Actions */
.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.btn-primary {
  background: var(--accent-cyan);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
}

.btn-primary:hover {
  background: var(--accent-green);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
}

.btn-secondary:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* KEV styling for cards */
.threat-card.kev {
  border-left: 3px solid var(--critical);
  background: linear-gradient(90deg, rgba(255, 45, 85, 0.05), var(--bg-card));
}

.threat-card.kev::before {
  background: var(--critical) !important;
  box-shadow: 0 0 15px var(--critical-glow) !important;
}

/* ── Toast ──────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 44px;
  right: 16px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.75rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.success { 
  border-left: 3px solid var(--low); 
  background: linear-gradient(90deg, rgba(48, 209, 88, 0.1), var(--bg-card));
}
.toast.error { 
  border-left: 3px solid var(--critical); 
  background: linear-gradient(90deg, rgba(255, 45, 85, 0.1), var(--bg-card));
}
.toast.info { 
  border-left: 3px solid var(--info); 
  background: linear-gradient(90deg, rgba(100, 210, 255, 0.1), var(--bg-card));
}

@keyframes slideIn {
  from { 
    transform: translateX(100%); 
    opacity: 0; 
  }
  to { 
    transform: translateX(0);    
    opacity: 1; 
  }
}

/* ── Legend ──────────────────────────────────────────────── */
.map-legend {
  position: absolute;
  bottom: 36px;
  left: 16px;
  z-index: 500;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  font-size: 0.7rem;
}

.legend-title {
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.6rem;
  margin-bottom: 10px;
  font-family: 'Space Grotesk', sans-serif;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.legend-item:last-child {
  margin-bottom: 0;
}

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

.legend-line {
  width: 16px;
  height: 0;
  flex-shrink: 0;
  opacity: 0.6;
}

/* ── Sidebar Toggle ──────────────────────────────────────── */
.sidebar-toggle {
  position: absolute;
  left: 400px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 600;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 12px 6px;
  font-size: 12px;
  transition: all var(--transition);
}

.sidebar-toggle:hover {
  background: var(--bg-elevated);
  color: var(--accent-cyan);
  padding-left: 10px;
}

#sidebar.collapsed ~ .sidebar-toggle,
.sidebar-toggle.collapsed {
  left: 0;
}

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 20px;
  color: var(--text-muted);
  text-align: center;
  gap: 12px;
}

.empty-state-icon { 
  font-size: 32px; 
  opacity: 0.5;
}
.empty-state-text { 
  font-size: 0.8rem; 
  font-style: italic;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 700;
    box-shadow: var(--shadow-card);
  }
  #sidebar.collapsed { width: 0; }
  .header-center { 
    display: none; 
  }
  .map-legend { 
    display: none; 
  }
  .sidebar-toggle {
    left: 340px;
  }
}

@media (max-width: 480px) {
  .live-badge { 
    display: none; 
  }
  #header { 
    padding: 0 12px; 
  }
  #sidebar {
    width: 100%;
  }
  .sidebar-toggle {
    left: calc(100% - 30px);
  }
}

/* ── CVE specific ───────────────────────────────────────── */
.cve-id {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.82rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

.cve-score {
  font-weight: 700;
  font-size: 0.85rem;
  font-family: 'Space Grotesk', sans-serif;
}

/* Glitch effect for critical items */
.threat-card.critical {
  animation: criticalPulse 2s ease-in-out infinite;
}

@keyframes criticalPulse {
  0%, 100% { 
    border-color: var(--border);
    box-shadow: none;
  }
  50% { 
    border-color: rgba(255, 45, 85, 0.5);
    box-shadow: inset 0 0 20px var(--critical-glow);
  }
}

/* Keyboard focus styles */
*:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

/* Selection */
::selection {
  background: var(--accent-cyan);
  color: var(--bg-primary);
}

/* ── Live News styles ────────────────────────────────────── */
.news-header-right,
.cve-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

#cve-source-filter {
  font-size: 0.62rem;
  padding: 2px 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--primary);
  border-radius: 3px;
  font-family: 'IBM Plex Mono', monospace;
  cursor: pointer;
  max-width: 140px;
}

#cve-source-filter:focus {
  border-color: var(--primary);
  outline: none;
}

#malware-source-filter {
  font-size: 0.62rem;
  padding: 2px 4px;
  background: var(--surface, var(--bg-card));
  border: 1px solid var(--border);
  color: var(--ransomware);
  border-radius: 3px;
  font-family: 'IBM Plex Mono', monospace;
  cursor: pointer;
  max-width: 160px;
}

#malware-source-filter:focus {
  border-color: var(--ransomware);
  outline: none;
}

#apt-source-filter {
  font-size: 0.62rem;
  padding: 2px 4px;
  background: var(--surface, var(--bg-card));
  border: 1px solid var(--border);
  color: var(--apt);
  border-radius: 3px;
  font-family: 'IBM Plex Mono', monospace;
  cursor: pointer;
  max-width: 170px;
}

#apt-source-filter:focus {
  border-color: var(--apt);
  outline: none;
}

#news-source-filter {
  font-size: 0.62rem;
  padding: 2px 4px;
  background: var(--surface, var(--bg-card));
  border: 1px solid var(--border);
  color: var(--info);
  border-radius: 3px;
  font-family: 'IBM Plex Mono', monospace;
  cursor: pointer;
  max-width: 160px;
}

#news-source-filter:focus {
  border-color: var(--info);
  outline: none;
}

.source-badge {
  font-size: 0.55rem;
  padding: 1px 4px;
  border-radius: 2px;
  background: rgba(0, 255, 213, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 255, 213, 0.2);
  font-family: 'IBM Plex Mono', monospace;
  white-space: nowrap;
  text-transform: uppercase;
}

/* Loading spinner */
.loading-spin {
  display: inline-block;
  animation: spin 1s linear infinite;
  font-size: 1.5rem;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.news-timestamp {
  font-size: 0.6rem;
  color: var(--text-muted);
  font-family: 'IBM Plex Mono', monospace;
  white-space: nowrap;
}

/* Pulsing left border for items < 30 min old */
.threat-card.news.news-fresh::before {
  animation: newsFreshPulse 2s ease-in-out 4;
}

@keyframes newsFreshPulse {
  0%, 100% { box-shadow: 0 0 6px var(--info); }
  50%       { box-shadow: 0 0 14px var(--info), 0 0 24px rgba(100,210,255,0.3); }
}

/* Live dot inside the category label for fresh items */
.news-live-badge {
  display: flex;
  align-items: center;
  gap: 5px;
}

.news-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--accent-cyan);
  border-radius: 50%;
  flex-shrink: 0;
  animation: blink 1.2s ease-in-out infinite;
}

/* Source label below card title */
.news-source-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.85;
}

/* HN upvote points */
.news-points {
  font-size: 0.62rem;
  color: var(--high);
  opacity: 0.8;
  font-family: 'IBM Plex Mono', monospace;
}

/* Count badge on tab buttons */
.tab-count {
  display: inline-block;
  background: var(--accent-cyan);
  color: var(--bg-primary);
  border-radius: 999px;
  padding: 0 5px;
  font-size: 0.55rem;
  font-weight: 700;
  min-width: 16px;
  text-align: center;
  line-height: 16px;
  vertical-align: middle;
  margin-left: 2px;
}

/* NVD lag note */
.nvd-lag-note {
  font-size: 0.58rem;
  color: var(--text-muted);
  opacity: 0.7;
  cursor: help;
  white-space: nowrap;
  border-bottom: 1px dotted var(--text-muted);
}
.cve-new-badge {
  display: inline-block;
  background: rgba(0, 255, 213, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 255, 213, 0.4);
  border-radius: 3px;
  font-size: 0.55rem;
  font-weight: 700;
  padding: 1px 5px;
  vertical-align: middle;
  letter-spacing: 0.08em;
  animation: newBadgeFade 8s forwards;
}

@keyframes newBadgeFade {
  0%   { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; width: 0; padding: 0; margin: 0; overflow: hidden; }
}

/* Slide-in animation for newly added CVE cards */
.threat-card.cve-new {
  animation: slideInNew 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  border-color: rgba(0, 255, 213, 0.35);
  box-shadow: 0 0 12px rgba(0, 255, 213, 0.12);
}

@keyframes slideInNew {
  from { transform: translateX(-10px); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

/* ── Stats Bar ──────────────────────────────────────────── */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 8px 16px;
  background: rgba(0,0,0,0.3);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-cyan);
}
.stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 1px;
}
.stat-critical .stat-value {
  color: var(--severity-critical, #ff4444);
}

/* ── Threat Activity Ticker ─────────────────────────────── */
.threat-ticker {
  position: fixed;
  bottom: 28px;
  left: 0;
  right: 0;
  height: 26px;
  background: rgba(5, 5, 8, 0.9);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  z-index: 1500;
  overflow: hidden;
  font-family: 'IBM Plex Mono', monospace;
}

.ticker-label {
  flex-shrink: 0;
  padding: 0 12px;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(0, 255, 213, 0.08);
  border-right: 1px solid var(--border);
  height: 100%;
  display: flex;
  align-items: center;
  letter-spacing: 0.08em;
}

.ticker-track {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.ticker-content {
  white-space: nowrap;
  font-size: 0.65rem;
  color: var(--text-muted);
  padding-left: 100%;
  animation: tickerScroll 60s linear infinite;
}

.ticker-content .ticker-item {
  display: inline;
  margin-right: 40px;
}

.ticker-content .ticker-cve { color: var(--cve); }
.ticker-content .ticker-malware { color: var(--ransomware); }
.ticker-content .ticker-apt { color: var(--apt); }
.ticker-content .ticker-news { color: var(--info); }
.ticker-content .ticker-sep { color: var(--border-light); margin: 0 16px; }

@keyframes tickerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* Adjust status bar to sit above ticker */
#status-bar {
  position: relative;
  z-index: 1501;
}

/* ── Enhanced stats bar ─────────────────────────────────── */
.stat-item {
  position: relative;
  padding: 4px 16px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.stat-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.stat-item::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 1px;
  background: var(--accent-cyan);
  transition: width 0.3s ease;
}

.stat-item:hover::after {
  width: 80%;
}

/* ── Card hover glow effect ─────────────────────────────── */
.threat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.threat-card.cve:hover::after {
  opacity: 1;
  box-shadow: inset 0 0 20px rgba(255, 204, 0, 0.05);
}

.threat-card.ransomware:hover::after {
  opacity: 1;
  box-shadow: inset 0 0 20px rgba(255, 45, 85, 0.05);
}

.threat-card.apt:hover::after {
  opacity: 1;
  box-shadow: inset 0 0 20px rgba(191, 90, 242, 0.05);
}

.threat-card.news:hover::after {
  opacity: 1;
  box-shadow: inset 0 0 20px rgba(100, 210, 255, 0.05);
}
