/**
 * WPML language item in header: loads LAST (after style.css + WPML plugin CSS).
 * Fixes: label stuck in “icon row” (main.css a>span absolute), WPML flex on <a>,
 * submenu right:0 hanging under Blog. Use long selectors for specificity.
 */

/* ---- Desktop header (StoryQuest markup: header > .it-header-menu > nav.it-menu-content) ---- */

header.it-header-height .it-header-menu nav.it-menu-content > ul > li.menu-item-object-wpml_ls_menu_item,
header.it-header-height .it-header-menu nav.it-menu-content > ul > li.wpml-ls-menu-item {
    position: relative !important;
    vertical-align: bottom !important;
    z-index: 50 !important;
    width: max-content !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
    float: none !important;
}

header.it-header-height .it-header-menu nav.it-menu-content > ul > li.menu-item-object-wpml_ls_menu_item.p-static,
header.it-header-height .it-header-menu nav.it-menu-content > ul > li.wpml-ls-menu-item.p-static {
    position: relative !important;
}

/* Beat WPML: ul .wpml-ls-menu-item a { display:flex; align-items:center } */
header.it-header-height .it-header-menu nav.it-menu-content > ul > li.menu-item-object-wpml_ls_menu_item > a,
header.it-header-height .it-header-menu nav.it-menu-content > ul > li.wpml-ls-menu-item > a {
    display: inline-block !important;
    align-items: unset !important;
    justify-content: unset !important;
    flex-direction: unset !important;
    padding: 30px 15px !important;
    padding-top: 50px !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    text-align: center !important;
}

@media only screen and (min-width: 1200px) and (max-width: 1399px) {
    header.it-header-height .it-header-menu nav.it-menu-content > ul > li.menu-item-object-wpml_ls_menu_item > a,
    header.it-header-height .it-header-menu nav.it-menu-content > ul > li.wpml-ls-menu-item > a {
        padding: 30px 12px !important;
        padding-top: 50px !important;
    }
}

/* Beat main.css .it-header-menu > nav > ul > li > a span { position:absolute; top:29% } on .wpml-ls-native */
header.it-header-height .it-header-menu nav.it-menu-content > ul > li.menu-item-object-wpml_ls_menu_item > a span.wpml-ls-native,
header.it-header-height .it-header-menu nav.it-menu-content > ul > li.menu-item-object-wpml_ls_menu_item > a .wpml-ls-display,
header.it-header-height .it-header-menu nav.it-menu-content > ul > li.wpml-ls-menu-item > a span.wpml-ls-native,
header.it-header-height .it-header-menu nav.it-menu-content > ul > li.wpml-ls-menu-item > a .wpml-ls-display {
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    max-width: none !important;
    width: auto !important;
    margin: 0 !important;
    display: inline !important;
    transform: none !important;
    text-align: center !important;
}

header.it-header-height .it-header-menu nav.it-menu-content > ul > li.menu-item-object-wpml_ls_menu_item .wpml-ls-flag,
header.it-header-height .it-header-menu nav.it-menu-content > ul > li.wpml-ls-menu-item .wpml-ls-flag {
    display: none !important;
}

header.it-header-height .it-header-menu nav.it-menu-content > ul > li.menu-item-object-wpml_ls_menu_item .wpml-ls-native,
header.it-header-height .it-header-menu nav.it-menu-content > ul > li.wpml-ls-menu-item .wpml-ls-native {
    font-size: 15px;
    font-weight: 600;
}

@media only screen and (min-width: 1200px) and (max-width: 1399px) {
    header.it-header-height .it-header-menu nav.it-menu-content > ul > li.menu-item-object-wpml_ls_menu_item .wpml-ls-native,
    header.it-header-height .it-header-menu nav.it-menu-content > ul > li.wpml-ls-menu-item .wpml-ls-native {
        font-size: 14px;
    }
}

/* Submenu: left edge of narrow language li, not right:0 shift under Blog */
header.it-header-height .it-header-menu nav.it-menu-content > ul > li.menu-item-object-wpml_ls_menu_item > ul.sub-menu,
header.it-header-height .it-header-menu nav.it-menu-content > ul > li.wpml-ls-menu-item > ul.sub-menu {
    width: max-content !important;
    min-width: 0 !important;
    max-width: min(92vw, 16rem) !important;
    padding: 0.35rem !important;
    top: 100% !important;
    left: 0 !important;
    right: auto !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    text-align: left !important;
    border-radius: 14px !important;
    border-top: none !important;
    background: #fff !important;
    box-shadow:
        0 12px 40px rgba(26, 39, 48, 0.14),
        0 2px 10px rgba(31, 144, 162, 0.1) !important;
    list-style: none !important;
    transform: none !important;
    -webkit-transform: none !important;
}

header.it-header-height .it-header-menu nav.it-menu-content > ul > li.menu-item-object-wpml_ls_menu_item:hover > ul.sub-menu,
header.it-header-height .it-header-menu nav.it-menu-content > ul > li.wpml-ls-menu-item:hover > ul.sub-menu {
    transform: none !important;
    -webkit-transform: none !important;
}

header.it-header-height .it-header-menu nav.it-menu-content > ul > li.menu-item-object-wpml_ls_menu_item > ul.sub-menu > li > a,
header.it-header-height .it-header-menu nav.it-menu-content > ul > li.wpml-ls-menu-item > ul.sub-menu > li > a {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem !important;
    border-radius: 10px;
    font-weight: 600 !important;
    font-size: 0.875rem;
    line-height: 1.25;
    color: #1a2730 !important;
    white-space: nowrap;
}

header.it-header-height .it-header-menu nav.it-menu-content > ul > li.menu-item-object-wpml_ls_menu_item > ul.sub-menu > li > a::before,
header.it-header-height .it-header-menu nav.it-menu-content > ul > li.wpml-ls-menu-item > ul.sub-menu > li > a::before {
    display: none !important;
    content: none !important;
}

header.it-header-height .it-header-menu nav.it-menu-content > ul > li.menu-item-object-wpml_ls_menu_item > a::after,
header.it-header-height .it-header-menu nav.it-menu-content > ul > li.wpml-ls-menu-item > a::after {
    display: none !important;
    content: none !important;
}

header.it-header-height .it-header-menu nav.it-menu-content > ul > li.menu-item-object-wpml_ls_menu_item:hover > a,
header.it-header-height .it-header-menu nav.it-menu-content > ul > li.wpml-ls-menu-item:hover > a {
    color: var(--it-theme-2, #1f90a2) !important;
}

body.rtl header.it-header-height .it-header-menu nav.it-menu-content > ul > li.menu-item-object-wpml_ls_menu_item > ul.sub-menu,
body.rtl header.it-header-height .it-header-menu nav.it-menu-content > ul > li.wpml-ls-menu-item > ul.sub-menu {
    left: auto !important;
    right: 0 !important;
}

/* ---- Mobile off-canvas clone ---- */
.it-menu-mobile li.menu-item-object-wpml_ls_menu_item .wpml-ls-flag,
.it-menu-mobile li.wpml-ls-menu-item .wpml-ls-flag,
.it-menu-mobile li[class*="wpml_ls_menu_item"] .wpml-ls-flag {
    display: none !important;
}

.it-menu-mobile li.menu-item-object-wpml_ls_menu_item > a,
.it-menu-mobile li.wpml-ls-menu-item > a,
.it-menu-mobile li[class*="wpml_ls_menu_item"] > a {
    display: flex !important;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
    padding-right: 44px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.it-menu-mobile li.menu-item-object-wpml_ls_menu_item .sub-menu,
.it-menu-mobile li.wpml-ls-menu-item .sub-menu,
.it-menu-mobile li[class*="wpml_ls_menu_item"] .sub-menu {
    padding: 0.35rem !important;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 0.35rem !important;
}

.it-menu-mobile li.menu-item-object-wpml_ls_menu_item .sub-menu > li > a,
.it-menu-mobile li.wpml-ls-menu-item .sub-menu > li > a,
.it-menu-mobile li[class*="wpml_ls_menu_item"] .sub-menu > li > a {
    color: rgba(255, 255, 255, 0.92) !important;
    padding: 0.55rem 0.65rem !important;
    border-radius: 8px;
}

.it-menu-mobile li.menu-item-object-wpml_ls_menu_item .sub-menu > li > a:hover,
.it-menu-mobile li.wpml-ls-menu-item .sub-menu > li > a:hover,
.it-menu-mobile li[class*="wpml_ls_menu_item"] .sub-menu > li > a:hover {
    background: rgba(31, 144, 162, 0.35) !important;
    color: #fff !important;
}

.it-menu-mobile li.menu-item-object-wpml_ls_menu_item .sub-menu > li > a::before,
.it-menu-mobile li.wpml-ls-menu-item .sub-menu > li > a::before,
.it-menu-mobile li[class*="wpml_ls_menu_item"] .sub-menu > li > a::before {
    display: none !important;
    content: none !important;
}
