/* Visual Flow Builder Styles */

.flow-builder-container {
    display: flex;
    height: calc(100vh - 200px);
    background: #f5f5f5;
    border: 1px solid #ddd;
}

/* Toolbox Panel */
.flow-toolbox {
    width: 200px;
    background: white;
    border-right: 1px solid #ddd;
    padding: 15px;
    overflow-y: auto;
}

.flow-toolbox h6 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.toolbox-category-header {
    font-size: 11px;
    text-transform: uppercase;
    color: #6c757d;
    margin-top: 15px;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid #dee2e6;
}

.toolbox-category-header:first-child {
    margin-top: 0;
}

.tool-item {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    cursor: move;
    text-align: center;
    transition: all 0.3s;
}

.tool-item:hover {
    background: #e9ecef;
    border-color: #6c757d;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.tool-item i {
    display: block;
    font-size: 24px;
    margin-bottom: 5px;
    color: #495057;
}

.tool-item span {
    font-size: 12px;
    color: #6c757d;
}

/* Canvas Area */
.flow-canvas-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #fafafa;
}

.flow-canvas {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 800px;
    overflow: hidden;
    cursor: grab;
}

.flow-canvas-content {
    position: absolute;
    width: 4000px;
    height: 4000px;
    transform-origin: 0 0;
}

.flow-canvas::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(200,200,200,0.2) 1px, transparent 1px),
        linear-gradient(90deg, rgba(200,200,200,0.2) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 0;
}

/* Flow Nodes */
.flow-node {
    position: absolute;
    background: white;
    border: 2px solid #007bff;
    border-radius: 8px;
    min-width: 160px;
    padding: 10px;
    cursor: move;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s;
    z-index: 10;
}

.flow-node.selected {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40,167,69,0.2);
}

.flow-node.dragging {
    opacity: 0.7;
    z-index: 1000;
}

.flow-node:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.flow-node-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e9ecef;
}

.flow-node-title {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 5px;
}

.flow-node-icon {
    font-size: 16px;
    color: #007bff;
}

.flow-node-actions {
    display: flex;
    gap: 5px;
}

.flow-node-action {
    width: 20px;
    height: 20px;
    border: none;
    background: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flow-node-action:hover {
    color: #dc3545;
}

.flow-node-content {
    font-size: 12px;
    color: #6c757d;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Connection Ports */
.node-port {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #fff;
    border: 2px solid #007bff;
    border-radius: 50%;
    cursor: crosshair;
    z-index: 11;
}

.node-port:hover {
    background: #007bff;
    transform: scale(1.3);
}

.node-port.input {
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
}

.node-port.output {
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
}

.node-port.top {
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
}

.node-port.bottom {
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
}

.node-port.output-true {
    right: -6px;
    top: 30%;
    transform: translateY(-50%);
    border-color: #28a745;
}

.node-port.output-true:hover {
    background: #28a745;
}

.node-port.output-false {
    right: -6px;
    top: 70%;
    transform: translateY(-50%);
    border-color: #dc3545;
}

.node-port.output-false:hover {
    background: #dc3545;
}

.node-port-label {
    position: absolute;
    right: 15px;
    font-size: 10px;
    font-weight: bold;
    color: #666;
    pointer-events: none;
}

.node-port-label.true-label {
    top: 30%;
    transform: translateY(-50%);
    color: #28a745;
}

.node-port-label.false-label {
    top: 70%;
    transform: translateY(-50%);
    color: #dc3545;
}

/* Connection Lines SVG */
.flow-connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.flow-connection {
    stroke: #007bff;
    stroke-width: 2;
    fill: none;
    pointer-events: stroke;
}

.flow-connection:hover {
    stroke: #28a745;
    stroke-width: 3;
}

.flow-connection.selected {
    stroke: #dc3545;
    stroke-width: 3;
}

.connection-arrow {
    fill: #007bff;
}

/* Properties Panel */
.flow-properties {
    width: 300px;
    background: white;
    border-left: 1px solid #ddd;
    padding: 20px;
    overflow-y: auto;
}

.flow-properties h6 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

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

.property-group label {
    font-size: 12px;
    font-weight: 500;
    color: #6c757d;
    margin-bottom: 5px;
}

.property-group input,
.property-group select,
.property-group textarea {
    font-size: 13px;
}

/* Zoom Controls */
.zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 5px;
    display: flex;
    gap: 5px;
    z-index: 100;
}

.zoom-control {
    width: 30px;
    height: 30px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
}

.zoom-control:hover {
    background: #f8f9fa;
    color: #333;
}

/* Minimap */
.flow-minimap {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 150px;
    height: 100px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    z-index: 100;
}

/* Context Menu */
.flow-context-menu {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 5px 0;
    min-width: 150px;
    z-index: 1000;
    display: none;
}

.flow-context-menu.show {
    display: block;
}

.context-menu-item {
    padding: 8px 15px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.context-menu-item:hover {
    background: #f8f9fa;
}

.context-menu-item i {
    width: 16px;
    color: #6c757d;
}

/* Node Types Specific Styles */
.flow-node.type-start {
    border-color: #28a745;
    background: #d4edda;
}

.flow-node.type-end {
    border-color: #dc3545;
    background: #f8d7da;
}

.flow-node.type-greeting,
.flow-node.type-say {
    border-color: #17a2b8;
}

.flow-node.type-menu,
.flow-node.type-gather {
    border-color: #ffc107;
}

.flow-node.type-condition {
    border-color: #6f42c1;
    border-radius: 4px;
}

.flow-node.type-api {
    border-color: #fd7e14;
}

.flow-node.type-transfer {
    border-color: #20c997;
}

/* Toolbar */
.flow-toolbar {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 5px 10px;
    display: flex;
    gap: 10px;
    z-index: 100;
}

.toolbar-btn {
    padding: 5px 10px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #6c757d;
}

.toolbar-btn:hover {
    background: #f8f9fa;
    color: #333;
}

.toolbar-separator {
    width: 1px;
    background: #dee2e6;
    margin: 0 5px;
}