/* ===== Header Styles ===== */
body {
    margin: 0;
}

:root {
    --brand-blue: #1e3c72;
    --brand-blue-light: #2a5298;
    --header-bg: #ffffff;
    --header-text: #1e293b;
    --header-text-hover: #1e3c72;
    --header-border: #e2e8f0;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.site-header .container,
.header-main-inner {
    max-width: 1500px;
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
}

/* ---- Main Header Layout ---- */
.header-main-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

/* Logo (Far Left) */
.site-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.site-logo a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.site-logo img {
    height: 42px;
    width: auto;
    object-fit: contain;
}

/* Main Navigation (Centered in Middle) */
.main-nav {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-nav .main-nav-account {
    display: none;
}

.main-nav>ul {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.main-nav>ul>li {
    position: relative;
}

.main-nav a {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--header-text);
    font-weight: 500;
    font-size: 17px;
    text-decoration: none;
    white-space: nowrap;
    padding: 6px 2px;
    transition: color 0.2s ease;
}

.main-nav>ul>li>a:hover,
.main-nav>ul>li.is-open>a {
    color: var(--brand-blue);
}

/* Arrow indicator */
.submenu-arrow {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    margin-top: -2px;
    transition: transform 0.2s ease;
    opacity: 0.6;
}

.has-submenu.is-open>a .submenu-arrow,
.has-megamenu.is-open>a .submenu-arrow {
    transform: rotate(-135deg);
    margin-top: 2px;
}

/* Icons (Far Right) */
.header-icons {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #334155;
    padding: 0;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
    position: relative;
}

.icon-btn:hover {
    color: var(--brand-blue);
}

.icon-btn img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.header-account-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--brand-blue);
    color: #ffd700;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
}

.cart-icon-btn {
    position: relative;
}

.cart-count-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: #dc3545;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- Toast Giỏ hàng ---- */
.toast-gio-hang {
    position: fixed;
    top: 85px;
    right: 20px;
    z-index: 9999;
    background: #16a34a;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14.5px;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

.toast-gio-hang.show {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Search Box ---- */
.search-box {
    position: absolute;
    top: calc(100% + 6px);
    right: 24px;
    z-index: 100;
    display: flex;
    align-items: center;
    width: 340px;
    height: 44px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    padding: 4px 6px 4px 16px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.search-box.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    padding: 0;
    font-size: 14px;
    color: #1e293b;
    background: transparent;
}

.search-box input::placeholder {
    color: #94a3b8;
}

.search-box button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 6px;
    background: var(--brand-blue);
    color: #ffffff;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.search-box button:hover {
    background: var(--brand-blue-light);
}

/* Search Suggestions */
.search-suggest {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 380px;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
    display: none;
    padding: 6px 0;
}

.search-suggest.is-open {
    display: block;
}

.search-suggest-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    text-decoration: none;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
}

.search-suggest-item:hover,
.search-suggest-item.is-active {
    background: #f8fafc;
}

.search-suggest-item img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
    background: #f8fafc;
    flex-shrink: 0;
}

.search-suggest-item-info {
    min-width: 0;
    flex: 1;
}

.search-suggest-item-name {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-suggest-item-meta {
    display: block;
    font-size: 12px;
    color: #64748b;
}

.search-suggest-item-price {
    font-size: 13.5px;
    font-weight: 700;
    color: #dc3545;
}

.search-suggest-empty,
.search-suggest-viewall {
    display: block;
    padding: 10px 14px;
    font-size: 13.5px;
    text-align: center;
    color: #64748b;
}

.search-suggest-viewall {
    color: var(--brand-blue);
    font-weight: 600;
    text-decoration: none;
}

/* ---- Submenu Dropdown ---- */
.submenu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 50;
    min-width: 220px;
    padding: 8px 0;
    list-style: none;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

.submenu::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
}

.has-submenu.is-open>.submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.submenu li {
    width: 100%;
}

.submenu a {
    display: block;
    padding: 8px 16px;
    font-size: 15px;
    color: #334155;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.submenu a:hover {
    background: #f8fafc;
    color: var(--brand-blue);
}

/* ---- Mega Menu ---- */
.megamenu {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    z-index: 50;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.14);
    border: 1px solid #e2e8f0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    min-width: 520px;
    pointer-events: none;
}

.megamenu::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
}

.has-megamenu.is-open>.megamenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* Desktop Hover Support */
@media (min-width: 993px) {
    .has-submenu:hover>.submenu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }

    .has-megamenu:hover>.megamenu {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
        pointer-events: auto;
    }

    .has-submenu:hover>a,
    .has-megamenu:hover>a {
        color: var(--brand-blue);
    }

    .has-submenu:hover>a .submenu-arrow,
    .has-megamenu:hover>a .submenu-arrow {
        transform: rotate(-135deg);
        margin-top: 2px;
    }
}

.megamenu-inner {
    display: flex;
}

.megamenu-content-group {
    display: flex;
    gap: 36px;
    padding: 24px 28px;
    align-items: flex-start;
    width: 100%;
}

.megamenu-cols {
    display: flex;
    gap: 32px;
    flex: 1;
}

.megamenu-col {
    min-width: 200px;
}

.megamenu-col h4 {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.megamenu-desc {
    margin: 0 0 14px;
    font-size: 15px;
    line-height: 1.5;
    color: #64748b;
    white-space: normal;
}

.megamenu-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.megamenu-col ul li {
    margin-bottom: 8px;
}

.megamenu-col ul a {
    font-size: 16px;
    font-weight: 500;
    color: #334155;
    text-decoration: none;
    transition: color 0.15s ease;
}

.megamenu-col ul a:hover {
    color: var(--brand-blue);
}

.megamenu-promo {
    flex-shrink: 0;
    width: 220px;
    border-left: 1px solid #f1f5f9;
    padding-left: 24px;
}

.megamenu-promo a {
    display: block;
    text-decoration: none;
}

.megamenu-promo img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

/* ---- Mobile Toggle ---- */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--brand-blue);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle.is-active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ---- Mobile Responsive ---- */
@media (max-width: 992px) {
    .header-main-inner {
        padding: 8px 16px;
        height: 60px;
    }

    .nav-toggle {
        display: flex;
        flex-shrink: 0;
    }

    .site-logo {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
    }

    .site-logo img {
        height: 34px;
    }

    .main-nav {
        display: none;
    }

    .main-nav.is-open {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        top: 60px;
        bottom: 0;
        z-index: 999;
        background: #ffffff;
        overflow-y: auto;
        padding: 16px 20px 32px;
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
    }

    .main-nav>ul {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .main-nav a {
        padding: 14px 0;
        font-size: 15px;
        border-bottom: 1px solid #f1f5f9;
        justify-content: space-between;
    }

    .main-nav .main-nav-account {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 14px 0;
        margin-top: 12px;
        border-top: 4px solid #f1f5f9;
        color: #0f172a;
        font-weight: 600;
        font-size: 15px;
        text-decoration: none;
    }

    .search-box {
        right: 16px;
        left: 16px;
        width: auto;
    }

    .submenu,
    .megamenu {
        position: static;
        display: none;
        opacity: 1;
        visibility: visible;
        transform: none !important;
        box-shadow: none;
        border: none;
        background: #f8fafc;
        border-radius: 6px;
        margin: 4px 0 8px;
        padding: 8px 12px;
        min-width: 0;
    }

    .has-submenu.is-open>.submenu,
    .has-megamenu.is-open>.megamenu {
        display: block;
    }

    .megamenu-content-group {
        flex-direction: column;
        gap: 16px;
        padding: 8px 0;
    }

    .megamenu-cols {
        flex-direction: column;
        gap: 12px;
    }

    .megamenu-promo {
        display: none;
    }
}

/* ===== Account Modal ===== */
.account-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(15, 23, 42, 0.6);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.account-modal-overlay.is-open {
    display: flex;
}

.account-modal {
    position: relative;
    width: 100%;
    max-width: 380px;
    background: #ffffff;
    border-radius: 16px;
    padding: 32px 28px 28px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.account-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    font-size: 15px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.account-modal-title {
    margin: 0 0 16px;
    font-size: 20px;
    font-weight: 800;
    color: var(--brand-blue);
}

.account-modal-mascot {
    width: 76px;
    height: 76px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--brand-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffd700;
    font-size: 38px;
}

.account-modal-desc {
    margin: 0 0 24px;
    font-size: 14px;
    line-height: 1.5;
    color: #475569;
}

.account-modal-actions {
    display: flex;
    gap: 12px;
}

.account-modal-btn {
    flex: 1;
    padding: 12px 16px;
    border-radius: 999px;
    font-size: 14.5px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.account-modal-btn-outline {
    background: #ffffff;
    color: var(--brand-blue);
    border: 1.5px solid var(--brand-blue);
}

.account-modal-btn-solid {
    background: var(--brand-blue);
    color: #ffffff;
    border: none;
}