/* Builder Layout */
.builder-container {
    display: flex;
    height: calc(100vh - 180px);
    /* Adjust based on header/nav height */
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.builder-sidebar {
    width: 200px;
    background: var(--bg-start);
    border-right: 1px solid var(--border);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.builder-sidebar h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text-secondary);
}

.tool-item {
    padding: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    user-select: none;
}

.tool-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.builder-controls {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#drawflow {
    flex: 1;
    position: relative;
    background: var(--bg-base);
    background-image: radial-gradient(var(--border) 1px, transparent 1px);
    background-size: 20px 20px;
    overflow: hidden;
}

/* Drawflow Node Styles */
.drawflow .drawflow-node {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 250px;
    min-height: 100px;
    color: var(--text-primary);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    padding: 0;
    /* Header handles padding */
}

.drawflow .drawflow-node.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.drawflow .drawflow-node .title-box {
    background: var(--bg-start);
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.drawflow .drawflow-node .title-box i {
    color: var(--accent);
}

.drawflow .drawflow-node .box {
    padding: 1rem;
}

/* Inputs inside nodes */
.drawflow-node input,
.drawflow-node textarea,
.drawflow-node select {
    width: 100%;
    margin-bottom: 0.5rem;
    background: var(--bg-base);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
}

.drawflow-node textarea {
    resize: vertical;
    min-height: 60px;
}

/* Connections */
.drawflow .connection .main-path {
    stroke: var(--accent);
    stroke-width: 3px;
}

.drawflow .drawflow-node .input,
.drawflow .drawflow-node .output {
    background: var(--bg-card);
    border: 2px solid var(--accent);
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.drawflow .drawflow-node .input:hover,
.drawflow .drawflow-node .output:hover {
    background: var(--accent);
    transform: scale(1.2);
}

/* Zoom/Lock Controls */
.bar-zoom {
    position: absolute;
    bottom: 15px;
    right: 15px;
    display: flex;
    gap: 10px;
    background: var(--bg-card);
    padding: 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    z-index: 10;
}

.bar-zoom i {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.bar-zoom i:hover {
    color: var(--accent);
}

.btn-lock {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background: var(--bg-card);
    padding: 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    z-index: 10;
    cursor: pointer;
}

/* Helpers */
.status-text {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}