/* =====================================================
   MOBILE SIDEBAR - Modern Redesign (Override)
   Ghi đè style.css cho sidebar mobile
   ===================================================== */

/* --- Sidebar Container --- */
.sidebar {
    position: fixed;
    top: 0;
    left: -340px;
    width: 320px;
    max-width: 88vw;
    height: 100vh;
    background: linear-gradient(160deg, #1565c0 0%, #0d47a1 40%, #0a3a8f 100%);
    z-index: 1050;
    transition: left 0.38s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
    box-shadow: 6px 0 40px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.sidebar.active {
    left: 0;
}

/* --- Sidebar Header --- */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}

.sidebar-logo {
    height: 44px;
    width: auto;
    object-fit: contain;
    border-radius: 8px;
    filter: brightness(1.1) drop-shadow(0 2px 6px rgba(0,0,0,0.3));
}

.sidebar-close {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    font-size: 1.4rem;
    font-weight: 300;
    cursor: pointer;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.25s ease;
    line-height: 1;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: rotate(90deg) scale(1.1);
}

/* --- Sidebar Brand Strip --- */
.sidebar-brand {
    padding: 14px 20px 10px;
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.sidebar-brand-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.75);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-align: center;
}

/* --- Sidebar Scroll Area --- */
.sidebar-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 0 20px;
    /* Custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.25) transparent;
}

.sidebar-body::-webkit-scrollbar {
    width: 4px;
}
.sidebar-body::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.25);
    border-radius: 4px;
}

/* --- Sidebar Menu --- */
.sidebar-menu {
    list-style: none;
    padding: 0 14px;
    margin: 0;
}

.sidebar-menu > li {
    margin-bottom: 4px;
}

/* --- Level 1 Link (parent) --- */
.sidebar-menu > li > a,
.sidebar-menu > li > .sidebar-item-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    padding: 13px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 12px;
    transition: background 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid transparent;
    cursor: pointer;
    width: 100%;
    text-align: left;
    position: relative;
}

.sidebar-menu > li > a:hover,
.sidebar-menu > li > .sidebar-item-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.22);
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.sidebar-menu > li > a.active,
.sidebar-menu > li.open > .sidebar-item-btn {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* --- Icon wrapper --- */
.sb-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
    transition: background 0.22s;
}

.sidebar-menu > li > a:hover .sb-icon,
.sidebar-menu > li.open > .sidebar-item-btn .sb-icon,
.sidebar-menu > li > a.active .sb-icon {
    background: rgba(255, 255, 255, 0.28);
}

/* --- Label --- */
.sb-label {
    flex: 1;
    line-height: 1.3;
}

/* --- Chevron (for items with submenu) --- */
.sb-chevron {
    font-size: 0.75rem;
    opacity: 0.7;
    transition: transform 0.3s ease, opacity 0.3s ease;
    flex-shrink: 0;
    margin-left: auto;
}

.sidebar-menu > li.open > .sidebar-item-btn .sb-chevron {
    transform: rotate(180deg);
    opacity: 1;
}

/* --- Submenu (Level 2) --- */
.sidebar-submenu {
    list-style: none;
    padding: 0;
    margin: 4px 0 4px 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
    border-left: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 0 0 0 8px;
}

.sidebar-menu > li.open > .sidebar-submenu {
    max-height: 500px;
    opacity: 1;
}

.sidebar-submenu > li {
    margin: 2px 0;
}

.sidebar-submenu > li > a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px 10px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
    position: relative;
}

.sidebar-submenu > li > a::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    flex-shrink: 0;
    transition: background 0.2s ease, transform 0.2s ease;
}

.sidebar-submenu > li > a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    padding-left: 20px;
}

.sidebar-submenu > li > a:hover::before {
    background: #fff;
    transform: scale(1.3);
}

.sidebar-submenu > li > a.active {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.sidebar-submenu > li > a.active::before {
    background: #fff;
}

/* --- Divider --- */
.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 10px 14px;
    border: none;
}

/* --- Sidebar Overlay --- */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 1049;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.38s ease, visibility 0.38s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* --- Hamburger button (mobile only) --- */
@media (max-width: 992px) {
    .hamburger {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        padding: 0;
        border-radius: 10px;
        background: #1565c0;
        border: 2px solid #1565c0;
        color: #fff;
        font-size: 1.1rem;
        cursor: pointer;
        transition: background 0.2s, transform 0.2s;
    }

    .hamburger:hover {
        background: #0d47a1;
        border-color: #0d47a1;
        transform: scale(1.05);
    }
}

/* Ẩn sidebar trên desktop */
@media (min-width: 993px) {
    .sidebar,
    .sidebar-overlay {
        display: none !important;
    }
}
