﻿/* ============================================
   Design Flow - 鏃犻檺鐢诲竷绯荤粺鏍峰紡
   ============================================ */

/* ============================================
   CSS 鍙橀噺瀹氫箟
   ============================================ */
:root {
  /* 棰滆壊绯荤粺 */
  --color-black: #111;
  --color-dark: #333;
  --color-gray-dark: #555;
  --color-gray: #666;
  --color-gray-medium: #999;
  --color-gray-light: #d5d5d5;
  --color-border: #e5e5e5;
  --color-border-light: #f0f0f0;
  --color-bg-light: #f5f5f5;
  --color-bg-lighter: #f8f8f8;
  --color-bg-lightest: #fafafa;
  --color-white: #fff;
  
  /* 閫忔槑鑹?*/
  --color-overlay-dark: rgba(0, 0, 0, 0.8);
  --color-overlay-medium: rgba(0, 0, 0, 0.2);
  --color-overlay-light: rgba(0, 0, 0, 0.08);
  --color-overlay-lighter: rgba(0, 0, 0, 0.06);
  --color-overlay-lightest: rgba(0, 0, 0, 0.03);
  
  /* 鍦嗚 */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 10px;
  --radius-2xl: 12px;
  --radius-3xl: 14px;
  --radius-4xl: 16px;
  --radius-5xl: 20px;
  --radius-full: 50%;
  
  /* 闃村奖 */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-2xl: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.15);
  --shadow-btn: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  
  /* 杩囨浮 */
  --transition-fast: 0.2s ease;
  --transition-base: 0.3s ease;
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* 姣涚幓鐠冩晥鏋?*/
  --backdrop-blur: blur(20px) saturate(180%);
  
  /* 闂磋窛 */
  --spacing-xs: 4px;
  --spacing-sm: 6px;
  --spacing-md: 8px;
  --spacing-lg: 10px;
  --spacing-xl: 12px;
  --spacing-2xl: 16px;
  --spacing-3xl: 20px;
  --spacing-4xl: 24px;
}

/* ============================================
   页面基础
   ============================================ */
body {
  font-family: 'Noto Sans SC', -apple-system, sans-serif;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  background: #f5f5f5;
  margin: 0;
  padding: 0;
}

/* ============================================
   无限画布
   ============================================ */
.flow-canvas-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #f8f9fc;
  background-image: radial-gradient(circle, #d4d7e5 1px, transparent 1px);
  background-size: 24px 24px;
  cursor: grab;
  touch-action: none;
}

.flow-lines-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.flow-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  z-index: 2;
}

/* ============================================
   卡片样式（复用编辑器结构，黑白灰主题）
   ============================================ */
.editor-card {
  position: absolute;
  width: 260px;
  background: #fff;
  border: 1.5px solid #222;
  border-radius: 10px;
  padding: 0;
  cursor: pointer;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  transform: translate(-50%, -50%);
  z-index: 10;
  font-family: 'Noto Sans SC', -apple-system, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}
.editor-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  border-color: #000;
  transform: translate(-50%, -50%) translateY(-2px);
}

/* 卡片头部 */
.editor-card__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 8px;
  border-bottom: 1px solid #f0f0f0;
  border-radius: 10px 10px 0 0;
}
.editor-card__type-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3px;
}
.editor-card__type-badge--main {
  background: #222;
  color: #fff;
}
.editor-card__type-badge--sub {
  background: #f0f0f0;
  color: #555;
}
.editor-card__number {
  font-size: 11px;
  color: #999;
  font-weight: 500;
}
/* 并行标签容器（不裁剪，承载旗帜+tooltip） */
.editor-card__parallel-wrap {
  position: absolute;
  top: -1px;
  right: 14px;
  z-index: 30;
  cursor: help;
}
.editor-card__parallel {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 28px;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  clip-path: polygon(0 0, 100% 0, 100% 75%, 50% 100%, 0 75%);
  padding-bottom: 6px;
  transition: filter 0.15s;
}
.editor-card__parallel-wrap:hover .editor-card__parallel {
  filter: brightness(1.2);
}
.editor-card__parallel-tip {
  position: absolute;
  top: 28px;
  right: -4px;
  padding: 6px 10px;
  background: #333;
  color: #fff;
  font-size: 11px;
  font-weight: 400;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 100;
}
.editor-card__parallel-tip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  right: 12px;
  border: 5px solid transparent;
  border-bottom-color: #333;
}
.editor-card__parallel-wrap:hover .editor-card__parallel-tip {
  opacity: 1;
  visibility: visible;
}

/* 卡片内容 */
.editor-card__body {
  padding: 10px 14px 12px;
}
.editor-card__title {
  font-size: 14px;
  font-weight: 600;
  color: #222;
  margin: 0 0 4px;
  line-height: 1.4;
}
.editor-card__desc {
  font-size: 12px;
  color: #888;
  margin: 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 展开区域 */
.editor-card__expand {
  padding: 0 14px 8px;
  border-top: 1px dashed #e8e8e8;
}
.editor-card__methods {
  margin: 8px 0 0;
  padding: 0 0 0 16px;
  font-size: 11px;
  color: #666;
  line-height: 1.7;
}
.editor-card__methods li {
  position: relative;
}
.editor-card__methods li::marker {
  color: #555;
}
.editor-card__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 5px 0;
  border: none;
  border-top: 1px solid #f0f0f0;
  background: #fafafa;
  font-size: 11px;
  color: #999;
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 0 0 10px 10px;
  font-family: inherit;
}
.editor-card__toggle:hover {
  background: #f0f0f0;
  color: #333;
}
.editor-card__toggle svg {
  transition: transform 0.2s;
}
.editor-card__toggle.is-open svg {
  transform: rotate(180deg);
}

/* 底部预算 */
.editor-card__footer {
  display: flex;
  gap: 12px;
  padding: 8px 14px;
  border-top: 1px solid #f0f0f0;
  font-size: 11px;
  color: #999;
  border-radius: 0 0 10px 10px;
}
.editor-card__footer span {
  display: flex;
  align-items: center;
  gap: 3px;
}

/* 主流程汇总底部 */
.editor-card__footer--summary {
  background: #f8f8f8;
  color: #555;
  font-weight: 600;
}

/* 连接端口（只读，不可拖拽） */
.editor-card__port {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #222;
  border: 1.5px solid #222;
  z-index: 30;
  pointer-events: none;
}
.editor-card__port--left {
  left: -5px;
  top: 50%;
  margin-top: -5px;
}
.editor-card__port--right {
  right: -5px;
  top: 50%;
  margin-top: -5px;
}
.editor-card__port--top {
  top: -5px;
  left: 50%;
  margin-left: -5px;
}
.editor-card__port--bottom {
  bottom: -5px;
  left: 50%;
  margin-left: -5px;
}

/* 高亮动画 */
.flow-card--highlight {
  animation: cardHighlight 1.2s ease;
}
@keyframes cardHighlight {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); }
  25% { box-shadow: 0 0 0 6px rgba(0,0,0,0.12); }
  50% { box-shadow: 0 0 0 3px rgba(0,0,0,0.06); }
  75% { box-shadow: 0 0 0 6px rgba(0,0,0,0.12); }
}

/* ============================================
   工具栏
   ============================================ */
.flow-toolbar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  z-index: 1000;
}
.flow-tool-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  transition: all 0.15s;
}
.flow-tool-btn svg {
  width: 18px;
  height: 18px;
}
.flow-tool-btn:hover {
  background: #f0f0f0;
  color: #222;
}
.flow-toolbar-divider {
  width: 1px;
  height: 20px;
  background: #e0e0e0;
  margin: 0 4px;
}
.flow-zoom-display {
  font-size: 12px;
  color: #888;
  min-width: 40px;
  text-align: center;
}

/* ============================================
   播放/暂停按钮
   ============================================ */
.flow-play-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  transition: all 0.15s;
  flex-shrink: 0;
  padding: 0;
}
.flow-play-btn svg {
  width: 14px;
  height: 14px;
}
.flow-play-btn:hover {
  background: #f0f0f0;
  color: #222;
}
/* ============================================
   阶段导航（一整条进度轨道 + 圆点标记）
   ============================================ */
.flow-stage-nav {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  height: 36px;
  display: flex;
  align-items: center;
  user-select: none;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border: 1px solid #e0e0e0;
  border-radius: 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  padding: 0 20px;
  z-index: 1000;
  box-sizing: border-box;
  overflow: visible;
}
.flow-stage-rail {
  position: relative;
  width: 100%;
  height: 3px;
  background: #e0e0e0;
  border-radius: 2px;
}
.flow-stage-rail-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: #222;
  border-radius: 2px;
  transition: width 0.3s ease;
}
/* 阶段圆点 */
.flow-stage-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d0d0d0;
  border: 2px solid #fff;
  cursor: pointer;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  transition: all 0.25s;
}
.flow-stage-dot:hover {
  background: #999;
  transform: translate(-50%, -50%) scale(1.3);
}
.flow-stage-dot.is-reached {
  background: #222;
}
/* 圆点上方浮动序号标签（hover显示） */
.flow-stage-dot-num {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 600;
  color: #fff;
  background: #222;
  border-radius: 4px;
  padding: 1px 5px;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.15s;
}
/* 未到达的圆点：悬停时显示数字 */
.flow-stage-dot:not(.is-reached):hover .flow-stage-dot-num {
  opacity: 1;
}
/* 正在通过的阶段：显示数字 */
.flow-stage-dot.is-passing .flow-stage-dot-num {
  opacity: 1;
}
/* 首尾大圆点 */
.flow-stage-dot[data-stage="1"],
.flow-stage-dot[data-stage="8"] {
  width: 12px;
  height: 12px;
}
/* 拖动手柄 */
.flow-stage-thumb {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #222;
  border: 2px solid #fff;
  border-radius: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  left: 0;
  z-index: 3;
  cursor: grab;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  transition: left 0.15s ease, box-shadow 0.15s;
  pointer-events: auto;
}
.flow-stage-thumb:hover,
.flow-stage-thumb.is-dragging {
  box-shadow: 0 0 0 5px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.2);
  cursor: grabbing;
}
.flow-stage-thumb.is-hidden {
  opacity: 0;
  pointer-events: none;
}

/* ============================================
   卡片详情弹窗
   ============================================ */
.flow-detail-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
}
.flow-detail-modal {
  background: #fff;
  border-radius: 14px;
  width: 420px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.flow-detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 24px 12px;
  border-bottom: 1px solid #f0f0f0;
}
.flow-detail-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 5px;
  font-weight: 500;
  white-space: nowrap;
}
.flow-detail-badge--main {
  background: #222;
  color: #fff;
}
.flow-detail-badge--sub {
  background: #f0f0f0;
  color: #555;
}
.flow-detail-header h3 {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  color: #222;
  margin: 0;
}
.flow-detail-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
  color: #999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.flow-detail-close:hover {
  background: #f0f0f0;
  color: #333;
}
.flow-detail-body {
  padding: 16px 24px 24px;
}
.flow-detail-body p {
  font-size: 14px;
  color: #555;
  line-height: 1.6;
  margin: 0 0 16px;
}
.flow-detail-body h4 {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  margin: 0 0 8px;
}
.flow-detail-body ul {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.flow-detail-body li {
  font-size: 12px;
  padding: 4px 10px;
  background: #f5f5f5;
  border-radius: 6px;
  color: #555;
}
.flow-detail-meta-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px solid #f5f5f5;
  font-size: 13px;
}
.flow-detail-meta-item .label {
  color: #999;
}
.flow-detail-meta-item .value {
  color: #333;
  font-weight: 500;
}

/* ============================================
   左下角设计说明卡
   ============================================ */
.flow-desc-card {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 320px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  z-index: 999;
  padding: 16px;
  transform: translateY(calc(100% + 40px));
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1), opacity 0.35s ease;
  pointer-events: none;
}
.flow-desc-card.is-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.flow-desc-card__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.flow-desc-card__badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: #222;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
}
.flow-desc-card__title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #222;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flow-desc-card__text {
  margin: 0 0 8px;
  font-size: 13px;
  color: #555;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.flow-desc-card__methods {
  margin: 0 0 8px;
}
.flow-desc-card__methods h5 {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: #888;
  letter-spacing: 0.5px;
}
.flow-desc-card__method-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.flow-desc-card__method-tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  color: #555;
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  line-height: 1.5;
}
.flow-desc-card__parallel {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  font-size: 12px;
  color: #666;
}
.flow-desc-card__parallel-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.flow-desc-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  color: #999;
}
.flow-desc-card__meta:empty {
  display: none;
}
.flow-desc-card__meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.flow-desc-card__meta span svg {
  flex-shrink: 0;
  opacity: 0.6;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .flow-canvas-wrapper {
    -webkit-user-select: none;
    user-select: none;
  }
  .flow-toolbar {
    -webkit-user-select: none;
    user-select: none;
    bottom: 12px;
    padding: 4px 8px;
    gap: 2px;
  }
  .flow-tool-btn {
    width: 32px;
    height: 32px;
  }
  .flow-tool-btn svg {
    width: 16px;
    height: 16px;
  }
  .flow-stage-nav {
    left: 12px;
    right: 12px;
    width: auto;
    transform: none;
    bottom: 56px;
    height: 40px;
    border-radius: 12px;
  }
  .chat-widget {
    bottom: 104px;
  }
  .chat-widget.desc-card-up {
    bottom: calc(104px + var(--desc-card-h, 160px) + 8px);
  }
  .flow-desc-card {
    left: 12px;
    right: 12px;
    bottom: 104px;
    width: auto;
    max-width: none;
    transform: translateY(calc(100% + 40px));
  }
  .flow-desc-card.is-visible {
    transform: translateY(0);
  }
  .flow-detail-modal {
    width: 90vw;
    max-width: none;
  }
}
