/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 4px;
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(51, 65, 85, 0.6);
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.6);
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(51, 65, 85, 0.9);
}

/* Tree Styles */
.tree-node ul {
    list-style-type: none;
    padding-left: 24px;
    margin-top: 4px;
    border-left: 1px solid #e2e8f0;
    /* Default light border */
    margin-left: 10px;
    position: relative;
    display: none;
    /* Initially hidden, toggled via JS */
}

.dark .tree-node ul {
    border-left-color: #334155;
    /* Default dark border */
}

.tree-node.expanded>ul {
    display: block;
    animation: slideDown 0.2s ease-out forwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tree-item-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: default;
    transition: background-color 0.15s ease;
    user-select: none;
}

.tree-item-content:hover {
    background-color: rgba(99, 102, 241, 0.05);
    /* indigo-500/5 */
}

.dark .tree-item-content:hover {
    background-color: rgba(99, 102, 241, 0.1);
    /* indigo-500/10 */
}

/* For folders only, change cursor */
.tree-node.is-folder>.tree-item-content {
    cursor: pointer;
}

/* Arrow indicator rotation */
.tree-arrow {
    transition: transform 0.2s ease;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
}

.tree-node.expanded>.tree-item-content .tree-arrow svg {
    transform: rotate(90deg);
}

.tree-node:not(.is-folder)>.tree-item-content .tree-arrow {
    visibility: hidden;
    /* Hide arrow for leaf nodes */
}

/* Tree Connecting Lines (Horizontal tick) */
.tree-item-content::before {
    content: '';
    position: absolute;
    left: 0;
    width: 14px;
    height: 1px;
    background-color: #e2e8f0;
    margin-top: -1px;
    /* Align to vertical center of text loosely */
    z-index: 0;
    pointer-events: none;
}

.dark .tree-item-content::before {
    background-color: #334155;
}

/* Special case: hide connecting line for root node */
.tree-root>.tree-node>.tree-item-content::before {
    display: none;
}

/* Make sure inner elements stay above the lines */
.tree-item-content>* {
    z-index: 1;
}

/* UI States */
body.viz-active #input-overlay {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

body.viz-active #sidebar {
    transform: translateX(0);
}

.drag-over {
    border-color: #6366f1 !important;
    /* indigo border */
    background-color: rgba(99, 102, 241, 0.05) !important;
}

.dark .drag-over {
    background-color: rgba(99, 102, 241, 0.1) !important;
}