/* ============================================================
   Sidebar: tree items, global search box, node drag & drop
   ============================================================ */

/* Sidebar tree item transitions (dark theme) */
.sidebar-item {
    transition: background-color 0.1s ease;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
}
.sidebar-item:hover { background-color: #1e293b; }
.sidebar-item.active {
    background-color: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    font-weight: 500;
}
.sidebar-item.sidebar-item-keyboard-active {
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.55);
    background-color: rgba(59, 130, 246, 0.12);
}
.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background: #3b82f6;
    border-radius: 0 3px 3px 0;
}
.sidebar-item .node-add-btn { opacity: 0; transition: opacity 0.1s ease; }
.sidebar-item:hover .node-add-btn { opacity: 1; }

/* Sidebar global search */
#global-search-box {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}
#global-search-box:focus-visible {
    outline: none;
    border-color: rgba(96, 165, 250, 0.85);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

/* ============================================================
   Sidebar Node Drag & Drop
   ============================================================ */
.sidebar-item[draggable="true"] { cursor: grab; }
.sidebar-item.node-drag-dragging { opacity: 0.35; cursor: grabbing; }
.sidebar-item.node-drop-above::before,
.sidebar-item.node-drop-below::after {
    content: '';
    position: absolute;
    left: 6px;
    right: 6px;
    height: 2px;
    background: #6366f1;
    border-radius: 9999px;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
    z-index: 10;
}
.sidebar-item.node-drop-above::before { top: -1px; }
.sidebar-item.node-drop-below::after  { bottom: -1px; }
.sidebar-item.node-drop-into {
    background-color: rgba(99, 102, 241, 0.12) !important;
    outline: 1px dashed rgba(99, 102, 241, 0.4);
    outline-offset: -2px;
}

/* ============================================================
   Sidebar Collapse/Expand
   ============================================================ */
#sidebar {
    transition: width 0.25s ease;
    position: relative;
    width: var(--sidebar-width, 16rem);
    min-width: var(--sidebar-width, 16rem);
}
#sidebar.no-transition {
    transition: none !important;
}
#sidebar-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
    z-index: 20;
    background: transparent;
    transition: background 0.15s ease;
}
#sidebar-resize-handle:hover,
#sidebar.sidebar-resizing #sidebar-resize-handle {
    background: var(--brand-500, #6366f1);
}
#sidebar.sidebar-resizing {
    transition: none !important;
    user-select: none;
}
#sidebar.sidebar-collapsed #sidebar-resize-handle {
    display: none;
}
#sidebar.sidebar-collapsed {
    width: 3rem;
    min-width: 3rem;
}
#sidebar.sidebar-collapsed > *:not(#sidebar-collapse-strip) {
    opacity: 0;
    pointer-events: none;
}
#sidebar-collapse-strip {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    flex-direction: column;
    align-items: center;
    padding-top: 1rem;
    z-index: 10;
}
#sidebar.sidebar-collapsed #sidebar-collapse-strip {
    display: flex;
}
