/* ========================================
   Sidebar Component Styles
   Matches 2.1 overview sidebar design
   ======================================== */

.sidebar-container {
    width: 216px; /* 200px + padding */
    min-width: 216px;
    height: 100vh;
    background: transparent; /* No background - cards float on main background */
    display: flex;
    flex-direction: column;
    padding: var(--overview-content-spacing, 8px);
    padding-top: calc(20px + var(--card-header-height, 42px)); /* Align with group card boxes (content padding + card header height) */
    gap: var(--overview-content-spacing, 8px);
    overflow: hidden;
}

/* Section Card - wrapper for header + content */
.sidebar-section-card {
    background: var(--bg-gradient-sidebar, var(--bg-elevated));
    border: 1px solid var(--border-default);
    border-radius: 8px;
    box-shadow: var(--shadow-small);
    display: flex;
    flex-direction: column;
    overflow: auto;
    flex-shrink: 0; /* Don't shrink, natural size */
}

/* Section Headers - sticky inside card */
.sidebar-section-header {
    height: var(--overview-header-height, 57px); /* Match overview-header-height */
    padding: 0 12px;
    background: var(--bg-elevated);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-primary);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 10;
    box-sizing: border-box;
    cursor: default;
    transition: all 0.2s;
    border-bottom: 1px solid var(--border-default);
}

/* Entity header is clickable */
.sidebar-section-header.entity-header {
    cursor: pointer;
}

.sidebar-section-header.entity-header:hover {
    background: var(--interactive-hover);
    border-color: var(--border-strong);
}

.sidebar-section-header.entity-header.active {
    background: var(--interactive-selected);
    color: var(--blue-primary);
    font-weight: 500;
}

.sidebar-section-header .sidebar-section-title {
    flex: 1;
    text-align: center;
}

/* Dot menu in headers */
.sidebar-section-header > button,
.sidebar-section-header .dot-menu {
    position: absolute;
    inset-inline-end: 12px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: auto; /* Ensure clickable even when parent might have pointer-events */
    z-index: 10; /* Above other header content */
}

.sidebar-section-header:hover > button,
.sidebar-section-header:hover .dot-menu {
    opacity: 1;
}

/* Folders Navigation - content inside card */
.sidebar-folders-container {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 500px; /* Limit growth, force scrolling beyond this */
}

/* Hide scrollbar on folders container */
.sidebar-folders-container::-webkit-scrollbar {
    width: 0;
    display: none;
}

.sidebar-folders-container {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

/* Empty folders container just takes minimal space */
.sidebar-folders-container:empty {
    min-height: 0;
}

/* Add Folder Button */
.sidebar-add-folder-btn {
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: 1px dashed var(--border-default);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.sidebar-add-folder-btn:hover {
    background: var(--interactive-hover);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Entity Switcher */
.sidebar-entity-switcher {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    flex-shrink: 0;
}

.sidebar-entity-switcher:hover {
    border-color: var(--blue-primary);
}

.sidebar-entity-switcher:focus {
    outline: none;
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px rgba(var(--blue-primary-rgb), 0.1);
}

/* Board Item Active State */
.sidebar-container .board-item.active {
    background: var(--interactive-selected);
    color: var(--blue-primary);
    font-weight: 500;
}

/* Placeholder Folder */
.collapsible-section.placeholder {
    cursor: pointer;
    transition: all 0.2s;
}

.collapsible-section.placeholder:hover {
    background: var(--interactive-hover);
}

/* Hide chevron on placeholder folders (nothing to expand) */
.collapsible-section.placeholder .btn-chevron {
    opacity: 0;
    pointer-events: none;
}

.collapsible-section.placeholder .collapsible-section-title {
    color: var(--text-tertiary);
    font-style: italic;
}

.collapsible-section.placeholder:hover .collapsible-section-title {
    color: var(--blue-primary);
}

/* Placeholder Board */
.board-item.placeholder {
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s;
}

.board-item.placeholder:hover {
    opacity: 1;
    background: var(--interactive-hover);
}

.board-item.placeholder .board-item-name {
    color: var(--text-tertiary);
    font-style: italic;
}

.board-item.placeholder:hover .board-item-name {
    color: var(--blue-primary);
}


/* Responsive - Collapse on small screens */
@media (max-width: 768px) {
    .sidebar-container {
        width: 180px;
        min-width: 180px;
        padding: 6px;
    }

    .sidebar-section-header {
        padding: 0 10px;
        font-size: 14px;
    }
}
