/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f8fafc;
    min-height: 100vh;
    color: #1a202c;
    overflow: hidden;
}

.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 16px 24px;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.header-left {
    flex: 0 0 auto;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.header-right {
    flex: 0 0 auto;
    display: flex;
    gap: 12px;
}

/* 工作流状态指示器 */
.workflow-status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.status-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #6c757d;
    color: white;
    transition: all 0.3s ease;
}

.workflow-status-indicator.status-valid {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.workflow-status-indicator.status-valid .status-icon {
    background: #28a745;
}

.workflow-status-indicator.status-invalid {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.workflow-status-indicator.status-invalid .status-icon {
    background: #dc3545;
    animation: statusErrorPulse 2s infinite;
}

.workflow-status-indicator.status-pending {
    background: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

.workflow-status-indicator.status-pending .status-icon {
    background: #ffc107;
}

@keyframes statusErrorPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

.header-left h1 {
    color: #2d3748;
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-left h1 i {
    color: #667eea;
}

.header-right {
    display: flex;
    gap: 12px;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* 侧边栏 */
.sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-section {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 节点工具箱 */
.node-palette {
    display: grid;
    gap: 8px;
}

.node-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: grab;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    color: #4a5568;
}

.node-item:hover {
    border-color: #667eea;
    background: #edf2f7;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.node-item:active {
    cursor: grabbing;
}

.node-item i {
    width: 20px;
    color: #667eea;
}

.node-item[data-type="start"] i { color: #48bb78; }
.node-item[data-type="ai-model"] i { color: #667eea; }
.node-item[data-type="api-call"] i { color: #ed8936; }
.node-item[data-type="condition"] i { color: #9f7aea; }
.node-item[data-type="loop"] i { color: #f56565; }
.node-item[data-type="text-processing"] i { color: #38b2ac; }
.node-item[data-type="end"] i { color: #e53e3e; }

/* 工作流列表 */
.workflow-list {
    margin-bottom: 16px;
}

.workflow-item {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    background: #f7fafc;
    display: flex;
    align-items: stretch;
}

.workflow-item-content {
    padding: 12px;
    flex: 1;
    cursor: pointer;
}

.workflow-item:hover {
    border-color: #667eea;
    background: #edf2f7;
}

.workflow-item.active {
    border-color: #667eea;
    background: #ebf4ff;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.workflow-item-title {
    font-weight: 500;
    color: #2d3748;
    margin-bottom: 4px;
}

.workflow-item-desc {
    font-size: 12px;
    color: #718096;
}

.workflow-item-actions {
    display: flex;
    align-items: center;
    padding: 0 8px;
    border-left: 1px solid #e2e8f0;
}

.workflow-delete-btn {
    background: none;
    border: none;
    color: #a0aec0;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 12px;
}

.workflow-delete-btn:hover {
    color: #e53e3e;
    background: #fed7d7;
}

.workflow-delete-btn:active {
    transform: scale(0.95);
}

.btn-full {
    width: 100%;
    margin-top: 16px;
}

/* 画布容器 */
.canvas-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
}

/* 画布工具栏 */
.canvas-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

#zoomLevel {
    font-size: 14px;
    font-weight: 500;
    color: #4a5568;
    min-width: 60px;
    text-align: center;
}

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

.connection-hint {
    font-size: 12px;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.connection-hint i {
    color: #28a745;
}

/* 画布 */
.canvas {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #ffffff;
    cursor: grab;
    user-select: none;
}

.canvas-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
}

.connections-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.nodes-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

/* 节点输入框样式 */
.node-input-textarea {
    width: 100%;
    min-height: 40px;
    max-height: 80px;
    padding: 4px 6px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
    line-height: 1.4;
    color: #2d3748;
    background: #ffffff;
    resize: none; /* 移除滚动条 */
    outline: none;
    transition: border-color 0.2s ease;
    overflow: hidden; /* 隐藏滚动条 */
}

.node-input-textarea:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.node-input-textarea::placeholder {
    color: #a0aec0;
}

/* 节点可编辑输入框样式 */
.node-input-editor {
    width: 100%;
    min-height: 40px;
    max-height: 80px;
    padding: 4px 6px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
    line-height: 1.4;
    color: #2d3748;
    background: #ffffff;
    outline: none;
    transition: border-color 0.2s ease;
    overflow-y: auto;
    word-wrap: break-word;
}

.node-input-editor:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.node-input-editor:empty:before {
    content: attr(placeholder);
    color: #a0aec0;
    pointer-events: none;
}

/* 内联标签样式 */
.inline-tag-label {
    font-family: 'Courier New', monospace;
    font-weight: 500;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 10px;
    display: inline-block;
    margin: 0 1px;
    vertical-align: baseline;
    user-select: none;
}

/* 属性面板可编辑输入框样式 */
.panel-input-editor {
    width: 100%;
    min-height: 80px;
    max-height: 150px;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;
    color: #2d3748;
    background: #ffffff;
    outline: none;
    transition: border-color 0.2s ease;
    overflow-y: auto;
    word-wrap: break-word;
}

.panel-input-editor:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.panel-input-editor:empty:before {
    content: attr(placeholder);
    color: #a0aec0;
    pointer-events: none;
}

/* 节点参数组样式 */
.node-param-group {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
}

.node-param-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
}

.node-param-row label {
    font-size: 10px;
    color: #718096;
    white-space: nowrap;
    min-width: 30px;
}

/* 节点参数选择框和输入框样式 */
.node-param-select {
    flex: 1;
    padding: 2px 4px;
    border: 1px solid #e2e8f0;
    border-radius: 3px;
    font-family: inherit;
    font-size: 10px;
    color: #2d3748;
    background: #ffffff;
    outline: none;
    transition: border-color 0.2s ease;
}

.node-param-select:focus {
    border-color: #667eea;
}

.node-param-input {
    flex: 1;
    padding: 2px 4px;
    border: 1px solid #e2e8f0;
    border-radius: 3px;
    font-family: inherit;
    font-size: 10px;
    color: #2d3748;
    background: #ffffff;
    outline: none;
    transition: border-color 0.2s ease;
}

.node-param-input:focus {
    border-color: #667eea;
}

/* 节点样式 */
.workflow-node {
    position: absolute;
    min-width: 200px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    cursor: move;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    overflow: hidden;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.workflow-node:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.workflow-node.selected {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1), 0 8px 24px rgba(0, 0, 0, 0.2);
}

.workflow-node.dragging {
    opacity: 0.8;
    z-index: 1000;
}

.node-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.node-header.start { background: linear-gradient(135deg, #48bb78 0%, #38a169 100%); }
.node-header.ai-model { background: linear-gradient(135deg, #667eea 0%, #5a67d8 100%); }
.node-header.api-call { background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%); }
.node-header.condition { background: linear-gradient(135deg, #9f7aea 0%, #805ad5 100%); }
.node-header.loop { background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%); }
.node-header.text-processing { background: linear-gradient(135deg, #38b2ac 0%, #319795 100%); }
.node-header.end { background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%); }

.node-header i {
    margin-right: 8px;
}

.node-delete {
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.node-delete:hover {
    background: rgba(255, 255, 255, 0.2);
}

.node-body {
    padding: 16px;
}

.node-title {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 8px;
}

.node-description {
    font-size: 14px;
    color: #718096;
    margin-bottom: 12px;
    line-height: 1.4;
}

.node-config {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.config-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.config-item label {
    font-size: 12px;
    font-weight: 500;
    color: #4a5568;
}

.config-item input,
.config-item select,
.config-item textarea {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.config-item input:focus,
.config-item select:focus,
.config-item textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.config-item textarea {
    resize: vertical;
    min-height: 60px;
}

/* 连接点 */
.node-ports {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.node-ports.left {
    left: -8px;  /* 让端口完全显示在外面 */
}

.node-ports.right {
    right: -8px;  /* 让端口完全显示在外面 */
}

.port {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #cbd5e0;
    border: 2px solid white;
    cursor: crosshair;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 20;  /* 确保端口在节点之上 */
    pointer-events: auto;  /* 确保可以接收鼠标事件 */
}

.port:hover {
    background: #667eea;
    transform: scale(1.3);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
}

.port.connected {
    background: #48bb78;
}

.port.input { background: #48bb78; }
.port.output { background: #667eea; }

/* 属性面板 */
.properties-panel {
    width: 320px;
    background: white;
    border-left: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 配置区域 */
.config-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.config-section h5 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 14px;
    font-weight: 600;
}

/* 输入字段列表 */
.input-fields-list {
    margin-bottom: 10px;
}

.input-field-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 12px;
}

.input-field-item code {
    background: #f1f3f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: #d73a49;
    font-weight: 500;
}

.input-field-item .field-description {
    color: #6c757d;
    font-size: 11px;
    flex: 1;
    margin-left: 8px;
}

/* 字段帮助提示 */
.field-help {
    margin-top: 8px;
    padding: 8px 12px;
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 4px;
    font-size: 11px;
    color: #1976d2;
}

.field-help small {
    display: block;
    margin: 0;
}

/* 标签建议下拉菜单 */
.tag-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2000; /* 提高z-index确保在画布上也能显示 */
    max-height: 150px; /* 在画布上减少高度 */
    overflow-y: auto;
}

.tag-suggestions-canvas {
    position: fixed;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 3000;
    max-height: 200px;
    overflow-y: auto;
    min-width: 250px;
}

.tag-suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.2s;
}

.tag-suggestion-item:hover {
    background-color: #f8fafc;
}

.tag-suggestion-item:last-child {
    border-bottom: none;
}

.tag-label {
    font-family: 'Courier New', monospace;
    font-weight: 500;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.tag-description {
    color: #64748b;
    font-size: 12px;
    flex: 1;
    margin-left: 8px;
}

.tag-node-name {
    color: #475569;
    font-size: 11px;
    font-weight: 500;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
}

.properties-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.properties-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 8px;
}

.properties-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.no-selection {
    text-align: center;
    padding: 40px 20px;
    color: #a0aec0;
}

.no-selection i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-selection p {
    font-size: 14px;
}

/* 执行结果面板 */
.execution-panel {
    position: fixed;
    bottom: 0;
    left: 280px;
    right: 320px;
    height: 300px;
    background: white;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    z-index: 1000;
}

.execution-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f7fafc;
}

.execution-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: #a0aec0;
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-re-execute {
    background: #3182ce;
    color: white;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.2s ease;
}

.btn-re-execute:hover {
    background: #2c5282;
}

.execution-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-expand, .btn-collapse {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: #a0aec0;
    transition: all 0.2s ease;
    font-size: 14px;
}

.btn-expand:hover, .btn-collapse:hover {
    background: #e2e8f0;
    color: #2d3748;
}

.execution-panel.expanded {
    height: calc(100vh - 60px); /* 全屏高度减去顶部导航栏 */
    top: 60px; /* 距离顶部导航栏 */
    bottom: auto;
    z-index: 1001;
}

.execution-panel.collapsed {
    height: 40px;
    overflow: hidden;
}

.execution-panel.collapsed .execution-content {
    display: none;
}

.execution-panel.collapsed .execution-header {
    border-bottom: none;
    cursor: pointer;
}

.execution-panel.collapsed .execution-header:hover {
    background: #edf2f7;
}

.execution-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.execution-logs {
    padding: 16px 20px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
}

.log-entry {
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.log-entry.info { border-left-color: #667eea; background: #f0f4ff; }
.log-entry.success { border-left-color: #48bb78; background: #f0fff4; }
.log-entry.warning { border-left-color: #ed8936; background: #fffaf0; }
.log-entry.error { border-left-color: #e53e3e; background: #fed7d7; }

.log-timestamp {
    color: #718096;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    background: rgba(113, 128, 150, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    margin-right: 8px;
}

.log-message {
    color: #2d3748;
    flex: 1;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
}

/* 按钮样式 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.btn-secondary {
    background: #f7fafc;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s ease;
}

.modal-content.large {
    max-width: 800px;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 24px;
}

.close {
    font-size: 28px;
    font-weight: bold;
    color: #adb5bd;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close:hover {
    color: #6c757d;
}

.modal-body {
    padding: 25px 30px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 配置标签页 */
.config-tabs {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.tab-buttons {
    display: flex;
    background: #f7fafc;
    border-bottom: 1px solid #e2e8f0;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #4a5568;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: white;
}

.tab-btn:hover {
    background: #edf2f7;
}

.tab-content {
    padding: 20px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* 连接线样式 */
.connection {
    position: absolute;
    pointer-events: none;
    z-index: 1;
}

.connection-line {
    stroke: #667eea;
    stroke-width: 2;
    fill: none;
    marker-end: url(#arrowhead);
    cursor: pointer;
    pointer-events: auto;
    transition: stroke-width 0.2s ease;
}

.connection-line:hover,
.connection-line.connection-hover {
    stroke-width: 4;
    stroke: #4c63d2;
}

.connection-line.connection-hover {
    stroke: #ff6b6b;
}

.connection-preview {
    stroke: #28a745;
    stroke-width: 2;
    stroke-dasharray: 5, 5;
    fill: none;
    marker-end: url(#arrowhead);
    opacity: 0.7;
    pointer-events: none;
}

/* 工作流验证样式 */
.workflow-node.valid-path {
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.3), 0 8px 24px rgba(0, 0, 0, 0.2);
    border-color: #28a745;
}

.workflow-node.valid-path .node-header {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.workflow-node.invalid-node {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.3), 0 8px 24px rgba(0, 0, 0, 0.2);
    border-color: #dc3545;
    animation: invalidNodePulse 2s infinite;
}

.workflow-node.invalid-node .node-header {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

@keyframes invalidNodePulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

/* SVG箭头定义 */
.connection-arrow {
    fill: #667eea;
}

/* 拖拽预览 */
.drag-preview {
    position: absolute;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.8;
    transform: rotate(5deg);
}

/* 工具提示 */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tooltip.show {
    opacity: 1;
}

/* 连接模式指示器 */
.connecting {
    cursor: crosshair;
}

.connecting .port {
    animation: portPulse 1.5s infinite;
}

@keyframes portPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* 节点执行状态样式 */
.workflow-node.node-executing {
    animation: nodeExecutingPulse 1.5s infinite;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.4), 0 8px 24px rgba(102, 126, 234, 0.3);
}

.workflow-node.node-executing .node-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    animation: headerExecutingGlow 1.5s infinite;
}

.workflow-node.node-executed {
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.5), 0 4px 12px rgba(40, 167, 69, 0.2);
}

.workflow-node.node-executed .node-header {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.workflow-node.node-error {
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.5), 0 4px 12px rgba(220, 53, 69, 0.2);
    animation: nodeErrorShake 0.5s ease-in-out;
}

.workflow-node.node-error .node-header {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

/* 执行状态动画 */
@keyframes nodeExecutingPulse {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.4), 0 8px 24px rgba(102, 126, 234, 0.3);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(102, 126, 234, 0.2), 0 12px 32px rgba(102, 126, 234, 0.4);
    }
}

@keyframes headerExecutingGlow {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.6);
    }
    50% {
        box-shadow: 0 4px 16px rgba(102, 126, 234, 0.9);
    }
}

@keyframes nodeErrorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .properties-panel {
        width: 280px;
    }

    .execution-panel {
        left: 280px;
        right: 280px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 240px;
    }

    .properties-panel {
        width: 240px;
    }

    .execution-panel {
        left: 240px;
        right: 240px;
    }

    .execution-panel.expanded {
        left: 0;
        right: 0;
    }

    .execution-controls {
        gap: 4px;
    }

    .btn-expand, .btn-collapse {
        padding: 3px;
        font-size: 12px;
    }

    .header-right {
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-right .btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* 发布弹窗样式 */
.publish-success {
    text-align: center;
    margin-bottom: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 50%, #4facfe 100%);
    border-radius: 12px;
    color: white;
}

.success-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.success-icon .fas {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.publish-success p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.experience-link-section {
    margin-bottom: 25px;
}

.experience-link-section h3 {
    margin: 0 0 15px 0;
    color: #2d3748;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.link-container {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.link-input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    background: #f8f9fa;
    word-break: break-all;
}

.link-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
}

.copy-btn {
    padding: 10px 15px;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.copy-btn.copied {
    background: #48bb78 !important;
    color: white;
}

.link-description {
    margin: 10px 0 0 0;
    font-size: 13px;
    color: #718096;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.link-description i {
    margin-top: 1px;
    color: #667eea;
}

.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

/* 聊天体验界面样式 */
.chat-experience-container {
    display: flex;
    flex-direction: column;
    max-width: 900px;
    width: 100%;
    height: 100vh;
    margin: 0 auto;
    background: white;
    overflow: hidden;
}

.chat-title-bar {
    padding: 20px 20px 0 20px;
    border-bottom: 1px solid #e2e8f0;
    background: white;
}

.workflow-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.workflow-title h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #2d3748;
}

.experience-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0; /* 确保flex子项可以缩小 */
}

.message {
    display: flex;
    gap: 12px;
    max-width: 80%;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ai-message .message-content {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    color: #2d3748;
}

.system-message .message-content {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: white;
    border: 2px solid #e2e8f0;
    font-size: 14px;
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: rgba(102, 126, 234, 0.3);
    color: white;
}

.ai-message .message-avatar {
    background: #667eea;
    color: white;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message-content p {
    margin: 0 0 8px 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

/* Markdown样式 */
.message-content h1,
.message-content h2,
.message-content h3 {
    margin: 16px 0 8px 0;
    font-weight: 600;
    color: #2d3748;
}

.message-content h1 {
    font-size: 20px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 4px;
}

.message-content h2 {
    font-size: 18px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 4px;
}

.message-content h3 {
    font-size: 16px;
    color: #4a5568;
}

.message-content strong {
    font-weight: 600;
    color: #2d3748;
}

.message-content ul,
.message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 4px 0;
    line-height: 1.5;
}

.message-content hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 16px 0;
}

.message-content br {
    display: block;
    margin: 4px 0;
}

/* 代码样式 */
.message-content code {
    background: #f7fafc;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #d73a49;
}

.message-content pre {
    background: #f7fafc;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
    border: 1px solid #e2e8f0;
}

.message-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* 引用样式 */
.message-content blockquote {
    border-left: 4px solid #667eea;
    padding-left: 16px;
    margin: 8px 0;
    color: #718096;
    font-style: italic;
}

.typing-indicator .message-content {
    padding: 16px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: typingDot 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% {
        opacity: 0.4;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1);
    }
}

.chat-input-area {
    border-top: 1px solid #e2e8f0;
    background: white;
    padding: 20px;
}

.input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#chatInput {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 24px;
    resize: none;
    outline: none;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.4;
    transition: border-color 0.2s ease;
    min-height: 20px;
    max-height: 120px;
}

#chatInput:focus {
    border-color: #667eea;
}

.send-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.send-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.send-button:active {
    transform: scale(0.95);
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
    color: #718096;
}

.char-count {
    font-weight: 500;
}

.input-tip {
    opacity: 0.8;
}

/* 插件选择弹窗样式 */
.plugin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.plugin-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.plugin-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.plugin-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    margin-right: 16px;
    flex-shrink: 0;
}

.plugin-info h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
}

.plugin-info p {
    margin: 0;
    font-size: 14px;
    color: #718096;
    line-height: 1.4;
}

/* 创建工作流弹窗AI智创功能样式 */
.workflow-creation-layout {
    display: flex;
    gap: 30px;
    min-height: 500px;
}

.creation-left-panel,
.creation-right-panel {
    flex: 1;
}

.creation-left-panel {
    border-right: 1px solid #e2e8f0;
    padding-right: 30px;
}

.creation-right-panel {
    padding-left: 30px;
}

.creation-left-panel h3,
.creation-right-panel h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #2d3748;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-creation-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ai-input-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-input-area textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.ai-input-area textarea:focus {
    outline: none;
    border-color: #667eea;
}

.input-tips {
    margin-top: 8px;
}

.input-tips small {
    color: #718096;
    font-size: 12px;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.ai-creation-actions {
    margin-top: 10px;
}

.btn-full {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

.ai-creation-progress {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.progress-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
}

.step {
    flex: 1;
    text-align: center;
    font-size: 12px;
    color: #a0aec0;
    position: relative;
}

.step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -10px;
    width: 20px;
    height: 1px;
    background: #e2e8f0;
}

.step.active {
    color: #667eea;
    font-weight: 600;
}

.ai-creation-result {
    background: #f0f9ff;
    border: 1px solid #90cdf4;
    border-radius: 8px;
    padding: 20px;
}

.ai-creation-result h4 {
    margin: 0 0 15px 0;
    color: #2b6cb0;
    font-size: 16px;
}

.analysis-content {
    color: #2d3748;
    line-height: 1.6;
    white-space: pre-wrap;
    font-size: 14px;
}

/* 超大弹窗样式 */
.modal-content.extra-large {
    max-width: 1200px;
    width: 95vw;
    max-height: 90vh;
}

/* 体验配置页面样式 */
.experience-config {
    max-width: 600px;
    margin: 0 auto;
    padding: 40px 20px;
}

.config-header {
    text-align: center;
    margin-bottom: 30px;
}

.config-header h2 {
    color: #2d3748;
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.config-header p {
    color: #718096;
    font-size: 16px;
    margin: 0;
}

.provider-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    background: #f7fafc;
    color: #4a5568;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

.tab-btn.active {
    background: #667eea;
    color: white;
}

.tab-btn:hover:not(.active) {
    background: #edf2f7;
}

.provider-config {
    display: none;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.provider-config.active {
    display: block;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #2d3748;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.config-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 30px;
}

/* 体验页面错误样式 */
.experience-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    text-align: center;
    padding: 40px;
}

.error-icon {
    font-size: 64px;
    color: #e53e3e;
    margin-bottom: 20px;
}

.experience-error h2 {
    color: #2d3748;
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.experience-error p {
    color: #718096;
    font-size: 16px;
    margin: 5px 0 20px 0;
    max-width: 400px;
}

/* 登录提示样式 */
.login-notice {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
    margin-bottom: 20px;
}

.notice-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.notice-content i {
    font-size: 18px;
}

.notice-content a {
    color: #ffffff;
    text-decoration: underline;
    font-weight: 500;
}

.notice-content a:hover {
    color: #e2e8f0;
}

@media (max-width: 768px) {
    .notice-content {
        flex-direction: column;
        gap: 5px;
    }

    .login-notice {
        padding: 10px 15px;
        font-size: 14px;
    }
}

/* 用户认证相关样式 */
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #2d3748;
    font-weight: 500;
}

.user-phone {
    padding: 4px 8px;
    background: #f7fafc;
    border-radius: 4px;
    font-size: 14px;
}

.auth-buttons {
    display: flex;
    gap: 8px;
}

.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 16px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    max-width: 300px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease-out;
}

.message-success {
    background-color: #48bb78;
}

.message-error {
    background-color: #f56565;
}

.message-info {
    background-color: #4299e1;
}

.message i {
    margin-right: 8px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.btn-link {
    background: none;
    border: none;
    color: #4299e1;
    cursor: pointer;
    text-decoration: underline;
    font-size: 14px;
    padding: 0;
}

.btn-link:hover {
    color: #3182ce;
}

.input-group {
    display: flex;
    gap: 8px;
}

.input-group input {
    flex: 1;
}

.input-group .btn {
    flex-shrink: 0;
    padding: 8px 12px;
}

.form-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

/* 股票监控台样式 */
.stock-monitor {
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    color: #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin: 10px 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    font-family: 'Courier New', monospace;
    border: 1px solid #4a5568;
}

.stock-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #4a5568;
}

.stock-title h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
}

.stock-code {
    display: block;
    font-size: 14px;
    color: #a0aec0;
    margin-top: 4px;
}

.stock-price {
    text-align: right;
}

.current-price {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 5px;
}

.price-change {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    font-size: 14px;
}

.change-symbol {
    font-size: 16px;
    font-weight: bold;
}

.stock-positive {
    color: #48bb78;
}

.stock-negative {
    color: #f56565;
}

.stock-neutral {
    color: #a0aec0;
}

.stock-details {
    margin-bottom: 20px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 8px;
    background: rgba(74, 85, 104, 0.3);
    border-radius: 6px;
    margin: 0 2px;
}

.detail-item label {
    font-size: 12px;
    color: #a0aec0;
    margin-bottom: 4px;
}

.detail-item span {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
}


.stock-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #4a5568;
    font-size: 12px;
    color: #a0aec0;
}

.update-time, .data-source {
    opacity: 0.8;
}

/* 知识库管理弹窗样式 */
.kb-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.kb-modal {
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.05);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
}

.kb-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 1px solid #e1e5e9;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 16px 16px 0 0;
}

.kb-modal-header h3 {
    margin: 0;
    color: #495057;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.kb-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.kb-modal-close:hover {
    background: #e9ecef;
    color: #495057;
}

.kb-modal-body {
    padding: 24px;
}

.kb-modal-footer {
    padding: 20px 28px;
    border-top: 1px solid #e1e5e9;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 0 0 16px 16px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}

.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    color: #495057;
    background: #fff;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin: 0;
}

.checkbox-label span {
    font-size: 14px;
    color: #495057;
}

.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

/* 语料列表样式 */
.documents-list {
    max-height: 500px;
    overflow-y: auto;
}

.no-documents {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.no-documents i {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.no-documents p {
    margin: 0;
    font-size: 16px;
}

.documents-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 16px;
    font-weight: 500;
    color: #495057;
}

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

.document-item {
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    padding: 20px;
    background: #fff;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.document-item:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
    border-color: #007bff;
}

.document-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.document-title {
    font-size: 16px;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
}

.document-title i {
    color: #6c757d;
}

.document-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #6c757d;
}

.document-id {
    background: #f8f9fa;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #007bff;
    border: 1px solid #dee2e6;
}

.source-type {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.source-type.manual {
    background: #e9ecef;
    color: #495057;
}

.source-type.ai_generated {
    background: #d4edda;
    color: #155724;
}

.source-type.uploaded {
    background: #d1ecf1;
    color: #0c5460;
}

.document-content {
    color: #495057;
    line-height: 1.6;
    margin-bottom: 12px;
    font-size: 14px;
    max-height: 300px;
    overflow-y: auto;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.document-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* 知识库管理样式 */
.kb-modal-overlay .kb-modal {
    max-height: 80vh;
    overflow: hidden;
}

/* 语料库管理样式 */
.corpus-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.corpus-toolbar .search-box {
    position: relative;
    min-width: 250px;
    max-width: 350px;
    flex: 1;
}

.corpus-toolbar .search-box i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    pointer-events: none;
}

.corpus-toolbar .form-input {
    padding-right: 35px;
    width: 100%;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
}

.corpus-toolbar .form-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.toolbar-left, .toolbar-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

.corpus-stats {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 统计概览 */
.stats-overview {
    margin-bottom: 30px;
}

.stats-hero {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.stats-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

.hero-number {
    font-size: 48px;
    font-weight: bold;
    color: white;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
    margin-bottom: 8px;
}

.hero-label {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
    position: relative;
    z-index: 1;
    margin-bottom: 4px;
}

.hero-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    position: relative;
    z-index: 1;
}

/* 统计细分 */
.stats-breakdown {
    margin-bottom: 25px;
}

.stats-breakdown h4 {
    margin: 0 0 20px 0;
    color: #495057;
    font-size: 16px;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-item {
    display: flex;
    align-items: center;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.chat-stat {
    border-left: 4px solid #007bff;
}

.knowledge-stat {
    border-left: 4px solid #28a745;
}

.user-stat {
    border-left: 4px solid #ffc107;
}

.stat-icon {
    font-size: 24px;
    margin-right: 16px;
    opacity: 0.8;
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 24px;
    font-weight: bold;
    color: #495057;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 4px;
}

.stat-percentage {
    font-size: 12px;
    color: #007bff;
    font-weight: 500;
}

.stat-bar {
    width: 60px;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    margin-left: 16px;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #6610f2);
    border-radius: 3px;
    transition: width 0.8s ease;
}

.chat-stat .stat-bar-fill {
    background: linear-gradient(90deg, #007bff, #0056b3);
}

.knowledge-stat .stat-bar-fill {
    background: linear-gradient(90deg, #28a745, #1e7e34);
}

.user-stat .stat-bar-fill {
    background: linear-gradient(90deg, #ffc107, #e0a800);
}

/* 统计操作 */
.stats-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.stats-details {
    border-top: 1px solid #dee2e6;
    padding-top: 15px;
}

.stats-details pre {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

.category-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.category-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.category-name {
    font-weight: 500;
    color: #495057;
}

.category-count {
    font-weight: bold;
    color: #007bff;
}

.corpus-list {
    max-height: 500px;
    overflow-y: auto;
}

.corpus-categories {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.corpus-category {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.category-header {
    background: #007bff;
    color: white;
    padding: 12px 15px;
}

.category-header h4 {
    margin: 0;
    font-size: 16px;
}

.category-items {
    padding: 15px;
}

.corpus-item {
    border-bottom: 1px solid #f0f0f0;
    padding: 12px 0;
}

.corpus-item:last-child {
    border-bottom: none;
}

.corpus-content {
    color: #495057;
    line-height: 1.5;
    margin-bottom: 8px;
    font-size: 14px;
}

.corpus-meta {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.corpus-id {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: #007bff;
}

.corpus-quality, .corpus-usage {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
}

.corpus-time {
    color: #6c757d;
    font-style: italic;
}

.corpus-actions {
    text-align: right;
}

.more-items {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 10px;
    border-top: 1px solid #f0f0f0;
}

.no-data, .error, .warning {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.no-data i, .error i, .warning i {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
}

.error {
    color: #dc3545;
}

.warning {
    color: #ffc107;
}

/* 语料库指南样式 */
.corpus-guide {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.guide-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #007bff;
}

.guide-header h4 {
    margin: 0;
    color: #007bff;
    font-size: 18px;
}

.guide-content {
    display: grid;
    gap: 20px;
}

.guide-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.guide-section h5 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 16px;
}

.guide-section ul {
    margin: 0;
    padding-left: 20px;
}

.guide-section li {
    margin-bottom: 5px;
    color: #6c757d;
}

.corpus-examples {
    display: grid;
    gap: 15px;
}

.example-category {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.example-category h6 {
    margin: 0 0 8px 0;
    color: #007bff;
    font-size: 14px;
    font-weight: 600;
}

.example-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.example-items span {
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #495057;
    border: 1px solid #dee2e6;
}

.kb-modal-body {
    max-height: calc(80vh - 140px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.kb-modal-body::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

.kb-management-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
    gap: 12px;
}

.toolbar-left, .toolbar-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

.toolbar-left {
    flex: 1;
}

.toolbar-right {
    flex-shrink: 0;
}

.kb-management-toolbar .form-select {
    min-width: 200px;
    max-width: 250px;
}

.kb-management-toolbar .search-box {
    position: relative;
    min-width: 200px;
    max-width: 300px;
    flex: 1;
}

.kb-management-toolbar .search-box i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

.kb-management-toolbar .form-input {
    padding-right: 35px;
    width: 100%;
}

.knowledge-bases-list {
    min-height: 200px;
}

.kb-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    margin-bottom: 16px;
    background: #fff;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.kb-item:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
    border-color: #007bff;
}

.kb-info {
    flex: 1;
    margin-right: 16px;
}

.kb-name {
    font-size: 16px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.kb-name i {
    color: #007bff;
}

.kb-description {
    color: #6c757d;
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.4;
}

.kb-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: #6c757d;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.kb-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.no-data {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.no-data i {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.no-data p {
    margin: 0;
    font-size: 16px;
}

.create-form {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    padding: 24px;
    margin-top: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.create-form h4 {
    margin: 0 0 16px 0;
    color: #495057;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
}

.loading {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.loading i {
    font-size: 24px;
    margin-bottom: 12px;
    display: block;
}

.loading p {
    margin: 0;
    font-size: 14px;
}

/* 配置区域分组 */
.config-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
}

.config-section-title {
    font-weight: 600;
    color: #495057;
    margin-bottom: 12px;
    font-size: 14px;
}

/* 执行日志中的HTML内容样式 */
.log-message.html-content {
    width: 100%;
    margin-top: 8px;
}

.log-message.html-content .stock-monitor {
    margin: 0;
    max-width: none;
}
