/* ORCA CTI — "Deep Signal" Theme (Light)
   A clean intelligence-desk look — white surfaces, soft slate borders, one
   blue signal accent standing in for the abyss glow the dark variant used.
   Every other hue on screen still carries a fixed, standardized meaning
   (TLP 2.0 classification, CVSS/Kent severity) rather than decoration. */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  --bg-main: #f3f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --border-color: #e4e9f0;
  --signal: #2563eb;
  --signal-dim: #bfdbfe;
}

body {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-main);
  color: #1e293b;
  overflow-x: hidden;
  color-scheme: light;
}

code, pre, .font-mono {
  font-family: 'IBM Plex Mono', monospace;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Card surfaces: hairline border by default, no default glow. Depth comes
   from a soft shadow and a slightly darker border on hover, not glow. */
.cyber-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.cyber-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.cyber-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* TLP 2.0 Badge Colors — standardized, never decorative */
.tlp-red { background: #fee2e2; color: #b91c1c; border: 1px solid #ef4444; }
.tlp-amber-strict { background: #fef3c7; color: #92400e; border: 1px solid #d97706; }
.tlp-amber { background: #fef3c7; color: #b45309; border: 1px solid #f59e0b; }
.tlp-green { background: #dcfce7; color: #15803d; border: 1px solid #10b981; }
.tlp-clear { background: #f1f5f9; color: #475569; border: 1px solid #94a3b8; }

/* Pyramid of Pain Levels — same hexes reused by the dashboard chart for consistency */
.pyramid-ttp { background: #fee2e2; color: #b91c1c; border: 1px solid #ef4444; }
.pyramid-tool { background: #ffedd5; color: #c2410c; border: 1px solid #f97316; }
.pyramid-artifact { background: #fef9c3; color: #a16207; border: 1px solid #eab308; }
.pyramid-domain { background: #dcfce7; color: #15803d; border: 1px solid #10b981; }
.pyramid-ip { background: #ccfbf1; color: #0f766e; border: 1px solid #14b8a6; }
.pyramid-hash { background: #f3e8ff; color: #7e22ce; border: 1px solid #a855f7; }

/* Sidebar Navigation — a dossier-tab metaphor: icons stay neutral until the
   section is open, then the tab and its icon pick up the one signal color. */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  color: #55606e;
  font-size: 13px;
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease;
  cursor: pointer;
  user-select: none;
  border-left: 3px solid transparent;
}
.nav-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.nav-item.active {
  background: #eff6ff;
  color: var(--signal);
  border-left: 3px solid var(--signal);
  font-weight: 600;
}
.nav-item.active i {
  color: var(--signal) !important;
}

/* Vis.js Graph Canvas Container */
#network-canvas {
  width: 100%;
  height: 680px;
  background: radial-gradient(circle at center, #ffffff 0%, #eef1f6 100%);
  border-radius: 10px;
  outline: none;
}

/* MITRE ATT&CK Matrix styling */
.mitre-tactic-col {
  min-width: 170px;
  max-width: 190px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px;
  flex-shrink: 0;
}
.mitre-tech-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.mitre-tech-card:hover {
  border-color: var(--signal);
  background: #eff6ff;
  transform: translateY(-1px);
}
.mitre-tech-card.highlighted {
  border-color: #f43f5e;
  background: rgba(244, 63, 94, 0.08);
  box-shadow: 0 0 0 1px rgba(244, 63, 94, 0.25);
}

/* Diamond Model Visual Container */
.diamond-wrapper {
  position: relative;
  width: 440px;
  height: 440px;
  margin: 0 auto;
}
.diamond-node {
  position: absolute;
  width: 130px;
  padding: 10px;
  border-radius: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(15, 23, 42, 0.12);
}
.diamond-node:hover {
  transform: scale(1.08);
}
.diamond-top { top: 10px; left: 155px; background: #fee2e2; border: 1px solid #ef4444; color: #b91c1c; }
.diamond-left { top: 165px; left: 10px; background: #fef3c7; border: 1px solid #f59e0b; color: #b45309; }
.diamond-right { top: 165px; right: 10px; background: #eff6ff; border: 1px solid var(--signal); color: var(--signal); }
.diamond-bottom { bottom: 10px; left: 155px; background: #f3e8ff; border: 1px solid #a855f7; color: #7e22ce; }

/* Sonar ping — the app's one live-signal motif, echoing ORCA's echolocation.
   Used wherever something is genuinely real-time, never as ambient decoration. */
.sonar-dot {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--signal);
  flex-shrink: 0;
}
.sonar-dot::before,
.sonar-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--signal);
  animation: sonar-ping 2.4s cubic-bezier(0.2, 0.7, 0.4, 1) infinite;
}
.sonar-dot::after {
  animation-delay: 1.2s;
}
@keyframes sonar-ping {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(4.5); opacity: 0; }
}

/* Legacy alias kept for any residual usage */
.pulse-live { animation: pulse-glow 2s infinite ease-in-out; }
@keyframes pulse-glow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.95); }
}

/* Live external source badge */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: #eff6ff;
  color: var(--signal);
  border: 1px solid #93c5fd;
}
.live-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--signal);
  animation: pulse-glow 1.4s infinite ease-in-out;
}
.source-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  font-size: 11px;
}
.source-pill .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Skeleton loading shimmer */
.skeleton {
  position: relative;
  overflow: hidden;
  background: #eef1f6;
  border-radius: 6px;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
  animation: skeleton-shimmer 1.4s infinite;
}
@keyframes skeleton-shimmer {
  100% { transform: translateX(100%); }
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 320px;
  max-width: calc(100vw - 40px);
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 30px -6px rgba(15, 23, 42, 0.18);
  font-size: 12px;
  color: #1e293b;
  animation: toast-in 0.25s ease-out;
}
.toast.toast-success { border-color: rgba(16, 185, 129, 0.5); }
.toast.toast-error { border-color: rgba(239, 68, 68, 0.5); }
.toast.toast-info { border-color: rgba(10, 166, 135, 0.5); }
.toast .toast-icon { margin-top: 1px; }
.toast.toast-success .toast-icon { color: #15803d; }
.toast.toast-error .toast-icon { color: #b91c1c; }
.toast.toast-info .toast-icon { color: var(--signal); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
.toast.toast-out {
  animation: toast-out 0.2s ease-in forwards;
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(20px); }
}

/* Dashboard hero stat — the single "opening moment": the live signal count,
   the most characteristic first thing an analyst wants to see. */
.hero-stat {
  background: linear-gradient(155deg, #eff6ff 0%, var(--bg-card) 60%);
  border: 1px solid var(--signal-dim);
}
.hero-stat .hero-value {
  font-family: 'IBM Plex Mono', monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* World heat map (jsvectormap) — tuned to sit on a white card */
.jvm-world-map-container {
  background: transparent !important;
}
.jvm-tooltip {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  color: #0f172a !important;
  font-family: 'IBM Plex Sans', sans-serif !important;
  font-size: 12px !important;
  padding: 6px 10px !important;
  border-radius: 6px !important;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.15);
}
.jvm-zoom-btn {
  background: #ffffff !important;
  color: #475569 !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.jvm-zoom-btn:hover {
  background: #f1f5f9 !important;
}
/* Regions with no value in the active series compute to fill="undefined"
   (jsVectorMap has no public API to pre-seed every region code at 0) —
   override that literal attribute to a neutral "no data" tint. */
#world-heat-map svg path[fill="undefined"] {
  fill: #e2e8f0;
}

/* Sector treemap legend chip */
.sector-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #475569;
}
.sector-legend-chip .swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Auto-scroll for long data tables (>20 rows) — see initTableScroll() in
   app.js. The wrapper caps height and scrolls vertically; the header stays
   pinned so column meaning is never lost while scrolling a long section. */
.table-scroll.is-scroll {
  max-height: 62vh;
  overflow-y: auto;
}
.table-scroll.is-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #ffffff;
}

/* Non-table info boxes opted in with [data-scroll-rows] (see sweepTableScroll)
   — scroll vertically once they exceed the row threshold so a box never
   pushes the page out of view. */
.rows-scroll {
  max-height: 62vh;
  overflow-y: auto;
}
