/* =====================================================================
   Header — Cohort 7 (TreeStyle — Bangladeshi menswear retail)
   Class pattern: header-7-{element}
   Premium polish: nav 56-64px, generous padding, sharp 4-6px radius,
   floating right-side fixed CTA cluster.
   ===================================================================== */

/* ---------- Burger (mobile only) — treeliving plain icon, no box ---------- */
.header-7-burger {
    background: transparent;
    border: 0;
    color: var(--bs-body-color);
    width: 40px;
    height: 40px;
    padding: 0;
}
.header-7-burger:hover { color: var(--bs-primary); }

/* ---------- Sticky shadow ---------- */
.header-7-sticky {
    z-index: 1030;
    transition: box-shadow 0.25s ease;
}
.header-7-sticky.is-scrolled {
    box-shadow: 0 4px 16px rgba(var(--bs-primary-rgb), 0.10);
}

/* ---------- 1. Main row (treeliving fidelity) ----------
   Desktop: logo (auto) | search (1fr) | actions (auto)
   Mobile : burger (auto) | logo (1fr, centered) | actions (auto)
*/
.header-7-mid {
    background: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color);
}
.header-7-mid-row {
    grid-template-columns: auto 1fr auto auto;     /* desktop: burger(hidden) | logo | search | actions */
    min-height: 72px;
    align-items: center;
}
@media (max-width: 991.98px) {
    .header-7-mid-row {
        grid-template-columns: auto 1fr auto;       /* mobile: burger | centered logo | person */
    }
    .header-7-mid-row > .header-7-search { display: none; }
    .header-7-logo {
        text-align: center;
        justify-self: center;
    }
}

.header-7-logo img {
    max-height: 40px;
    width: auto;
    object-fit: contain;
}
@media (max-width: 575.98px) {
    .header-7-logo img { max-height: 36px; }
}

/* Search bar — treeliving fidelity: TWO SEPARATE light-gray pills.
   Left pill = input field. Right pill = "Search" button. Small gap between
   them (Bootstrap input-group default merges them; we override). */
.header-7-search-field {
    background: transparent;     /* the input-group itself has no bg — children do */
    border-radius: 0;
    overflow: visible;
    gap: 6px;                    /* tight gap between the two pills */
}
.header-7-search-field .form-control {
    height: 44px;
    font-size: 0.95rem;
    background: #F1F1F1 !important;       /* left pill bg */
    border: 0 !important;
    border-radius: 0.4rem !important;     /* full rounded — both ends */
    color: var(--bs-body-color);
    box-shadow: none !important;
    padding-left: 1rem;
}
.header-7-search-field .form-control::placeholder {
    color: #888;
    font-weight: 400;
    font-size: 0.95rem;
}
.header-7-search-field .form-control:focus {
    background: #EAEAEA !important;
}
.header-7-search-field .input-group-text {
    border: 0;
    background: #F1F1F1;
    border-radius: 0.4rem;
}
.header-7-search-submit {
    --bs-btn-color: var(--bs-body-color);
    --bs-btn-bg: #F1F1F1;
    --bs-btn-border-color: #F1F1F1;
    --bs-btn-hover-bg: var(--bs-border-color);
    --bs-btn-hover-border-color: var(--bs-border-color);
    --bs-btn-hover-color: var(--bs-body-color);
    background: #F1F1F1 !important;       /* right pill bg — same as input */
    border: 0 !important;
    border-radius: 0.4rem !important;     /* full rounded — both ends */
    height: 44px;
    padding: 0 1.4rem;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    font-weight: 500;
}
.header-7-search-submit:hover {
    background: var(--bs-border-color) !important;
}

/* Search dropdown */
.header-7-search-dropdown {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    max-height: 70vh;
    overflow-y: auto;
}
.header-7-search-list a {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 0.75rem;
    align-items: center;
    padding: 0.65rem 0.85rem;
    color: var(--bs-body-color);
    text-decoration: none;
    border-bottom: 1px solid var(--bs-border-color);
    transition: background-color 0.15s ease;
}
.header-7-search-list a:hover { background: var(--bs-light-primary); }
.header-7-search-list img {
    width: 56px; height: 56px;
    object-fit: cover;
    border-radius: 0.25rem;
    background: var(--bs-secondary-bg);
}
.header-7-search-name {
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.header-7-search-price {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--bs-primary);
}
.header-7-search-price-old {
    color: var(--bs-secondary-color);
    font-weight: 400;
    margin-left: 0.5rem;
}
.header-7-search-empty {
    display: block;
    padding: 1.25rem;
    text-align: center;
    color: var(--bs-secondary-color);
    font-size: 0.9rem;
}
.header-7-search-more {
    color: var(--bs-primary);
    font-weight: 600;
    background: var(--bs-light-primary);
}
.header-7-search-more:hover {
    background: var(--bs-primary);
    color: #fff;
}

/* Action icons — treeliving boxed gray containers (44x44 rounded square) */
.header-7-action {
    width: 44px;
    height: 44px;
    background: #F1F1F1;
    border: 1px solid #F1F1F1;
    color: var(--bs-body-color);
    border-radius: 0.25rem;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    padding: 0;                                    /* button reset */
}
.header-7-action:hover {
    background: var(--bs-border-color);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}
.header-7-action svg { display: block; }
button.header-7-action {                            /* native button reset */
    line-height: 0;
    appearance: none;
}

.header-7-cart-count,
.header-7-wishlist-count {
    position: absolute;
    top: -4px; right: -4px;
    width: 18px; height: 18px;
    display: inline-flex;
    align-items: center; justify-content: center;
    background: var(--bs-secondary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 50%;
    line-height: 1;
    border: 2px solid var(--bs-body-bg);
}

/* ---------- 2. Sub-nav (BLACK strip, treeliving.co fidelity) ---------- */
.header-7-nav {
    background: #0E0E0E;                     /* near-black — treeliving signature strip */
    color: var(--bs-body-bg);
}
/* Sub-nav inner row — generous height + items vertically centered */
.header-7-nav-row {
    min-height: 50px;
    align-items: center;                     /* vertical centering — fixes the menu drift */
}
.header-7-nav-container {
    padding-block: 0;
}
.header-7-nav-row {
    min-height: 44px;
}
.header-7-menu {
    display: flex;
    flex-wrap: wrap;
    align-items: center;                 /* equal baseline for all top-level items */
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}
.header-7-menu .nav-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0 2rem 0 0;                 /* 32px — matches treeliving generous spacing */
}
.header-7-menu .nav-item:last-child { padding-right: 0; }
.header-7-menu .nav-link {
    color: var(--bs-body-bg);
    font-size: 0.95rem;                  /* 15px — treeliving menu size */
    font-weight: 400;
    line-height: 1;
    padding: 0.95rem 0;                  /* tall click target, treeliving rhythm */
    text-transform: none;                /* native casing — "Panjabi - Kurta" not uppercase */
    letter-spacing: 0;
    transition: opacity 0.15s ease;
    opacity: 0.95;
    white-space: nowrap;
}
.header-7-menu .nav-link:hover,
.header-7-menu .nav-item.active > .nav-link {
    opacity: 1;
    color: var(--bs-body-bg);
}

/* ---------- Desktop submenu dropdown ----------
   get_all_categories_in_menu() emits:
     <li.nav-item.has-child> with chevron
       <a.nav-link.menu-link>
       <div.collapse.menu-dropdown id="cat-menu-N">
         <ul.nav.nav-sm.flex-column>
           <li.nav-item><a.nav-link>...</a></li>
           ...
         </ul>
       </div>
   On desktop we open via hover (force .show / display:block on hover); on mobile
   the parent's .is-expanded class drives display.
*/
@media (min-width: 992px) {
    /* Chevron AFTER the parent label (treeliving-style "Panjabi - Kurta ▾").
       Uses a Unicode glyph for crisper rendering than CSS-border triangles
       at small sizes, plus rotates 180° on hover for the "open" cue. */
    .header-7-menu .nav-item.has-child > .nav-link {
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }
    .header-7-menu .nav-item.has-child > .nav-link {
        /* Tighter gap between label and chevron — treeliving has the icon
           sitting just inside the label baseline, not as a separate element. */
        gap: 3px;
    }
    .header-7-menu .nav-item.has-child > .nav-link::after {
        /* Treeliving fidelity: thin SVG chevron-down (two-stroke V).
           Tucked tight to label so the pair reads as ONE item, not two. */
        content: '';
        display: inline-block;
        width: 14px;
        height: 14px;
        margin-left: 1px;                /* near-touching label */
        background: currentColor;
        -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
                mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
        -webkit-mask-repeat: no-repeat;
                mask-repeat: no-repeat;
        -webkit-mask-position: center;
                mask-position: center;
        -webkit-mask-size: contain;
                mask-size: contain;
        opacity: 0.95;
        vertical-align: -1px;
        transition: transform 0.2s ease, opacity 0.2s ease;
        position: static !important;
        line-height: 1;
    }
    .header-7-menu .nav-item.has-child:hover > .nav-link::after,
    .header-7-menu .nav-item.has-child:focus-within > .nav-link::after {
        transform: rotate(180deg);
        opacity: 1;
    }
    /* Suppress the underline accent on parent links with submenu — chevron
       already signals openability, double-cue feels noisy */
    .header-7-menu .nav-item.has-child > .nav-link::before {
        display: none;
    }

    /* Dropdown panel — clean white card below parent.
       Tight to content: width auto so 4-letter items don't sit in a 240px box.
       Sharp 4px top corners, rounded 8px bottom, soft shadow, thin top accent
       in primary color so the panel reads as connected to the green sub-nav. */
    .header-7-menu .menu-dropdown {
        display: block !important;           /* override Bootstrap .collapse */
        position: absolute;
        top: calc(100% + 0px);
        left: -8px;                          /* slight negative offset so dropdown aligns with parent label start */
        right: auto !important;              /* prevent stretching to parent right edge (Bootstrap .collapse can set right) */
        width: max-content;                  /* fit content + padding, no wider */
        min-width: 180px;                    /* short items still feel substantial */
        max-width: 320px;                    /* long items wrap rather than balloon */
        background: var(--bs-body-bg);
        border: 1px solid var(--bs-border-color);
        border-top: 3px solid var(--bs-secondary, var(--bs-danger));  /* red accent strip — treeliving cherry red signature */
        border-radius: 0 0 0.5rem 0.5rem;
        box-shadow: 0 14px 32px rgba(0, 0, 0, 0.10), 0 4px 8px rgba(0, 0, 0, 0.04);
        padding: 0.4rem 0;
        z-index: 1020;
        opacity: 0;
        visibility: hidden;
        transform: translateY(6px);
        transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    }
    .header-7-menu .nav-item.has-child:hover > .menu-dropdown,
    .header-7-menu .nav-item.has-child:focus-within > .menu-dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        transition-delay: 0s;
    }
    /* Hover bridge — invisible 10px gap between sub-nav baseline and dropdown
       top so pointer can travel without the dropdown closing */
    .header-7-menu .nav-item.has-child > .menu-dropdown::before {
        content: '';
        position: absolute;
        top: -10px; left: 0; right: 0;
        height: 10px;
        background: transparent;
    }

    /* Submenu list reset */
    .header-7-menu .menu-dropdown .nav {
        list-style: none;
        margin: 0;
        padding: 0;
        flex-direction: column;
    }
    .header-7-menu .menu-dropdown .nav-item {
        width: 100%;
        position: relative;
        border: none !important;
    }

    /* Submenu link — flush edges so hover bg reaches the dropdown sides.
       No bottom-border (was leaving a 1px transparent line that picked up
       subpixel rendering between rows). */
    .header-7-menu .menu-dropdown .nav-link {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 0.625rem 1.1rem !important;
        margin: 0 !important;
        color: var(--bs-body-color) !important;
        font-size: 0.875rem;
        font-weight: 500;
        white-space: nowrap;
        text-transform: capitalize;
        border: 0 !important;
        transition: background-color 0.12s ease, color 0.12s ease;
        width: 100%;
    }
    .header-7-menu .menu-dropdown .nav-link::before,
    .header-7-menu .menu-dropdown .nav-link::after {
        display: none !important;
    }
    .header-7-menu .menu-dropdown .nav-link:hover {
        background: var(--bs-light-primary, var(--bs-tertiary-bg));
        color: var(--bs-primary) !important;
    }

    /* Right-arrow for items that have a deeper submenu */
    .header-7-menu .menu-dropdown .nav-item.has-child > .nav-link::after {
        content: '\203A' !important;          /* › single right angle */
        display: inline-block !important;
        font-size: 1.1rem;
        line-height: 1;
        opacity: 0.55;
        transform: none;
        margin: 0;
        position: static !important;
        background: none !important;
        height: auto !important;
        width: auto !important;
    }
    .header-7-menu .menu-dropdown .nav-item.has-child:hover > .nav-link::after {
        opacity: 1;
        color: var(--bs-primary);
    }

    /* Cascade — second-level submenu opens to the right edge of parent panel */
    .header-7-menu .menu-dropdown .nav-item.has-child > .menu-dropdown {
        top: -3px;                            /* compensate red accent strip */
        left: 100%;
        margin-left: 4px;
        border-radius: 0.5rem;
        border-top: 3px solid var(--bs-secondary, var(--bs-danger));
    }
}

/* SALE chip on the right of sub-nav */
.header-7-sale-chip {
    transition: transform 0.15s ease;
}
.header-7-sale-chip:hover { transform: translateY(-1px); }
.header-7-sale-badge {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    box-shadow: 0 2px 4px rgba(var(--bs-danger-rgb), 0.25);
}
.header-7-sale-label {
    color: rgba(var(--bs-body-bg-rgb), 0.92) !important;
}

/* ---------- 3. Mobile drawer ---------- */
@media (max-width: 991.98px) {
    .header-7-nav {
        position: fixed;
        top: 0; left: 0;
        width: min(85vw, 340px);
        height: 100vh;
        background: var(--bs-body-bg);
        z-index: 1050;
        display: flex;
        flex-direction: column;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 8px 0 24px rgba(0, 0, 0, 0.18);
        overflow-y: auto;
    }
    body.is-mobile-nav-open .header-7-nav { transform: translateX(0); }

    .header-7-nav-container {
        padding: 0;
        flex: 1;
    }
    .header-7-nav-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0;
        min-height: 0;
    }

    .header-7-menu {
        flex-direction: column;
        width: 100%;
        gap: 0;
        background: var(--bs-body-bg);
    }
    /* Reset desktop's `display: inline-flex; padding-right:1.4rem` so each
       nav-item is a full-width block on mobile and the submenu stacks
       BELOW the parent label, not beside it. */
    .header-7-menu .nav-item {
        display: block;
        width: 100%;
        position: static;
        padding: 0;
        margin: 0;
        border-bottom: 1px solid var(--bs-border-color);
    }
    .header-7-menu .nav-link {
        padding: 0.85rem 1rem;
        color: var(--bs-body-color);
        font-weight: 500;
        font-size: 0.95rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }
    .header-7-menu .nav-link::after { display: none; }
    .header-7-menu .nav-item.has-child > .nav-link::after {
        content: '+';
        display: inline-flex;
        font-weight: 400;
        font-size: 1.1rem;
        color: var(--bs-secondary-color);
        margin: 0;
        background: none !important;
        width: auto;
        height: auto;
    }
    .header-7-menu .nav-item.is-expanded > .nav-link::after { content: '−'; }

    /* Mobile submenu — get_all_categories_in_menu() emits .menu-dropdown
       (Bootstrap collapse). Override to use our .is-expanded state.
       Explicitly UNSET the desktop absolute positioning so on mobile the
       submenu flows inline below its parent (not beside / not floating). */
    .header-7-menu .menu-dropdown {
        display: none !important;
        position: static !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        margin: 0 !important;
        background: var(--bs-secondary-bg);
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        padding: 0 0 0.5rem 0 !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
    }
    .header-7-menu .nav-item.is-expanded > .menu-dropdown {
        display: block !important;
    }
    .header-7-menu .menu-dropdown .nav {
        list-style: none;
        margin: 0;
        padding: 0;
    }
    .header-7-menu .menu-dropdown .nav-link {
        padding: 0.6rem 1rem 0.6rem 2rem !important;     /* indent submenu items */
        font-size: 0.9rem;
        color: var(--bs-secondary-color) !important;
        font-weight: 500;
        text-transform: capitalize;
    }
    .header-7-menu .menu-dropdown .nav-link:hover {
        background: var(--bs-light-primary);
        color: var(--bs-primary) !important;
    }

    /* Mobile search overlay — !important needed because the form carries
       Bootstrap's .position-relative .w-100 utilities (which use !important). */
    .header-7-search {
        display: none !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        background: var(--bs-body-bg);
        padding: 0.85rem 1rem;
        border-bottom: 1px solid var(--bs-border-color);
        z-index: 1055;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
        margin: 0;
    }
    body.is-mobile-search-open .header-7-search { display: block !important; }
    /* Search dropdown sticks under the overlay, full-width */
    body.is-mobile-search-open .header-7-search-dropdown {
        position: relative;
        margin-top: 0.5rem;
        max-height: calc(100vh - 80px);
    }

    /* Drawer bottom utility row — Home / Search / Login / Cart icons (treeliving mobile pattern) */
    .header-7-drawer-utility-item {
        color: var(--bs-body-color);
        font-size: 0.7rem;
        font-weight: 500;
        letter-spacing: 0.02em;
        border-radius: 0.4rem;
        transition: background-color 0.15s ease, color 0.15s ease;
    }
    .header-7-drawer-utility-item:hover,
    .header-7-drawer-utility-item:focus {
        background: var(--bs-light-primary, var(--bs-tertiary-bg));
        color: var(--bs-primary);
    }
    .header-7-drawer-utility-item small { font-size: 0.7rem; }
}
@media (min-width: 992px) {
    .header-7-drawer-top,
    .header-7-drawer-eyebrow,
    .header-7-drawer-foot { display: none !important; }
}

/* Overlay backdrop for mobile drawer */
.header-7-overlay {
    background: rgba(0, 0, 0, 0.45);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
body.is-mobile-nav-open .header-7-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* ---------- 4. Floating right-side CTA cluster ---------- */
.header-7-fab {
    position: fixed;
    right: 16px;
    bottom: 24px;
    z-index: 1035;
}
.header-7-fab-link {
    width: 48px;
    height: 48px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
}
.header-7-fab-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.24);
    color: #fff;
}
.header-7-fab-whatsapp { background: #25D366; }
.header-7-fab-phone    { background: var(--bs-primary); }
.header-7-fab-messenger{ background: #0084FF; }

@media (max-width: 575.98px) {
    .header-7-fab { right: 12px; bottom: 16px; }
    .header-7-fab-link { width: 44px; height: 44px; }
}

/* Hide floating cluster when mobile drawer is open (avoid overlap with close X) */
body.is-mobile-nav-open .header-7-fab { opacity: 0; pointer-events: none; }
