/* مگامنو دو ستونه شبیه الگوی فروشگاهی: سطح ۲ راست، سطح ۳ چپ */

#header.fixed-top {
    overflow: visible;
    z-index: 1100;
}

#navbar {
    position: relative;
}

#navbar > ul {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
}

#navbar:not(.navbar-mobile) > ul > li.dropdown > ul {
    display: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.nav-mega-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(16, 32, 48, 0.45);
    z-index: 1090;
}

.nav-mega-backdrop.is-visible {
    display: block;
}

@media (min-width: 992px) {
    #navbar:not(.navbar-mobile) > ul > li {
        display: flex;
        align-items: center;
    }

    #navbar:not(.navbar-mobile) > ul > li > a {
        display: flex;
        align-items: center;
        height: auto;
        padding-top: 12px;
        padding-bottom: 12px;
        line-height: 1.4;
    }

    #navbar:not(.navbar-mobile) > ul > li.nav-mega {
        position: static;
    }

    #navbar:not(.navbar-mobile) > ul > li.nav-mega > ul {
        position: absolute;
        top: calc(100% + 10px);
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: min(1100px, calc(100vw - 32px)) !important;
        max-width: min(1100px, calc(100vw - 32px)) !important;
        height: min(72vh, 560px) !important;
        max-height: min(72vh, 560px) !important;
        margin: 0;
        padding: 0;
        overflow: hidden !important;
        background: #fff;
        border-radius: 16px;
        box-shadow: 0 22px 50px rgba(18, 66, 101, 0.22);
        z-index: 1200;
        display: none !important;
    }

    #navbar:not(.navbar-mobile) > ul > li.nav-mega > ul::before {
        content: "";
        position: absolute;
        top: -18px;
        left: 0;
        right: 0;
        height: 18px;
    }

    #navbar:not(.navbar-mobile) > ul > li.nav-mega.open > ul,
    #navbar:not(.navbar-mobile) > ul > li.nav-mega:hover > ul,
    #navbar:not(.navbar-mobile) > ul > li.nav-mega:focus-within > ul {
        display: block !important;
    }

    #navbar:not(.navbar-mobile) .nav-mega-shell {
        display: flex;
        flex-direction: row;
        width: 100%;
        height: 100%;
        min-height: 0;
        max-height: none;
        list-style: none;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }

    #navbar:not(.navbar-mobile) .nav-mega-l2-col {
        flex: 0 0 270px;
        width: 270px;
        height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background: #f6f8fb;
        border-left: 1px solid #e8eef4;
    }

    #navbar:not(.navbar-mobile) .nav-mega-l3-col {
        flex: 1 1 auto;
        min-width: 0;
        height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background: #fff;
    }

    #navbar:not(.navbar-mobile) .nav-mega-l2 {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        border: 0;
        background: transparent;
        padding: 13px 18px;
        text-align: right;
        font-size: 14px;
        font-weight: 700;
        color: #1b4f72;
        cursor: pointer;
        border-right: 3px solid transparent;
        line-height: 1.5;
        white-space: normal;
    }

    #navbar:not(.navbar-mobile) .nav-mega-l2 i {
        color: #8aa4b8;
        font-size: 12px;
        margin-right: 8px;
    }

    #navbar:not(.navbar-mobile) .nav-mega-l2:hover {
        background: #fff;
        color: #2487ce;
    }

    #navbar:not(.navbar-mobile) .nav-mega-l2.is-active {
        background: #fff;
        color: #2487ce;
        border-right-color: #e67a00;
        box-shadow: inset 0 0 0 1px #eef3f8;
    }

    #navbar:not(.navbar-mobile) .nav-mega-l3-pane {
        display: none;
        padding: 22px 26px;
        background: #fff;
        direction: rtl;
        text-align: right;
    }

    #navbar:not(.navbar-mobile) .nav-mega-l3-pane.is-active {
        display: block;
    }

    #navbar:not(.navbar-mobile) .nav-count {
        display: none !important;
    }

    #navbar:not(.navbar-mobile) .nav-mega-back {
        display: none !important;
    }

    #navbar:not(.navbar-mobile) .nav-mega-l3-head {
        margin-bottom: 16px;
        padding-bottom: 10px;
        border-bottom: 1px solid #eef3f8;
        text-align: right;
    }

    #navbar:not(.navbar-mobile) .nav-mega-l3-head a {
        display: inline-flex;
        align-items: center;
        justify-content: flex-start;
        gap: 8px;
        color: #2487ce !important;
        font-size: 16px;
        font-weight: 800;
        padding: 0 10px 0 0 !important;
        border-right: 3px solid #e67a00;
        min-height: auto;
        text-align: right;
    }

    #navbar:not(.navbar-mobile) .nav-mega-l3-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
        gap: 4px 28px;
        direction: rtl;
        text-align: right;
        justify-items: stretch;
    }

    #navbar:not(.navbar-mobile) .nav-mega-l3-link {
        display: block;
        padding: 9px 6px !important;
        color: #4b5d6c !important;
        font-size: 13.5px;
        font-weight: 500;
        line-height: 1.6;
        white-space: normal;
        border-radius: 8px;
        text-align: right !important;
        justify-content: flex-start !important;
        width: 100%;
    }

    #navbar:not(.navbar-mobile) .nav-mega-l3-link:hover {
        color: #2487ce !important;
        background: #f4f9fd;
    }

    #navbar:not(.navbar-mobile) > ul > li.nav-user {
        position: relative;
    }

    #navbar:not(.navbar-mobile) > ul > li.nav-user > ul {
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        right: auto;
        width: 280px !important;
        max-width: min(280px, 92vw) !important;
        max-height: min(70vh, 480px) !important;
        overflow-y: auto !important;
        padding: 8px 0 !important;
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 14px 32px rgba(18, 66, 101, 0.18);
        z-index: 1300;
        display: none !important;
    }

    #navbar:not(.navbar-mobile) > ul > li.nav-user.open > ul,
    #navbar:not(.navbar-mobile) > ul > li.nav-user:hover > ul,
    #navbar:not(.navbar-mobile) > ul > li.nav-user:focus-within > ul {
        display: flex !important;
        flex-direction: column !important;
    }

    #navbar:not(.navbar-mobile) > ul > li.nav-user > ul li {
        min-width: 0 !important;
        width: 100%;
    }

    #navbar:not(.navbar-mobile) > ul > li.nav-user > ul a {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 16px !important;
        white-space: nowrap;
    }
}

@media (max-width: 991px) {
    #navbar:not(.navbar-mobile) > ul {
        display: none !important;
    }

    .mobile-nav-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        position: relative !important;
        z-index: 1201;
        width: auto;
        min-width: 44px;
        height: 44px;
        padding: 0 4px;
        border: 0;
        background: transparent;
        color: #124265 !important;
        font-size: 15px;
        line-height: 1;
        gap: 6px;
        appearance: none;
        -webkit-appearance: none;
        direction: ltr;
    }

    .mobile-nav-toggle i {
        font-size: 28px;
        line-height: 1;
    }

    .mobile-nav-toggle-text {
        font-size: 13px;
        font-weight: 800;
        white-space: nowrap;
        color: #124265;
    }

    .mobile-nav-close {
        display: none;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 10px;
        left: 12px;
        right: auto;
        z-index: 4000;
        width: 44px;
        height: 44px;
        padding: 0;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: #fff;
        font-size: 36px;
        line-height: 1;
        cursor: pointer;
    }

    #navbar.navbar-mobile .mobile-nav-toggle {
        display: none !important;
        visibility: hidden;
        pointer-events: none;
    }

    #navbar.navbar-mobile .mobile-nav-close {
        display: flex !important;
    }

    .nav-mega-backdrop,
    .nav-mega-backdrop.is-visible {
        display: none !important;
    }

    body.mobile-nav-open {
        overflow: hidden;
    }
}

.mobile-nav-close {
    display: none;
}

#navbar.navbar-mobile {
    position: fixed !important;
    overflow: hidden;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    background: rgba(10, 38, 58, 0.9);
    z-index: 4000;
}

#navbar.navbar-mobile > ul {
    display: block !important;
    align-items: stretch;
    flex-wrap: nowrap;
}

.navbar-mobile ul {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#navbar.navbar-mobile > ul > li.dropdown > ul {
    position: static !important;
    width: auto !important;
    max-height: none !important;
    height: auto !important;
    transform: none !important;
    left: auto !important;
    right: auto !important;
    margin: 0 12px 10px;
    display: none !important;
    overflow: visible !important;
    background: #f7fbfe;
    border-radius: 10px;
    box-shadow: none !important;
}

#navbar.navbar-mobile > ul > li.dropdown.open > ul,
#navbar.navbar-mobile > ul > li.dropdown > ul.dropdown-active {
    display: block !important;
}

#navbar.navbar-mobile > ul > li.nav-user > ul {
    direction: rtl;
    text-align: right;
}

#navbar.navbar-mobile > ul > li.nav-user > ul li {
    width: 100%;
    min-width: 0 !important;
}

#navbar.navbar-mobile > ul > li.nav-user > ul a {
    display: flex !important;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    text-align: right !important;
}

#navbar.navbar-mobile > ul > li.nav-user > ul a i {
    margin: 0;
    color: #8aa4b8;
    font-size: 12px;
}

.navbar-mobile .nav-mega-shell {
    display: block;
    list-style: none;
    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;
}

.navbar-mobile .nav-mega-l2-col,
.navbar-mobile .nav-mega-l3-col {
    width: auto;
    height: auto;
    overflow: visible;
    background: transparent;
    border: 0;
}

.navbar-mobile .nav-mega-l3-col {
    display: none;
}

.navbar-mobile .nav-mega-shell.is-l3-open .nav-mega-l2-col {
    display: none;
}

.navbar-mobile .nav-mega-shell.is-l3-open .nav-mega-l3-col {
    display: block;
}

.navbar-mobile .nav-mega-back {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    margin-bottom: 8px;
    border: 0;
    background: #eef5fb;
    color: #1b4f72;
    font-weight: 700;
    padding: 10px 12px;
    border-radius: 8px;
    text-align: right;
}

.navbar-mobile .nav-mega-l3-pane.is-active {
    display: block !important;
}

.nav-count {
    display: none;
}

.navbar-mobile .nav-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: linear-gradient(165deg, #3aa0e6 0%, #1d6fae 100%);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
    box-shadow: 0 2px 7px rgba(29, 111, 174, 0.28);
    flex: 0 0 auto;
}

#navbar.navbar-mobile > ul > li.dropdown > a {
    display: flex !important;
    align-items: center;
    gap: 8px;
}

#navbar.navbar-mobile > ul > li.dropdown > a > span:not(.nav-count) {
    flex: 1 1 auto;
    text-align: right;
}

#navbar.navbar-mobile > ul > li.dropdown > a > i {
    margin: 0;
    flex: 0 0 auto;
}

.navbar-mobile .nav-mega-l2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    width: 100%;
    border: 0;
    border-bottom: 1px solid #e8eef4;
    background: transparent;
    padding: 12px 14px;
    text-align: right;
    font-weight: 700;
    color: #1b4f72;
    border-right: 3px solid transparent;
}

.navbar-mobile .nav-mega-l2 > span:not(.nav-count) {
    flex: 1 1 auto;
    text-align: right;
}

.navbar-mobile .nav-mega-l2 > i {
    flex: 0 0 auto;
    color: #8aa4b8;
    font-size: 12px;
}

.navbar-mobile .nav-mega-l2.is-active {
    background: #fff;
    color: #2487ce;
    border-right-color: #e67a00;
}

.navbar-mobile .nav-mega-l3-pane {
    display: none;
    padding: 4px 12px 12px;
    direction: rtl;
    text-align: right;
    background: #fff;
}

.navbar-mobile .nav-mega-l3-pane.is-active {
    display: block;
}

.navbar-mobile .nav-mega-l3-head a {
    color: #2487ce;
    font-weight: 800;
    text-align: right;
    justify-content: flex-start;
    padding: 8px 4px !important;
}

.navbar-mobile .nav-mega-l3-link {
    display: block;
    padding: 10px 8px !important;
    color: #4b5d6c !important;
    text-align: right !important;
    justify-content: flex-start !important;
}

.navbar-mobile a,
.navbar-mobile .nav-mega-l2 {
    min-height: 44px;
}

.mobile-nav-search {
    display: none;
}

#navbar.navbar-mobile .mobile-nav-search {
    display: block;
    position: absolute;
    top: 52px;
    right: 15px;
    left: 15px;
    z-index: 6;
}

.mobile-nav-search-field {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 46px;
    padding: 0 12px;
    margin: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 22px rgba(18, 66, 101, 0.16);
}

.mobile-nav-search-field i {
    color: #2487ce;
    font-size: 16px;
}

.mobile-nav-search-field input {
    flex: 1 1 auto;
    width: 100%;
    border: 0;
    outline: none;
    background: transparent;
    color: #1b4f72;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.6;
    min-height: 44px;
}

.mobile-nav-search-field input::placeholder {
    color: #8aa4b8;
    font-weight: 500;
}

.mobile-nav-search-clear {
    display: none;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: #ffe3e3;
    color: #e03131;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.mobile-nav-search-clear i {
    font-size: 22px;
    line-height: 1;
    color: #e03131;
}

.mobile-nav-search-clear:hover,
.mobile-nav-search-clear:focus {
    background: #ffc9c9;
    color: #c92a2a;
}

.mobile-nav-search-field.has-value .mobile-nav-search-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#navbar.navbar-mobile > ul {
    top: 108px !important;
}

#navbar.navbar-mobile.is-searching > ul {
    visibility: hidden;
    pointer-events: none;
}

.mobile-nav-search-results,
.mobile-nav-search-empty {
    display: none;
}

#navbar.navbar-mobile.is-searching .mobile-nav-search-results:not([hidden]) {
    display: block;
    position: absolute;
    top: 58px;
    right: 0;
    left: 0;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 14px 32px rgba(18, 66, 101, 0.18);
    padding: 6px 0;
}

#navbar.navbar-mobile.is-searching .mobile-nav-search-empty:not([hidden]) {
    display: block;
    position: absolute;
    top: 58px;
    right: 0;
    left: 0;
    margin: 0;
    padding: 28px 16px;
    background: #fff;
    border-radius: 12px;
    color: #6b7f8e;
    text-align: center;
    font-weight: 700;
}

.mobile-nav-hit {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 11px 16px !important;
    min-height: 52px !important;
    color: #1b4f72 !important;
    text-align: right !important;
    border-bottom: 1px solid #eef3f8;
}

.mobile-nav-hit:last-child {
    border-bottom: 0;
}

.mobile-nav-hit-title {
    font-size: 14px;
    font-weight: 800;
    line-height: 1.6;
}

.mobile-nav-hit-mark {
    background: #ffe08a;
    color: #124265;
    padding: 0 3px;
    border-radius: 4px;
    font-weight: 800;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.mobile-nav-hit-path .mobile-nav-hit-mark {
    background: #ffe9b3;
    color: #1b4f72;
    font-weight: 700;
}

.mobile-nav-hit-path {
    font-size: 11px;
    color: #7a93a6;
    font-weight: 500;
    line-height: 1.5;
}

.mobile-nav-hit:hover,
.mobile-nav-hit:focus {
    background: #f4f9fd;
    color: #2487ce !important;
}
