/* ============================================
   CSS HEADER
   ============================================ */
.ce-header {
    padding: 10px 0;
    /* Reduced padding slightly to accommodate larger logo */
    position: sticky;
    top: 0;
    z-index: 100;
    /* Lower z-index, will be increased on desktop via media query */
}

.logo a {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.logo-img {
    height: 38px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    font-size: 21px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
    text-transform: uppercase;
}

.logo-text.text-primary {
    color: #f9a22e;
}

.logo-text .text-secondary {
    color: var(--white);

}



.ce-header.sticky {
    background: #2e3293;
    box-shadow: var(--shadow-md);
    padding: 10px 0;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

.main-nav a {
    font-weight: 500;
    font-size: 16px;
    position: relative;
    padding: 10px 0;
    color: var(--white);
}

.main-nav a:hover,
.main-nav a.active {
    color: #ffbf5d;
}

.has-dropdown {
    position: relative;
}

.has-dropdown>a>i {
    font-size: 10px;
    margin-left: 6px;
    position: relative;
    top: -2px;
}

.dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white);
    box-shadow: var(--shadow-md);
    min-width: 200px;
    border-radius: 12px;
    padding: 10px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.has-dropdown:hover .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown>a {
    display: block;
    padding: 8px 15px;
    font-size: 15px;
    color: var(--text-color);
}

.dropdown>a:hover {
    color: #444db0;
    background: #edf0fe;
}

.decoration-icon {
    font-size: 12px;
    margin-left: 4px;
}

.header-actions .icon-btn {
    font-size: 18px;
    color: var(--text-color);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    transition: 0.2s;
    background: transparent;
}

.header-actions .icon-btn:hover {
    opacity: 1;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: white;
    /* No z-index - let it be under overlay */
}

.mobile-menu-close {
    display: none;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-color);
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    transition: var(--transition-normal);
    z-index: 1001;
}

.mobile-menu-close:hover {
    background: var(--secondary-color);
    transform: rotate(90deg);
}




/* CSS bổ sung */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-action-item {
    position: relative;
    /* This will be the positioning context for popups */
}

.header-action-item:hover .icon-btn {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

/* Badge Counter */
.header-action-item .icon-btn {
    position: relative;
}

.header-action-item .badge {
    position: absolute;
    top: -5px;
    right: -6px;
    background: #d72974;
    color: var(--white);
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

/* Badge animation khi có số lớn */
.header-action-item .badge {
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* ============================================
   NOTIFICATION POPUP
   ============================================ */
.notification-popup {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    width: 380px;
    max-height: 500px;
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition-normal);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notification-wrapper.active .notification-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Notification Header */
.notification-header {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-color);
}

.mark-all-read {
    font-size: 13px;
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-fast);
}

.mark-all-read:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Notification List - Scrollable */
.notification-list {
    max-height: 360px;
    overflow-y: auto;
}

.notification-list::-webkit-scrollbar {
    width: 6px;
}

.notification-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.notification-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.notification-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Notification Item */
.notification-item {
    display: flex;
    gap: 12px;
    padding: 8px 16px;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    border-top: solid 1px #e1e1e1;
    background: var(--white);
    padding-bottom: 4px;
}

.notification-item:hover {
    background: #f8f9fa;
}

/* Đảo ngược: xanh nhạt = đã đọc */
.notification-item:not(.unread) {
    background: #ecedf9;
}

.notification-item:not(.unread):hover {
    background: #d9ebff;
}

/* Avatar */
.notification-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

/* Content */
.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-color);
}

.notification-text strong {
    font-weight: 600;
    color: var(--primary-color);
}

.notification-time {
    font-size: 12px;
    color: var(--text-light);
}

/* Unread Dot - Chấm màu hồng cho item chưa đọc */
.unread-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #d72974;
    flex-shrink: 0;
    align-self: center;
}

/* Notification Footer */
.notification-footer {
    display: block;
    padding: 10px 16px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 14px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition-fast);
}

.notification-footer:hover {
    background: var(--primary-color);
    color: var(--white);
}

.notification-footer i {
    font-size: 12px;
    margin-left: 6px;
}

/* Responsive - Mobile Notification Popup */
@media (max-width: 767px) {
    .notification-popup {
        position: fixed;
        top: 50%;
        left: 50%;
        right: auto;
        transform: translate(-50%, -50%) scale(0.9);
        width: calc(100% - 24px);
        max-width: 500px;
        max-height: 70vh;
        opacity: 0;
        visibility: hidden;
    }

    .notification-list {
        max-height: calc(80vh);
    }

    .notification-wrapper.active .notification-popup {
        opacity: 1;
        visibility: visible;
        transform: translate(-50%, -50%) scale(1);
    }

    /* Show overlay when notification is active */
    .notification-wrapper.active~.menu-overlay,
    .notification-wrapper.active+* .menu-overlay {
        opacity: 1;
        visibility: visible;
    }
}




.ce-header .main-nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 40px;
}

.header-actions .icon-btn>i {
    color: var(--white);
    transition: 0.2s;
}

/* ============================================
   USER PROFILE DROPDOWN
   ============================================ */
.wp-info-user-header {
    position: relative;
    display: inline-block;
}

.avatar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-full);
    transition: var(--transition-normal);
}

.avatar-user:hover {
    background: rgba(255, 255, 255, 0.2);
}

.img-ava {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--white);
    object-fit: cover;
    display: block;
}


.avatar-user i {
    color: var(--white);
    font-size: 10px;
    transition: var(--transition-normal);
}

.wp-info-user-header:hover .avatar-user i {
    transform: rotate(180deg);
}

/* User Dropdown Menu - chỉ ghi đè những gì khác .dropdown chung */
.wp-info-user-header .dropdown {
    right: 0;
    /* Ghi đè left: 0 của .dropdown chung */
    left: auto;
}


.wp-info-user-header .dropdown a {
    font-weight: 500;
}

.wp-info-user-header .dropdown a i {
    margin-right: 8px;
    color: #b5b5b5;
    font-size: 13px;
    width: 16px;
    text-align: center;
    transition: 0.3s;
}

.wp-info-user-header .dropdown a:hover {
    color: #444db0;
    background: #edf0fe;
}

.wp-info-user-header .dropdown a:hover i {
    color: #444db0;
}

/* Style riêng cho button Đăng xuất */
.wp-info-user-header .dropdown button.signout {
    border: none;
    width: 90%;
    background: #ffe9e9;
    margin: auto;
    border-radius: 6px;
    text-align: center;
    margin-top: 8px;
    cursor: pointer;
    display: block;
    padding: 10px 16px;
    font-size: 14px;
    color: #dc3545;
    font-weight: 600;
    transition: 0.2s;
    font-family: var(--font-family);
}

.wp-info-user-header .dropdown button.signout:hover {
    color: #fff;
    background: #dc3545;
}

.wp-info-user-header .dropdown button.signout i {
    margin-left: 8px;
    font-size: 14px;
}

/* ============================================
   DESKTOP STYLES
   ============================================ */



/* ============================================
   RESPONSIVE STYLES
   ============================================ */

/* Responsive cho Mobile Dropdown */
@media (max-width: 991px) {
    .has-dropdown.active-dropdown .dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        box-shadow: none;
        padding: 0px 12px;
        background: #f8f9fa;
        display: block;
        margin-bottom: 12px;
    }

    /* Chỉ ẩn dropdown của navigation menu, không ảnh hưởng user profile */
    .main-nav .has-dropdown:not(.active-dropdown) .dropdown {
        display: none;
    }
}

/* Responsive cho Navigation và Header */
@media (max-width: 991px) {
    .ce-header {
        padding: 10px 0;
    }


    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        padding: 5px;
        width: 40px;
        height: 40px;
        /* No z-index, will be under overlay. Hidden via JS when menu opens */
    }

    .mobile-menu-close {
        display: block;
    }

    .main-nav {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        background: var(--white);
        padding: 20px 20px 20px;
        box-shadow: var(--shadow-lg);
        transition: var(--transition-normal);
        flex-direction: column;
        display: flex;
        z-index: 1000;
        overflow-y: auto;
    }

    .main-nav.active {
        left: 0;
    }

    .ce-header .main-nav ul {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 0;
    }

    .main-nav ul li {
        width: 100%;
        border-bottom: 1px solid #f0f0f0;
    }

    .main-nav a {
        display: block;
        padding: 16px 0;
        font-size: 15px;
        color: var(--text-color);
    }

    .main-nav a:hover,
    .main-nav a.active {
        color: var(--primary-color);
    }

    .header-actions .icon-btn {
        opacity: 1;
        font-size: 16px;
    }

    .main-nav .dropdown a {
        font-size: 15px;
        font-weight: 400;
        padding: 10px 0px;
    }



}

@media (max-width: 575px) {
    .logo-text {
        width: 90px;
        font-size: 14px;
        font-weight: 600;
        position: absolute;
        left: 45px;
        top: 7px;
    }

    .logo-img {

        height: 32px;
    }

    .logo a {
        gap: 2px;

    }

    .logo.collapse-style .logo-img {
        width: 180px;
        max-width: none;
        height: 40px;
    }

    .logo.collapse-style a {
        width: 38px;
        overflow: hidden;
    }

    .ce-header.sticky {
        padding: 4px 0px;
    }

    .ce-header .container {
        padding: 0 8px;
    }

    .btn-learn-header {
        padding: 4px 8px;
        font-weight: 500;
        font-size: 13px;
    }

    .btn-login-header {
        padding: 6px 12px;
    }

    .header-actions {
        gap: 8px;
    }
}

@media (min-width: 576px) and (max-width: 767px) {
    .logo-text {
        font-size: 16px;
        width: 120px;
    }

    .logo a {
        gap: 6px;
    }

    .ce-header.sticky {
        padding: 6px 0px;
    }

    .logo-img {
        height: 32px;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .logo-text {
        font-size: 18px;
    }

    .ce-header.sticky {
        padding: 6px 0px;
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .logo-text {
        font-size: 17px;
        width: 120px;
    }

    .logo a {
        gap: 6px;
    }

    .ce-header .main-nav ul {
        gap: 20px;
    }

    .header-actions {
        gap: 8px;
    }

    .ce-header.sticky {
        padding: 6px 0px;
    }
}


@media (min-width: 1200px) and (max-width: 1499px) {
    .logo-text {
        font-size: 18px;
        width: 120px;
    }

    .logo a {
        gap: 6px;
    }

    .ce-header .main-nav ul {
        gap: 28px;
    }

    .header-actions {
        gap: 8px;
    }
}

/* Menu Overlay */
body.menu-open {
    overflow: hidden;
}

body.overflow-hidden {
    overflow: hidden;
    height: 100vh;
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   KẾT THÚC CSS HEADER
   ============================================ */