/* My WeizeRouter · Topology Visualizer Stylesheet
   Cyber-Luxury Midnight Obsidian & Neon Circuit Interface */

.topology-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
  margin-bottom: 36px;
  position: relative;
  overflow: hidden;
}
.topology-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--gold), transparent);
}

/* Header & Live Stream Bar */
.topo-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.topo-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}
.topo-title {
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-main);
  text-transform: uppercase;
}
.topo-title span {
  color: var(--cyan);
}
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 9.5px var(--mono);
  font-weight: 600;
  letter-spacing: 1.5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.35);
  color: var(--green);
  text-transform: uppercase;
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse-live 1.8s infinite;
}
@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.topo-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.btn-simulate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 11px var(--mono);
  font-weight: 700;
  color: #06080c;
  background: linear-gradient(115deg, #f0e1be, #d4b878);
  border: 1px solid #d4b878;
  padding: 7px 16px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(212, 184, 120, 0.3);
  transition: all 0.2s;
}
.btn-simulate:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(212, 184, 120, 0.45);
}
.btn-simulate:active {
  transform: translateY(0);
}

/* Stats Ticker & Curve Row */
.topo-stats-banner {
  display: grid;
  grid-template-columns: repeat(5, 1fr) 1.2fr;
  gap: 12px;
  background: rgba(8, 11, 16, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 24px;
  align-items: center;
}
.topo-stat-item {
  display: flex;
  flex-direction: column;
}
.topo-stat-label {
  font: 9.5px var(--mono);
  letter-spacing: 1.2px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.topo-stat-val {
  font: 15px var(--mono);
  font-weight: 700;
  color: var(--text-main);
}
.topo-stat-val.gold { color: var(--gold); }
.topo-stat-val.cyan { color: var(--cyan); }
.topo-stat-val.green { color: var(--green); }

.topo-mini-chart-wrap {
  display: flex;
  flex-direction: column;
  height: 48px;
}
.topo-mini-chart-label {
  font: 9px var(--mono);
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
}
.topo-mini-svg {
  width: 100%;
  height: 32px;
}

/* ==================================================================
   THREE-COLUMN PIPELINE TOPOLOGY
   ================================================================== */
.topo-canvas-container {
  position: relative;
  width: 100%;
  min-height: 520px;
  display: grid;
  grid-template-columns: 280px 1fr 340px;
  gap: 24px;
  align-items: center;
}

/* Connecting Canvas Overlay */
#topo-circuit-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* Column 1: Client Nodes */
.topo-clients-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 3;
}
.topo-node {
  position: relative;
  background: rgba(14, 19, 26, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.topo-node:hover, .topo-node.active {
  border-color: var(--cyan);
  background: rgba(20, 28, 38, 0.95);
  transform: translateX(4px);
  box-shadow: 0 6px 20px rgba(112, 197, 212, 0.2);
}
.topo-node-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topo-node-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  display: grid;
  place-items: center;
  font-size: 13px;
  color: var(--cyan);
  border: 1px solid rgba(112, 197, 212, 0.2);
}
.topo-node-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
}
.topo-node-sub {
  font: 9px var(--mono);
  color: var(--text-muted);
}
.topo-node-count {
  font: 11px var(--mono);
  font-weight: 700;
  color: var(--gold);
  background: rgba(212, 184, 120, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(212, 184, 120, 0.25);
  flex-shrink: 0;
}

/* Column 2: Central Router Core Hub */
.topo-core-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 3;
  padding: 20px;
}
.topo-core-card {
  position: relative;
  background: radial-gradient(circle at 50% 50%, rgba(20, 27, 38, 0.95), rgba(9, 13, 18, 0.98));
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 35px rgba(212, 184, 120, 0.15);
  max-width: 320px;
  width: 100%;
}
.topo-core-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 25px;
  padding: 1.5px;
  background: linear-gradient(135deg, var(--gold), transparent 50%, var(--cyan));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.topo-core-radar {
  position: relative;
  width: 100px;
  height: 100px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
}
.radar-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px dashed rgba(212, 184, 120, 0.4);
  animation: spin-radar 14s linear infinite;
}
.radar-ring-inner {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  border: 1px solid rgba(112, 197, 212, 0.4);
  animation: spin-radar-rev 10s linear infinite;
}
@keyframes spin-radar {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes spin-radar-rev {
  from { transform: rotate(0deg); }
  to { transform: rotate(-360deg); }
}
.topo-core-logo {
  width: 44px;
  height: 44px;
  z-index: 2;
  filter: drop-shadow(0 0 10px rgba(212, 184, 120, 0.6));
}
.topo-core-title {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff;
  margin-bottom: 4px;
}
.topo-core-status {
  font: 10px var(--mono);
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}
.topo-core-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.topo-core-metric-item {
  font: 9.5px var(--mono);
  color: var(--text-muted);
}
.topo-core-metric-item b {
  display: block;
  font-size: 12px;
  color: var(--text-main);
  margin-top: 2px;
}

/* Column 3: AI Model Pools */
.topo-models-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 3;
}
.topo-model-node {
  position: relative;
  background: rgba(14, 19, 26, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.topo-model-node:hover, .topo-model-node.active {
  border-color: var(--gold);
  background: rgba(22, 28, 38, 0.95);
  transform: translateX(-4px);
  box-shadow: 0 6px 22px rgba(212, 184, 120, 0.25);
}
.topo-model-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}
.topo-model-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
}
.topo-model-texts {
  overflow: hidden;
}
.topo-model-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topo-model-meta {
  font: 9px var(--mono);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.topo-model-nodes-count {
  color: var(--green);
}
.topo-model-badge {
  font: 10.5px var(--mono);
  font-weight: 700;
  color: var(--cyan);
  background: rgba(112, 197, 212, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(112, 197, 212, 0.25);
  flex-shrink: 0;
}

/* Route Info Popover / Overlay Card */
.route-telemetry-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(6, 8, 12, 0.85);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 999px;
  font: 10px var(--mono);
  color: var(--gold);
  display: none;
  align-items: center;
  gap: 8px;
  z-index: 10;
}

/* ==================================================================
   MOBILE BREAKPOINTS
   ================================================================== */
@media (max-width: 1024px) {
  .topo-stats-banner {
    grid-template-columns: repeat(3, 1fr);
  }
  .topo-mini-chart-wrap {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .topology-box {
    padding: 20px 16px;
  }
  .topo-canvas-container {
    grid-template-columns: 1fr;
    gap: 20px;
    width: 100%;
    max-width: 100%;
  }
  #topo-circuit-canvas {
    display: none; /* Mobile switches to sleek vertical connection */
  }
  .topo-core-col {
    order: -1;
    padding: 0;
    width: 100%;
  }
  .topo-core-card {
    max-width: 100%;
    padding: 24px 18px;
  }
  .topo-node:hover, .topo-node.active {
    transform: none;
  }
  .topo-model-node:hover, .topo-model-node.active {
    transform: none;
  }
  .topo-stats-banner {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 12px 14px;
  }
  .topo-mini-chart-wrap {
    grid-column: 1 / -1;
  }
}

/* WR 3D Core mount: one engine, topology-owned, responsive. */
.topo-core-3d{position:absolute;inset:0;z-index:3;pointer-events:auto;cursor:grab;border-radius:50%;overflow:visible}.topo-core-3d:active{cursor:grabbing}.topo-core-3d canvas{display:block;width:100%;height:100%;touch-action:none}.topo-core-radar:has(.topo-core-3d) .topo-core-logo{opacity:.12;position:relative;z-index:1}.topo-core-radar{isolation:isolate}@media(max-width:860px){.topo-core-radar{width:128px;height:128px}.topo-core-3d{inset:-18px}.topo-core-card{min-width:0;width:100%}.topo-canvas-container{overflow:visible}.topo-node,.topo-model-node{min-width:0;overflow-wrap:anywhere}}
