@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,300;0,400;0,600;0,700;0,800;1,400&family=Orbitron:wght@500;700;900&family=Share+Tech+Mono&display=swap');

:root {
  --bg-deep: #08080a;
  --bg-grid-line: rgba(255, 30, 66, 0.04);
  --bg-grid-dot: rgba(255, 30, 66, 0.12);
  --surface-0: #0a0a0d;
  --surface-1: #101117;
  --surface-2: #151722;
  --surface-3: #1c1f2e;
  --border-subtle: #1f2333;
  --border-active: #2f354d;
  --border-tactical: rgba(255, 30, 66, 0.4);
  
  --crimson-core: #ff1e42;
  --crimson-laser: #e11d48;
  --crimson-bright: #ff3366;
  --crimson-glow: rgba(255, 30, 66, 0.45);
  --crimson-dim: rgba(255, 30, 66, 0.15);

  --amber-alert: #f59e0b;
  --amber-glow: rgba(245, 158, 11, 0.4);
  --cyan-telemetry: #00f0ff;
  --cyan-glow: rgba(0, 240, 255, 0.4);
  --emerald-ok: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.4);

  --text-main: #f0f2f8;
  --text-secondary: #8c93a8;
  --text-muted: #52596d;
  --text-accent: #ff1e42;

  --font-mono: 'JetBrains Mono', 'Share Tech Mono', monospace;
  --font-display: 'Orbitron', monospace;
}

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

/* Glassmorphism Tactical Cards (Matches Reference Monitor) */
.glass-panel-tactical {
  background: rgba(11, 14, 22, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.glass-card-subtle {
  background: rgba(13, 17, 26, 0.75);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
}

.iso-grid-bg {
  background-color: #07080c;
  background-image: 
    radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(to right, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 30px 30px, 120px 120px, 120px 120px;
}

body {
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-mono);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #0b0c10;
}
::-webkit-scrollbar-thumb {
  background: #252838;
  border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--crimson-core);
}

/* Cyberpunk Scanline & Vignette Effect */
.tactical-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, transparent 65%, rgba(4, 4, 6, 0.85) 100%);
  z-index: 40;
}

.scanlines-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
  background-size: 100% 3px;
  opacity: 0.25;
  z-index: 39;
}

/* Infinite Canvas Grid */
.millimeter-grid {
  background-color: var(--bg-deep);
  background-image: 
    radial-gradient(var(--bg-grid-dot) 1.2px, transparent 1.2px),
    linear-gradient(to right, var(--bg-grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--bg-grid-line) 1px, transparent 1px);
  background-size: 24px 24px, 120px 120px, 120px 120px;
}

/* HUD Top Bar */
.hud-glass {
  background: rgba(10, 11, 15, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.7), 0 1px 0 rgba(255, 30, 66, 0.25);
}

.hud-pill {
  background: rgba(16, 18, 26, 0.8);
  border: 1px solid #1f2333;
  transition: all 0.2s ease;
}
.hud-pill:hover {
  border-color: rgba(255, 30, 66, 0.4);
}

.beveled-corner-sm {
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}

.beveled-corner-md {
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}

.beveled-corner-full {
  clip-path: polygon(8px 0%, calc(100% - 8px) 0%, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0% calc(100% - 8px), 0% 8px);
}

/* Tactical Glowing Accents */
.glow-crimson {
  box-shadow: 0 0 16px var(--crimson-glow);
}
.text-glow-crimson {
  text-shadow: 0 0 10px rgba(255, 30, 66, 0.65);
}
.text-glow-cyan {
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.65);
}
.border-crimson-glow {
  border-color: var(--crimson-core);
  box-shadow: 0 0 12px var(--crimson-glow);
}

/* Canvas Nodes */
.agent-node {
  position: absolute;
  cursor: grab;
  user-select: none;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  z-index: 10;
}
.agent-node:active {
  cursor: grabbing;
}
.agent-node.selected {
  border-color: var(--crimson-core) !important;
  box-shadow: 0 0 24px rgba(255, 30, 66, 0.55), inset 0 0 15px rgba(255, 30, 66, 0.2) !important;
  z-index: 25;
}

/* L3 Central Reactor Ring */
.l3-reactor {
  position: relative;
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.l3-reactor-ring-outer {
  position: absolute;
  inset: 0;
  border: 2px dashed rgba(255, 30, 66, 0.65);
  border-radius: 50%;
  animation: reactor-rotate 18s linear infinite;
}

.l3-reactor-ring-inner {
  position: absolute;
  inset: 10px;
  border: 2px solid rgba(255, 30, 66, 0.4);
  border-top-color: var(--crimson-core);
  border-radius: 50%;
  animation: reactor-rotate-reverse 8s linear infinite;
}

.l3-reactor-core {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle, #ff1e42 20%, #99001a 70%, #200408 100%);
  box-shadow: 0 0 20px rgba(255, 30, 66, 0.8), inset 0 0 8px #ffffff;
  animation: core-pulse 2.2s ease-in-out infinite;
}

@keyframes reactor-rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes reactor-rotate-reverse {
  0% { transform: rotate(360deg); }
  100% { transform: rotate(0deg); }
}

@keyframes core-pulse {
  0%, 100% { transform: scale(0.95); opacity: 0.9; }
  50% { transform: scale(1.08); opacity: 1; box-shadow: 0 0 30px rgba(255, 30, 66, 1), inset 0 0 12px #ffffff; }
}

/* Port Styling */
.agent-port {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #0f1118;
  border: 2px solid #373d54;
  position: absolute;
  cursor: crosshair;
  transition: all 0.2s ease;
  z-index: 15;
}
.agent-port:hover {
  transform: scale(1.35);
  border-color: var(--crimson-core);
  background: #ff1e42;
  box-shadow: 0 0 10px var(--crimson-core);
}
.agent-port.port-in {
  border-color: #3b82f6;
}
.agent-port.port-in:hover {
  border-color: #60a5fa;
  background: #3b82f6;
  box-shadow: 0 0 10px #3b82f6;
}
.agent-port.port-out {
  border-color: var(--crimson-core);
}

/* Magnetic Connection SVG */
.cable-bg {
  stroke: rgba(255, 30, 66, 0.14);
  stroke-width: 3;
  fill: none;
}
.cable-core {
  stroke: rgba(255, 30, 66, 0.7);
  stroke-width: 1.5;
  fill: none;
  stroke-dasharray: 4 3;
  animation: cable-flow 1.5s linear infinite;
}
.cable-core.cable-amber {
  stroke: rgba(245, 158, 11, 0.75);
}
.cable-core.cable-alert {
  stroke: rgba(255, 30, 66, 1);
  stroke-width: 2.2;
}

@keyframes cable-flow {
  0% { stroke-dashoffset: 28; }
  100% { stroke-dashoffset: 0; }
}

/* Pulsing radar dots */
.radar-blip {
  animation: radar-ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes radar-ping {
  75%, 100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* Tactical Audio Waveform Visualizer */
.audio-bar {
  display: inline-block;
  width: 3px;
  background-color: var(--crimson-core);
  border-radius: 1px;
  transition: height 0.1s ease;
}

/* Wireshark Terminal Rows */
.traffic-row {
  transition: background-color 0.15s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.traffic-row:hover {
  background-color: rgba(255, 30, 66, 0.12);
  cursor: pointer;
}
.traffic-row.selected {
  background-color: rgba(255, 30, 66, 0.22);
  border-left: 3px solid var(--crimson-core);
}

/* Modal styling */
.tactical-modal-backdrop {
  background: rgba(4, 5, 8, 0.85);
  backdrop-filter: blur(8px);
}

/* Flash on arrival */
@keyframes node-flash {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.7) drop-shadow(0 0 15px rgba(255, 30, 66, 0.8)); }
  100% { filter: brightness(1); }
}
.flash-impact {
  animation: node-flash 0.4s ease-out;
}
