/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 80px; /* Match header height */
    width: 300px;
    background-color: rgba(11, 16, 21, 0.98);
    color: var(--text-main);
    z-index: 900;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(10px);
    /* Dynamic height and scrolling */
    height: auto;
    max-height: calc(100vh - 100px); /* Leave some space at bottom */
    border-bottom-right-radius: var(--radius-md);
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    /* Draggable cursor */
    cursor: move;
}

.sidebar.collapsed {
    width: 40px;
    transform: none; /* Don't move it off screen, just shrink it */
    cursor: default; /* Only draggable when open? Or always? Let's say always */
}

/* Sidebar Toggle Button */
.sidebar-toggle-container {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border);
    cursor: pointer; /* Handle for dragging */
    background: var(--surface);
}

.sidebar-toggle {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem; /* Smaller arrow */
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background-color: rgba(0, 220, 255, 0.1);
    color: #fff;
}

/* Sidebar Content */
.sidebar-content {
    padding: var(--spacing-md);
    overflow-y: auto; /* Enable scrolling */
    overflow-x: hidden;
    flex: 1;
    /* Custom Scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--primary-dark) var(--surface);
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
    cursor: default; /* Content shouldn't trigger drag */
}

.sidebar.collapsed .sidebar-content {
    opacity: 0;
    pointer-events: none;
    display: none; /* Hide content when collapsed */
}

/* Category Header Styling */
.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0.5rem; /* More padding */
    margin: 0 -0.5rem; /* Negative margin to align text with header */
    cursor: pointer;
    color: var(--text-light);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.85rem;
    transition: var(--transition);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05); /* Subtle separator */
    margin-bottom: 0.25rem;
    border-radius: var(--radius-sm);
}

.category-header:hover {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.02);
}

.category-header .name {
    color: var(--text-main); /* Cleaner look, not colored by default */
}

.category-header:hover .name {
    color: var(--primary);
}

.category-header .arrow {
    font-size: 0.7rem;
    color: var(--text-light);
    opacity: 0.5;
    transition: transform 0.2s;
}

.category-header:hover .arrow {
    opacity: 1;
    color: var(--primary);
    transform: translateX(2px);
}
