/*
 * Shared off-canvas category-arrow states.
 *
 * The storefront can render either ICT_Navigation or Rootways_Megamenu.
 * Keep the icon geometry fixed and transition only colour so hover/focus never
 * shifts the menu row or its label.
 */

.main-menu-wrapper .menu-item.has-children > .title {
    --xbau-side-menu-arrow-color: #4D4D4F;
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    position: relative;
}

.main-menu-wrapper .menu-item.has-children > .title::after {
    border-color: var(--xbau-side-menu-arrow-color) !important;
    border-style: solid;
    border-width: 2px 2px 0 0;
    box-sizing: border-box;
    content: "" !important;
    display: block !important;
    flex: 0 0 10px;
    height: 10px;
    margin-left: auto;
    transform: rotate(45deg);
    transition: border-color 180ms ease;
    width: 10px;
}

/* Keep the arrow visible while Magento is between static-asset and PHP-template
 * versions during a deployment. The runtime marks a link ready only after its
 * real SVG exists; until then the pseudo-element above is the safe fallback. */
.main-menu-wrapper .menu-item.has-children > .title.xbau-side-menu-arrow-ready::after {
    content: none !important;
    display: none !important;
}

.main-menu-wrapper .menu-item.has-children:is(:hover, :focus-within) > .title,
.main-menu-wrapper .menu-item.has-children > .title:is(:hover, :focus-visible),
.main-menu-wrapper .menu-item.has-children.active > .title,
.main-menu-wrapper .menu-item.has-children.child-active > .title {
    --xbau-side-menu-arrow-color: #1E99A4;
}

.main-menu-wrapper .menu-item.has-children > .title > .xbau-side-menu-label {
    min-width: 0;
}

.main-menu-wrapper .menu-item.has-children > .title > .xbau-side-menu-arrow {
    color: var(--xbau-side-menu-arrow-color) !important;
    display: inline-flex !important;
    flex: 0 0 24px;
    height: 24px;
    margin-left: auto;
    opacity: 1 !important;
    transition: color 180ms ease;
    visibility: visible !important;
    width: 24px;
}

.main-menu-wrapper .menu-item.has-children > .title > .xbau-side-menu-arrow svg {
    display: block !important;
    height: 24px;
    width: 24px;
}

.main-menu-wrapper .menu-item.has-children > .title > .xbau-side-menu-arrow path {
    fill: currentColor !important;
}

/* Rootways top-level, category and brand rows. */
html body .sections.nav-sections:not(.active) .rootmenu .xbau-side-menu-arrow {
    display: none !important;
}

html body .sections.nav-sections.active .rootmenu a {
    --xbau-side-menu-arrow-color: #4D4D4F;
}

html body .sections.nav-sections.active .rootmenu a:is(:hover, :focus-visible),
html body .sections.nav-sections.active .rootmenu li:focus-within > a.xbau-side-menu-parent,
html body .sections.nav-sections.active .rootmenu li:hover > a.xbau-side-menu-parent {
    --xbau-side-menu-arrow-color: #1E99A4;
}

html body .sections.nav-sections.active .rootmenu a.xbau-side-menu-parent,
html body .sections.nav-sections.active .rootmenu .all-category-wrapper > a,
html body .sections.nav-sections.active .rootmenu > .rootmenu-list > li > a[data-xbau-menu-role="brands"],
html body .sections.nav-sections.active .rootmenu > .rootmenu-list > li > a[href$="/brands"],
html body .sections.nav-sections.active .rootmenu > .rootmenu-list > li > a[href$="/brands.html"],
html body .sections.nav-sections.active .rootmenu a.has-sub-cat,
html body .sections.nav-sections.active .rootmenu a:not(.xbau-side-menu-arrow-ready):has(+ :is(
    .rootmenu-submenu,
    .rootmenu-submenu-sub,
    .rootmenu-submenu-sub-sub,
    .megamenu,
    .halfmenu,
    .verticalopen,
    .verticalopen02,
    .verticalmenu02,
    .tabbing_lev4,
    .level3-popup,
    .level4-popup,
    .level4-listing,
    .varticalmenu_main,
    .colultabtwo,
    .colultabthree,
    .resultdiv
):not(.empty_category)) {
    align-items: center;
    display: flex !important;
    gap: 12px;
    justify-content: space-between;
    position: relative;
}

html body .sections.nav-sections.active .rootmenu a.xbau-side-menu-parent:is(.active, [aria-expanded="true"]) {
    --xbau-side-menu-arrow-color: #1E99A4;
}

html body .sections.nav-sections.active .rootmenu a.xbau-side-menu-arrow-ready::after {
    content: none !important;
    display: none !important;
}

/* Static-content/PHTML versions can briefly be mixed during Magento deploys.
 * These selectors keep the two required drawer rows and legacy submenu parents
 * visible until menu.js installs the deterministic inline SVG. */
html body .sections.nav-sections.active .rootmenu a.xbau-side-menu-parent:not(.xbau-side-menu-arrow-ready)::after,
html body .sections.nav-sections.active .rootmenu .all-category-wrapper > a:not(.xbau-side-menu-arrow-ready)::after,
html body .sections.nav-sections.active .rootmenu > .rootmenu-list > li > a[data-xbau-menu-role="brands"]:not(.xbau-side-menu-arrow-ready)::after,
html body .sections.nav-sections.active .rootmenu > .rootmenu-list > li > a[href$="/brands"]:not(.xbau-side-menu-arrow-ready)::after,
html body .sections.nav-sections.active .rootmenu > .rootmenu-list > li > a[href$="/brands.html"]:not(.xbau-side-menu-arrow-ready)::after,
html body .sections.nav-sections.active .rootmenu a.has-sub-cat:not(.xbau-side-menu-arrow-ready)::after,
html body .sections.nav-sections.active .rootmenu a:not(.has-sub-cat):not(.xbau-side-menu-arrow-ready):has(+ :is(
    .rootmenu-submenu,
    .rootmenu-submenu-sub,
    .rootmenu-submenu-sub-sub,
    .megamenu,
    .halfmenu,
    .verticalopen,
    .verticalopen02,
    .verticalmenu02,
    .tabbing_lev4,
    .level3-popup,
    .level4-popup,
    .level4-listing,
    .varticalmenu_main,
    .colultabtwo,
    .colultabthree,
    .resultdiv
):not(.empty_category)) > .cat-arrow::after {
    background-color: var(--xbau-side-menu-arrow-color) !important;
    background-image: none !important;
    border: 0 !important;
    box-sizing: border-box;
    content: "" !important;
    display: block !important;
    flex: 0 0 24px;
    font-size: 0 !important;
    height: 24px;
    margin: 0;
    padding: 0 !important;
    transform: none !important;
    transition: background-color 180ms ease;
    width: 24px;
    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTguNDMzMDcgNi41NzQ5Nkw5LjQ5NDA3IDUuNTE0OTZMMTUuMjczMSAxMS4yOTJDMTUuMzY2MiAxMS4zODQ1IDE1LjQ0MDEgMTEuNDk0NiAxNS40OTA2IDExLjYxNThDMTUuNTQxIDExLjczNzEgMTUuNTY3IDExLjg2NzEgMTUuNTY3IDExLjk5ODVDMTUuNTY3IDEyLjEyOTggMTUuNTQxIDEyLjI1OTggMTUuNDkwNiAxMi4zODExQzE1LjQ0MDEgMTIuNTAyMyAxNS4zNjYyIDEyLjYxMjQgMTUuMjczMSAxMi43MDVMOS40OTQwNyAxOC40ODVMOC40MzQwNyAxNy40MjVMMTMuODU4MSAxMkw4LjQzMzA3IDYuNTc0OTZaIiBmaWxsPSIjMjYyNjI2Ii8+Cjwvc3ZnPgo=");
    -webkit-mask-position: center;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-size: 24px 24px;
    mask-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1zbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTguNDMzMDcgNi41NzQ5Nkw5LjQ5NDA3IDUuNTE0OTZMMTUuMjczMSAxMS4yOTJDMTUuMzY2MiAxMS4zODQ1IDE1LjQ0MDEgMTEuNDk0NiAxNS40OTA2IDExLjYxNThDMTUuNTQxIDExLjczNzEgMTUuNTY3IDExLjg2NzEgMTUuNTY3IDExLjk5ODVDMTUuNTY3IDEyLjEyOTggMTUuNTQxIDEyLjI1OTggMTUuNDkwNiAxMi4zODExQzE1LjQ0MDEgMTIuNTAyMyAxNS4zNjYyIDEyLjYxMjQgMTUuMjczMSAxMi43MDVMOS40OTQwNyAxOC40ODVMOC40MzQwNyAxNy40MjVMMTMuODU4MSAxMkw4LjQzMzA3IDYuNTc0OTZaIiBmaWxsPSIjMjYyNjI2Ii8+Cjwvc3ZnPgo=");
    mask-position: center;
    mask-repeat: no-repeat;
    mask-size: 24px 24px;
}

html body .sections.nav-sections.active .rootmenu a.xbau-side-menu-parent:not(.xbau-side-menu-arrow-ready)::after,
html body .sections.nav-sections.active .rootmenu .all-category-wrapper > a:not(.xbau-side-menu-arrow-ready)::after,
html body .sections.nav-sections.active .rootmenu > .rootmenu-list > li > a[data-xbau-menu-role="brands"]:not(.xbau-side-menu-arrow-ready)::after,
html body .sections.nav-sections.active .rootmenu > .rootmenu-list > li > a[href$="/brands"]:not(.xbau-side-menu-arrow-ready)::after,
html body .sections.nav-sections.active .rootmenu > .rootmenu-list > li > a[href$="/brands.html"]:not(.xbau-side-menu-arrow-ready)::after,
html body .sections.nav-sections.active .rootmenu a.has-sub-cat:not(.xbau-side-menu-arrow-ready)::after {
    margin-left: auto;
}

/* The hydrated/server-rendered parent always uses one real 24px SVG. */
html body .sections.nav-sections.active .rootmenu a.xbau-side-menu-parent > .xbau-side-menu-arrow {
    color: var(--xbau-side-menu-arrow-color) !important;
    display: inline-flex !important;
    flex: 0 0 24px !important;
    height: 24px !important;
    margin: 0 0 0 auto !important;
    max-height: 24px !important;
    max-width: 24px !important;
    min-height: 24px !important;
    min-width: 24px !important;
    opacity: 1 !important;
    pointer-events: none;
    transition: color 180ms ease;
    visibility: visible !important;
    width: 24px !important;
}

html body .sections.nav-sections.active .rootmenu a.xbau-side-menu-parent > .xbau-side-menu-arrow svg {
    display: block !important;
    height: 24px !important;
    width: 24px !important;
}

html body .sections.nav-sections.active .rootmenu a.xbau-side-menu-parent > .xbau-side-menu-arrow path {
    fill: currentColor !important;
}

/* Runtime-normalised triggers use the inline SVG, never stacked legacy arrows. */
html body .sections.nav-sections.active .rootmenu a.xbau-side-menu-parent > .cat-arrow,
html body .sections.nav-sections.active .rootmenu a.xbau-side-menu-parent > .arrow-div,
html body .sections.nav-sections.active .rootmenu a.xbau-side-menu-parent > .fa-angle-down {
    display: none !important;
}

/* A legacy nested parent can arrive with both has-sub-cat and cat-arrow.
 * The parent fallback above owns first paint in that case, so suppress the
 * redundant child slot and avoid two chevrons/a 24px layout jump. */
html body .sections.nav-sections.active .rootmenu a.has-sub-cat > .cat-arrow {
    display: none !important;
}

html body .sections.nav-sections.active .rootmenu a > .cat-arrow {
    display: none !important;
    flex: 0 0 24px;
    height: 24px;
    margin: 0;
    width: 24px;
}

html body .sections.nav-sections.active .rootmenu a:not(.has-sub-cat):not(.xbau-side-menu-arrow-ready):has(+ :is(
    .rootmenu-submenu,
    .rootmenu-submenu-sub,
    .rootmenu-submenu-sub-sub,
    .megamenu,
    .halfmenu,
    .verticalopen,
    .verticalopen02,
    .verticalmenu02,
    .tabbing_lev4,
    .level3-popup,
    .level4-popup,
    .level4-listing,
    .varticalmenu_main,
    .colultabtwo,
    .colultabthree,
    .resultdiv
):not(.empty_category)) > .cat-arrow {
    display: block !important;
}

html body .sections.nav-sections.active .rootmenu a > .cat-arrow::before {
    content: none !important;
    display: none !important;
}

/* The deepest tabbed category level receives its arrow from web/js/menu.js. */
html body .sections.nav-sections.active .rootmenu a > .arrow-div {
    flex: 0 0 24px;
    height: 24px;
    width: 24px;
}

html body .sections.nav-sections.active .rootmenu a > .arrow-div svg {
    display: block;
    height: 24px;
    width: 24px;
}

html body .sections.nav-sections.active .rootmenu a > .arrow-div svg path {
    fill: var(--xbau-side-menu-arrow-color) !important;
    transition: fill 180ms ease;
}

html body .sections.nav-sections.active .rootmenu a > .fa-angle-down {
    color: var(--xbau-side-menu-arrow-color) !important;
    transition: color 180ms ease;
}

/* Rootways' responsive expand control is a sibling of the category link. */
.sections.nav-sections .rootmenu .rootmenu-click {
    --xbau-side-menu-arrow-color: #4D4D4F;
}

.sections.nav-sections .rootmenu li:hover > .rootmenu-click,
.sections.nav-sections .rootmenu li:has(> a:focus-visible) > .rootmenu-click,
.sections.nav-sections .rootmenu .rootmenu-click:is(:hover, :focus-visible) {
    --xbau-side-menu-arrow-color: #1E99A4;
}

.sections.nav-sections .rootmenu .rootmenu-click > .rootmenu-arrow::before {
    border-color: var(--xbau-side-menu-arrow-color) !important;
    transition: background-color 180ms ease, border-color 180ms ease;
}

.sections.nav-sections .rootmenu > .rootmenu-list > li > .rootmenu-click > .rootmenu-arrow::before,
.sections.nav-sections .rootmenu > .rootmenu-list > li > .rootmenu-click > .rootmenu-arrow::after {
    background-color: var(--xbau-side-menu-arrow-color) !important;
    transition: background-color 180ms ease;
}

@media (prefers-reduced-motion: reduce) {
    .main-menu-wrapper .menu-item.has-children > .title::after,
    .main-menu-wrapper .menu-item.has-children > .title > .xbau-side-menu-arrow,
    .sections.nav-sections .rootmenu a.xbau-side-menu-parent > .xbau-side-menu-arrow,
    .sections.nav-sections .rootmenu a.xbau-side-menu-parent:not(.xbau-side-menu-arrow-ready)::after,
    .sections.nav-sections .rootmenu a.has-sub-cat:not(.xbau-side-menu-arrow-ready)::after,
    .sections.nav-sections .rootmenu a:not(.has-sub-cat):not(.xbau-side-menu-arrow-ready):has(+ :not(.empty_category)) > .cat-arrow::after,
    .sections.nav-sections .rootmenu a > .arrow-div svg path,
    .sections.nav-sections .rootmenu a > .fa-angle-down,
    .sections.nav-sections .rootmenu .rootmenu-click > .rootmenu-arrow::before,
    .sections.nav-sections .rootmenu .rootmenu-click > .rootmenu-arrow::after {
        transition: none;
    }
}
