/* ═══════════════════════════════════════════════════════
   CVC Dashboard — Hive Singularity UI (God-Level Cortex)
   ═══════════════════════════════════════════════════════ */

#tab-swarm {
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  position: relative;
  background-color: #010204;
  font-family: 'JetBrains Mono', 'Courier New', Courier, monospace;
}

#swarm-canvas-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* Make SVG Draggable */
#swarm-svg {
  cursor: grab;
  width: 100%;
  height: 100%;
}
#swarm-svg:active {
  cursor: grabbing;
}

/* ── SVG Cortex & Layout ── */

.squad-box {
  fill: rgba(180, 59, 59, 0.02);
  stroke: rgba(180, 59, 59, 0.15);
  stroke-width: 1.5;
  stroke-dasharray: 6 6;
  rx: 8;
}

.neural-wire {
  fill: none;
  stroke: rgba(180, 59, 59, 0.15);
  stroke-width: 1.5px;
}
.neural-wire-zeus {
  fill: none;
  stroke: rgba(255, 255, 255, 0.3);
  stroke-width: 4px;
  stroke-dasharray: 4 4;
  animation: wire-flow 2s linear infinite reverse;
}
.neural-wire-captain {
  fill: none;
  stroke: rgba(208, 98, 98, 0.3);
  stroke-width: 2.5px;
}

@keyframes wire-flow {
  to { stroke-dashoffset: -100; }
}

.pulse-read {
  fill: #d06262;
  filter: drop-shadow(0 0 6px #d06262);
}
.pulse-write {
  fill: #ffaa00;
  filter: drop-shadow(0 0 6px #ffaa00);
}

/* ── Robot Avatars & Animations ── */

.robot-avatar {
  transition: filter 0.2s, stroke 0.2s, fill 0.2s;
  
}

.robot-head { fill: #0b1118; stroke: rgba(255, 255, 255, 0.15); stroke-width: 1; }
.robot-body { fill: #060a10; stroke: rgba(255, 255, 255, 0.1); stroke-width: 1; }
.robot-limb { stroke-width: 1.5; stroke-linecap: round; opacity: 0.6; }
.robot-label { fill: #ffffff; font-size: 11px; text-anchor: middle; font-weight: 600; letter-spacing: 0.5px; }
.robot-sub { fill: rgba(255,255,255,0.4); font-size: 8px; text-anchor: middle; }

/* The Physical Interaction Glow */

.robot-avatar.active-read .robot-head {
  stroke: #d06262;
  filter: drop-shadow(0 0 15px #d06262);
  fill: #003344;
}


.robot-avatar.active-write .robot-head {
  stroke: #ffaa00;
  filter: drop-shadow(0 0 15px #ffaa00);
  fill: #442200;
}

/* ── The Superbrain Cortex ── */

.brain-core {
  fill: rgba(0, 40, 60, 0.8);
  stroke: #d06262;
  stroke-width: 2;
  filter: drop-shadow(0 0 25px rgba(208, 98, 98, 0.2));
  transition: all 0.1s ease-out;
}
.brain-core.flash-read {
  fill: rgba(0, 150, 200, 0.9);
  filter: drop-shadow(0 0 60px rgba(208, 98, 98, 1));
}
.brain-core.flash-write {
  fill: rgba(200, 100, 0, 0.9);
  stroke: #ffaa00;
  filter: drop-shadow(0 0 60px rgba(255, 170, 0, 1));
}

.brain-sulcus {
  fill: none;
  stroke: rgba(208, 98, 98, 0.4);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.brain-label {
  fill: #d06262;
  font-size: 16px;
  font-weight: 800;
  text-anchor: middle;
  text-shadow: 0 0 10px #d06262;
  letter-spacing: 4px;
}

/* Sci-Fi Overlay Grid */
.swarm-ui-layer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 220px; 
  z-index: 10;
  pointer-events: none;
  padding: 0 20px 0 20px; /* Flush against the bottom */
  box-sizing: border-box;
}

.swarm-bottom-bar {
  background: rgba(2, 6, 12, 0.85);
  border: 1px solid rgba(180, 59, 59, 0.3);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  width: 100%;
  height: 100%;
  padding: 15px 20px;
  color: #d06262;
  pointer-events: auto;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  gap: 20px;
  box-sizing: border-box;
}

.bottom-section {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0; /* CRITICAL FIX: Forces flex children to not expand past 100% height */
  overflow: hidden;
}

.stats-section { flex: 0.8; }
.nodes-section { flex: 2; border-left: 1px solid rgba(180, 59, 59, 0.2); padding-left: 20px; }
.telemetry-section { flex: 1.2; border-left: 1px solid rgba(180, 59, 59, 0.2); padding-left: 20px; }

.panel-title {
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(180, 59, 59, 0.3);
  padding-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0; /* Keep titles from shrinking */
}

.stat-row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 11px; flex-shrink: 0; }
.stat-label { color: rgba(255, 255, 255, 0.7); }
.stat-value { color: #fff; font-weight: bold; }

.agent-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
  padding-right: 5px;
  min-height: 0; /* CRITICAL FIX: Enables vertical scrolling */
}
.agent-list::-webkit-scrollbar { width: 4px; }
.agent-list::-webkit-scrollbar-thumb { background: rgba(180, 59, 59, 0.5); border-radius: 4px; }

.agent-item {
  padding: 4px 8px;
  background: rgba(180, 59, 59, 0.08);
  border: 1px solid rgba(180, 59, 59, 0.3);
  border-radius: 4px;
  font-size: 10px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  color: #fff;
  transition: all 0.2s;
}
.agent-item:hover { background: rgba(180, 59, 59, 0.2); cursor: default; }

.terminal-feed {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding-right: 5px;
  min-height: 0; /* CRITICAL FIX: Enables vertical scrolling */
}
.terminal-feed::-webkit-scrollbar { width: 4px; }
.terminal-feed::-webkit-scrollbar-thumb { background: rgba(180, 59, 59, 0.5); border-radius: 4px; }

.log-entry { font-size: 10px; margin-bottom: 6px; line-height: 1.4; word-break: break-all; flex-shrink: 0; }
.log-time { color: rgba(255, 255, 255, 0.4); margin-right: 5px; }
.log-agent { color: #fff; font-weight: bold; }
.log-action.read { color: #d06262; }
.log-action.write { color: #ffaa00; }

.scanlines {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(to bottom, rgba(255,255,255,0) 50%, rgba(0,0,0,0.1) 50%);
  background-size: 100% 4px;
  z-index: 11;
  pointer-events: none;
  opacity: 0.3;
}
