/* ======================================================================
   Header — Cohort 8 (Dhaka Bazaar — Bangladeshi kitchenware retail)
   Bootstrap-first: layout / spacing / colors / forms / dropdowns / buttons
   come from Bootstrap utilities + components. This file only carries
   premium polish that Bootstrap does NOT ship — navy nav band, orange
   search button, square navy 38×38 icon actions, drawer transitions.
   ====================================================================== */

/* Sticky elevation cue */
.header-8-sticky.is-scrolled {
    box-shadow: 0 4px 8px rgba(1, 24, 91, 0.06), 0 2px 4px rgba(1, 24, 91, 0.04);
    transition: box-shadow 0.15s ease;
}

/* ---------- Main row layout ----------
   Mobile (< 992px): [burger] [logo] [actions], search hidden as inline (overlay mode)
   Desktop (>= 992px): [logo] [search] [actions] */
.header-8-mid-row {
    grid-template-columns: auto 1fr auto;
    column-gap: 12px;
    row-gap: 0;
    align-items: center;
}

.header-8-mid-row .header-8-logo { justify-self: start; }

@media (max-width: 991.98px) {
    .header-8-mid-row > .header-8-search { display: none; }
    body.is-mobile-search-open .header-8-mid-row > .header-8-search {
        display: block;
        grid-column: 1 / -1;
        margin-top: 8px;
    }
    .header-8-logo img {
        max-height: 44px;
        width: auto;
        object-fit: contain;
    }
}

@media (min-width: 992px) {
    .header-8-mid-row {
        grid-template-columns: auto 1fr auto;
        column-gap: 24px;
    }
}

/* ---------- Mobile burger (transparent, no border, just navy icon) ---------- */
.header-8-burger {
    width: 42px;
    height: 42px;
    background: transparent;
    border: none;
    color: var(--bs-primary);
    border-radius: 0.25rem;
    transition: background 0.10s ease;
}
.header-8-burger:hover,
.header-8-burger:focus-visible {
    background: var(--bs-light-primary);
    outline: none;
}

/* ---------- Search input — orange 1.5px border + flat right edge ---------- */
.header-8-search-field {
    border: 1.5px solid var(--bs-border-accent);
    border-radius: 0.25rem;
    overflow: hidden;
    background: var(--bs-body-bg);
}

.header-8-search-input {
    border: none;
    background: transparent;
    color: var(--bs-body-color);
    font-size: 0.95rem;
    padding: 0.6rem 0.85rem;
}
.header-8-search-input:focus {
    outline: none;
    box-shadow: none;
    background: transparent;
}
.header-8-search-input::placeholder {
    color: var(--bs-secondary-color);
    opacity: 0.85;
}

/* Spinner sits between input and submit button */
.header-8-search-spinner {
    background: transparent;
    border: none;
    color: var(--bs-secondary);
}

/* ---------- Search submit — navy bg with white text + search icon ---------- */
.header-8-search-submit {
    background: var(--bs-primary);
    color: #fff;
    border: none;
    padding: 0 1.25rem;
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.10s ease;
    border-radius: 0;
}
.header-8-search-submit:hover,
.header-8-search-submit:focus-visible {
    background: #0A2575;
    color: #fff;
    outline: none;
}
.header-8-search-submit svg { display: inline-block; }
@media (max-width: 575.98px) {
    .header-8-search-submit-label { display: none; }
    .header-8-search-submit { padding: 0 0.9rem; }
}

/* ---------- Search dropdown ---------- */
.header-8-search-dropdown {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    z-index: 1080;
}
.header-8-search-list { max-height: 60vh; overflow-y: auto; }
.header-8-search-list a {
    display: flex;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--bs-border-color);
    text-decoration: none;
    color: var(--bs-body-color);
    transition: background 0.10s ease;
}
.header-8-search-list a:last-child { border-bottom: none; }
.header-8-search-list a:hover { background: var(--bs-light-secondary); }
.header-8-search-list img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 0.25rem;
    border: 1px solid var(--bs-border-color);
    flex: 0 0 48px;
}
.header-8-search-name { font-weight: 500; font-size: 0.92rem; line-height: 1.3; }
.header-8-search-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
    font-size: 0.88rem;
    color: var(--bs-secondary);
    font-weight: 700;
}
.header-8-search-price-old {
    color: var(--bs-danger);
    text-decoration: line-through;
    font-weight: 400;
    font-size: 0.82rem;
}
.header-8-search-empty {
    display: block;
    padding: 24px 16px;
    text-align: center;
    color: var(--bs-secondary-color);
    font-size: 0.9rem;
}
.header-8-search-more {
    color: var(--bs-primary);
    font-weight: 600;
    font-size: 0.88rem;
    background: var(--bs-bg-alt, var(--bs-light-primary));
    border-color: var(--bs-border-color) !important;
}
.header-8-search-more:hover {
    color: var(--bs-secondary);
    background: var(--bs-light-secondary);
}

/* ---------- Square navy icon actions (signature element) ---------- */
.header-8-action-square {
    width: 38px;
    height: 38px;
    background: var(--bs-primary);
    color: #fff;
    border: none;
    border-radius: 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.10s ease;
    flex: 0 0 38px;
}
.header-8-action-square:hover,
.header-8-action-square:focus-visible {
    background: #0A2575;
    color: #fff;
    outline: none;
}

/* Count badge — orange pill bottom-right of the icon button */
.header-8-cart-count {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--bs-secondary);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 50rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ---------- Sub-nav band — navy with flat horizontal category links (DESKTOP) ---------- */
.header-8-nav {
    background: var(--bs-primary);
    color: #fff;
}
.header-8-nav .header-8-nav-container {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.header-8-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
    align-items: center;
}
.header-8-menu .nav-item { position: relative; }
.header-8-menu .nav-link {
    color: #fff;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 0.35rem 0;
    text-decoration: none;
    transition: color 0.10s ease;
    line-height: 1.3;
}
.header-8-menu .nav-link:hover,
.header-8-menu .nav-link:focus-visible {
    color: var(--bs-secondary);
    outline: none;
}

/* Mobile drawer hides server-rendered sub-menu chevrons; keep visible on desktop */
.header-8-menu .has-child > .nav-link::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    opacity: 0.7;
}

/* Desktop submenu — orange-bordered dropdown.
   Backend renders the dropdown as `<div class="collapse menu-dropdown"><ul class="nav">…</ul></div>`
   (Bootstrap collapse, hidden by default). On desktop we override the collapse and
   show/hide via :hover + :focus-within. Scope strictly to `.has-child` so empty
   dropdown wrappers on leaf items don't trigger a hover-box. */
@media (min-width: 992px) {
    .header-8-menu .has-child > .menu-dropdown {
        display: block !important;
        position: absolute;
        /* Anchor to the BOTTOM of the navy nav band (not just the nav-item).
           The nav-container adds 0.65rem padding-bottom around the nav-link,
           so `top: 100%` alone leaves the dropdown overlapping inside the band.
           `calc(100% + 0.65rem)` pushes it past the band; +6px for a clean gap. */
        top: calc(100% + 0.65rem + 6px);
        left: 0;
        min-width: 220px;
        background: #fff;
        border: 1px solid var(--bs-border-accent);
        border-radius: 0.25rem;
        padding: 0;
        margin-top: 0;
        box-shadow: 0 6px 18px rgba(1, 24, 91, 0.12);
        opacity: 0;
        visibility: hidden;
        transform: translateY(4px);
        transition: opacity 0.10s ease, transform 0.10s ease, visibility 0.10s ease;
        z-index: 1050;
        height: auto !important;
        overflow: hidden;
    }
    .header-8-menu .has-child:hover > .menu-dropdown,
    .header-8-menu .has-child:focus-within > .menu-dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    .header-8-menu .has-child > .menu-dropdown ul {
        list-style: none;
        padding: 0;
        margin: 0;
        flex-direction: column !important;
        background: transparent !important;
    }
    .header-8-menu .has-child > .menu-dropdown li { list-style: none; padding: 0; }
    .header-8-menu .has-child > .menu-dropdown .nav-link {
        display: block;
        padding: 0.5rem 0.9rem;
        color: var(--bs-body-color);
        font-size: 0.86rem;
        font-weight: 400;
        text-decoration: none;
        background: transparent;
        transition: background 0.10s ease, color 0.10s ease;
    }
    .header-8-menu .has-child > .menu-dropdown .nav-link:hover,
    .header-8-menu .has-child > .menu-dropdown .nav-link:focus-visible {
        background: var(--bs-light-secondary);
        color: var(--bs-secondary);
    }
    /* Leaf items (no children) carry an empty `.menu-dropdown` div from the backend —
       keep it hidden so it never opens a blank box on hover. */
    .header-8-menu .nav-item:not(.has-child) > .menu-dropdown {
        display: none !important;
    }
}

/* ---------- Hotline (desktop right side of navy band) ---------- */
.header-8-hotline {
    color: #fff;
    flex: 0 0 auto;
}
.header-8-hotline-icon {
    width: 32px;
    height: 32px;
    background: var(--bs-success);
    color: #fff;
}
.header-8-hotline-label {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.header-8-hotline-number {
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
}

/* ---------- Mobile drawer ----------
   The Blade NO longer carries Bootstrap utility classes `bg-primary text-white`
   on `<nav class="header-8-nav">` — those leaked into mobile and made the drawer
   navy-on-navy unreadable. We control bg + color per breakpoint here. */
@media (max-width: 991.98px) {
    .header-8-nav {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 86vw;
        max-width: 320px;
        background: #fff !important;          /* white drawer interior */
        color: var(--bs-body-color) !important;
        overflow-y: auto;
        z-index: 1085;
        transform: translateX(-100%);
        transition: transform 0.20s ease;
        display: flex;
        flex-direction: column;
        box-shadow: 4px 0 16px rgba(1, 24, 91, 0.08);
    }
    body.is-mobile-nav-open .header-8-nav { transform: translateX(0); }

    .header-8-nav-container { padding: 0.5rem 0; background: #fff; }
    .header-8-nav-row { flex-direction: column; align-items: stretch !important; gap: 0 !important; }

    /* FULL-WIDTH stack: stretch so .nav-item fills the drawer width.
       Without this, items inherit `align-items: center` from desktop and
       shrink to content-width → centered text + fragmented dividers. */
    .header-8-menu {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0;
        width: 100%;
        padding: 0;
        list-style: none;
    }
    .header-8-menu .nav-item {
        border-bottom: 1px solid var(--bs-border-color);
        width: 100%;
        list-style: none;
        -webkit-tap-highlight-color: rgba(249, 115, 22, 0.10);
    }
    .header-8-menu .nav-item:last-child { border-bottom: none; }
    .header-8-menu .nav-link {
        color: var(--bs-body-color) !important;
        font-size: 0.95rem;
        font-weight: 500;
        padding: 0.95rem 1.1rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: transparent;
        text-align: left;
        width: 100%;
    }
    /* Hover only on devices that actually have a hover pointer (mouse).
       On touch devices, :hover sticks after a tap — that's why Wearables
       appeared persistently highlighted in the user's drawer screenshot. */
    @media (hover: hover) {
        .header-8-menu .nav-link:hover {
            background: var(--bs-light-secondary);
            color: var(--bs-secondary) !important;
        }
    }
    /* Keyboard focus ring (visible only on keyboard navigation, not touch) */
    .header-8-menu .nav-link:focus-visible {
        outline: 2px solid var(--bs-secondary);
        outline-offset: -2px;
        background: var(--bs-light-secondary);
        color: var(--bs-secondary) !important;
    }

    .header-8-menu .has-child > .nav-link::after {
        margin-left: auto;
        transition: transform 0.15s ease;
    }
    .header-8-menu .has-child.is-expanded > .nav-link::after {
        transform: translateY(-2px) rotate(-135deg);
    }
    .header-8-menu .menu-dropdown {
        display: none !important;
        background: var(--bs-bg-alt, var(--bs-light-primary));
    }
    .header-8-menu .has-child.is-expanded > .menu-dropdown { display: block !important; height: auto !important; }
    .header-8-menu .menu-dropdown ul {
        list-style: none;
        padding-left: 1.25rem;
        margin: 0;
    }
    .header-8-menu .menu-dropdown li { list-style: none; }
    .header-8-menu .menu-dropdown .nav-link {
        padding: 0.65rem 1rem;
        font-size: 0.88rem;
        font-weight: 400;
        color: var(--bs-body-color);
        display: block;
    }
    .header-8-menu .menu-dropdown .nav-link:hover {
        background: var(--bs-light-secondary);
        color: var(--bs-secondary);
    }

    .header-8-hotline { display: none !important; }

    /* Mobile-only drawer header + footer */
    .header-8-drawer-top { padding: 0.85rem 1rem !important; }
    .header-8-drawer-close {
        width: 38px;
        height: 38px;
        background: transparent;
        border: none;
        color: var(--bs-body-color);
        border-radius: 0.25rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .header-8-drawer-close:hover { background: var(--bs-light-secondary); }

    .header-8-drawer-top {
        background: #fff;
        border-bottom: 1px solid var(--bs-border-color);
    }
    .header-8-drawer-foot {
        border-top: 1px solid var(--bs-border-color);
        background: #fff;
    }
    .header-8-drawer-cta {
        padding: 0.65rem 1rem;
        border-radius: 0.25rem;
        font-weight: 600;
        font-size: 0.92rem;
        text-decoration: none;
        text-align: center;
    }
    .header-8-drawer-cta-primary {
        background: var(--bs-secondary);
        color: #fff;
    }
    .header-8-drawer-cta-primary:hover { background: #EA580C; color: #fff; }
    .header-8-drawer-cta-outline {
        background: transparent;
        border: 1px solid var(--bs-primary);
        color: var(--bs-primary);
    }
    .header-8-drawer-cta-outline:hover { background: var(--bs-primary); color: #fff; }

    .header-8-drawer-hotline {
        color: var(--bs-body-color);
    }
    .header-8-drawer-hotline-icon {
        width: 32px;
        height: 32px;
        background: var(--bs-success);
        color: #fff;
    }
    .header-8-drawer-hotline-label {
        color: var(--bs-secondary-color);
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }
    .header-8-drawer-hotline-number {
        color: var(--bs-body-color);
        font-size: 0.95rem;
        font-weight: 700;
    }

    .header-8-drawer-social-chip {
        background: var(--bs-light-primary);
        color: var(--bs-primary);
        border-radius: 0.25rem;
        font-size: 0.82rem;
        font-weight: 500;
    }
    .header-8-drawer-social-chip:hover {
        background: var(--bs-primary);
        color: #fff;
    }
}

@media (min-width: 992px) {
    .header-8-drawer-top,
    .header-8-drawer-foot { display: none !important; }
}

/* ---------- Drawer overlay ---------- */
.header-8-overlay {
    background: rgba(1, 24, 91, 0.45);
    z-index: 1080;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    pointer-events: none;
}
body.is-mobile-nav-open .header-8-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
@media (min-width: 992px) {
    .header-8-overlay { display: none !important; }
}

/* ---------- Keep sticky-top stacking above scroll content ---------- */
.header-8-sticky { z-index: 1040; }
