/* assets/css/style.css (Bản nâng cấp cuối cùng - Hỗ trợ Scroll) */

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #fff;
    --top-navbar-height: 56px;
}

body {
    background-color: #f8f9fa;
}

.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* --- Cấu hình Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid #dee2e6;
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 1032;
    transition: margin-left 0.3s ease-in-out;
    /* [THÊM MỚI] Sử dụng Flexbox để quản lý layout bên trong sidebar */
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 0 1rem;
    border-bottom: 1px solid #dee2e6;
    height: var(--top-navbar-height);
    display: flex;
    align-items: center;
    /* [THÊM MỚI] Đảm bảo header không co lại */
    flex-shrink: 0;
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: bold;
    color: #212529;
    text-decoration: none;
}

/* [THÊM MỚI] Logic cho scroll */
.sidebar-body {
    /* Cho phép phần thân tự động co giãn để lấp đầy không gian còn lại */
    flex-grow: 1;
    /* CHÌA KHÓA: Tự động hiển thị thanh cuộn theo chiều dọc khi cần */
    overflow-y: auto;
}

.sidebar-body .list-group-item {
    border-radius: 0;
    border-left: 3px solid transparent;
    transition: background-color 0.2s ease, border-left-color 0.2s ease;
    border-bottom: none;
    border-top: none;
    padding: 0.9rem 1rem;
    color: #495057;
}

.sidebar-body .list-group-item i {
    color: #6c757d;
}

.sidebar-body .list-group-item.active {
    background-color: #e9f2ff;
    color: #0d6efd;
    border-left-color: #0d6efd;
    font-weight: 500;
}
.sidebar-body .list-group-item.active i {
    color: #0d6efd;
}

.sidebar-body .list-group-item:not(.active):hover {
    background-color: #f1f1f1;
}


/* --- Cấu hình Content --- */
.main-content {
    width: 100%;
    transition: margin-left 0.3s ease-in-out;
}

.top-navbar {
    height: var(--top-navbar-height);
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* === PHẦN RESPONSIVE === */
@media (min-width: 992px) {
    .main-content {
        margin-left: var(--sidebar-width);
    }
}
@media (max-width: 991.98px) {
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    .sidebar.is-open {
        margin-left: 0;
    }
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0,0,0,0.5);
        z-index: 1031;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    }
    .sidebar-overlay.is-open {
        opacity: 1;
        visibility: visible;
    }
}