.workflow-engine {
    position: relative;
}

.workflow-card {
    background: var(--card-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.workflow-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.workflow-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.workflow-info h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.workflow-info p {
    font-size: 0.875rem;
    color: var(--text-light);
}

.workflow-status {
    flex-shrink: 0;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-active {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.status-inactive {
    background-color: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

.workflow-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background-color: var(--background-color);
    border-radius: 8px;
}

.workflow-triggers h5,
.workflow-actions h5 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.workflow-triggers ul,
.workflow-actions ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.workflow-triggers li,
.workflow-actions li {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.workflow-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.workflow-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-light);
}

.workflow-controls {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background-color: var(--background-color);
    border-color: var(--primary-color);
}

.btn-icon.btn-danger:hover {
    border-color: #ef4444;
    color: #ef4444;
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-color);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}

.modal-close:hover {
    background-color: var(--background-color);
}

.modal-body {
    padding: 1.5rem;
}

/* 表单样式 */
#workflow-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.form-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.trigger-list,
.action-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.trigger-item,
.action-item {
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 1rem;
    align-items: flex-end;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--card-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1001;
}

.notification.show {
    transform: translateX(0);
}

/* 工作流详情样式 */
.workflow-detail {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.detail-header h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-color);
}

.detail-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.detail-section h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.detail-section p {
    font-size: 0.875rem;
    color: var(--text-light);
    margin: 0;
}

.detail-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.detail-section li {
    font-size: 0.875rem;
    color: var(--text-light);
    padding: 0.5rem;
    background-color: var(--background-color);
    border-radius: 6px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.stat-item {
    background-color: var(--background-color);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-light);
}

.detail-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* 工作流列表样式 */
.workflows-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.workflow-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.workflow-item:hover {
    box-shadow: var(--shadow-sm);
}

.workflow-item .workflow-info h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-color);
}

.workflow-item .workflow-info p {
    font-size: 0.75rem;
    color: var(--text-light);
    margin: 0;
}

.workflow-item .workflow-actions {
    display: flex;
    gap: 0.5rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .workflow-body {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .workflow-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .workflow-controls {
        width: 100%;
        justify-content: flex-end;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
}

/* 可视化编辑器样式 */
.visual-editor {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 80vh;
}

.visual-editor .editor-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.visual-editor .editor-content {
    display: flex;
    gap: 1rem;
    flex: 1;
    overflow: hidden;
}

.visual-editor .palette {
    width: 250px;
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    overflow-y: auto;
}

.visual-editor .palette h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.visual-editor .palette-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.visual-editor .palette-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background-color: var(--card-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: grab;
    transition: all 0.3s ease;
}

.visual-editor .palette-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.visual-editor .palette-item:active {
    cursor: grabbing;
}

.visual-editor .canvas-container {
    flex: 1;
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.visual-editor .canvas {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: auto;
}

.visual-editor .canvas-grid {
    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;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.visual-editor .node {
    position: absolute;
    width: 200px;
    background-color: var(--card-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: move;
    z-index: 10;
}

.visual-editor .node-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background-color: var(--primary-color);
    color: white;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.visual-editor .node-header span {
    font-size: 0.875rem;
    font-weight: 500;
}

.visual-editor .node-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.visual-editor .node-property {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.visual-editor .node-property label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-light);
}

.visual-editor .node-input {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.75rem;
    width: 100%;
}

.visual-editor .node-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.visual-editor .node-inputs, .visual-editor .node-outputs {
    display: flex;
    gap: 0.5rem;
    padding: 0 1rem 0.75rem;
}

.visual-editor .input-port, .visual-editor .output-port {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--primary-color);
    cursor: crosshair;
}

.visual-editor .input-port {
    background-color: #10b981;
}

.visual-editor .output-port {
    background-color: #3b82f6;
}

.visual-editor .trigger-node .node-header {
    background-color: #f59e0b;
}

.visual-editor .action-node .node-header {
    background-color: #3b82f6;
}

.visual-editor .editor-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* 服务能力标签样式 */
.service-capabilities {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.service-capabilities h6 {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.capabilities-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.capability-tag {
    padding: 0.25rem 0.5rem;
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    font-size: 0.75rem;
    color: var(--text-light);
}