/* ============================================================
   NextMerce-style header layout (scoped to .header--nm)

   Reproduces the reference header item positioning:
     left group  = logo + rounded search pill
     right group = buy/sell links · language · wishlist · account
   Loaded AFTER home.css / style.css so these rules win the
   cascade at equal specificity without editing the SCSS source.
   ============================================================ */

.header--nm {
    --nm-blue: #3C50E0;
    --nm-dark: #1C274C;
    --nm-dark-4: #8D93A5;
    --nm-gray-1: #F5F7FF;
    --nm-gray-3: #E5E7EB;
    --nm-red: #F23030;
}

/* ---- top bar layout ------------------------------------------------ */
/* Centered container like NextMerce (max-w-7xl = 1280px), overriding the
   legacy `.header .container { max-width: 92% }`. */
.header--nm .container {
    max-width: 1280px !important;
    width: 100%;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 20px;
    padding-right: 20px;
}

/* keep the category bar contents aligned with the header container */
.header--nm .category-bar-inner {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

.header--nm .main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 16px 0;
    transition: padding 0.3s ease;
}

/* ---- scroll collapse (NextMerce-style) ----------------------------- */
.header--nm {
    transition: box-shadow 0.3s ease, background 0.3s ease;
}
.header--nm.is-scrolled .main-header {
    padding-top: 8px;
    padding-bottom: 8px;
}
.header--nm.is-scrolled {
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}
.header--nm .category-bar-inner {
    transition: height 0.3s ease;
}
.header--nm.is-scrolled .category-bar-inner {
    height: 44px;
}

/* left group: logo + search (override the legacy width:100%) */
.header--nm .main-header .header-left {
    display: flex;
    align-items: center;
    gap: 24px;
    width: auto;
    flex: 1 1 auto;
    padding: 0;
}

/* ---- logo ---------------------------------------------------------- */
.header--nm .main-header .header-left .header-logo {
    max-width: none !important;
    width: auto !important;
    margin: 0 !important;
    flex-shrink: 0;
}

.header--nm .main-header .header-left .header-logo a {
    display: block;
}

.header--nm .main-header .header-left .header-logo img {
    width: 150px;
    height: auto;
    min-height: 0;
    display: block;
}

/* ---- search pill --------------------------------------------------- */
.header--nm .main-header .header-left .header-search {
    width: 100%;
    max-width: 475px;
}

/* Reshape the EXISTING search box (common.css) into the NextMerce pill.
   Uses !important to win against common.css's !important rules, otherwise
   the old box border shows through and looks like a second field. */
.header--nm .main-header .header-left .header-search .box-header-search {
    width: 100% !important;
    height: 44px !important;
    border-radius: 9999px !important;
    border: 1px solid var(--nm-gray-3) !important;
    background: var(--nm-gray-1) !important;
    box-shadow: none !important;
    padding: 0 10px 0 20px !important;
    transform: none !important;
    display: flex;
    align-items: center;
    position: relative !important;
}

.header--nm .main-header .header-left .header-search .box-header-search:hover {
    border-color: var(--nm-gray-3) !important;
    background: var(--nm-gray-1) !important;
    box-shadow: none !important;
    transform: none !important;
}

.header--nm .main-header .header-left .header-search .box-header-search:focus-within {
    border-color: var(--nm-blue) !important;
    background: #fff !important;
    box-shadow: none !important;
    transform: none !important;
}

/* Input sits transparent inside the pill — no inner border/box */
.header--nm .nm-search-input {
    flex: 1;
    min-width: 0;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 14px;
    color: var(--nm-dark);
    outline: none;
}

.header--nm .nm-search-input::placeholder {
    color: var(--nm-dark-4);
}

/* Search button — in-flow, sits at the right end of the pill */
.header--nm .nm-search-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #707787;
    cursor: pointer;
    transition: color .15s ease;
}

.header--nm .nm-search-btn:hover {
    color: var(--nm-blue);
}

/* autocomplete dropdown spans the full pill width */
.header--nm .box-header-search .autocomplete-suggestions {
    left: 0;
    right: 0;
    width: 100%;
}

/* ---- right group --------------------------------------------------- */
.header--nm .main-header .header-shop {
    display: flex;
    align-items: center;
    gap: 24px;
    width: auto;
    text-align: left;
    flex-shrink: 0;
    padding: 0;
}

/* buy / sell links */
.header--nm .header-shop .header-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--nm-dark);
    white-space: nowrap;
}

.header--nm .header-shop .header-link:hover {
    color: var(--nm-blue);
    opacity: 1;
}

/* ---- language widget (improved) ------------------------------------ */
.header--nm .langContainer.nm-lang {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* drop the legacy globe icon (custom.css .langContainer::before) */
.header--nm .nm-lang::before {
    content: none !important;
    display: none !important;
}

.header--nm .nm-lang::after {
    content: "";
    position: absolute;
    right: 13px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-right: 1.6px solid var(--nm-dark-4);
    border-bottom: 1.6px solid var(--nm-dark-4);
    transform: translateY(-65%) rotate(45deg);
    pointer-events: none;
}

.header--nm .nm-lang select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    height: 38px;
    border: 1px solid var(--nm-gray-3);
    border-radius: 9999px;
    background: #fff;
    color: var(--nm-dark);
    font-size: 14px;
    font-weight: 500;
    padding: 0 32px 0 16px;
    cursor: pointer;
    outline: none;
    transition: border-color .15s ease;
}

.header--nm .nm-lang select:hover {
    border-color: var(--nm-blue);
}

/* ---- wishlist icon ------------------------------------------------- */
.header--nm .nm-wishlist {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    position: relative;
    color: var(--nm-dark);
    padding: 0;
    background: none;
}

.header--nm .nm-wishlist:hover {
    color: var(--nm-blue);
    opacity: 1;
}

.header--nm .nm-badge {
    position: absolute;
    top: -7px;
    right: -9px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: var(--nm-red) !important;
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    line-height: 18px;
    text-align: center;
    border-radius: 9999px;
    display: inline-block;
}

/* ---- account block (2 states) -------------------------------------- */
.header--nm .nm-account-wrap {
    position: relative;
}

.header--nm .nm-account {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    background: none;
    border: 0;
    padding: 0;
}

.header--nm .nm-account-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--nm-gray-3);
    border-radius: 50%;
    color: var(--nm-dark);
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    overflow: hidden;
}

.header--nm .nm-account-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    text-align: left;
}

.header--nm .nm-account-label {
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: var(--nm-dark-4);
}

.header--nm .nm-account-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--nm-dark);
    white-space: nowrap;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header--nm .nm-account:hover .nm-account-name {
    color: var(--nm-blue);
}

.header--nm .nm-account-chevron {
    color: var(--nm-dark);
    transition: transform .2s ease;
    flex-shrink: 0;
}

.header--nm .nm-account-wrap .dropdown-account.dropdown-open + .nm-account .nm-account-chevron,
.header--nm .nm-account-wrap.open .nm-account-chevron {
    transform: rotate(180deg);
}

/* dropdown menu aligns to the right edge of the account block, and must sit
   above the category bar (z-index:998) which renders later in the header */
.header--nm .nm-account-wrap .dropdown-account {
    left: auto;
    right: 0;
    top: calc(100% + 14px);
    z-index: 1001;
}

/* ---- responsive ---------------------------------------------------- */
@media (max-width: 1199px) {
    .header--nm .main-header .header-left .header-search {
        max-width: 320px;
    }
}

@media (max-width: 991.98px) {
    /* collapse the 2-line account label first */
    .header--nm .nm-account-text {
        display: none;
    }

    /* when a mobile drawer exists, account + favorites live inside it */
    .header--nm.has-drawer .nm-account-wrap,
    .header--nm.has-drawer .nm-wishlist {
        display: none;
    }

    .header--nm .main-header .header-shop {
        gap: 16px;
    }
}

/* ---- mobile drawer: account + favorites footer --------------------- */
/* (the drawer aside is rendered OUTSIDE .header--nm, so use literal colors) */
.mobile-menu-footer {
    flex-shrink: 0;
    border-top: 1px solid #ECEFF4;
    padding: 10px 8px 16px;
    background: #FFFFFF;
}

.mobile-menu-footer .mm-foot-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    color: #1A1D24;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.mobile-menu-footer .mm-foot-link:hover {
    background-color: #EEF4FE;
    color: #1565d8;
}

.mobile-menu-footer .mm-foot-link svg {
    flex-shrink: 0;
    color: currentColor;
}

.mobile-menu-footer .mm-foot-label {
    flex: 1;
}

.mobile-menu-footer .mm-foot-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #F23030;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
    border-radius: 9999px;
}
