/**
 * Header toolbar — neumorphic neutral shell + top search sheet
 */
#header.vo2-header-neutral,
#header.vo2-header-neutral.header-scrolled {
    --ht-bg: var(--surface-1, #eef1f6);
    --ht-fg: var(--fg-2, #3a4254);
    --ht-fg-muted: var(--fg-3, #6b7282);
    --ht-accent: var(--primary, #df2063);
    --ht-shadow-dark: rgba(163, 177, 198, 0.45);
    --ht-shadow-light: rgba(255, 255, 255, 0.92);
    --ht-raised: var(--nm-raised-sm, -4px -4px 10px var(--ht-shadow-light), 5px 5px 12px var(--ht-shadow-dark));
    --ht-inset: var(--nm-inset-sm, inset 2px 2px 5px var(--ht-shadow-dark), inset -2px -2px 5px var(--ht-shadow-light));
    background: var(--ht-bg) !important;
    box-shadow: 0 4px 18px rgba(163, 177, 198, 0.22);
    border-bottom: 1px solid rgba(163, 177, 198, 0.28);
}

#header.vo2-header-neutral .social-links a {
    color: var(--ht-fg-muted);
}

#header.vo2-header-neutral .social-links a:hover {
    color: var(--ht-accent);
}

#header.vo2-header-neutral .logo img {
    filter: brightness(0) saturate(100%) opacity(0.78);
}

/* ---- Header row layout ---- */
.vo2-header-row {
    flex-wrap: nowrap;
    gap: 0.65rem;
    width: 100%;
}

.vo2-header-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex: 1 1 auto;
    min-width: 0;
}

.vo2-header-brand .logo {
    display: inline-flex;
    align-items: center;
    line-height: 0;
    margin: 0 !important;
}

.vo2-header-brand__social {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    color: var(--ht-fg-muted, #6b7282);
    text-decoration: none !important;
    box-shadow: var(--ht-inset);
    transition: color 0.15s ease, box-shadow 0.15s ease;
}

.vo2-header-brand__social:hover,
.vo2-header-brand__social:focus {
    color: var(--ht-accent, #df2063);
    box-shadow: var(--ht-raised);
}

.vo2-header-brand__social--ig i {
    font-size: 1.05rem;
    line-height: 1;
}

.vo2-header-brand__social img {
    display: block;
    filter: brightness(0) saturate(100%) opacity(0.55);
}

.header-toolbar {
    flex: 0 0 auto;
    margin-inline-start: 0;
}

@media (min-width: 992px) {
    .vo2-header-row {
        flex-wrap: wrap;
    }

    .vo2-header-brand {
        flex: 0 0 auto;
        margin-inline-end: 0.75rem;
    }

    #header .vo2-header-row #navbar {
        order: 2;
        flex: 1 1 auto;
    }

    .vo2-header-row .header-toolbar {
        order: 3;
        margin-inline-start: auto;
    }

    #header.vo2-header-neutral .navbar a,
    #header.vo2-header-neutral .navbar a:focus {
        color: var(--ht-fg) !important;
    }

    #header.vo2-header-neutral .navbar a:hover,
    #header.vo2-header-neutral .navbar .active,
    #header.vo2-header-neutral .navbar li:hover > a {
        color: var(--ht-accent) !important;
    }

    /* Submenus — neumorphic panel (replaces legacy pink --bg-header-color blocks) */
    #header.vo2-header-neutral .navbar .dropdown ul {
        background: var(--surface-1, #eef1f6) !important;
        border: none !important;
        border-radius: 14px !important;
        padding: 0.4rem !important;
        box-shadow: var(--nm-raised-sm, -4px -4px 10px rgba(255, 255, 255, 0.92), 5px 5px 12px rgba(163, 177, 198, 0.55)) !important;
    }

    #header.vo2-header-neutral .navbar .dropdown ul li {
        min-width: 11rem;
    }

    #header.vo2-header-neutral .navbar .dropdown ul a,
    #header.vo2-header-neutral .navbar .dropdown ul a:focus {
        color: var(--fg-2, #3a4254) !important;
        font-size: 0.85rem;
        font-weight: 600;
        padding: 0.45rem 0.75rem !important;
        border-radius: 10px;
        text-transform: none;
    }

    #header.vo2-header-neutral .navbar .dropdown ul a i {
        color: var(--fg-4, #9aa1b1);
    }

    #header.vo2-header-neutral .navbar .dropdown ul a:hover,
    #header.vo2-header-neutral .navbar .dropdown ul .active:hover,
    #header.vo2-header-neutral .navbar .dropdown ul li:hover > a {
        color: var(--primary, #df2063) !important;
        background: rgba(223, 32, 99, 0.08) !important;
    }
}

.header-toolbar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-inline-start: auto;
    flex: 0 1 auto;
    min-width: 0;
}

.header-toolbar__search {
    flex: 1 1 10rem;
    min-width: 0;
    max-width: 14rem;
    margin: 0 !important;
}

.header-toolbar__search--desktop {
    display: block;
}

.header-toolbar__search .form-control {
    height: 38px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    color: #1a1f2b;
    font-size: 0.85rem;
    padding: 0.4rem 0.85rem;
    box-shadow: var(--ht-inset);
    transition: box-shadow 0.15s ease;
}

.header-toolbar__search .form-control:focus {
    outline: none;
    box-shadow:
        var(--ht-inset),
        0 0 0 2px rgba(255, 255, 255, 0.35);
}

.header-toolbar__search .form-control::placeholder {
    color: #9aa1b1;
}

.header-toolbar__group {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}

.header-toolbar__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    color: var(--ht-fg, #3a4254) !important;
    text-decoration: none !important;
    background: var(--ht-bg, #eef1f6);
    box-shadow: var(--ht-raised);
    border: none;
    padding: 0;
    position: relative;
    transition: box-shadow 0.15s ease, transform 0.12s ease, color 0.15s ease;
    vertical-align: middle;
}

.header-toolbar__btn:hover,
.header-toolbar__btn:focus {
    color: var(--ht-accent, #df2063) !important;
    box-shadow: var(--ht-inset);
    transform: translateY(1px);
}

.header-toolbar__btn i {
    font-size: 1.25rem;
    line-height: 1;
}

.header-toolbar__btn--search {
    display: none;
}

.header-toolbar__btn--profile {
    width: auto;
    height: auto;
    padding: 2px;
    border-radius: 999px;
    box-shadow: var(--ht-raised);
}

.header-toolbar__btn--profile:hover,
.header-toolbar__btn--profile:focus {
    box-shadow: var(--ht-inset);
}

.header-toolbar__btn--profile::after {
    display: none !important;
}

.header-toolbar__avatar {
    display: block;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(163, 177, 198, 0.35);
    background: linear-gradient(145deg, #c8d0dc 0%, #eef1f6 100%);
}

/* Toolbar icon colors — override legacy cart.css (white/green) */
#header .header-toolbar .my-cart-icon {
    color: inherit !important;
}

#header .header-toolbar .my-cart-icon:hover {
    transform: none;
}

#header .header-toolbar .my-cart-badge {
    top: -3px;
    inset-inline-end: -3px;
    inset-inline-start: auto;
    left: auto;
    right: auto;
    background: var(--ht-accent, #df2063) !important;
    color: #fff !important;
    border-radius: 999px;
    border: 1.5px solid var(--ht-bg, #eef1f6);
    box-shadow: 0 2px 6px rgba(223, 32, 99, 0.35);
    font-size: 9px;
    font-weight: 800;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    padding: 0 4px;
}

#header .header-toolbar .notification-badge {
    color: inherit !important;
    font-size: inherit;
    left: auto;
    right: auto;
}

#header .header-toolbar .nc-bell-btn i {
    color: inherit;
}

/* Unified count badges — cart, bell, etc. */
.vo2-count-badge,
.header-toolbar__badge {
    position: absolute;
    top: -3px;
    inset-inline-end: -3px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--ht-accent, #df2063);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(223, 32, 99, 0.35);
    border: 1.5px solid var(--ht-bg, #eef1f6);
    pointer-events: none;
    z-index: 2;
}

.vo2-count-badge:empty,
.header-toolbar__badge:empty,
.vo2-count-badge.d-none,
.header-toolbar__badge.d-none {
    display: none !important;
}

/* Legacy cart.css overrides inside toolbar */
#header .header-toolbar .notification-badge {
    position: absolute;
    left: auto;
    right: auto;
    inset-inline-end: -3px;
    top: -3px;
    color: #fff;
    font-size: 9px;
}

#header .header-toolbar .nc-root.nc-bell-wrap {
    margin: 0 !important;
}

#header .header-toolbar .nc-bell-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    color: var(--ht-fg, #3a4254) !important;
    background: var(--ht-bg, #eef1f6);
    box-shadow: var(--ht-raised);
}

#header .header-toolbar .nc-bell-btn:hover,
#header .header-toolbar .nc-bell-btn:focus {
    color: var(--ht-accent, #df2063) !important;
    background: var(--ht-bg, #eef1f6);
    box-shadow: var(--ht-inset);
    transform: translateY(1px);
}

#header .header-toolbar .nc-badge {
    top: -3px;
    inset-inline-end: -3px;
    inset-inline-start: auto;
    right: auto;
    left: auto;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    font-size: 9px;
    font-weight: 800;
    background: var(--ht-accent, #df2063);
    color: #fff;
    border: 1.5px solid var(--ht-bg, #eef1f6);
    box-shadow: 0 2px 6px rgba(223, 32, 99, 0.35);
}

/* ---- Top search sheet (mobile / full-width) ---- */
.header-search-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1085;
    background: rgba(26, 31, 43, 0.42);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.header-search-sheet {
    position: fixed;
    top: 0;
    inset-inline: 0;
    z-index: 1090;
    max-height: min(88vh, 720px);
    display: flex;
    flex-direction: column;
    background: var(--surface-1, #eef1f6);
    border-radius: 0 0 22px 22px;
    box-shadow:
        var(--nm-raised, -8px -8px 20px rgba(255, 255, 255, 0.92), 10px 10px 24px rgba(163, 177, 198, 0.55)),
        0 16px 40px rgba(26, 31, 43, 0.12);
    padding: calc(0.65rem + env(safe-area-inset-top, 0px)) 0.85rem 0.85rem;
}

.header-search-sheet__inner {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
}

.header-search-sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.header-search-sheet__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    color: var(--fg-1, #1a1f2b);
}

.header-search-sheet__close {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 12px;
    background: var(--surface-1, #eef1f6);
    color: var(--ht-fg, #3a4254);
    box-shadow: var(--nm-raised-sm);
    transition: color 0.15s ease, box-shadow 0.15s ease;
}

.header-search-sheet__close:hover,
.header-search-sheet__close:focus {
    color: var(--ht-accent, #df2063);
    box-shadow: var(--nm-inset-sm);
}

.header-search-sheet__field {
    position: relative;
    flex-shrink: 0;
    border-radius: 16px;
}

/* Minimal loading highlight around search input (no spinner inside) */
@keyframes vo2-search-ring-pulse {
    0%,
    100% {
        box-shadow:
            var(--nm-inset-sm),
            0 0 0 1px rgba(223, 32, 99, 0.12);
    }

    50% {
        box-shadow:
            var(--nm-inset-sm),
            0 0 0 2px rgba(223, 32, 99, 0.42);
    }
}

.header-search-sheet__field.is-search-loading .header-search-sheet__input,
.header-toolbar__search.is-search-loading .form-control {
    animation: vo2-search-ring-pulse 1.1s ease-in-out infinite;
}

.header-search-sheet .vo2loading,
.header-search-sheet__field .vo2loading,
.header-toolbar__search .vo2loading {
    display: none !important;
}

.header-search-sheet__icon {
    position: absolute;
    inset-inline-start: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--fg-4, #9aa1b1);
    font-size: 1rem;
    pointer-events: none;
    z-index: 1;
}

.header-search-sheet__input {
    position: relative;
    z-index: 2;
    height: 52px;
    border: none;
    border-radius: 16px;
    padding-inline-start: 2.7rem;
    background: var(--surface-1, #eef1f6);
    color: var(--fg-1, #1a1f2b);
    box-shadow: var(--nm-inset-sm);
}

.header-search-sheet__input:focus {
    outline: none;
    box-shadow:
        var(--nm-inset-sm),
        0 0 0 2px rgba(223, 32, 99, 0.16);
}

.header-search-sheet__hint {
    margin: 0.55rem 0 0.35rem;
    font-size: 0.72rem;
    color: var(--fg-3, #6b7282);
    flex-shrink: 0;
}

.header-search-sheet__results {
    flex: 1 1 auto;
    min-height: 120px;
    max-height: calc(88vh - 11rem);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 0.35rem;
    border-radius: 14px;
    background: var(--surface-2, #f3f5f9);
    box-shadow: var(--nm-inset-sm);
}

.header-search-sheet__results:empty {
    display: none;
}

/* Autocomplete dropdown inside top sheet */
.header-search-sheet .dropdown-menu,
.header-search-sheet__results .dropdown-menu,
body.vo2-search-open .header-search-sheet ~ .dropdown-menu.show {
    position: static !important;
    display: block;
    float: none;
    width: 100%;
    max-height: none;
    margin: 0;
    padding: 0.35rem;
    border: none;
    border-radius: 14px;
    background: transparent;
    box-shadow: none;
    overflow: visible;
    transform: none !important;
    z-index: 1 !important;
}

.header-search-sheet .dropdown-item,
.header-search-sheet__results .dropdown-item {
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
    font-size: 0.85rem;
    color: var(--fg-2, #3a4254);
    white-space: normal;
}

.header-search-sheet .dropdown-item:hover,
.header-search-sheet .dropdown-item:focus,
.header-search-sheet__results .dropdown-item:hover,
.header-search-sheet__results .dropdown-item:focus {
    background: rgba(223, 32, 99, 0.08);
    color: var(--ht-accent, #df2063);
}

body.vo2-search-open {
    overflow: hidden;
}

@media (min-width: 992px) {
    .header-search-backdrop,
    .header-search-sheet {
        display: none !important;
    }
}

/* Profile dropdown — neumorphic panel (not pink bar) */
#header .header-toolbar .dropdown-menu.vo2-profile-menu {
    inset-inline-end: 0;
    inset-inline-start: auto;
    left: auto !important;
    right: 0;
}

[dir="rtl"] #header .header-toolbar .dropdown-menu.vo2-profile-menu {
    right: auto !important;
    left: 0 !important;
}

/* Mobile header — brand + toolbar one row; hide in-header nav (bottom pill) */
@media (max-width: 991.98px) {
    #header .vo2-header-row {
        flex-wrap: nowrap;
        align-items: center;
        gap: 0.5rem;
    }

    .vo2-header-brand {
        flex: 1 1 auto;
        min-width: 0;
    }

    .header-toolbar {
        flex: 0 0 auto;
        margin-inline-start: auto;
        margin-inline-end: 0;
        width: auto;
        margin-top: 0;
        flex-wrap: nowrap;
        justify-content: flex-start;
    }

    .header-toolbar__search--desktop,
    .header-toolbar__search {
        display: none;
    }

    .header-toolbar__btn--search {
        display: inline-flex;
    }

    #header #navbar,
    #header #rankingNavbar {
        display: none !important;
    }
}
