/* ==================== 全局设计系统 ==================== */

:root {
  /* 系统色调 */
  --primary-dark: #0f1419;     /* 深蓝 */
  --primary-blue: #1e3a8a;     /* 科技蓝 */
  --accent-orange: #f97316;    /* 橙色强调 */
  --accent-cyan: #06b6d4;      /* 青绿强调 */
  --accent-green: #10b981;     /* 绿色 */
  --accent-red: #ef4444;       /* 错误红 */
  
  /* 中性色 */
  --neutral-50: #f9fafb;
  --neutral-100: #f3f4f6;
  --neutral-200: #e5e7eb;
  --neutral-300: #d1d5db;
  --neutral-400: #9ca3af;
  --neutral-500: #6b7280;
  --neutral-600: #4b5563;
  --neutral-700: #374151;
  --neutral-800: #1f2937;
  --neutral-900: #111827;
  
  /* 功能色 */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;
  
  /* 动画变量 */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 300ms ease-in-out;
  --transition-slow: 500ms ease-in-out;
  
  /* 阴影 */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  background: linear-gradient(135deg, var(--primary-dark) 0%, #1a1f3a 100%);
  color: #e5e7eb;
  overflow: hidden;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==================== 通用组件 ==================== */

.demo-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 20% 50%, rgba(30, 58, 138, 0.1) 0%, transparent 50%),
              radial-gradient(circle at 80% 80%, rgba(6, 182, 212, 0.05) 0%, transparent 50%),
              linear-gradient(135deg, var(--primary-dark) 0%, #1a1f3a 100%);
  position: relative;
  overflow: hidden;
}

/* 背景网格 */
.demo-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(0deg, transparent 24%, rgba(6, 182, 212, 0.03) 25%, rgba(6, 182, 212, 0.03) 26%, transparent 27%, transparent 74%, rgba(6, 182, 212, 0.03) 75%, rgba(6, 182, 212, 0.03) 76%, transparent 77%, transparent),
    linear-gradient(90deg, transparent 24%, rgba(6, 182, 212, 0.03) 25%, rgba(6, 182, 212, 0.03) 26%, transparent 27%, transparent 74%, rgba(6, 182, 212, 0.03) 75%, rgba(6, 182, 212, 0.03) 76%, transparent 77%, transparent);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 1;
}

.demo-header {
  padding: 24px 32px;
  border-bottom: 1px solid rgba(6, 182, 212, 0.1);
  background: rgba(15, 20, 25, 0.4);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.demo-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: #f0f9ff;
  margin-bottom: 4px;
}

.demo-header p {
  font-size: 14px;
  color: #94a3b8;
}

.demo-content {
  flex: 1;
  display: flex;
  padding: 32px;
  gap: 24px;
  overflow: auto;
  position: relative;
  z-index: 2;
}

.demo-section {
  flex: 1;
  min-width: 0;
}

/* ==================== 卡片组件 ==================== */

.card {
  background: rgba(30, 42, 66, 0.4);
  border: 1px solid rgba(6, 182, 212, 0.15);
  border-radius: 12px;
  padding: 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: all var(--transition-base);
}

.card:hover {
  border-color: rgba(6, 182, 212, 0.3);
  box-shadow: 0 12px 48px rgba(6, 182, 212, 0.15);
  transform: translateY(-2px);
}

.card.active {
  border-color: var(--accent-orange);
  background: rgba(249, 115, 22, 0.05);
  box-shadow: 0 0 24px rgba(249, 115, 22, 0.2);
}

.card.pulse {
  animation: pulse-card 1s ease-in-out infinite;
}

@keyframes pulse-card {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.02);
    opacity: 0.9;
  }
}

/* ==================== 节点和流程 ==================== */

.timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(30, 58, 138, 0.3);
  border: 1px solid rgba(30, 58, 138, 0.5);
  transition: all var(--transition-base);
}

.timeline-item.active {
  background: rgba(249, 115, 22, 0.2);
  border-color: var(--accent-orange);
  box-shadow: 0 0 16px rgba(249, 115, 22, 0.3);
  animation: slide-right 0.6s ease-in-out;
}

@keyframes slide-right {
  from {
    transform: translateX(-20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(6, 182, 212, 0.4);
  border: 2px solid var(--accent-cyan);
  flex-shrink: 0;
  position: relative;
}

.timeline-item.active .timeline-dot {
  background: var(--accent-orange);
  border-color: var(--accent-orange);
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.6);
  animation: glow-dot 1.5s ease-in-out infinite;
}

@keyframes glow-dot {
  0%, 100% {
    box-shadow: 0 0 12px rgba(249, 115, 22, 0.6);
  }
  50% {
    box-shadow: 0 0 24px rgba(249, 115, 22, 0.3);
  }
}

.timeline-label {
  font-size: 13px;
  font-weight: 500;
  color: #cbd5e1;
}

.timeline-item.active .timeline-label {
  color: var(--accent-orange);
  font-weight: 600;
}

/* ==================== 按钮 ==================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-orange) 0%, #f97316 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--accent-cyan);
}

.btn-secondary:hover {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--accent-cyan);
}

.btn-success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-green);
}

.btn-success:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--accent-green);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-red);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--accent-red);
}

.btn.pulse {
  animation: pulse-btn 1.5s ease-in-out infinite;
}

@keyframes pulse-btn {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
  }
  50% {
    box-shadow: 0 4px 24px rgba(249, 115, 22, 0.6);
  }
}

/* ==================== 弹窗 ==================== */

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, rgba(30, 42, 66, 0.95) 0%, rgba(15, 20, 25, 0.95) 100%);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: 16px;
  padding: 28px;
  min-width: 400px;
  max-width: 500px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  z-index: 100;
  animation: modal-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-pop {
  from {
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: #f0f9ff;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 99;
}

/* ==================== 图表容器 ==================== */

.chart-container {
  width: 100%;
  height: 240px;
  background: rgba(15, 20, 25, 0.5);
  border: 1px solid rgba(6, 182, 212, 0.1);
  border-radius: 12px;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ==================== SVG 连接线 ==================== */

svg.flow-connector {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.flow-line {
  stroke: rgba(6, 182, 212, 0.3);
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 5, 5;
  animation: flow-animation 1.5s linear infinite;
}

@keyframes flow-animation {
  to {
    stroke-dashoffset: -10;
  }
}

.flow-line.active {
  stroke: var(--accent-orange);
  stroke-width: 3;
  filter: drop-shadow(0 0 8px rgba(249, 115, 22, 0.6));
}

/* ==================== 通知卡片 ==================== */

.notification {
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.6) 0%, rgba(6, 182, 212, 0.3) 100%);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  animation: notification-enter 0.5s ease-out;
}

@keyframes notification-enter {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.notification-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  margin-right: 12px;
  font-size: 14px;
  line-height: 24px;
}

.notification-title {
  font-weight: 600;
  color: #f0f9ff;
  margin-bottom: 4px;
}

.notification-content {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.5;
}

/* ==================== 下拉菜单 ==================== */

.select-wrapper {
  position: relative;
  width: 100%;
}

.select-wrapper select {
  width: 100%;
  padding: 12px 16px;
  background: rgba(30, 58, 138, 0.4);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: 8px;
  color: #f0f9ff;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2306b6d4' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.select-wrapper select:hover {
  border-color: rgba(6, 182, 212, 0.4);
  background-color: rgba(30, 58, 138, 0.6);
}

.select-wrapper select:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
}

/* ==================== 数值显示 ==================== */

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent-orange);
  font-family: 'Monaco', 'Courier New', monospace;
}

.stat-label {
  font-size: 13px;
  color: #94a3b8;
  margin-top: 4px;
}

.stat-unit {
  font-size: 14px;
  color: #64748b;
  margin-left: 4px;
}

/* ==================== 徽章 ==================== */

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-error {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-info {
  background: rgba(6, 182, 212, 0.2);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

/* ==================== 响应式 ==================== */

@media (max-width: 1400px) {
  .demo-content {
    flex-direction: column;
    padding: 16px;
    gap: 16px;
  }
  
  .demo-section {
    flex: initial;
    height: auto;
  }
}

@media (max-width: 768px) {
  .demo-header {
    padding: 16px 20px;
  }
  
  .demo-header h1 {
    font-size: 18px;
  }
  
  .demo-content {
    padding: 12px;
    gap: 12px;
  }
  
  .card {
    padding: 12px;
  }
  
  .modal {
    min-width: 90%;
    max-width: 90%;
    padding: 20px;
  }
}
