/**
 * Connection Line Styles
 * 连接线样式
 */

/* ==================== Connection Layer 连接层 ==================== */
.ne-connection-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: var(--ne-z-connections);
    overflow: visible;
}

/* ==================== Connection Path 连接路径 ==================== */
.ne-connection {
    fill: none;
    stroke-width: var(--ne-connection-width);
    stroke-linecap: round;
    pointer-events: stroke;
    cursor: pointer;
    transition: stroke-width var(--ne-transition-fast);
}

.ne-connection:hover {
    stroke-width: var(--ne-connection-width-hover);
}

.ne-connection.selected {
    stroke: var(--ne-connection-selected);
    stroke-width: var(--ne-connection-width-hover);
    filter: drop-shadow(0 0 4px var(--ne-connection-selected));
}

/* ==================== Connection Type Colors 连接类型颜色 ==================== */
.ne-connection.exec {
    stroke: var(--ne-pin-exec);
    stroke-width: var(--ne-connection-width-exec);
}

.ne-connection.bool { stroke: var(--ne-pin-bool); }
.ne-connection.int { stroke: var(--ne-pin-int); }
.ne-connection.float { stroke: var(--ne-pin-float); }
.ne-connection.string { stroke: var(--ne-pin-string); }
.ne-connection.vector2 { stroke: var(--ne-pin-vector2); }
.ne-connection.vector3 { stroke: var(--ne-pin-vector3); }
.ne-connection.vector4 { stroke: var(--ne-pin-vector4); }
.ne-connection.color { stroke: var(--ne-pin-color); }
.ne-connection.object { stroke: var(--ne-pin-object); }
.ne-connection.array { stroke: var(--ne-pin-array); }
.ne-connection.map { stroke: var(--ne-pin-map); }
.ne-connection.struct { stroke: var(--ne-pin-struct); }
.ne-connection.enum { stroke: var(--ne-pin-enum); }
.ne-connection.delegate { stroke: var(--ne-pin-delegate); }
.ne-connection.any { stroke: var(--ne-pin-any); }

/* ==================== Connection Preview 连接预览 ==================== */
.ne-connection-preview {
    fill: none;
    stroke: var(--ne-connection-preview);
    stroke-width: 3px;
    stroke-dasharray: 8 4;
    pointer-events: none;
    animation: ne-connection-dash 0.3s linear infinite;
    filter: drop-shadow(0 0 4px currentColor);
}

.ne-connection-preview.valid {
    stroke: var(--ne-state-success);
    stroke-dasharray: none;
    stroke-width: 3px;
    filter: drop-shadow(0 0 8px var(--ne-state-success));
}

.ne-connection-preview.invalid {
    stroke: var(--ne-connection-invalid);
    filter: drop-shadow(0 0 6px var(--ne-connection-invalid));
}

/* Preview type colors */
.ne-connection-preview.exec { stroke: var(--ne-pin-exec); }
.ne-connection-preview.bool { stroke: var(--ne-pin-bool); }
.ne-connection-preview.int { stroke: var(--ne-pin-int); }
.ne-connection-preview.float { stroke: var(--ne-pin-float); }
.ne-connection-preview.string { stroke: var(--ne-pin-string); }
.ne-connection-preview.vector2 { stroke: var(--ne-pin-vector2); }
.ne-connection-preview.vector3 { stroke: var(--ne-pin-vector3); }
.ne-connection-preview.vector4 { stroke: var(--ne-pin-vector4); }
.ne-connection-preview.color { stroke: var(--ne-pin-color); }
.ne-connection-preview.object { stroke: var(--ne-pin-object); }
.ne-connection-preview.array { stroke: var(--ne-pin-array); }
.ne-connection-preview.map { stroke: var(--ne-pin-map); }
.ne-connection-preview.struct { stroke: var(--ne-pin-struct); }
.ne-connection-preview.enum { stroke: var(--ne-pin-enum); }
.ne-connection-preview.delegate { stroke: var(--ne-pin-delegate); }
.ne-connection-preview.any { stroke: var(--ne-pin-any); }

@keyframes ne-connection-dash {
    to {
        stroke-dashoffset: -12;
    }
}

/* ==================== Connection Hit Area 连接点击区域 ==================== */
.ne-connection-hit {
    fill: none;
    stroke: transparent;
    stroke-width: 20px;
    pointer-events: stroke;
    cursor: pointer;
}

.ne-connection-hit:hover + .ne-connection-glow + .ne-connection {
    stroke-width: var(--ne-connection-width-hover);
}

/* ==================== Connection Glow 连接发光 ==================== */
.ne-connection-glow {
    fill: none;
    stroke-width: 8px;
    opacity: 0;
    filter: blur(4px);
    pointer-events: none;
    transition: opacity var(--ne-transition-fast);
}

.ne-connection-glow.exec { stroke: var(--ne-pin-exec); }
.ne-connection-glow.bool { stroke: var(--ne-pin-bool); }
.ne-connection-glow.int { stroke: var(--ne-pin-int); }
.ne-connection-glow.float { stroke: var(--ne-pin-float); }
.ne-connection-glow.string { stroke: var(--ne-pin-string); }
.ne-connection-glow.vector2 { stroke: var(--ne-pin-vector2); }
.ne-connection-glow.vector3 { stroke: var(--ne-pin-vector3); }
.ne-connection-glow.vector4 { stroke: var(--ne-pin-vector4); }
.ne-connection-glow.color { stroke: var(--ne-pin-color); }
.ne-connection-glow.object { stroke: var(--ne-pin-object); }
.ne-connection-glow.array { stroke: var(--ne-pin-array); }
.ne-connection-glow.map { stroke: var(--ne-pin-map); }
.ne-connection-glow.struct { stroke: var(--ne-pin-struct); }
.ne-connection-glow.enum { stroke: var(--ne-pin-enum); }
.ne-connection-glow.delegate { stroke: var(--ne-pin-delegate); }
.ne-connection-glow.any { stroke: var(--ne-pin-any); }

.ne-connection-hit:hover + .ne-connection-glow {
    opacity: 0.5;
}

/* ==================== Connection Flow Animation 连接流动动画 ==================== */
.ne-connection.exec.animated {
    stroke-dasharray: 4 8;
    animation: ne-exec-flow 0.4s linear infinite;
}

@keyframes ne-exec-flow {
    to {
        stroke-dashoffset: -12;
    }
}

/* ==================== Reroute Node 重路由节点 ==================== */
.ne-reroute {
    fill: var(--ne-node-bg);
    stroke: currentColor;
    stroke-width: 2px;
    cursor: move;
    transition: transform var(--ne-transition-fast);
}

.ne-reroute:hover {
    transform: scale(1.2);
}

.ne-reroute.selected {
    stroke: var(--ne-connection-selected);
    filter: drop-shadow(0 0 4px var(--ne-connection-selected));
}
