/* ========================================= */
/* === MOBILE MENU DRAWER - RESPONSIVE   === */
/* ========================================= */
/* File này chứa tất cả CSS cho mobile menu drawer */
/* Được tách riêng để dễ bảo trì và chỉnh sửa */

/* 1. Overlay với hiệu ứng kính mờ (Glassmorphism) */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Màu nền tối nhẹ hơn để thấy hiệu ứng blur */
    background-color: rgba(0, 0, 0, 0.3);
    /* Hiệu ứng mờ nền phía sau */
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease;
}

/* 2. Drawer Container */
.mobile-menu-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    max-width: 85vw;
    height: 100%;
    background-color: #fff;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    z-index: 2001;
    transform: translateX(100%);
    /* Transition mượt hơn dạng cubic-bezier */
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
}

/* Trạng thái Active cho Body/Overlay/Drawer */
body.mobile-menu-active {
    overflow: hidden;
    overflow-x: hidden;
}
body.mobile-menu-active .mobile-menu-overlay {
    opacity: 1;
    visibility: visible;
}
body.mobile-menu-active .mobile-menu-drawer {
    transform: translateX(0);
}

.drawer-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f3f4f6;
    background-color: #fff;
    z-index: 2; /* Để nằm trên animation của items */
}
.drawer-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 5px;
    transition: all 0.2s;
}
.drawer-close-btn:hover {
    color: #dc3545;
    transform: rotate(90deg); /* Hiệu ứng xoay nhẹ khi hover nút đóng */
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

/* 3. Mobile Nav Item với Animation "Staggered" (Bay vào lần lượt) */
.mobile-nav-item {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    color: #374151;
    font-weight: 500;
    text-decoration: none;
    border-left: 3px solid transparent;

    /* Trạng thái mặc định: Ẩn và lệch sang phải */
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s ease-out;
}

/* Khi Menu Active: Hiện và về vị trí cũ */
body.mobile-menu-active .mobile-nav-item {
    opacity: 1;
    transform: translateX(0);
}

/* TẠO ĐỘ TRỄ (DELAY) CHO TỪNG DÒNG ĐỂ BAY VÀO LẦN LƯỢT */
body.mobile-menu-active .mobile-nav-item:nth-child(1) {
    transition-delay: 0.1s;
}
body.mobile-menu-active .mobile-nav-item:nth-child(2) {
    transition-delay: 0.15s;
}
body.mobile-menu-active .mobile-nav-item:nth-child(3) {
    transition-delay: 0.2s;
}
body.mobile-menu-active .mobile-nav-item:nth-child(4) {
    transition-delay: 0.25s;
}
body.mobile-menu-active .mobile-nav-item:nth-child(5) {
    transition-delay: 0.3s;
}
body.mobile-menu-active .mobile-nav-item:nth-child(6) {
    transition-delay: 0.35s;
}
body.mobile-menu-active .mobile-nav-item:nth-child(7) {
    transition-delay: 0.4s;
}
body.mobile-menu-active .mobile-nav-item:nth-child(8) {
    transition-delay: 0.45s;
}
body.mobile-menu-active .mobile-nav-item:nth-child(9) {
    transition-delay: 0.5s;
}
body.mobile-menu-active .mobile-nav-item:nth-child(10) {
    transition-delay: 0.55s;
}
body.mobile-menu-active .mobile-nav-item:nth-child(11) {
    transition-delay: 0.6s;
}

.mobile-nav-item i {
    width: 24px;
    margin-right: 12px;
    color: #6b7280;
    text-align: center;
    transition: color 0.2s;
}

/* Hover & Active State Styles */
.mobile-nav-item:hover,
.mobile-nav-item.active {
    background-color: rgba(46, 125, 113, 0.08);
    color: #2E7D71;
    border-left-color: #2E7D71;
    text-decoration: none;
}
.mobile-nav-item:hover i,
.mobile-nav-item.active i {
    color: #2E7D71;
}

.drawer-footer {
    padding: 20px;
    border-top: 1px solid #f3f4f6;
    /* Animation cho footer luôn */
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease-out;
}
body.mobile-menu-active .drawer-footer {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.5s; /* Hiện sau cùng */
}

.btn-auth-mobile {
    display: block;
    width: 100%;
    padding: 10px;
    text-align: center;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s, opacity 0.2s;
    border: none;
    cursor: pointer;
}
.btn-auth-mobile:active {
    transform: scale(0.98);
}
.btn-auth-mobile:hover {
    text-decoration: none;
    opacity: 0.9;
}
.btn-logout {
    background-color: #fee2e2;
    color: #dc2626;
}
.btn-google {
    background-color: #4285f4;
    color: white;
}

/* ========================================= */
/* === CSS CHỈNH SỬA CHO MOBILE          === */
/* ========================================= */

/* 1. CSS Cho Logo Mobile & Ẩn Menu Desktop */
@media (max-width: 991.98px) {
    .header-menu-wrapper nav {
        display: none !important;
    }
    .header-menu-wrapper {
        margin: 0 !important;
    }

    .mobile-logo-img {
        height: 30px;
        width: auto;
        margin-right: 8px;
        object-fit: contain;
    }

    .logo-link {
        font-size: 1.1rem !important;
        display: flex;
        align-items: center;
    }
    
    .logo-link .brand-text {
        display: flex;
        align-items: center;
    }
}

/* 2. CSS Cho Màn hình điện thoại nhỏ (Dưới 768px) */
@media (max-width: 767.98px) {
    .icon-btn {
        width: 36px;
        height: 36px;
    }
    .header-icons-wrapper {
        padding-right: 2px;
    }
}

/* 3. Ngăn chặn horizontal overflow trên mobile */
@media (max-width: 991.98px) {
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    /* Đảm bảo mobile menu drawer không gây overflow */
    .mobile-menu-drawer {
        max-width: min(280px, 85vw);
    }
}

