/* ==========================================================================
   Imm-Transit 交互式网络拓扑与动态测速控制台样式 (assets/css/topology.css)
   方案二：分层网络拓扑可视化 (Layered Network Topology Visualization)
   ========================================================================== */

.topology-section {
  position: relative;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0) 0%, rgba(224, 242, 254, 0.4) 50%, rgba(248, 250, 252, 0) 100%);
  padding: 80px 0;
  overflow: hidden;
}

.topology-wrapper {
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 32px;
  position: relative;
}

/* 拓扑控制栏 (Top Bar) */
.topology-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 28px;
}

.topology-title-area h3 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.topology-title-area p {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.topology-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 协议快速选择器 */
.protocol-chips {
  display: flex;
  background: var(--bg-card-muted);
  padding: 3px;
  border-radius: var(--radius-md);
  gap: 4px;
}

.protocol-chip {
  border: none;
  background: transparent;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.protocol-chip.active {
  background: #FFFFFF;
  color: var(--sky-blue);
  box-shadow: var(--shadow-xs);
}

/* 拓扑 SVG 画布容器 */
.topology-canvas-container {
  width: 100%;
  position: relative;
  border-radius: var(--radius-lg);
  background: radial-gradient(circle at 50% 50%, rgba(240, 249, 255, 0.7) 0%, rgba(255, 255, 255, 1) 100%);
  border: 1px solid rgba(226, 232, 240, 0.8);
  padding: 20px;
  overflow-x: auto;
}

.topology-svg {
  width: 100%;
  min-width: 820px;
  height: auto;
  display: block;
}

/* SVG 拓扑线条与脉冲流光 */
.topo-line-base {
  stroke: #CBD5E1;
  stroke-width: 2;
  stroke-dasharray: 4 4;
}

.topo-line-active {
  stroke: url(#lineGradientFlow);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 8 6;
  animation: topoLineDash 2s linear infinite;
  filter: drop-shadow(0 0 6px rgba(6, 182, 212, 0.45));
}

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

/* 拓扑节点元素 */
.topo-node {
  cursor: pointer;
  transition: all var(--transition-base);
}

.topo-node:hover .node-circle {
  transform: scale(1.15);
  stroke: var(--sky-blue);
  stroke-width: 3;
}

.topo-node.active .node-circle {
  stroke: var(--cyan);
  stroke-width: 3.5;
  filter: drop-shadow(0 0 10px rgba(6, 182, 212, 0.6));
}

.node-circle {
  transition: all var(--transition-fast);
  transform-origin: center;
}

.node-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  fill: var(--text-main);
  text-anchor: middle;
}

.node-subtext {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  fill: var(--text-muted);
  text-anchor: middle;
}

.node-ping-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  fill: var(--emerald);
  text-anchor: middle;
}

/* 拓扑交互状态检查器面板 */
.topology-inspector {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}

.inspector-node-detail {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.inspector-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.node-type-badge {
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--sky-blue-light);
  color: var(--sky-blue);
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.inspector-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.metric-item {
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.metric-item-label {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.metric-item-val {
  font-size: 1.22rem;
  font-weight: 800;
  color: var(--text-main);
  font-family: var(--font-mono);
  margin-top: 2px;
}

/* 测速模拟启动器 */
.inspector-speed-tester {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.04) 0%, rgba(6, 182, 212, 0.05) 100%);
  border: 1px solid rgba(2, 132, 199, 0.2);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.speed-tester-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.tester-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}

.speed-meter-bar {
  height: 10px;
  background: var(--bg-card-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
  margin: 14px 0 10px;
}

.speed-meter-progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--sky-blue), var(--cyan), var(--emerald));
  border-radius: var(--radius-full);
  transition: width 0.3s ease-out;
}

.speed-tester-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

@media (max-width: 900px) {
  .topology-inspector {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .topology-wrapper {
    padding: 18px;
  }
  .inspector-metrics-grid {
    grid-template-columns: 1fr;
  }
  .topology-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
}
