/**
 * Pipeline Builder Styles
 * 
 * 处理流程构建器样式
 */

/* ==================== 构建器容器 ==================== */

.pipeline-builder {
    background: var(--bg-secondary, #f8f9fa);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.pipeline-builder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.pipeline-builder-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary, #2c3e50);
}

.pipeline-builder-header .hint {
    font-size: 0.85rem;
    color: var(--text-muted, #6c757d);
}

/* ==================== 模块卡片网格 ==================== */

.pipeline-modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

/* ==================== 模块卡片 ==================== */

.module-card {
    background: var(--bg-card, #ffffff);
    border: 2px solid var(--border-color, #e0e0e0);
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.module-card:hover {
    border-color: var(--primary, #3498db);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.module-card.selected {
    border-color: var(--primary, #3498db);
    background: var(--primary-light, #e3f2fd);
}

.module-card.selected .toggle-indicator {
    color: var(--primary, #3498db);
    font-weight: bold;
}

/* ==================== 模块卡片内容 ==================== */

.module-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.module-info {
    flex: 1;
}

.module-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary, #2c3e50);
    margin-bottom: 4px;
}

.module-desc {
    font-size: 0.8rem;
    color: var(--text-muted, #6c757d);
    line-height: 1.3;
}

.module-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

/* ==================== 配置按钮 ==================== */

.config-btn {
    background: transparent;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.config-btn:hover {
    background: var(--bg-hover, #f0f0f0);
    border-color: var(--primary, #3498db);
}

.toggle-indicator {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--success, #27ae60);
}

/* ==================== 流程预览 ==================== */

.pipeline-preview {
    background: var(--bg-card, #ffffff);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 12px;
}

.preview-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted, #6c757d);
    font-size: 0.9rem;
}

.preview-icon {
    font-size: 1.2rem;
}

.preview-title {
    font-size: 0.85rem;
    color: var(--text-muted, #6c757d);
    margin-bottom: 10px;
}

.preview-steps {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.preview-step {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-light, #e3f2fd);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.step-number {
    width: 20px;
    height: 20px;
    background: var(--primary, #3498db);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.step-icon {
    font-size: 1rem;
}

.step-name {
    font-weight: 500;
    color: var(--text-primary, #2c3e50);
}

/* ==================== 拖拽排序 ==================== */

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.reorder-hint {
    font-size: 0.75rem;
    color: var(--text-muted, #6c757d);
    font-style: italic;
}

.draggable-step {
    cursor: grab;
    user-select: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.draggable-step:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.draggable-step:active {
    cursor: grabbing;
}

.drag-handle {
    font-size: 0.8rem;
    color: var(--text-muted, #9ca3af);
    margin-left: 4px;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.draggable-step:hover .drag-handle {
    opacity: 1;
}

.draggable-step.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.draggable-step.drag-over {
    background: var(--primary, #3498db);
    color: white;
    transform: scale(1.05);
}

.draggable-step.drag-over .step-number {
    background: white;
    color: var(--primary, #3498db);
}

.draggable-step.drag-over .step-name {
    color: white;
}

.draggable-step.drag-over .drag-handle {
    color: rgba(255, 255, 255, 0.7);
}

.step-arrow {
    color: var(--text-muted, #6c757d);
    font-size: 1rem;
}

/* ==================== 提示信息 ==================== */

.pipeline-hints {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hint-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    background: #fff8e1;
    border-radius: 8px;
    border-left: 3px solid #ffc107;
    font-size: 0.85rem;
}

.hint-icon {
    flex-shrink: 0;
}

.hint-text {
    color: #7a6a00;
    line-height: 1.4;
}

/* ==================== 暗色主题 ==================== */

@media (prefers-color-scheme: dark) {
    .pipeline-builder {
        background: #1e1e2e;
    }

    .module-card {
        background: #2a2a3e;
        border-color: #404050;
    }

    .module-card:hover {
        border-color: #5ba3d4;
    }

    .module-card.selected {
        background: #2a3a4e;
        border-color: #5ba3d4;
    }

    .module-name {
        color: #e4e4e4;
    }

    .pipeline-preview {
        background: #2a2a3e;
    }

    .preview-step {
        background: #2a3a4e;
    }

    .step-name {
        color: #e4e4e4;
    }

    .draggable-step.drag-over {
        background: #5ba3d4;
    }

    .draggable-step.drag-over .step-name {
        color: white;
    }

    .drag-handle {
        color: #6c7280;
    }

    .hint-item {
        background: #3a3a2e;
        border-left-color: #c9a000;
    }

    .hint-text {
        color: #c9a000;
    }
}

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

@media (max-width: 600px) {
    .pipeline-modules-grid {
        grid-template-columns: 1fr;
    }

    .pipeline-builder-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .preview-steps {
        flex-direction: column;
        align-items: flex-start;
    }

    .step-arrow {
        transform: rotate(90deg);
        margin: 4px 0 4px 10px;
    }
}