/* ============================================================================
   VERIJ WORKFLOW STUDIO - STYLES
   ============================================================================
   File: wwwroot/css/workflow-studio.css
   ============================================================================ */

/* ============================================================================
   MAIN LAYOUT
   ============================================================================ */

.workflow-studio {
    display: flex;
    height: 100vh;
    background-color: #212121;
    color: #ffffff;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ============================================================================
   SIDEBARS
   ============================================================================ */

.workflow-sidebar {
    background: linear-gradient(180deg, #3d3d3d 0%,#242424 100%);
    border-right: 1px solid #484848;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.left-sidebar {
    width: 200px;
    padding: 0;
}

.right-sidebar {
    width: 50px;
    border-left: 1px solid #4b4b4b;
    border-right: none;
    padding: 10px 5px;
    align-items: center;
}

.sidebar-header {
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid #171717;
}

.header-title {
    font-weight: 600;
    font-size: 14px;
    color: #c8c8c8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-divider {
    height: 1px;
    background: #2d3748;
    margin: 10px 0;
}

/* ============================================================================
   TOOL ITEMS
   ============================================================================ */

.tool-group {
    padding: 5px 10px;
}

.tool-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: #efefef;
}



.tool-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.tool-item.active {
    background: rgb(187, 187, 187, 0.20);
    border: 1px solid rgb(255, 255, 255, 0.40);
}

.tool-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tool-item i {    font-size: 18px;
    width: 24px;
    text-align: center;
}

/* Right sidebar - icon only */
.right-sidebar .tool-item {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    margin-bottom: 5px;
}

.right-sidebar .tool-item i {
    margin: 0;
}

/* Draggable node items */
.tool-item[draggable="true"] {
    border: 1px solid transparent;
}

.tool-item[draggable="true"]:hover {
    border-color: rgb(248, 253, 255, 0.30);
    background: rgb(54, 56, 57, 0.10);
}

/* ============================================================================
   CANVAS CONTAINER
   ============================================================================ */

.workflow-canvas-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid #4e4e4e;
    min-height: 50px;
}

.workflow-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.workflow-name {
    font-size: 18px;
    font-weight: 600;
}

.workflow-status {
    font-size: 12px;
    padding: 4px 10px;
}

.canvas-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.unsaved-indicator {
    color: #ffc107;
    font-size: 13px;
    animation: pulse 2s infinite;
}


.saved-indicator {
    color: #28a745;
    font-size: 13px;
    animation: fadeout 10s 1 forwards;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes fadeout {
    0%{
        opacity: 1;
    }

    50% {
        opacity: 1;
    }

    100%{ opacity: 0; }
}

/* ============================================================================
   SVG CANVAS
   ============================================================================ */

.workflow-canvas {
    flex: 1;
    background: #191919;
    cursor: default;
}

.workflow-canvas.panning {
    cursor: grab;
}

.workflow-canvas.panning:active {
    cursor: grabbing;
}

/* Zoom indicator */
.zoom-indicator {
    position: absolute;
    bottom: 20px;
    right: 70px;
    background: rgba(0, 0, 0, 0.7);
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 12px;
    color: #a0aec0;
}

/* ============================================================================
   NODES
   ============================================================================ */

.node {
    cursor: move;
    transition: filter 0.2s ease;
}

.node:hover {
    filter: brightness(1.1);
}

.node.selected {
    filter: drop-shadow(0 0 8px rgba(0, 191, 255, 0.5));
}

/* Node type colors */
.node rect,
.node ellipse,
.node polygon {
    transition: all 0.2s ease;
}

.start-node ellipse {
    fill: #28a745;
}

.end-node ellipse {
    fill: #dc3545;
}

.transformation-node rect {
    fill: #17a2b8;
}

.decision-node polygon,
.condition-node polygon {
    fill: #ffc107;
}

.errorlog-node rect {
    fill: #721c24;
}

.sqlread-node rect {
    fill: #6f42c1;
}

.apiget-node rect {
    fill: #20c997;
}

.notification-node rect {
    fill: #fd7e14;
}

.trigger-node rect {
    fill: #e83e8c;
}

.verijqueue-node rect {
    fill: #007bff;
}

/* ============================================================================
   CONNECTORS
   ============================================================================ */
.connector {
    cursor: crosshair;
    pointer-events: all;
}

    /* Use a transparent hit area to prevent hover flickering */
    .connector circle {
        transition: fill 0.15s ease, stroke 0.15s ease;
    }

    /* Add invisible larger hit target */
    .connector::before {
        content: '';
        position: absolute;
        width: 24px;
        height: 24px;
        margin: -12px;
        pointer-events: all;
    }

    .connector:hover circle {
        fill: #00bfff;
        stroke: #00bfff;
    }

    /* Don't use transform scale - it causes the stuttering */
    .connector:active circle {
        fill: #0099cc;
    }


/* ============================================================================
   CONNECTIONS
   ============================================================================ */

.connection {
    cursor: pointer;
}

.connection-path {
    transition: stroke-width 0.2s ease;
}

.connection:hover .connection-path {
    stroke-width: 3;
}

.connection.selected .connection-path {
    stroke-width: 3;
    stroke-dasharray: 5, 5;
    animation: dash 0.5s linear infinite;
}

@keyframes dash {
    to {
        stroke-dashoffset: -10;
    }
}

.connection-label {
    pointer-events: none;
    user-select: none;
}

.connection-label-bg {
    pointer-events: none;
}

/* ============================================================================
   MODALS
   ============================================================================ */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
   
}

.modal-dialog {
    pointer-events: unset !important;
}

    .modal-dialog.workflow-modal {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: #282829;
        border: 1px solid #545556;
        z-index: 1005 !important;
    }

        .modal-dialog.workflow-modal .modal-body
        {
            border-radius: 12px;
            width: 700px;
            max-width: 90vw;
            max-height: 80vh;
            overflow: hidden;
            z-index: 1001;
            box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
        }

            .modal-dialog.workflow-modal .modal-body::-webkit-scrollbar {
                width: 10px !important;
                display: block !important;
            }

            .modal-dialog.workflow-modal .modal-body::-webkit-scrollbar-thumb {
                background: #5e5e5e !important;
                border-radius: 5px !important;
                border: 2px solid #2c2c2c !important;
                scrollbar-face-color: #5e5e5e !important;
            }

            .modal-dialog.workflow-modal .modal-body::-webkit-scrollbar-track {
                background: #101010 !important;
            }

.modal-header {
    color: whitesmoke !important;
}

.modal-dialog.workflow-modal.modal-lg {
    width: 1200px;
}

.modal-dialog.workflow-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid #545556;
}

    .modal-dialog.workflow-modal .modal-header h5 {
        margin: 0;
        font-size: 18px;
        font-weight: 600;
    }

.modal-dialog.workflow-modal .btn-close {
    background: none;
    border: none;
    color: #b3b3b3;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

    .modal-dialog.workflow-modal .btn-close:hover {
        color: #ffffff;
    }

.modal-dialog.workflow-modal .modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-dialog.workflow-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid #4e4e4e;
}

/* ============================================================================
   FORM CONTROLS IN MODALS
   ============================================================================ */

.workflow-modal .form-label {
    color: #a0aec0;
    font-size: 13px;
    margin-bottom: 5px;
}

.workflow-modal .form-control,
.workflow-modal .form-select {
    background: #282829;
    border: 1px solid #545556;
    color: #ffffff;
    border-radius: 6px;
    padding: 10px 12px;
}

.workflow-modal .form-control:focus,
.workflow-modal .form-select:focus {
    background: #161616;
    border-color: #d0d0d0;
    color: #ffffff;
    box-shadow: 0 0 0 2px rgba(0, 191, 255, 0.2);
}

.workflow-modal .form-control::placeholder {
    color: #6b6b6b;
}

.workflow-modal textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* ============================================================================
   WORKFLOW LIST (Open Dialog)
   ============================================================================ */

.workflow-list {
    max-height: 400px;
    /*overflow-y: auto;*/
}

.workflow-list-item {
    padding: 12px 15px;
    border: 1px solid #cacaca !important;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.workflow-list-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: #757575;
}

.workflow-list-item.selected {
    background: rgb(255, 255, 255, 0.10);
    border-color: #f7fdff;
}

.workflow-list-name {
    font-weight: 600;
    margin-bottom: 5px;
    color: whitesmoke !important;

}

.workflow-list-meta {
    font-size: 12px;
    color: #a0aec0;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.workflow-modal .btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.workflow-modal .btn-primary {
    background: #00bfff;
    border: none;
    color: #000;
}

.workflow-modal .btn-primary:hover {
    background: #00a8e0;
}

.workflow-modal .btn-secondary {
    background: #4a5568;
    border: none;
    color: #fff;
}

.workflow-modal .btn-secondary:hover {
    background: #5a6578;
}

.workflow-modal .btn-danger {
    background: #dc3545;
    border: none;
    color: #fff;
}

.workflow-modal .btn-danger:hover {
    background: #c82333;
}

.workflow-modal .btn-outline-danger {
    background: transparent;
    border: 1px solid #dc3545;
    color: #dc3545;
}

.workflow-modal .btn-outline-danger:hover {
    background: #dc3545;
    color: #fff;
}

.workflow-modal .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================================================
   ICON COLORS
   ============================================================================ */

.text-primary { color: #17a2b8 !important; }
.text-success { color: #28a745 !important; }
.text-danger { color: #dc3545 !important; }
.text-warning { color: #ffc107 !important; }
.text-info { color: #00bfff !important; }
.text-secondary { color: #6c757d !important; }
.text-purple { color: #6f42c1 !important; }
.text-muted {
    color: #747474 !important;
}

/* ============================================================================
   BADGE COLORS
   ============================================================================ */
.bg-success {
    background-color: #28a745 !important;
}
.bg-danger { background-color: #dc3545 !important; }
.bg-warning { background-color: #ffc107 !important; color: #000 !important; }
.bg-secondary { background-color: #6c757d !important; }

/* ============================================================================
   SCROLLBAR
   ============================================================================ */

.workflow-studio ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.workflow-studio ::-webkit-scrollbar-track {
    background: #1a1a2e;
}

.workflow-studio ::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 4px;
}

.workflow-studio ::-webkit-scrollbar-thumb:hover {
    background: #5a6578;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .left-sidebar {
        width: 60px;
    }

    .left-sidebar .tool-item span {
        display: none;
    }

    .left-sidebar .tool-item {
        justify-content: center;
    }

    .left-sidebar .sidebar-header {
        display: none;
    }
}
