.btn-primary{
    color: #fff;
    background-color: #9746fd;
    border-color: #9746fd;
    transition: all .2s ease-in-out 0s;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active{
    color: #9746fd !important;
    background-color: #fff !important;
    border-color: #9746fd !important;
}
a {
    color: #9746fd;
    transition: all .2s ease-in-out 0s;
}
a:hover {
    color: #7912f9;
}
.btn.disabled, .btn:disabled, fieldset:disabled .btn {
    color: #fff;
    pointer-events: none;
    background-color: #9746fd;
    border-color: #9746fd;
    opacity: 0.65;
}
.btn-danger{
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
    transition: all .2s ease-in-out 0s;
}
.btn-danger:hover, .btn-danger:focus, .btn-danger:active{
    color: #dc3545 !important;
    background-color: #fff !important;
    border-color: #dc3545 !important;
}
.btn-warning{
    color: #fff;
    background-color: #ffc107;
    border-color: #ffc107;
    transition: all .2s ease-in-out 0s;
}
.btn-warning:hover, .btn-warning:focus, .btn-warning:active{
    color: #ffc107 !important;
    background-color: #fff !important;
    border-color: #ffc107 !important;
}
.btn-info{
    color: #fff;
    background-color: #0dcaf0;
    border-color: #0dcaf0;
    transition: all .2s ease-in-out 0s;
}
.btn-info:hover, .btn-info:focus, .btn-info:active{
    color: #0dcaf0 !important;
    background-color: #fff !important;
    border-color: #0dcaf0 !important;
}
.bg-info {
    background-color: #0dcaf0 !important;
    padding: 5px;
    font-size: 15px;
    border-radius: 5px;
}
.save_btn{
  cursor: pointer;
    background: blue;
    color: #fff;
    padding: 15px;
    margin-bottom: 15px;
    display: inline-block;
}

/* Workflow Tree Zoom and Drag Styles */
.workflow_data{
    border: 1px solid #e5e4e4;
    border-radius: 15px;
    padding: 20px;
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.workflow_controls {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    display: flex;
    gap: 8px;
    flex-direction: column;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.workflow_controls .btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border: 2px solid #e9ecef;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    color: #6c757d;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.workflow_controls .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
}

.workflow_controls .btn:hover::before {
    left: 100%;
}

.workflow_controls .btn:hover {
    background: linear-gradient(145deg, #9746fd, #7912f9);
    color: #fff;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(151, 70, 253, 0.4);
}

.workflow_controls .btn:active {
    transform: translateY(0) scale(0.95);
}

.workflow_controls .btn.active {
    background: linear-gradient(145deg, #9746fd, #7912f9);
    color: #fff;
    box-shadow: 0 4px 15px rgba(151, 70, 253, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 4px 15px rgba(151, 70, 253, 0.5); }
    50% { box-shadow: 0 4px 20px rgba(151, 70, 253, 0.8); }
    100% { box-shadow: 0 4px 15px rgba(151, 70, 253, 0.5); }
}

.workflow_controls .btn.disabled {
    opacity: 0.4;
    pointer-events: none;
    transform: scale(0.9);
}

.zoom-info {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    z-index: 1000;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

#tree{
    overflow: hidden;
    height: 500px;
    position: relative;
    cursor: default;
    transform-origin: center center;
    transition: transform 0.05s ease;
    border-radius: 10px;
    background: rgba(255,255,255,0.5);
    user-select: none;
}

#tree.dragging {
    cursor: grab !important;
    transition: none !important;
}

#tree.dragging * {
    cursor: grab !important;
    user-select: none;
}

#tree.dragging:active {
    cursor: grabbing !important;
}

#tree.dragging:active * {
    cursor: grabbing !important;
}

.tree-container {
    position: relative;
    min-width: 100%;
    min-height: 100%;
    transform-origin: center center;
    padding: 20px;
    transition: transform 0.05s ease;
}

.tree-container.dragging {
    transition: none !important;
}

/* Enhanced Tree Node Styling */
.main_node {
    margin: 0 auto;
    max-width: 800px;
}

.main_node_box {
    border-radius: 15px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* .main_node_box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #9746fd, #7912f9, #9746fd);
    background-size: 200% 100%;
    animation: gradient-shift 3s ease infinite;
} */

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}


.header_section {
    border: 2px solid #000;
    border-radius: 10px;
    border-top-right-radius: 0px;
    border-top-left-radius: 0px;
    padding: 15px 20px;
    text-align: center;
    background: transparent;
    position: relative;
    transition: all 0.3s ease;
}


.title_section{
    min-height: 25px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 16px;
    margin-bottom: 10px;
}

.action_section{
    margin-top: 15px;
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.action_section a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    color: #6c757d;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
}

.action_section a:hover {
    background: linear-gradient(145deg, #9746fd, #7912f9);
    color: #fff;
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 6px 20px rgba(151, 70, 253, 0.3);
}

.dead_sub_node img{
    width: 18px;
    height: 18px;
    vertical-align: middle;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.header_top_section {
    border: 2px solid #000;
    border-bottom: none;
    text-align: center;
    padding: 12px 20px;
    border-radius: 10px 10px 0 0;
    font-weight: 500;
    color: #495057;
    position: relative;
    transition: all 0.3s ease;
}


.sub_node_box{
    position: relative;
    transition: all 0.3s ease;
    border-radius: 12px;
    padding: 5px;
}


.sub_node_box:before {
    position: absolute;
    content: "";
    border-left: 3px solid #9746fd;
    left: 50%;
    top: 0;
    transform: translate(0, -100%);
    height: 40px;
    border-radius: 2px;
    box-shadow: 0 2px 8px rgba(151, 70, 253, 0.3);
}

.sub_node td{
    vertical-align: top;
    padding: 5px;
}

/* Gender Section Styling */
.gender_section {
    margin: 15px 0;
    padding: 10px;
    background: rgba(151, 70, 253, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(151, 70, 253, 0.1);
}

.gender_section .form-check-inline {
    margin-right: 15px;
}

.gender_section .form-check-input {
    border: 2px solid #dee2e6;
    transition: all 0.3s ease;
}

.gender_section .form-check-input:checked {
    background-color: #9746fd;
    border-color: #9746fd;
    box-shadow: 0 0 0 0.2rem rgba(151, 70, 253, 0.25);
}

.gender_section .form-check-label {
    font-weight: 500;
    color: #495057;
    margin-left: 5px;
}

/* Sub Node Styling */
.sub_node {
    margin-top: 20px;
}

.sub_node table {
    border-collapse: separate;
    border-spacing: 20px;
}

/* End Node Styling */
.end_node {
    margin-top: 20px;
}

/* .end_node .sub_node_box {
    background: linear-gradient(145deg, #28a745, #20c997);
    color: white;
    border: 2px solid #28a745;
} */

/* .end_node .header_top_section, .end_node .title_section {
    color: white;
}    */

/* .end_node .header_section {
    background: rgba(255,255,255,0.1);
    color: white;
} */

/* Zoom and Pan Visual Indicators */
.zoom-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(151, 70, 253, 0.1);
    pointer-events: none;
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.zoom-overlay.active {
    opacity: 1;
}

/* Animation for smooth transitions */
.tree-container {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Visual feedback for zoom operations */
.workflow_data.zooming {
    background: linear-gradient(45deg, #f8f9fa 25%, transparent 25%), 
                linear-gradient(-45deg, #f8f9fa 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #f8f9fa 75%), 
                linear-gradient(-45deg, transparent 75%, #f8f9fa 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    animation: zoom-pattern 0.5s ease-in-out;
}

@keyframes zoom-pattern {
    0% { background-position: 0 0, 0 10px, 10px -10px, -10px 0px; }
    50% { background-position: 10px 10px, 10px 20px, 20px 0px, 0px 10px; }
    100% { background-position: 0 0, 0 10px, 10px -10px, -10px 0px; }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .workflow_controls {
        position: fixed;
        top: 50%;
        right: 10px;
        transform: translateY(-50%);
    }
    
    .zoom-info {
        font-size: 10px;
        padding: 6px 12px;
    }
    
    .sub_node_box {
        margin: 20px 20px 0 0;
    }
    
    .action_section a {
        width: 30px;
        height: 30px;
    }
}

/* Visual indicator for drag mode */
.workflow_data.drag-mode-active {
    position: relative;
}

.workflow_data.drag-mode-active::before {
    content: 'DRAG MODE ACTIVE';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(151, 70, 253, 0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    z-index: 1001;
    pointer-events: none;
    animation: drag-indicator 2s ease-in-out infinite;
}

@keyframes drag-indicator {
    0%, 100% { opacity: 0.7; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
}

/* Enhanced drag cursor */
#tree.dragging {
    cursor: grab !important;
}

#tree.dragging * {
    cursor: grab !important;
    user-select: none;
}

#tree.dragging:active {
    cursor: grabbing !important;
}

#tree.dragging:active * {
    cursor: grabbing !important;
}

/* Fullscreen Styles */
.workflow_data.fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    border-radius: 0 !important;
    padding: 20px !important;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.workflow_data.fullscreen #tree {
    height: calc(100vh - 40px) !important;
    max-height: none !important;
}

.workflow_data.fullscreen .workflow_controls {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 10000 !important;
}

.workflow_data.fullscreen .zoom-info {
    position: fixed !important;
    top: 20px !important;
    left: 20px !important;
    z-index: 10000 !important;
}

/* Fullscreen overlay */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.fullscreen-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Fullscreen exit button */
.fullscreen-exit {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 10001;
    background: rgba(151, 70, 253, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    transform: scale(0.8);
}

.fullscreen-exit:hover {
    background: rgba(151, 70, 253, 1);
    transform: scale(1.1);
}

.fullscreen-exit.active {
    opacity: 1;
    transform: scale(1);
}

/* Responsive fullscreen adjustments */
@media (max-width: 768px) {
    .workflow_data.fullscreen {
        padding: 10px !important;
    }
    
    .workflow_data.fullscreen #tree {
        height: calc(100vh - 20px) !important;
    }
    
    .workflow_data.fullscreen .workflow_controls {
        top: 10px !important;
        right: 10px !important;
    }
    
    .workflow_data.fullscreen .zoom-info {
        top: 10px !important;
        left: 10px !important;
    }
    
    .fullscreen-exit {
        top: 10px;
        left: 10px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* Collapse/Expand Node Functionality */
.collapse_node {
    transition: all 0.3s ease;
}

.collapse_node:hover {
    background: linear-gradient(145deg, #9746fd, #7912f9) !important;
    color: #fff !important;
    transform: scale(1.1);
}

.collapse_node i {
    transition: transform 0.3s ease;
}

.collapse_node.collapsed i {
    transform: rotate(-90deg);
}

/* Smooth animation for collapsing/expanding */
.include_section {
    transition: all 0.3s ease;
    overflow: hidden;
}

.include_section.collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
}

.include_section.expanded {
    max-height: none;
    opacity: 1;
}

/* Visual indicator for nodes with children */
.sub_node_box.has-children .header_section {
    border-left: 3px solid #9746fd;
    position: relative;
}

.sub_node_box.has-children .header_section::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid #9746fd;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
}

/* Collapse icon styling */
.collapse_node i.bi-chevron-down {
    transform: rotate(0deg);
}

.collapse_node i.bi-chevron-right {
    transform: rotate(-90deg);
}

/* Animation for collapse/expand */
@keyframes collapse-animation {
    0% { max-height: 100%; opacity: 1; }
    100% { max-height: 0; opacity: 0; }
}

@keyframes expand-animation {
    0% { max-height: 0; opacity: 0; }
    100% { max-height: 100%; opacity: 1; }
}

.include_section.collapsing {
    animation: collapse-animation 0.3s ease-in-out;
}

.include_section.expanding {
    animation: expand-animation 0.3s ease-in-out;
}

/* Enhanced visual feedback for collapse state */
/* .sub_node_box.collapsed .header_section {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border-color: #dee2e6;
} */

/* .sub_node_box.collapsed .header_section .title_section {
    color: #6c757d;
} */

/* Ensure collapsed sections are properly hidden */
.include_section:not(:visible) {
    display: none !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* Smooth transition for collapse/expand */
.include_section {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Remove any conflicting CSS that might interfere */
.include_section.collapsed {
    display: none !important;
}

.include_section.expanded {
    display: block !important;
}

/* Visual indicator for nodes that can be collapsed */
.sub_node_box.has-children .header_section {
    position: relative;
}

.sub_node_box.has-children .header_section::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid #9746fd;
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
    opacity: 0.6;
}

/* Tooltip for collapse button */
.collapse_node[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

/* Responsive collapse behavior */
@media (max-width: 768px) {
    .collapse_node {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
    
    .include_section {
        transition: all 0.2s ease;
    }
}
