/**
 * ELREDA Header
 * -----------------------------------------------------------------------------
 * Permanent header polish for Astra Free.
 *
 * Astra remains responsible for the Header Builder structure.
 * This file only fills the visual/responsive gaps that are not convenient
 * to control from Astra Free.
 *
 * Required builder structure:
 * Desktop:
 *   Above   -> Social + Secondary Menu (ELREDA - Utility Menu)
 *   Primary -> Logo + Widget 1 (Woo Product Search) + Account + Cart
 *   Below   -> Primary Menu (ELREDA - Main Menu)
 *
 * Mobile:
 *   Above   -> Secondary Menu
 *   Primary -> Toggle + Logo + Cart
 *   Below   -> Widget 2 (Woo Product Search)
 *   Offcanvas -> Main Menu
 */


/* ==========================================================================
   1. ABOVE HEADER / UTILITY BAR
   ========================================================================== */

.ast-above-header-bar {
    background: var(--elreda-surface, #fff);
    border-bottom-color: var(--elreda-border, #e2e7ed);
}

/* Keep utility links compact and aligned. */
.ast-above-header-bar .main-header-menu {
    display: flex;
    align-items: center;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 2px;
}

.ast-above-header-bar .main-header-menu > .menu-item > .menu-link {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding-inline: 10px;
    color: var(--elreda-text, #182230);
    font-family: var(--elreda-font-ar, "IBM Plex Sans Arabic", Tahoma, Arial, sans-serif);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    transition:
        color var(--elreda-transition, 180ms ease),
        background-color var(--elreda-transition, 180ms ease);
}

.ast-above-header-bar .main-header-menu > .menu-item > .menu-link:hover,
.ast-above-header-bar .main-header-menu > .menu-item.current-menu-item > .menu-link {
    color: var(--elreda-blue, #0a55a2);
}

/* Social icons: subtle motion without replacing each network's chosen color. */
.ast-above-header-bar .ast-builder-social-element {
    transition:
        transform var(--elreda-transition, 180ms ease),
        opacity var(--elreda-transition, 180ms ease);
}

.ast-above-header-bar .ast-builder-social-element:hover {
    transform: translateY(-1px);
}


/* ==========================================================================
   2. PRIMARY SHOPPING HEADER
   ========================================================================== */

.ast-primary-header-bar {
    background: var(--elreda-navy, #061a36);
}

.ast-primary-header-bar .ast-builder-grid-row {
    align-items: center;
    column-gap: clamp(12px, 2vw, 28px);
}

/* Logo: keep the transparent logo crisp and contained. */
.ast-primary-header-bar .site-logo-img img,
.ast-primary-header-bar .custom-logo {
    display: block;
    width: auto;
    max-height: 70px;
    object-fit: contain;
}

/* Account + Cart become comfortable click/tap targets. */
.ast-primary-header-bar .ast-header-account-wrap a,
.ast-primary-header-bar .ast-site-header-cart a {
    color: #fff;
    transition:
        color var(--elreda-transition, 180ms ease),
        background-color var(--elreda-transition, 180ms ease);
}

.ast-primary-header-bar .ast-header-account-wrap a:hover,
.ast-primary-header-bar .ast-site-header-cart a:hover {
    color: #fff;
}

/* Make common SVG icon implementations inherit the white header color. */
.ast-primary-header-bar .ast-header-account-wrap svg,
.ast-primary-header-bar .ast-site-header-cart svg {
    color: currentColor;
}

/* Cart count / badge. Astra has used both selectors across versions. */
.ast-primary-header-bar .ast-cart-menu-wrap .count,
.ast-primary-header-bar .ast-site-header-cart i.astra-icon::after {
    background: var(--elreda-red, #ed0029) !important;
    border-color: var(--elreda-red, #ed0029) !important;
    color: #fff !important;
}


/* ==========================================================================
   3. WOOCOMMERCE PRODUCT SEARCH IN HEADER
   ========================================================================== */

/* Hide the Widget title ("البحث") inside the header. */
.site-header .ast-header-widget-area .widget-title,
.site-header .widget-area .widget-title {
    display: none;
}

/* Allow the search widget to use the available center area. */
.ast-primary-header-bar .ast-header-widget-area,
.ast-primary-header-bar .widget-area {
    width: 100%;
}

/*
 * WooCommerce search markup:
 * .woocommerce-product-search
 *   input.search-field
 *   button[type="submit"]
 */
.site-header .woocommerce-product-search {
    display: flex !important;
    align-items: stretch;
    width: min(100%, 680px);
    max-width: 680px;
    margin: 0 auto;
    direction: rtl;
}

.site-header .woocommerce-product-search .search-field {
    flex: 1 1 auto;
    min-width: 0;
    height: 46px;
    margin: 0;
    padding-inline: 16px;
    border: 1px solid var(--elreda-border, #e2e7ed);
    border-inline-end: 0;
    border-start-start-radius: var(--elreda-radius-md, 10px);
    border-end-start-radius: var(--elreda-radius-md, 10px);
    border-start-end-radius: 0;
    border-end-end-radius: 0;
    background: #fff;
    color: var(--elreda-text, #182230);
    font-family: var(--elreda-font-ar, "IBM Plex Sans Arabic", Tahoma, Arial, sans-serif);
    font-size: 15px;
    line-height: 1;
    outline: 0;
    box-shadow: none;
    transition:
        border-color var(--elreda-transition, 180ms ease),
        box-shadow var(--elreda-transition, 180ms ease);
}

.site-header .woocommerce-product-search .search-field::placeholder {
    color: var(--elreda-price-old, #98a2b3);
    opacity: 1;
}

.site-header .woocommerce-product-search .search-field:focus {
    border-color: var(--elreda-blue, #0a55a2);
    box-shadow: 0 0 0 3px rgb(10 85 162 / 14%);
}

.site-header .woocommerce-product-search button[type="submit"] {
    flex: 0 0 96px;
    width: 96px;
    height: 46px;
    margin: 0;
    padding: 0 16px;
    border: 0;
    border-start-start-radius: 0;
    border-end-start-radius: 0;
    border-start-end-radius: var(--elreda-radius-md, 10px);
    border-end-end-radius: var(--elreda-radius-md, 10px);
    background: var(--elreda-red, #ed0029);
    color: #fff;
    font-family: var(--elreda-font-ar, "IBM Plex Sans Arabic", Tahoma, Arial, sans-serif);
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    transition:
        background-color var(--elreda-transition, 180ms ease),
        transform var(--elreda-transition, 180ms ease);
}

.site-header .woocommerce-product-search button[type="submit"]:hover,
.site-header .woocommerce-product-search button[type="submit"]:focus-visible {
    background: var(--elreda-red-hover, #c90023);
}

.site-header .woocommerce-product-search button[type="submit"]:active {
    transform: translateY(1px);
}


/* ==========================================================================
   4. DESKTOP MAIN NAVIGATION
   ========================================================================== */

@media (min-width: 922px) {

    .ast-desktop .ast-below-header-bar {
        background: var(--elreda-navy-deep, #031329);
    }

    .ast-desktop .ast-below-header-bar .main-header-menu {
        align-items: center;
        justify-content: center;
        gap: 2px;
    }

    .ast-desktop .ast-below-header-bar .main-header-menu > .menu-item > .menu-link {
        display: flex;
        align-items: center;
        min-height: 48px;
        margin-block: 0;
        padding-inline: clamp(10px, 1vw, 15px);
        border-radius: var(--elreda-radius-sm, 8px);
        color: #fff !important;
        background: transparent;
        font-family: var(--elreda-font-ar, "IBM Plex Sans Arabic", Tahoma, Arial, sans-serif);
        font-size: 15px;
        font-weight: 600;
        line-height: 1.3;
        white-space: nowrap;
        transition:
            color var(--elreda-transition, 180ms ease),
            background-color var(--elreda-transition, 180ms ease);
    }

    .ast-desktop .ast-below-header-bar .main-header-menu > .menu-item:hover > .menu-link,
    .ast-desktop .ast-below-header-bar .main-header-menu > .menu-item:focus-within > .menu-link,
    .ast-desktop .ast-below-header-bar .main-header-menu > .current-menu-item > .menu-link,
    .ast-desktop .ast-below-header-bar .main-header-menu > .current-menu-ancestor > .menu-link {
        background: var(--elreda-blue, #0a55a2);
        color: #fff !important;
    }

    /* Keep Astra's dropdown arrow clean and properly spaced in RTL/LTR. */
    .ast-desktop .ast-below-header-bar .main-header-menu .dropdown-menu-toggle {
        margin-inline-start: 7px;
        color: currentColor;
    }


    /* ----------------------------------------------------------------------
       Desktop submenus
       ---------------------------------------------------------------------- */

    .ast-desktop .ast-below-header-bar .main-header-menu .sub-menu {
        min-width: 255px;
        padding: 8px;
        border: 1px solid var(--elreda-border, #e2e7ed);
        border-radius: var(--elreda-radius-md, 10px);
        background: #fff;
        box-shadow: 0 14px 34px rgb(3 19 41 / 14%);
        overflow: hidden;
    }

    .ast-desktop .ast-below-header-bar .main-header-menu .sub-menu .menu-item {
        background: transparent;
    }

    .ast-desktop .ast-below-header-bar .main-header-menu .sub-menu .menu-link {
        display: flex;
        align-items: center;
        min-height: 42px;
        padding: 9px 12px;
        border: 0;
        border-radius: 7px;
        background: transparent;
        color: var(--elreda-text, #182230) !important;
        font-family: var(--elreda-font-ar, "IBM Plex Sans Arabic", Tahoma, Arial, sans-serif);
        font-size: 14.5px;
        font-weight: 500;
        line-height: 1.5;
        white-space: normal;
        transition:
            color var(--elreda-transition, 180ms ease),
            background-color var(--elreda-transition, 180ms ease),
            padding var(--elreda-transition, 180ms ease);
    }

    .ast-desktop .ast-below-header-bar .main-header-menu .sub-menu .menu-item:hover > .menu-link,
    .ast-desktop .ast-below-header-bar .main-header-menu .sub-menu .menu-item:focus-within > .menu-link,
    .ast-desktop .ast-below-header-bar .main-header-menu .sub-menu .current-menu-item > .menu-link {
        background: var(--elreda-bg, #f5f7fa);
        color: var(--elreda-blue, #0a55a2) !important;
        padding-inline-start: 16px;
    }


    /* ----------------------------------------------------------------------
       Offers pill
       ----------------------------------------------------------------------
       Preferred: add CSS class "elreda-offers-menu" to the Offers menu item.
       URL fallback keeps it working with the current /offers/ page.
       ---------------------------------------------------------------------- */

    .ast-desktop .ast-below-header-bar .main-header-menu > .elreda-offers-menu > .menu-link,
    .ast-desktop .ast-below-header-bar .main-header-menu > .menu-item > a[href*="/offers/"] {
        min-height: 36px;
        margin-block: 6px;
        background: var(--elreda-red, #ed0029);
        color: #fff !important;
        border-radius: var(--elreda-radius-pill, 999px);
        padding-inline: 16px;
    }

    .ast-desktop .ast-below-header-bar .main-header-menu > .elreda-offers-menu:hover > .menu-link,
    .ast-desktop .ast-below-header-bar .main-header-menu > .elreda-offers-menu:focus-within > .menu-link,
    .ast-desktop .ast-below-header-bar .main-header-menu > .menu-item > a[href*="/offers/"]:hover,
    .ast-desktop .ast-below-header-bar .main-header-menu > .menu-item > a[href*="/offers/"]:focus-visible {
        background: var(--elreda-red-hover, #c90023);
        color: #fff !important;
    }
}



/* Search block markup (WooCommerce + WordPress). */
/* 1) SEARCH WIDGET: no visible title above the search box.
 * Hide the label visually, but retain it for screen readers.
 */
.site-header .wc-block-product-search__label:not(.screen-reader-text),
.site-header .wp-block-search__label:not(.screen-reader-text) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* 2) SEARCH WIDGET: center its content and eliminate block/widget margins. */
.site-header .wc-block-product-search,
.site-header .wp-block-search,
.site-header .widget_block:has(.wc-block-product-search),
.site-header .widget_block:has(.wp-block-search) {
    width: 100%;
    min-width: 0;
    max-width: 700px;
    margin: 0 auto;
}

.site-header .wc-block-product-search form,
.site-header .wp-block-search form {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* WooCommerce Block: input and submit button are children of this wrapper. */
.site-header .wc-block-product-search__fields,
/* WordPress Search Block fallback. */
.site-header .wp-block-search__inside-wrapper {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    min-width: 0;
    height: 46px;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    direction: rtl;
    border: 1px solid var(--elreda-border, #e2e7ed);
    border-radius: var(--elreda-radius-md, 10px);
    background: #fff;
    box-shadow: 0 2px 10px rgb(0 0 0 / 7%);
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.site-header .wc-block-product-search__fields:focus-within,
.site-header .wp-block-search__inside-wrapper:focus-within {
    border-color: var(--elreda-blue, #0a55a2);
    box-shadow: 0 0 0 3px rgb(10 85 162 / 17%);
}

.site-header .wc-block-product-search__field,
.site-header .wp-block-search__input {
    display: block !important;
    flex: 1 1 0% !important;
    min-width: 0 !important;
    width: 1% !important;
    height: 100% !important;
    min-height: 0;
    max-height: none;
    margin: 0 !important;
    padding: 0 16px !important;
    border: 0 !important;
    border-radius: 0 !important;
    outline: 0;
    background: #fff;
    color: var(--elreda-text, #182230);
    font: 400 15px/1.4 var(--elreda-font-ar, "IBM Plex Sans Arabic", Tahoma, Arial, sans-serif);
    box-shadow: none !important;
    direction: rtl;
    text-align: right;
}

.site-header .wc-block-product-search__field::placeholder,
.site-header .wp-block-search__input::placeholder {
    color: var(--elreda-muted, #667085);
    opacity: .85;
}

.site-header .wc-block-product-search__field:focus,
.site-header .wp-block-search__input:focus {
    outline: 0;
    box-shadow: none !important;
}

.site-header .wc-block-product-search__button,
.site-header .wp-block-search__button {
    display: inline-flex !important;
    flex: 0 0 94px !important;
    align-items: center !important;
    justify-content: center !important;
    width: 94px !important;
    min-width: 0;
    height: 100% !important;
    min-height: 0;
    margin: 0 !important;
    padding: 0 10px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: var(--elreda-red, #ed0029) !important;
    color: #fff !important;
    font: 700 14px/1 var(--elreda-font-ar, "IBM Plex Sans Arabic", Tahoma, Arial, sans-serif);
    white-space: nowrap;
    box-shadow: none !important;
    cursor: pointer;
    transition: background-color 180ms ease;
}

.site-header .wc-block-product-search__button:hover,
.site-header .wc-block-product-search__button:focus-visible,
.site-header .wp-block-search__button:hover,
.site-header .wp-block-search__button:focus-visible {
    background: var(--elreda-red-hover, #c90023) !important;
    color: #fff !important;
}

.site-header .wc-block-product-search__button svg,
.site-header .wp-block-search__button svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}


/* ==========================================================================
   5. MOBILE HEADER + OFF-CANVAS NAVIGATION (clean revision)
   ========================================================================== */
@media (max-width: 921px) {

    /* Utility links in one row: تواصل معنا | فروعنا. */
    .ast-header-break-point .ast-above-header-bar,
    .ast-header-break-point .ast-above-header-bar .ast-builder-grid-row {
        min-height: 32px;
    }

    .ast-header-break-point .ast-above-header-bar .main-header-menu {
        display: flex !important;
        flex-flow: row nowrap !important;
        align-items: center;
        justify-content: center;
        margin: 0;
        padding: 0;
        width: auto;
    }

    .ast-header-break-point .ast-above-header-bar .main-header-menu > .menu-item {
        width: auto !important;
        flex: 0 0 auto;
        border: 0;
    }

    .ast-header-break-point .ast-above-header-bar .main-header-menu > .menu-item > .menu-link {
        display: inline-flex;
        align-items: center;
        min-height: 32px;
        height: 32px;
        padding: 0 10px;
        font-size: 13px;
        color: var(--elreda-text, #182230);
        white-space: nowrap;
    }

    .ast-header-break-point .ast-above-header-bar .main-header-menu > .menu-item + .menu-item > .menu-link {
        border-inline-start: 1px solid var(--elreda-border, #e2e7ed);
    }

    .ast-header-break-point .ast-above-header-bar .ast-builder-social-element {
        display: none !important;
    }

    /* Main mobile row and the minimal hamburger (no persistent outline). */
    .ast-header-break-point .ast-primary-header-bar,
    .ast-header-break-point .ast-primary-header-bar .ast-builder-grid-row {
        min-height: 64px;
        background: var(--elreda-navy, #061a36);
    }

    .ast-header-break-point .ast-primary-header-bar .site-logo-img img,
    .ast-header-break-point .ast-primary-header-bar .custom-logo {
        max-height: 54px;
        width: auto;
    }

    .ast-header-break-point .ast-primary-header-bar .ast-button-wrap .menu-toggle,
    .ast-header-break-point .ast-primary-header-bar .menu-toggle.main-header-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        min-width: 44px;
        padding: 0;
        margin: 0;
        border: 0 !important;
        border-radius: 10px;
        background: transparent !important;
        color: #fff;
        box-shadow: none !important;
        outline: 0;
    }

    .ast-header-break-point .ast-primary-header-bar .ast-button-wrap .menu-toggle:hover,
    .ast-header-break-point .ast-primary-header-bar .ast-button-wrap .menu-toggle:focus-visible {
        background: rgb(255 255 255 / 11%) !important;
    }

    .ast-header-break-point .ast-primary-header-bar .ast-button-wrap .menu-toggle:focus-visible {
        outline: 2px solid #fff;
        outline-offset: 3px;
    }

    .ast-header-break-point .ast-primary-header-bar .menu-toggle svg {
        width: 23px;
        height: 23px;
        color: #fff;
    }

    /* Mobile product-search block: one row, never input + button stacked. */
    .ast-header-break-point .ast-below-header-bar {
        background: var(--elreda-navy-deep, #031329);
    }

    .ast-header-break-point .ast-below-header-bar .ast-builder-grid-row {
        padding: 8px 12px 10px;
    }

    .ast-header-break-point .ast-below-header-bar .ast-header-widget-area,
    .ast-header-break-point .ast-below-header-bar .widget-area,
    .ast-header-break-point .ast-below-header-bar .wc-block-product-search,
    .ast-header-break-point .ast-below-header-bar .wp-block-search {
        min-width: 0;
        width: 100%;
        max-width: none;
        margin: 0;
    }

    .ast-header-break-point .ast-below-header-bar .wc-block-product-search__fields,
    .ast-header-break-point .ast-below-header-bar .wp-block-search__inside-wrapper {
        height: 44px;
    }

    .ast-header-break-point .ast-below-header-bar .wc-block-product-search__field,
    .ast-header-break-point .ast-below-header-bar .wp-block-search__input {
        padding-inline: 12px !important;
        font-size: 14px;
    }

    .ast-header-break-point .ast-below-header-bar .wc-block-product-search__button,
    .ast-header-break-point .ast-below-header-bar .wp-block-search__button {
        flex-basis: 74px !important;
        width: 74px !important;
        font-size: 13px;
    }

    /* ----------------------------------------------------------------------
       Astra Flyout drawer — preserve native open/close JS + submenu state.
       Do NOT rotate the whole Astra toggle button: Astra may rotate it
       itself when expanded, including its clickable box.
       ---------------------------------------------------------------------- */

    .ast-mobile-popup-drawer .ast-mobile-popup-overlay {
        background: rgb(3 19 41 / 60%);
    }

    .ast-mobile-popup-drawer .ast-mobile-popup-inner {
        width: min(88vw, 360px);
        max-width: 360px;
        max-height: 100vh;
        max-height: 100dvh;
        background: #fff;
        color: var(--elreda-text, #182230);
        box-shadow: 0 0 34px rgb(3 19 41 / 20%);
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .ast-mobile-popup-drawer .ast-mobile-popup-header {
        min-height: 56px;
        padding: 7px 14px;
        background: #fff;
        border-bottom: 1px solid var(--elreda-border, #e2e7ed);
    }

    .ast-mobile-popup-drawer .ast-mobile-popup-header .menu-toggle-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: 0;
        border-radius: 9px;
        color: var(--elreda-navy, #061a36);
        background: var(--elreda-bg, #f5f7fa);
    }

    .ast-mobile-popup-drawer .ast-mobile-popup-header .menu-toggle-close:hover {
        color: #fff;
        background: var(--elreda-red, #ed0029);
    }

    .ast-mobile-popup-drawer .ast-mobile-popup-content {
        padding: 8px 0 24px;
        overflow: visible;
    }

    /* Explicitly remove Astra builder's 24px menu spacing on a narrow drawer. */
    .ast-mobile-popup-drawer .ast-mobile-popup-content .ast-builder-menu-mobile,
    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-bar-navigation {
        width: 100%;
        min-width: 0;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible;
    }

    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu {
        display: block;
        width: 100%;
        max-width: 100%;
        margin: 0 !important;
        padding: 0 14px !important;
        list-style: none;
        overflow: visible;
    }

    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu .menu-item {
        position: relative;
        display: block;
        width: 100%;
        min-width: 0;
        height: auto !important;
        min-height: 0;
        margin: 0 !important;
        overflow: visible;
    }

    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu > .menu-item {
        border-bottom: 1px solid var(--elreda-border, #e2e7ed);
    }

    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu > .menu-item:last-child {
        border-bottom: 0;
    }

    /* Link and toggle occupy one row; the name can wrap if needed. */
    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu > .menu-item > .menu-link {
        display: flex;
        align-items: center;
        min-height: 52px;
        width: 100%;
        margin: 0;
        padding: 11px 12px !important;
        color: var(--elreda-text, #182230);
        background: transparent;
        font: 600 15px/1.55 var(--elreda-font-ar, "IBM Plex Sans Arabic", Tahoma, Arial, sans-serif);
        text-align: start;
        white-space: normal;
        border: 0;
        border-radius: 0;
    }

    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu > .menu-item.menu-item-has-children > .menu-link {
        padding-inline-end: 58px !important; /* reserve space for arrow on the left in RTL */
    }

    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu > .menu-item:hover > .menu-link,
    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu > .current-menu-item > .menu-link,
    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu > .current-menu-ancestor > .menu-link {
        color: var(--elreda-blue, #0a55a2);
    }

    /* Square toggle remains in place when Astra adds ast-submenu-expanded. */
    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu > .menu-item.menu-item-has-children > .ast-menu-toggle {
        position: absolute !important;
        inset-block-start: 7px !important;
        inset-inline-end: 8px !important;
        top: 7px !important;
        left: 8px !important;
        right: auto !important;
        z-index: 2;
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 38px !important;
        min-width: 38px;
        height: 38px !important;
        min-height: 38px;
        padding: 0 !important;
        margin: 0 !important;
        border: 0 !important;
        border-radius: 9px !important;
        background: var(--elreda-bg, #f5f7fa) !important;
        color: var(--elreda-navy, #061a36) !important;
        box-shadow: none !important;
        transform: none !important; /* prevents rotating the entire button */
        overflow: hidden;
        cursor: pointer;
    }

    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu > .menu-item > .ast-menu-toggle:hover,
    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu > .menu-item > .ast-menu-toggle:focus-visible,
    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu > .ast-submenu-expanded > .ast-menu-toggle {
        background: var(--elreda-blue, #0a55a2) !important;
        color: #fff !important;
    }

    /* Use Astra's single actual icon. Prevent duplicated pseudo arrows. */
    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu > .menu-item > .ast-menu-toggle .ast-icon,
    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu > .menu-item > .ast-menu-toggle svg {
        display: block;
        width: 16px;
        height: 16px;
        margin: 0 !important;
        position: static !important;
        transform: none !important;
    }

    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu > .menu-item > .ast-menu-toggle:has(svg)::before {
        content: none !important;
    }

    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu > .ast-submenu-expanded > .ast-menu-toggle svg {
        transform: rotate(180deg) !important;
    }

    /* Crucial: a submenu MUST be in normal flow, not positioned far below. */
    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu .sub-menu {
        position: static !important;
        inset: auto !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        left: auto !important;
        float: none !important;
        clear: both;
        width: 100% !important;
        min-width: 0;
        max-width: 100%;
        margin: 0 0 12px !important;
        padding: 6px 8px !important;
        border: 1px solid var(--elreda-border, #e2e7ed);
        border-radius: 9px;
        background: var(--elreda-bg, #f5f7fa);
        box-shadow: none;
        transform: none !important;
        overflow: visible !important; /* never clip the last category */
        max-height: none !important;
        height: auto !important;
    }

    /* Respect Astra open-state; don't force ALL submenus open. */
    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu .menu-item:not(.ast-submenu-expanded) > .sub-menu {
        display: none !important;
    }

    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu .menu-item.ast-submenu-expanded > .sub-menu {
        display: block !important;
    }

    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu .sub-menu > .menu-item {
        border: 0;
    }

    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu .sub-menu .menu-link {
        display: flex;
        align-items: center;
        width: 100%;
        min-height: 43px;
        height: auto;
        margin: 0;
        padding: 9px 12px !important;
        border-radius: 7px;
        background: transparent;
        color: var(--elreda-text, #182230);
        font: 500 14px/1.5 var(--elreda-font-ar, "IBM Plex Sans Arabic", Tahoma, Arial, sans-serif);
        text-align: start;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    /* Astra sometimes adds chevrons to EVERY nested link: hide decorative ones. */
    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu .sub-menu .menu-link::before,
    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu .sub-menu .menu-link::after,
    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu .sub-menu .menu-link .icon-arrow,
    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu .sub-menu .menu-link .dropdown-menu-toggle {
        display: none !important;
        content: none !important;
    }

    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu .sub-menu .menu-link:hover,
    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu .sub-menu .current-menu-item > .menu-link {
        background: #fff;
        color: var(--elreda-blue, #0a55a2);
    }

    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu > .elreda-offers-menu > .menu-link,
    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu > .menu-item > a[href*="/offers/"] {
        display: inline-flex;
        width: auto;
        min-height: 38px;
        margin: 7px 0;
        padding: 7px 16px !important;
        border-radius: 999px;
        background: var(--elreda-red, #ed0029);
        color: #fff !important;
    }
}

/* Accessibility and very small phones. */
@media (max-width: 390px) {
    .ast-header-break-point .ast-primary-header-bar .custom-logo {
        max-height: 50px;
    }
    .ast-mobile-popup-drawer .ast-mobile-popup-content .main-header-menu {
        padding-inline: 10px !important;
    }
}

.site-header a:focus-visible,
.site-header button:focus-visible,
.ast-mobile-popup-drawer a:focus-visible,
.ast-mobile-popup-drawer button:focus-visible {
    outline: 2px solid var(--elreda-blue-hover, #1267c4);
    outline-offset: 2px;
}

/* Last-resort support for classic search forms wrapped by Astra Widget blocks.
 * Some widgets use .search-form + a label wrapper rather than Woo's classes.
 * These rules intentionally never target the normal page content or footer.
 */
.site-header .ast-header-widget-area form.search-form,
.site-header .widget-area form.search-form,
.site-header .ast-header-widget-area form.woocommerce-product-search,
.site-header .widget-area form.woocommerce-product-search {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: 700px;
    height: 46px;
    margin: 0 auto !important;
    padding: 0 !important;
    direction: rtl;
    overflow: hidden;
    border-radius: var(--elreda-radius-md, 10px);
    background: #fff;
}

.site-header .ast-header-widget-area form.search-form > label,
.site-header .widget-area form.search-form > label {
    display: block;
    flex: 1 1 0%;
    min-width: 0;
    height: 100%;
    margin: 0;
}

.site-header .ast-header-widget-area form.search-form input[type="search"],
.site-header .widget-area form.search-form input[type="search"] {
    display: block;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fff;
    color: var(--elreda-text, #182230);
    direction: rtl;
    text-align: right;
    box-shadow: none !important;
}

.site-header .ast-header-widget-area form.search-form button,
.site-header .ast-header-widget-area form.search-form input[type="submit"],
.site-header .widget-area form.search-form button,
.site-header .widget-area form.search-form input[type="submit"] {
    display: inline-flex !important;
    flex: 0 0 90px !important;
    align-items: center;
    justify-content: center;
    width: 90px !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 10px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: var(--elreda-red, #ed0029);
    color: #fff;
    font-weight: 700;
}

@media (max-width: 921px) {
    .site-header .ast-header-widget-area form.search-form,
    .site-header .widget-area form.search-form,
    .site-header .ast-header-widget-area form.woocommerce-product-search,
    .site-header .widget-area form.woocommerce-product-search {
        max-width: none;
        height: 44px;
    }

    .site-header .ast-header-widget-area form.search-form button,
    .site-header .ast-header-widget-area form.search-form input[type="submit"],
    .site-header .widget-area form.search-form button,
    .site-header .widget-area form.search-form input[type="submit"] {
        flex-basis: 74px !important;
        width: 74px !important;
    }
}
