/**
 * LuminaNote Studio - Freeform N8N Node Flow Editor Styling
 */

.flow-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #080C15;
    background-image: 
        radial-gradient(circle at 1.5px 1.5px, rgba(255, 255, 255, 0.07) 1.5px, transparent 0);
    background-size: 28px 28px;
    user-select: none;
}

.flow-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 4000px;
    height: 3000px;
    transform-origin: 0 0;
    transition: transform 0.05s ease-out;
}

.flow-svg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Bezier Connector Wires */
.flow-wire {
    fill: none;
    stroke: #3B82F6;
    stroke-width: 3.5px;
    stroke-linecap: round;
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.5));
    transition: stroke 0.2s ease;
}

.flow-wire-pulse {
    fill: none;
    stroke: #93C5FD;
    stroke-width: 3.5px;
    stroke-dasharray: 8 16;
    animation: flowPulse 1.2s linear infinite;
    pointer-events: none;
}

@keyframes flowPulse {
    from { stroke-dashoffset: 24; }
    to { stroke-dashoffset: 0; }
}

/* Flow Nodes Container */
.flow-nodes-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

/* Individual Freeform Draggable N8N Node */
.n8n-node {
    position: absolute;
    width: 270px;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    box-shadow: 0 16px 40px -6px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: default;
    display: flex;
    flex-direction: column;
}

.n8n-node:hover {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 24px 50px -8px rgba(0, 0, 0, 0.7), 0 0 24px rgba(59, 130, 246, 0.25);
}

.n8n-node.is-active {
    border-color: #3B82F6;
    box-shadow: 0 0 0 2px #3B82F6, 0 20px 45px rgba(59, 130, 246, 0.35);
}

.n8n-node.is-dragging {
    opacity: 0.92;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(59, 130, 246, 0.4);
    z-index: 100;
}

/* Node Header (Draggable Handle) */
.n8n-node-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    cursor: grab;
}

.n8n-node-header:active {
    cursor: grabbing;
}

.n8n-node-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 8px;
}

.n8n-badge-cover { background: rgba(225, 29, 72, 0.2); color: #FB7185; border: 1px solid rgba(225, 29, 72, 0.35); }
.n8n-badge-notebook { background: rgba(37, 99, 235, 0.2); color: #60A5FA; border: 1px solid rgba(37, 99, 235, 0.35); }
.n8n-badge-widget { background: rgba(217, 119, 6, 0.2); color: #FBBF24; border: 1px solid rgba(217, 119, 6, 0.35); }
.n8n-badge-end { background: rgba(147, 51, 234, 0.2); color: #C084FC; border: 1px solid rgba(147, 51, 234, 0.35); }

.n8n-node-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.n8n-btn-icon {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: transparent;
    border: none;
    color: #94A3B8;
    cursor: pointer;
    transition: all 0.15s ease;
}

.n8n-btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
}

.n8n-btn-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #F87171;
}

/* Node Body & Preview */
.n8n-node-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.n8n-preview-box {
    width: 100%;
    height: 145px;
    background: #090D16;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

.n8n-preview-box:hover .n8n-edit-overlay {
    opacity: 1;
}

.n8n-edit-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.n8n-preview-box canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.n8n-node-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.n8n-node-title {
    font-size: 13px;
    font-weight: 700;
    color: #F8FAFC;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.n8n-node-subtitle {
    font-size: 11px;
    color: #94A3B8;
    truncate: true;
}

/* Node Footer Controls */
.n8n-node-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 18px;
    gap: 8px;
}

.n8n-stepper-container {
    display: inline-flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 2px 4px;
    gap: 2px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn-step {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: #94A3B8;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-step:hover {
    background: #3B82F6;
    color: #FFFFFF;
}

.btn-step:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.lbl-node-pages {
    font-size: 11px;
    font-weight: 700;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    color: #F8FAFC;
    min-width: 24px;
    text-align: center;
}

.n8n-multipage-strip {
    background: rgba(30, 58, 138, 0.25);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 10px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.node-subpage-slider {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    accent-color: #3B82F6;
    cursor: pointer;
}

/* Connection Ports */
.n8n-port {
    position: absolute;
    top: 50%;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #1E293B;
    border: 2.5px solid #3B82F6;
    transform: translateY(-50%);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.7);
    z-index: 10;
}

.n8n-port-in { left: -8px; }
.n8n-port-out { right: -8px; }

/* Floating Flow Controls */
.flow-floating-bar {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 40px;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 20;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.flow-stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #94A3B8;
}

.flow-stat-val {
    font-weight: 700;
    color: #F8FAFC;
}

.flow-divider {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.12);
}
