/* =====================================
   MAIN HEADER
===================================== */

.mbs-header {
    position: relative;
    z-index: 1100;
    width: 100%;
    background: #ffffff;
    border-bottom: 1px solid var(--mbs-border);
    transition:
        top 0.35s ease,
        background-color 0.35s ease,
        border-color 0.35s ease,
        box-shadow 0.35s ease,
        backdrop-filter 0.35s ease;
}

body.home .mbs-header {
    position: fixed;
    top: var(--mbs-announcement-height);
    right: 0;
    left: 0;
    background: transparent;
    border-bottom-color: rgba(255, 255, 255, 0.16);
}

body.home .mbs-header.is-scrolled {
    top: 0;
    background: rgba(255, 255, 255, 0.97);
    border-bottom-color: var(--mbs-border);
    box-shadow: 0 10px 35px rgba(8, 20, 35, 0.08);
    backdrop-filter: blur(14px);
}

.mbs-header-container {
    width: min(calc(100% - 52px), var(--mbs-container));
    height: var(--mbs-header-height);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr) 180px;
    align-items: center;
    gap: 24px;
}

/* =====================================
   LOGO
===================================== */

.mbs-logo {
    display: flex;
    align-items: center;
}

.mbs-logo .custom-logo-link {
    display: inline-flex;
    align-items: center;
}

.mbs-logo .custom-logo {
    width: auto;
    max-width: 170px;
    height: auto;
    max-height: 58px;
    object-fit: contain;
    transition: filter 0.3s ease;
}

.mbs-logo > a:not(.custom-logo-link) {
    color: var(--mbs-text);
    font-size: 28px;
    font-weight: 600;
}

body.home .mbs-header:not(.is-scrolled) .mbs-logo .custom-logo {
    filter: brightness(0) invert(1);
}

/* =====================================
   DESKTOP MENU
===================================== */

.mbs-main-menu {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mbs-navigation {
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    list-style: none;
}

.mbs-menu-item {
    position: relative;
    list-style: none;
}

.mbs-menu-item > a {
    min-height: var(--mbs-header-height);
    color: var(--mbs-text);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: color 0.25s ease;
}

body.home .mbs-header:not(.is-scrolled) .mbs-menu-item > a {
    color: #ffffff;
}

.mbs-menu-item > a:hover,
.mbs-menu-item.is-current > a {
    color: var(--mbs-primary);
}

body.home
.mbs-header:not(.is-scrolled)
.mbs-menu-item > a:hover,
body.home
.mbs-header:not(.is-scrolled)
.mbs-menu-item.is-current > a {
    color: var(--mbs-primary);
}

.mbs-menu-chevron {
    width: 14px;
    height: 14px;
    transition: transform 0.25s ease;
}

.mbs-menu-item:hover .mbs-menu-chevron {
    transform: rotate(180deg);
}

/* =====================================
   DESKTOP SUBMENU
===================================== */

.mbs-submenu {
    position: absolute;
    top: calc(100% - 1px);
    left: 0;
    z-index: 50;
    min-width: 250px;
    margin: 0;
    padding: 10px 0;
    border: 1px solid var(--mbs-border);
    background: #ffffff;
    box-shadow: 0 18px 45px rgba(8, 20, 35, 0.1);
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    pointer-events: none;
    transition:
        opacity 0.25s ease,
        visibility 0.25s ease,
        transform 0.25s ease;
}

.mbs-menu-item:hover > .mbs-submenu,
.mbs-menu-item:focus-within > .mbs-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.mbs-submenu li {
    margin: 0;
    list-style: none;
}

.mbs-submenu a {
    min-height: 44px;
    padding: 10px 20px;
    color: var(--mbs-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    font-size: 14px;
    letter-spacing: 0;
    text-transform: none;
    transition:
        color 0.25s ease,
        background-color 0.25s ease,
        padding-left 0.25s ease;
}

.mbs-submenu a:hover {
    padding-left: 25px;
    background: #fafafa;
    color: var(--mbs-primary);
}

.mbs-category-submenu small {
    color: #999999;
    font-size: 11px;
}

.mbs-submenu-toggle {
    display: none;
}

/* =====================================
   HEADER ACTIONS
===================================== */

.mbs-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 17px;
}

.mbs-header-icon {
    position: relative;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--mbs-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition:
        color 0.25s ease,
        background-color 0.25s ease;
}

body.home
.mbs-header:not(.is-scrolled)
.mbs-header-icon {
    color: #ffffff;
}

.mbs-header-icon:hover {
    color: var(--mbs-primary);
}

.mbs-header-icon svg {
    width: 23px;
    height: 23px;
}

.mbs-cart-count {
    position: absolute;
    top: -4px;
    right: -3px;
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: var(--mbs-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
}

/* =====================================
   MOBILE CONTROLS
===================================== */

.mbs-mobile-left,
.mbs-mobile-right {
    display: none;
}

.mbs-mobile-cart {
    position: relative;
    width: 42px;
    height: 42px;
    color: var(--mbs-text);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mbs-mobile-cart svg {
    width: 25px;
    height: 25px;
}

.mbs-mobile-toggle {
    width: 42px;
    height: 42px;
    padding: 8px;
    border: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.mbs-mobile-toggle span {
    width: 24px;
    height: 2px;
    background: var(--mbs-text);
    transition:
        transform 0.25s ease,
        opacity 0.25s ease,
        background-color 0.25s ease;
}

.mbs-mobile-toggle.is-active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mbs-mobile-toggle.is-active span:nth-child(2) {
    opacity: 0;
}

.mbs-mobile-toggle.is-active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

body.home
.mbs-header:not(.is-scrolled)
.mbs-mobile-toggle span {
    background: #ffffff;
}

body.home
.mbs-header:not(.is-scrolled)
.mbs-mobile-cart {
    color: #ffffff;
}

.mbs-mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(8, 20, 35, 0.55);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity 0.3s ease,
        visibility 0.3s ease;
}

.mbs-mobile-menu-backdrop.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* =====================================
   SEARCH OVERLAY
===================================== */

.mbs-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    padding: 110px 24px 40px;
    background: rgba(255, 255, 255, 0.98);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity 0.25s ease,
        visibility 0.25s ease;
}

.mbs-search-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.mbs-search-dialog {
    position: relative;
    width: min(100%, 900px);
    margin: 0 auto;
}

.mbs-search-close {
    position: absolute;
    top: -55px;
    right: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--mbs-text);
    font-size: 38px;
    line-height: 1;
}

.mbs-search-label {
    margin-bottom: 18px;
    color: var(--mbs-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.mbs-search-dialog form {
    position: relative;
}

.mbs-search-dialog input[type="search"] {
    width: 100%;
    height: 68px;
    padding: 0 70px 0 22px;
    border: 1px solid #dddddd;
    border-radius: 0;
    background: #ffffff;
    color: var(--mbs-text);
    font-size: 19px;
    outline: none;
}

.mbs-search-dialog input[type="search"]:focus {
    border-color: var(--mbs-primary);
}

.mbs-search-dialog button[type="submit"] {
    position: absolute;
    top: 50%;
    right: 12px;
    width: 44px;
    height: 44px;
    border: 0;
    transform: translateY(-50%);
    background: transparent;
}

/* =====================================
   TABLET / MOBILE
===================================== */

@media (max-width: 1100px) {
    .mbs-navigation {
        gap: 20px;
    }

    .mbs-menu-item > a {
        font-size: 12px;
    }
}

@media (max-width: 991px) {
    .mbs-header-container {
        width: calc(100% - 36px);
        grid-template-columns: 50px minmax(0, 1fr) 50px;
        gap: 10px;
    }

    .mbs-mobile-left,
    .mbs-mobile-right {
        display: flex;
        align-items: center;
    }

    .mbs-mobile-left {
        justify-content: flex-start;
    }

    .mbs-mobile-right {
        justify-content: flex-end;
    }

    .mbs-logo {
        justify-content: center;
    }

    .mbs-logo .custom-logo {
        max-width: 145px;
        max-height: 52px;
    }

    .mbs-header-actions {
        display: none;
    }

    .mbs-main-menu {
        position: fixed;
        top: 0;
        right: -100%;
        z-index: 1080;
        width: min(86vw, 340px);
        height: 100dvh;
        padding: 90px 24px 30px;
        background: #ffffff;
        align-items: flex-start;
        justify-content: flex-start;
        overflow-y: auto;
        box-shadow: -18px 0 45px rgba(8, 20, 35, 0.12);
        transition: right 0.35s ease;
    }

    .mbs-main-menu.is-open {
        right: 0;
    }

    .mbs-navigation {
        width: 100%;
        display: block;
    }

    .mbs-menu-item {
        width: 100%;
        border-bottom: 1px solid var(--mbs-border);
    }

    .mbs-menu-item > a {
        width: calc(100% - 48px);
        min-height: 58px;
        color: var(--mbs-text) !important;
        font-size: 13px;
    }

    .mbs-menu-chevron {
        display: none;
    }

    .mbs-submenu-toggle {
        position: absolute;
        top: 8px;
        right: 0;
        width: 44px;
        height: 44px;
        padding: 12px;
        border: 0;
        background: transparent;
        color: var(--mbs-text);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mbs-submenu-toggle svg {
        width: 18px;
        height: 18px;
        transition: transform 0.25s ease;
    }

    .mbs-menu-item.is-open > .mbs-submenu-toggle svg {
        transform: rotate(180deg);
    }

    .mbs-submenu {
        position: static;
        min-width: 100%;
        max-height: 0;
        padding: 0;
        border: 0;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        overflow: hidden;
        transform: none;
        pointer-events: auto;
        transition:
            max-height 0.35s ease,
            padding 0.35s ease;
    }

    .mbs-menu-item.is-open > .mbs-submenu {
        max-height: 700px;
        padding: 5px 0 16px;
    }

    .mbs-submenu a {
        padding: 10px 12px;
        color: var(--mbs-muted);
        font-size: 13px;
    }

    .mbs-submenu a:hover {
        padding-left: 18px;
    }
}

@media (max-width: 640px) {
    .mbs-header-container {
        width: calc(100% - 24px);
    }

    .mbs-logo .custom-logo {
        max-width: 125px;
        max-height: 46px;
    }

    .mbs-main-menu {
        width: min(88vw, 310px);
        padding: 82px 20px 25px;
    }

    .mbs-search-overlay {
        padding: 90px 16px 30px;
    }

    .mbs-search-dialog input[type="search"] {
        height: 58px;
        font-size: 16px;
    }
}

@media (min-width: 992px) {
    .mbs-mobile-menu-backdrop {
        display: none;
    }
}