/* ===== 流程总视图样式 ===== */
#flowOverview {
  display: none;
  position: relative;
  width: 100%;
  height: calc(100vh - 120px);
  overflow: hidden;
  background: #f0f2f5;
  border: 1px solid #ddd;
  border-radius: 8px;
  cursor: grab;
}
#flowOverview:active { cursor: grabbing; }
#flowOverview .fo-canvas {
  position: absolute;
  top: 0; left: 0;
  transform-origin: 0 0;
}
#flowOverview .fo-svg {
  position: absolute;
  top: 0; left: 0;
  width: 8000px; height: 8000px;
  pointer-events: none;
  overflow: visible;
}
#flowOverview .fo-svg path {
  pointer-events: stroke;
  cursor: pointer;
}

/* ---- 节点 ---- */
.fo-node {
  position: absolute;
  min-width: 140px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  cursor: grab;
  user-select: none;
  transition: box-shadow 0.15s;
  overflow: hidden;
}
.fo-node:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.2); }
.fo-node:active { cursor: grabbing; }
.fo-node .fo-node-header {
  padding: 6px 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fo-node .fo-node-body {
  padding: 8px 10px;
  background: #fff;
  font-size: 11px;
  color: #666;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fo-node .fo-node-body .node-type {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  color: #fff;
  margin-right: 4px;
}

/* 表单节点 — 按类型分色 */
.fo-node-form .fo-node-header { background: #667eea; }
.fo-node-form .fo-node-body .node-type { background: #667eea; }
.fo-node-form-normal .fo-node-header { background: #667eea; }
.fo-node-form-normal .fo-node-body .node-type { background: #667eea; }
.fo-node-form-process .fo-node-header { background: #5e35b1; }
.fo-node-form-process .fo-node-body .node-type { background: #5e35b1; }
.fo-node-form-dashboard .fo-node-header { background: #e91e63; }
.fo-node-form-dashboard .fo-node-body .node-type { background: #e91e63; }
.fo-node-form-silent_poll .fo-node-header { background: #00897b; }
.fo-node-form-silent_poll .fo-node-body .node-type { background: #00897b; }
.fo-node-form-supply_chain .fo-node-header { background: #f5a623; }
.fo-node-form-supply_chain .fo-node-body .node-type { background: #f5a623; }
.fo-node-form-device .fo-node-header { background: #455a64; }
.fo-node-form-device .fo-node-body .node-type { background: #455a64; }
.fo-node-form-pool .fo-node-header { background: #0097a7; }
.fo-node-form-pool .fo-node-body .node-type { background: #0097a7; }

/* 工作流节点 — 蓝色渐变 + 虚线边框 */
.fo-node-workflow {
  border: 2px dashed #4facfe;
  border-radius: 8px;
}
.fo-node-workflow .fo-node-header {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  display: flex;
  align-items: center;
  gap: 4px;
}
.fo-node-workflow .fo-node-header .fo-wf-icon {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
}
.fo-node-workflow .fo-node-header .fo-wf-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.fo-node-workflow .fo-node-body .node-type { background: #4facfe; }

/* 触发器图标 */
.fo-trigger-icon {
  font-size: 11px;
  cursor: default;
  line-height: 1;
}

/* 定时触发节点 — 卡片 */
.fo-node-schedule {
  border: 2px dashed #fa709a;
  border-radius: var(--radius, 8px);
  background: rgba(250, 112, 154, 0.04);
}
.fo-node-schedule .fo-node-header {
  background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
  border-radius: 6px 6px 0 0;
}
.fo-node-schedule .fo-node-body .node-type { background: #fa709a; }

/* 工作流结束节点 — 小方块 */
.fo-node-wfend {
  width: 56px;
  height: 36px;
  min-width: unset;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 4px;
}
.fo-node-wfend .fo-node-header {
  background: #9e9e9e;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  padding: 0;
  border-radius: 4px;
}
.fo-node-wfend .fo-node-body { display: none; }

/* ---- 连线类型 ---- */
.edge-solid  { stroke: #999; stroke-width: 2; fill: none; }
.edge-dashed { stroke-dasharray: 8 4; stroke-width: 2; fill: none; }
.edge-dotdash { stroke-dasharray: 12 4 4 4; stroke-width: 2; fill: none; }

.edge-type-form     { stroke: #999; }
.edge-type-workflow  { stroke: #4facfe; }
.edge-type-write     { stroke: #f5576c; }

/* 高亮 / 选中 */
.edge-highlight { stroke-width: 3.5; opacity: 1; filter: drop-shadow(0 0 4px currentColor); }
.edge-dim       { opacity: 0.15; }

/* 交叉圆弧 — 已移除视觉标记 */

/* ---- 连线 tooltip ---- */
.edge-tooltip {
  position: absolute;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 8px 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  font-size: 12px;
  color: #333;
  max-width: 280px;
  z-index: 100;
  pointer-events: none;
}
.edge-tooltip .et-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: #333;
}
.edge-tooltip .et-item {
  padding: 2px 0;
  color: #666;
}

/* ---- 缩放控制 ---- */
.fo-zoom-controls {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
  z-index: 50;
}
.fo-zoom-controls button {
  width: 32px; height: 32px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fo-zoom-controls button:hover { background: #f0f0f0; }
.fo-zoom-level {
  padding: 0 8px;
  font-size: 12px;
  line-height: 32px;
  color: #666;
}

/* ---- 切换按钮 ---- */
.flow-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  background: #fff;
  color: #333;
  font-size: 13px;
  cursor: pointer;
  margin-left: 8px;
  vertical-align: middle;
}
.flow-toggle-btn:hover { border-color: #4facfe; color: #4facfe; }
.flow-toggle-btn.active { background: #e6f7ff; border-color: #4facfe; color: #4facfe; }

/* ---- 流程视图节点按钮 ---- */
.fo-node-actions {
  display: flex;
  gap: 2px;
  padding: 4px 6px;
  background: #fff;
  border-top: 1px solid #f0f0f0;
}
.fo-node-actions .fo-btn {
  flex: 1;
  padding: 3px 0;
  border: none;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s;
}
.fo-node-actions .fo-btn:hover { filter: brightness(0.9); }
.fo-btn-build { background: #ede7f6; color: #5e35b1; }
.fo-btn-edit { background: #e3f2fd; color: #1976d2; }
.fo-btn-perm { background: #fff3e0; color: #e65100; }
.fo-btn-toggle-on { background: #e8f5e9; color: #2e7d32; }
.fo-btn-toggle-off { background: #ffebee; color: #c62828; }
.fo-btn-delete { background: #ffebee; color: #c62828; }

/* 文件夹容器矩形 */
.fo-folder-rect {
  position: absolute;
  border: 2px dashed #4facfe;
  border-radius: 12px;
  background: rgba(79, 172, 254, 0.05);
  pointer-events: none;
  z-index: 0;
}
.fo-folder-label {
  position: absolute;
  top: -10px; left: 12px;
  background: #fff;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: #4facfe;
  white-space: nowrap;
}
.fo-folder-title {
  position: absolute;
  left: 0; right: 0;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #333;
  background: rgba(79, 172, 254, 0.08);
  border-bottom: 2px solid #4facfe;
  border-radius: 8px 8px 0 0;
  pointer-events: none;
  z-index: 1;
}
