/**
 * Flow Builder Component Styles
 * Container for chat panel + workflow graph
 */

.flow-builder {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--surface-primary);
}

/* Header */
.flow-builder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--glass-border);
    background: var(--glass-background-dark);
}

.flow-builder-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.flow-builder-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.flow-builder-back-btn:hover {
    background: var(--glass-background-light);
    color: var(--text-primary);
}

.flow-builder-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.flow-builder-subtitle {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.flow-builder-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.flow-builder-cancel-btn,
.flow-builder-save-btn {
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.flow-builder-cancel-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
}

.flow-builder-cancel-btn:hover {
    background: var(--glass-background-light);
    color: var(--text-primary);
}

.flow-builder-save-btn {
    background: var(--accent-primary);
    border: none;
    color: white;
}

.flow-builder-save-btn:hover {
    background: var(--accent-primary-hover);
}

.flow-builder-save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Main content area */
.flow-builder-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Chat panel (left) */
.flow-builder-chat {
    width: 350px;
    min-width: 300px;
    max-width: 450px;
    border-inline-end: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
}

/* Resize handle */
.flow-builder-resize-handle {
    width: 4px;
    cursor: col-resize;
    background: transparent;
    transition: background 0.15s ease;
}

.flow-builder-resize-handle:hover,
.flow-builder-resize-handle.active {
    background: var(--accent-primary);
}

/* Graph panel (right) */
.flow-builder-graph {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--surface-secondary);
}

.flow-builder-graph-container {
    flex: 1;
    position: relative;
}

/* Empty graph state */
.flow-builder-graph-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-tertiary);
}

.flow-builder-graph-empty-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.flow-builder-graph-empty-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.flow-builder-graph-empty-subtitle {
    font-size: 13px;
    max-width: 280px;
}

/* Graph controls overlay */
.flow-builder-graph-controls {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    gap: 8px;
}

.flow-builder-graph-control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--glass-background);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.flow-builder-graph-control-btn:hover {
    background: var(--glass-background-light);
    color: var(--text-primary);
}

/* Server status indicator */
.flow-builder-server-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--glass-background);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    font-size: 11px;
    color: var(--text-tertiary);
}

.flow-builder-server-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef4444;
}

.flow-builder-server-status.connected .flow-builder-server-status-dot {
    background: #22c55e;
}

/* Loading overlay */
.flow-builder-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 100;
}

.flow-builder-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
    background: var(--glass-background);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.flow-builder-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.flow-builder-loading-text {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .flow-builder-content {
        flex-direction: column;
    }

    .flow-builder-chat {
        width: 100%;
        max-width: none;
        height: 40%;
        min-height: 200px;
        border-inline-end: none;
        border-bottom: 1px solid var(--glass-border);
    }

    .flow-builder-resize-handle {
        display: none;
    }

    .flow-builder-graph {
        height: 60%;
    }
}
