/* ============================================================
 * ensp.css — eNSP模拟器样式 (华为eNSP风格: 浅灰面板+画布+黑终端)
 * ============================================================ */
.ensp-layout {
  display: flex;
  height: 640px;
  background: #eceff1;
  border-top: 1px solid #cfd8dc;
}
/* 左侧设备柜 */
.ensp-pallet {
  width: 200px;
  flex-shrink: 0;
  background: #f5f6f7;
  border-right: 1px solid #cfd8dc;
  overflow-y: auto;
  padding: 8px;
}
.ensp-pallet-group { margin-bottom: 8px; }
.ensp-pallet-group-title {
  font-size: 12px;
  font-weight: bold;
  color: #546e7a;
  padding: 6px 4px;
  border-bottom: 2px solid #1976d2;
  margin-bottom: 6px;
}
.ensp-pallet-items { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ensp-pallet-item {
  background: #fff;
  border: 1px solid #cfd8dc;
  border-radius: 6px;
  padding: 8px 4px;
  text-align: center;
  cursor: grab;
  transition: all 0.15s;
  user-select: none;
}
.ensp-pallet-item:hover { border-color: #1976d2; background: #e3f2fd; transform: translateY(-1px); }
.ensp-pallet-item:active { cursor: grabbing; }
.ensp-pallet-item .pi-icon { display: flex; justify-content: center; margin-bottom: 2px; }
.ensp-pallet-item .pi-name { font-size: 11px; color: #37474f; font-weight: 600; }
.ensp-pallet-item .pi-model { font-size: 10px; color: #90a4ae; }
/* 线缆区 */
.ensp-cables { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ensp-cable-btn {
  background: #fff; border: 1px solid #cfd8dc; border-radius: 6px;
  padding: 6px 4px; text-align: center; cursor: pointer; font-size: 11px;
  color: #37474f; transition: all 0.15s;
}
.ensp-cable-btn:hover { border-color: #1976d2; background: #e3f2fd; }
.ensp-cable-btn.active { border-color: #1976d2; background: #e3f2fd; color: #1976d2; font-weight: bold; }
/* 中间画布区 */
.ensp-center { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.ensp-toolbar {
  display: flex; align-items: center; gap: 6px;
  background: #cfd8dc; padding: 6px 10px; border-bottom: 1px solid #b0bec5;
  flex-wrap: wrap;
}
.ensp-toolbar .sep { width: 1px; height: 18px; background: #90a4ae; }
.ensp-tbtn {
  border: 1px solid #b0bec5; background: #fff; border-radius: 4px;
  padding: 4px 10px; font-size: 12px; cursor: pointer; color: #37474f;
}
.ensp-tbtn:hover { background: #e3f2fd; border-color: #1976d2; color: #1976d2; }
.ensp-tbtn.green { color: #2e7d32; }
.ensp-tbtn.red { color: #c62828; }
.ensp-canvas-wrap {
  flex: 1; position: relative; background: #fafafa; overflow: hidden;
  background-image:
    linear-gradient(rgba(176,190,197,0.25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(176,190,197,0.25) 1px, transparent 1px);
  background-size: 20px 20px;
}
.ensp-canvas-wrap svg { width: 100%; height: 100%; display: block; }
.ensp-hint {
  position: absolute; top: 10px; left: 12px;
  font-size: 11px; color: #78909c; background: rgba(255,255,255,0.85);
  padding: 4px 10px; border-radius: 4px; border: 1px dashed #b0bec5;
  pointer-events: none;
}
.ensp-hint.cable-mode { color: #e65100; border-color: #ff9800; font-weight: bold; }
/* 右侧设备列表 */
.ensp-devlist {
  width: 190px; flex-shrink: 0; background: #f5f6f7;
  border-left: 1px solid #cfd8dc; overflow-y: auto; padding: 8px;
}
.ensp-devlist-title {
  font-size: 12px; font-weight: bold; color: #546e7a;
  border-bottom: 2px solid #1976d2; padding: 4px; margin-bottom: 6px;
  display: flex; justify-content: space-between;
}
.ensp-dev-row {
  background: #fff; border: 1px solid #cfd8dc; border-radius: 6px;
  padding: 6px 8px; margin-bottom: 6px; font-size: 12px;
}
.ensp-dev-row .dn { font-weight: bold; color: #263238; display: flex; align-items: center; gap: 6px; }
.ensp-dev-row .dm { color: #90a4ae; font-size: 10px; }
.ensp-dev-row .dops { display: flex; gap: 4px; margin-top: 5px; }
.ensp-dev-row .dops button {
  flex: 1; border: 1px solid #cfd8dc; background: #f5f5f5; border-radius: 4px;
  font-size: 10px; padding: 3px 2px; cursor: pointer;
}
.ensp-dev-row .dops button:hover { background: #e3f2fd; border-color: #1976d2; }
.ensp-dev-row .dops button.run { color: #2e7d32; }
.ensp-dev-row .dops button.stop { color: #c62828; }
.ensp-led {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
  background: #b0bec5;
}
.ensp-led.on { background: #4caf50; box-shadow: 0 0 4px #4caf50; }
.ensp-led.off { background: #ef5350; }
/* SVG 内设备 */
.ensp-node { cursor: move; }
.ensp-node.selected .node-body { stroke: #1976d2; stroke-width: 2.5; }
.ensp-node.running .ensp-status-dot { fill: #4caf50; }
.ensp-node.stopped .ensp-status-dot { fill: #ef5350; }
.ensp-link { stroke: #455a64; stroke-width: 2; cursor: pointer; }
.ensp-link:hover { stroke: #1976d2; stroke-width: 3; }
.ensp-link.selected { stroke: #f57c00; stroke-width: 3.5; }
.ensp-link-label { font-size: 9px; fill: #78909c; }
.ensp-link-port-label { font-size: 8.5px; fill: #1976d2; font-family: monospace; }
/* CLI 终端窗口 */
.ensp-term {
  position: fixed; right: 16px; bottom: 16px; width: 560px; max-width: 94vw;
  height: 380px; max-height: 70vh;
  background: #263238; border-radius: 8px; box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  display: flex; flex-direction: column; z-index: 2000;
  border: 1px solid #37474f; resize: both; overflow: hidden;
}
.ensp-term-header {
  background: #37474f; color: #eceff1; padding: 6px 12px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; cursor: default;
}
.ensp-term-header .th-title { display: flex; align-items: center; gap: 8px; }
.ensp-term-header .th-led { width: 8px; height: 8px; border-radius: 50%; background: #4caf50; }
.ensp-term-header button {
  background: transparent; border: none; color: #b0bec5; cursor: pointer; font-size: 14px;
}
.ensp-term-header button:hover { color: #fff; }
.ensp-term-body {
  flex: 1; overflow-y: auto; padding: 10px 12px;
  font-family: 'Consolas', 'Courier New', monospace; font-size: 12.5px;
  color: #cfd8dc; line-height: 1.5; white-space: pre-wrap; word-break: break-all;
}
.ensp-term-input-line { display: flex; padding: 4px 12px 10px; background: #263238; }
.ensp-term-input-line span { font-family: 'Consolas', monospace; font-size: 12.5px; color: #80cbc4; margin-right: 4px; }
.ensp-term-input-line input {
  flex: 1; background: transparent; border: none; outline: none;
  font-family: 'Consolas', monospace; font-size: 12.5px; color: #eceff1;
}
@media (max-width: 768px) {
  .ensp-pallet { width: 90px; }
  .ensp-pallet-items, .ensp-cables { grid-template-columns: 1fr; }
  .ensp-devlist { width: 80px; }
  .ensp-dev-row .dm, .ensp-pallet-item .pi-model { display: none; }
  .ensp-layout { height: 520px; }
}
