:root {
    --header-height: 100px;
}



html, body {
    margin: 0;
    height: 100%;
    width: 100%;
}

html {
    scrollbar-width: none;
    scrollbar-color: #909090 transparent;
    scrollbar-gutter: stable;
}

body {
    font-size: 14px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* =========================
   MOBILE
========================= */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 0;
        height: 0;
    }
    
    html {
        scrollbar-width: none;
    }
}


a {
    text-decoration: none;
}

ol,
ul {
    margin: 0;
    padding: 0;
}

ol > li,
ul > li {
    list-style: none;
}



/* =========================
   LAYOUT
========================= */
header,
main,
footer {
    box-sizing: border-box;
}

header {
    background: linear-gradient(
        105deg,
        #5420a5 0%,
        #7620c1 32%,
        #a51b91 60%,
        #c51b4d 82%,
        #d13c12 100%
    );
    color: #fff;
    box-shadow: 0 4px 20px rgba(92, 28, 160, 0.18);
    height: var(--header-height);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
}

main {
    padding-top: var(--header-height);
    min-height: calc(100dvh - var(--header-height));
}

footer {
    display: flex;
}


/* =========================
    HEADER
========================= */
.header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: 100%;
    padding: 0.75rem 0;
}

.header-ctrl {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-item {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
}
.header-item:nth-of-type(2) {
    width: 30%;
}




/* =====================================
   SEARCH INPUT - COMMON
===================================== */
.desktop-search,
.mobile-search {
    display: flex;
    align-items: center;
    gap: 12px;

    height: 38px;
    width: 100%;
    min-width: 0;

    padding: 0 14px;

    background: rgba(255, 255, 255, .2);
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 30px;

    color: #fff;

    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    box-sizing: border-box;
    transition: all .2s ease;
}

/* Focus */
.desktop-search:focus-within,
.mobile-search:focus-within {
    background: rgba(255, 255, 255, .23);
    border-color: rgba(255, 255, 255, .4);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .08);
}

/* Input */
.desktop-search .search-input,
.mobile-search .search-input {
    flex: 1;
    min-width: 0;
    width: 100%;

    padding: 0;
    border: 0;
    outline: 0;

    background: transparent;
    color: #fff;

    font-size: 14px;
    box-shadow: none;
}

.desktop-search .search-input::placeholder,
.mobile-search .search-input::placeholder {
    color: rgba(255, 255, 255, .5);
}

/* Ẩn nút X mặc định của trình duyệt */
.desktop-search input[type="search"]::-webkit-search-cancel-button,
.mobile-search input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

/* =====================================
   CLEAR BUTTON
===================================== */

.search-clear {
    display: none;
    align-items: center;
    justify-content: center;

    width: 28px;
    height: 28px;
    flex: 0 0 28px;

    padding: 0;
    border: 0;
    border-radius: 50%;

    background: transparent;
    color: #fff;

    font-size: 16px;
    cursor: pointer;
}

.search-clear.show {
    display: inline-flex;
}

.search-clear:hover {
    background: rgba(255, 255, 255, .18);
}

/* =====================================
   DESKTOP SEARCH
===================================== */
.desktop-search {
    width: 500px;
    max-width: 100%;
}

/* =====================================
   MOBILE SEARCH
===================================== */

#mobile-search {
    display: none;
}

@media (max-width: 768px) {

    #mobile-search {
        position: fixed;
        inset: 0;
        z-index: 99999;

        display: flex;
        flex-direction: column;

        background: #f8f7fc;

        opacity: 0;
        visibility: hidden;
        pointer-events: none;

        transform: translateX(100%);
        transition:
            transform .25s ease,
            opacity .25s ease,
            visibility .25s ease;
    }

    #mobile-search.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateX(0);
    }

    .mobile-search-header {
        display: flex;
        align-items: center;
        gap: 12px;

        padding: 12px 16px;

        background: linear-gradient(
            105deg,
            #5420a5,
            #7921c5,
            #c51b72,
            #d13c12
        );
    }

    .mobile-search {
        flex: 1;
        height: 38px;
    }

    .mobile-search-content {
        flex: 1;
        overflow-y: auto;
        padding: 20px 16px;
    }

    /* Ẩn desktop search */
    .desktop-search {
        display: none;
    }
}

.mobile-search-content {
    flex: 1;
    overflow-y: auto;
    padding: 25px 16px;
}

.search-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: 70px 15px;

    color: #999;
    text-align: center;
}

.search-empty i {
    font-size: 38px;
    color: #b9a0d8;
}

.search-empty p {
    margin-top: 12px;
    font-size: 14px;
}




.header-button > a, .header-profile > a {
    background: rgba(255, 255, 255, .3);
    backdrop-filter: blur(10px);
    color: #fff;
}
.header-button > a:hover, .header-profile > a:hover {
    background: rgba(255, 255, 255, .4);
    color: #eee;
}

.header-button {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    background: transparent;
}

.header-button > a {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    text-decoration: none;
    transition: background .2s ease;
}

.header-button .dot {
    display: inline-block;
    flex: 0 0 8px;
    width: 10px;
    height: 10px;
    margin-left: 8px;

    background-color: red;
    border: 1px solid yellow;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, .15);

    position: absolute;
    top: 15%;
    right: 20%;
}

/* Hiệu ứng nhấp nháy */
.header-button .dot.pulse {
    animation: notification-pulse 1.5s infinite;
}

@keyframes notification-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, .4);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(220, 53, 69, 0);
    }
}



/* =========================
   USER PROFILE
========================= */
.header-profile {
    width: auto;
    min-width: 38px;
    height: 38px;
    flex: 0 0 auto;
}

.header-profile > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 38px;
    width: auto;
    min-width: 38px;
    padding: 4px 14px 4px 4px;
    border-radius: 50px;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    box-sizing: border-box;
    transition: background .2s ease, border-color .2s ease;
}

.header-profile > a > .avatar {
    width: 30px;
    height: 30px;
    min-width: 30px;
    flex: 0 0 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffd0dc, #ffe2b8);
    border: 2px solid rgba(255, 255, 255, .7);
    color: #7921a8;
    font-size: 12px;
    font-weight: 700;
    box-sizing: border-box;
}

.header-profile > a > .username {
    display: block;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}


/* =========================
   MOBILE
========================= */
@media (max-width: 768px) {
    .form-search {
        display: none;
    }

    .header-profile {
        width: 38px;
        min-width: 38px;
        height: 38px;
        flex: 0 0 38px;
    }

    .header-profile > a {
        width: 38px;
        min-width: 38px;
        height: 38px;
        padding: 3px;
        gap: 0;
        border-radius: 50%;
    }

    .header-profile > a > .username {
        display: none;
    }
}




/* =========================================================
   HEADER MENU
========================================================= */
.header-menu {
    position: relative;
    z-index: 1000;
    width: 100%;
    font-size: 14px;
}

/* =========================================================
   MOBILE MENU BAR
========================================================= */
.header-menu-mobile {
    display: none;
    width: 100%;
}

.header-menu-mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 38px;
}

.header-menu-mobile-title {
    font-size: 14px;
    font-weight: 600;
}

.header-menu-mobile-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.header-menu-mobile-toggle:hover {
    background: rgba(128, 128, 128, 0.15);
}

.header-menu-mobile-toggle:focus-visible,
.header-menu-item > a:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* =========================================================
   MENU LIST
========================================================= */
.header-menu-desktop {
    display: block;
    width: 100%;
}

.header-menu-list {
    display: flex;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

.header-menu-item {
    position: relative;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Menu links - all levels */
.header-menu-item > a {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 38px;
    padding: 8px 14px 6px;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 8px 8px 0 0;
    color: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

.header-menu-item > a:hover {
    background: rgba(255, 255, 255, 0.16);
    border-bottom-color: currentColor;
}

.header-menu-item.active > a {
    border-bottom-color: currentColor;
    font-weight: 600;
}

/* Icons */
.header-menu-item > a > i {
    flex-shrink: 0;
    font-size: 15px;
}

.header-menu-arrow {
    flex-shrink: 0;
    margin-left: auto;
    font-size: 11px !important;
    transition: transform 0.2s ease;
}

/* =========================================================
   SUBMENU - ALL LEVELS
========================================================= */
.header-menu-submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1001;
    width: max-content;
    min-width: 220px;
    max-width: 280px;
    margin: 0;
    padding: 5px;
    list-style: none;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color);
    border-radius: 0;
    box-shadow: var(--bs-box-shadow);
}

/* Nested submenu */
.header-menu-submenu .header-menu-submenu {
    top: 0;
    left: 100%;
    margin-left: 5px;
}

/* Submenu links */
.header-menu-submenu .header-menu-item > a {
    min-height: 38px;
    padding: 8px 12px;
    border: 0;
    border-radius: 5px;
    color: inherit;
    font-size: 13px;
    font-weight: 400;
    white-space: normal;
}

.header-menu-submenu .header-menu-item > a:hover,
.header-menu-submenu .header-menu-item.active > a,
.header-menu-submenu .header-menu-item.open > a {
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
    border: 0;
}

/* =========================================================
   DESKTOP - SUBMENU BEHAVIOR
========================================================= */
@media (min-width: 769px) {

    /* Show submenu */
    .header-menu-item.open > .header-menu-submenu {
        display: block;
    }

    /* Prevent hover gap */
    .header-menu-item.has-submenu > .header-menu-submenu::before {
        content: "";
        position: absolute;
        top: -8px;
        left: 0;
        width: 100%;
        height: 8px;
        background: transparent;
    }

    /* Nested submenu hover bridge */
    .header-menu-submenu
    .header-menu-item.has-submenu > .header-menu-submenu::before {
        top: 0;
        left: -8px;
        width: 8px;
        height: 100%;
    }

    /* Keep parent highlighted */
    .header-menu-list > .header-menu-item.has-submenu.open > a {
        background: rgba(255, 255, 255, 0.16);
        border-bottom-color: currentColor;
    }

    /* Keep nested parent highlighted */
    .header-menu-submenu
    .header-menu-item.has-submenu.open > a {
        background: var(--bs-secondary-bg);
        color: var(--bs-body-color);
    }

    /* Arrow */
    .header-menu-item.open > a > .header-menu-arrow {
        transform: rotate(180deg);
    }

    .header-menu-submenu
    .header-menu-item.open > a > .header-menu-arrow {
        transform: rotate(90deg);
    }

}

/* =========================================================
   MOBILE
========================================================= */
@media (max-width: 768px) {

    .header-menu-mobile {
        display: block;
    }

    .header-menu-desktop {
        display: none;
        width: 100%;
        max-height: calc(100dvh - 100px);
        overflow-x: hidden;
        overflow-y: auto;
        background: var(--bs-body-bg);
        color: var(--bs-body-color);
        box-shadow: var(--bs-box-shadow);
    }

    .header-menu-desktop.open {
        display: block;
    }

    /* Main list */
    .header-menu-list {
        display: block;
        padding: 5px 10px;
        border: 1px solid var(--bs-border-color);
    }

    .header-menu-item {
        display: block;
        width: 100%;
    }

    /* All links */
    .header-menu-item > a {
        min-height: 42px;
        padding: 10px 12px;
        border: 0;
        border-radius: 6px;
        white-space: normal;
    }

    .header-menu-item > a:hover,
    .header-menu-item.active > a,
    .header-menu-item.open > a {
        border: 0;
    }

    .header-menu-item > a:hover {
        background: var(--bs-secondary-bg);
    }

    .header-menu-item.active > a {
        background: var(--bs-secondary-bg);
    }

    .header-menu-item.open > a {
        background: var(--bs-secondary-bg);
    }

    /* Submenu */
    .header-menu-submenu,
    .header-menu-submenu .header-menu-submenu {
        position: static;
        display: none;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        margin: 0;
        padding: 0 0 0 16px;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
        color: inherit;
    }

    .header-menu-item.open > .header-menu-submenu {
        display: block;
    }

    /* Submenu links */
    .header-menu-submenu .header-menu-item > a {
        min-height: 38px;
        padding: 9px 12px;
        font-size: 13px;
        border: 0;
    }

    .header-menu-submenu .header-menu-item > a:hover,
    .header-menu-submenu .header-menu-item.active > a,
    .header-menu-submenu .header-menu-item.open > a {
        background: var(--bs-tertiary-bg);
        color: var(--bs-body-color);
    }

    /* Arrow */
    .header-menu-arrow {
        transform: rotate(0deg);
    }

    .header-menu-item.open > a > .header-menu-arrow {
        transform: rotate(180deg);
    }

}

/* =========================================================
   SMALL MOBILE
========================================================= */
@media (max-width: 480px) {

    .header-menu-list {
        padding: 5px 8px;
    }

    .header-menu-item > a {
        padding: 10px;
    }

    .header-menu-submenu,
    .header-menu-submenu .header-menu-submenu {
        padding-left: 12px;
    }

}

/* =========================================================
   REDUCED MOTION
========================================================= */
@media (prefers-reduced-motion: reduce) {

    .header-menu *,
    .header-menu *::before,
    .header-menu *::after {
        transition: none !important;
        animation: none !important;
    }
}

