/* Premium Navbar & Header Layout CSS */
.navbar {
    height: 72px;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.02);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #0f172a;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -0.8px;
    text-decoration: none;
    background: linear-gradient(135deg, #0f172a 30%, #4f46e5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: transform 0.2s ease;
}

.logo:hover {
    transform: translateY(-0.5px);
}

.logo-icon {
    font-size: 26px;
    filter: drop-shadow(0 2px 8px rgba(79, 70, 229, 0.25));
    -webkit-text-fill-color: initial; /* reset gradient for emoji logo */
}

/* Menu links with animated underline and premium styling */
.nav-menu {
    display: flex;
    gap: 12px;
    align-items: center;
}

.nav-menu a {
    color: #475569;
    font-size: 14.5px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 12px;
    transition: all 0.2s ease;
    text-decoration: none;
    position: relative;
}

.nav-menu a:hover {
    color: #4f46e5;
    background: rgba(79, 70, 229, 0.05);
}

.nav-menu a.active {
    color: #4f46e5;
    background: rgba(79, 70, 229, 0.08);
}

.nav-menu a.active::after {
    content: "";
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 3px;
    background: #4f46e5;
    border-radius: 99px;
}

/* Actions list */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-link {
    color: #475569;
    font-weight: 700;
    font-size: 14.5px;
    padding: 10px 20px;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.login-link:hover {
    color: #4f46e5;
    border-color: rgba(79, 70, 229, 0.2);
    background: rgba(79, 70, 229, 0.02);
}

.register-btn {
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    color: #ffffff !important;
    padding: 10px 24px;
    border-radius: 12px;
    font-size: 14.5px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.2);
    transition: all 0.25s ease;
}

.register-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.3);
    background: linear-gradient(135deg, #4338ca 0%, #2563eb 100%);
}

/* Redesigned Profile Dropdown Styles */
.user-profile-dropdown {
    position: relative;
    display: inline-block;
}

/* Invisible bridge to cover hover gap between trigger and menu */
.user-profile-dropdown::before {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 0;
    right: 0;
    height: 12px;
    background: transparent;
    z-index: 105;
}

.profile-trigger-btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 6px 14px;
    border-radius: 99px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-trigger-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.profile-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #818cf8 0%, #4f46e5 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

.profile-username {
    font-size: 14px;
    font-weight: 700;
    color: #334155;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-chevron {
    font-size: 9px;
    color: #64748b;
    transition: transform 0.2s;
}

.user-profile-dropdown:hover .profile-chevron {
    transform: rotate(180deg);
}

/* Dropdown Content */
.profile-dropdown-content {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    min-width: 240px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.1);
    overflow: hidden;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 110;
}

.user-profile-dropdown:hover .profile-dropdown-content {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-header-info {
    padding: 16px 20px;
    background: #f8fafc;
}

.dropdown-header-info strong {
    font-size: 15px;
    color: #0f172a;
    display: block;
}

.dropdown-header-info p {
    font-size: 12px;
    color: #64748b;
    margin: 4px 0 0 0;
}

.dropdown-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 0;
}

.profile-dropdown-content a {
    color: #334155;
    padding: 12px 20px;
    text-decoration: none;
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
}

.profile-dropdown-content a:hover {
    background: #f1f5f9;
    color: #4f46e5;
}

.profile-dropdown-content .admin-link {
    color: #ef4444;
}

.profile-dropdown-content .admin-link:hover {
    background: #fef2f2;
    color: #b91c1c;
}

.profile-dropdown-content .logout-btn {
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.15s, color 0.15s;
}

.profile-dropdown-content .logout-btn:hover {
    background: #f8fafc;
    color: #0f172a;
}

/* Mobile Toggle Button */
.mobile-nav-toggle {
    display: none;
    font-size: 28px;
    background: none;
    border: none;
    color: #475569;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    outline: none;
}

.mobile-nav-toggle:hover {
    background: rgba(79, 70, 229, 0.05);
    color: #4f46e5;
}

/* Mobile Menu Drawer */
.mobile-menu-drawer {
    position: fixed;
    top: 0;
    right: -320px;
    width: 320px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: -10px 0 30px rgba(15, 23, 42, 0.08);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-menu-drawer.open {
    right: 0;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.mobile-menu-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.drawer-header {
    height: 72px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    flex-shrink: 0;
}

.close-drawer-btn {
    font-size: 22px;
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    outline: none;
}

.close-drawer-btn:hover {
    background: rgba(15, 23, 42, 0.05);
    color: #0f172a;
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.drawer-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.drawer-nav a {
    color: #475569;
    font-size: 16px;
    font-weight: 600;
    padding: 12px 16px;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.2s;
}

.drawer-nav a:hover, .drawer-nav a.active {
    color: #4f46e5;
    background: rgba(79, 70, 229, 0.05);
}

.drawer-nav a.active::after {
    display: none; /* Hide desktop underline active indicator in drawer */
}

.drawer-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 20px 0;
}

.drawer-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.drawer-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.drawer-user-info .profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #818cf8 0%, #4f46e5 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
}

.drawer-user-info .user-details {
    display: flex;
    flex-direction: column;
}

.drawer-user-info .profile-username {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

.drawer-user-info .user-role {
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
}

.drawer-user-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.drawer-user-nav a {
    color: #334155;
    padding: 10px 16px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.2s;
}

.drawer-user-nav a:hover {
    background: #f1f5f9;
    color: #4f46e5;
}

.drawer-user-nav .admin-link {
    color: #ef4444;
}

.drawer-user-nav .admin-link:hover {
    background: #fef2f2;
    color: #b91c1c;
}

.drawer-logout-btn {
    width: 100%;
    background: none;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.drawer-logout-btn:hover {
    background: #f8fafc;
    color: #0f172a;
    border-color: #94a3b8;
}

.drawer-auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.login-link-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    font-weight: 700;
    font-size: 15px;
    padding: 12px;
    border-radius: 12px;
    text-decoration: none;
    border: 1px solid #cbd5e1;
    transition: all 0.2s;
}

.login-link-mobile:hover {
    color: #4f46e5;
    background: rgba(79, 70, 229, 0.02);
    border-color: rgba(79, 70, 229, 0.2);
}

.register-btn-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    color: #ffffff !important;
    padding: 12px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.15);
    transition: all 0.2s;
}

.register-btn-mobile:hover {
    background: linear-gradient(135deg, #4338ca 0%, #2563eb 100%);
}

.drawer-lang-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.drawer-lang-selector .lang-label {
    font-size: 13px;
    color: #64748b;
    font-weight: 600;
}

.language-selector-mobile {
    display: flex;
    gap: 12px;
}

.language-selector-mobile a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    transition: all 0.2s;
}

.language-selector-mobile a.active-lang {
    background: rgba(79, 70, 229, 0.05);
    border-color: #4f46e5;
    color: #4f46e5;
}

/* Responsive constraints */
@media (max-width: 1100px) {
    .nav-menu {
        display: none;
    }
    
    .mobile-nav-toggle {
        display: block;
    }
}

@media (max-width: 700px) {
    .navbar {
        padding: 0 20px;
    }

    .nav-actions {
        display: none;
    }
}
 .user-menu {
     display: flex;
     align-items: center;
     gap: 12px;
     height: 30px; /* CHỐT chiều cao chung */
 }

.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px ;
    height: 30px ;
    border-radius: 50%;
    overflow: hidden;
    background: transparent; /* xoá nền đen */
    border: none; /* xoá viền nếu có */
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* nút đăng xuất */
.logout-btn {
    padding: 4px 10px;
    border: 1px solid #ff4d4f;
    color: #ff4d4f;
    border-radius: 20px;
    text-decoration: none;
    font-size: 14px;
    transition: 0.2s;
    height: 28px; /* ÉP bằng avatar */
}

.logout-btn:hover {
    background: #ff4d4f;
    color: white;
}