/* Comprehensive Isolated RTL Layout for Arabic (/ar) across Desktop, Tablet, and Mobile */
html[dir="rtl"],
html[dir="rtl"] body {
    direction: rtl;
    text-align: right;
    overflow-x: hidden;
}

/* TopBar */
html[dir="rtl"] .TopBar .Links {
    direction: rtl;
    white-space: nowrap;
}
html[dir="rtl"] .TopBar .Links > li {
    float: right;
}
html[dir="rtl"] .TopBar .Links > li.lang .dropdown {
    left: auto;
    right: 0;
    text-align: right;
}
html[dir="rtl"] .TopBar .SocialNetworks {
    float: left;
}
html[dir="rtl"] .NavigationTrigger {
    float: left;
}

/* PageTop Header */
html[dir="rtl"] .PageTop .Container .Logo {
    float: right;
    display: flex;
    align-items: center;
}
html[dir="rtl"] .PageTop .Container .Logo .text {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    margin-right: 30px;
    padding-right: 30px;
    border-right: 1px solid #000000;
}
html[dir="rtl"] .PageTop .Container .Menu {
    float: left;
}
html[dir="rtl"] .PageTop .Container .Menu .Search {
    margin-left: 0;
    margin-right: 20px;
    text-align: left;
    border-left: none;
    border-right: 1px solid #cfcfcf;
}
html[dir="rtl"] .PageTop .SearchBar .Container .close {
    right: auto;
    left: 10px;
    text-align: left;
    border-left: none;
    border-right: 1px solid #cfcfcf;
}

/* Main Navigation & Dropdowns & MegaMenu (.SubMenu) */
html[dir="rtl"] .Navigation > .Container > ul {
    direction: rtl;
}
html[dir="rtl"] .Navigation .Container > ul > li {
    float: right;
}
html[dir="rtl"] .Navigation .Container > ul > li > ul {
    left: auto;
    right: 0;
    text-align: right;
}
html[dir="rtl"] .SubMenu .l {
    left: auto;
    right: 0;
}
html[dir="rtl"] .SubMenu .Container {
    direction: rtl;
}
html[dir="rtl"] .SubMenu .Container .description {
    padding-left: 35px;
    padding-right: 20px;
    border-right: none;
    border-left: 1px solid rgba(255, 255, 255, 0.8);
    text-align: right;
}
html[dir="rtl"] .SubMenu .Container .description p {
    text-align: right;
}
html[dir="rtl"] .SubMenu .Container .items {
    flex: 1;
    min-width: 0;
}

/* Hero Slides & ItemCarousel (keep horizontal Swiper track LTR, text RTL to prevent PDF/track collision) */
html[dir="rtl"] .Slides {
    overflow: hidden;
}
html[dir="rtl"] .Slides .swiper-slide .a {
    text-align: right;
    padding-left: 24px;
    padding-right: 0;
}
html[dir="rtl"] .Slides .swiper-slide .a h2 {
    line-height: 1.25;
}
html[dir="rtl"] .ProductionLine .title h4 {
    white-space: nowrap;
    overflow: visible;
}
html[dir="rtl"] .ItemCarousel {
    overflow: hidden;
}
html[dir="rtl"] .ItemCarousel .Container {
    direction: ltr;
}
html[dir="rtl"] .ItemCarousel .item .title {
    direction: rtl;
    text-align: right;
}
html[dir="rtl"] .ItemCarousel .item .title::before {
    left: auto;
    right: 25px;
}

/* PageCover (Category / Product / Corporate Banners) */
html[dir="rtl"] .PageCover .Container .title {
    text-align: right;
    padding-left: 200px;
}
html[dir="rtl"] .PageCover.pagesImg .Container .title {
    padding-left: 0;
}
html[dir="rtl"] .PageCover .Container .image {
    right: auto;
    left: 0;
}
html[dir="rtl"] .PageCover .Container .leftT {
    text-align: right;
    padding-left: 170px;
    box-sizing: border-box;
}
html[dir="rtl"] .PageCover .title ul {
    gap: 4px 6px;
    line-height: 1.5;
}
html[dir="rtl"] .PageCover .title ul li {
    float: right;
    margin-right: 0;
    margin-left: 10px;
}
html[dir="rtl"] .PageCover .title ul li i.material-icons {
    transform: rotate(180deg);
}

/* History, ProductionLine, Press, Groups */
html[dir="rtl"] .History.mainpage {
    gap: 20px;
}
html[dir="rtl"] .History.mainpage .content {
    min-width: 0;
    text-align: right;
}
html[dir="rtl"] .ProductionLine {
    direction: ltr;
}
html[dir="rtl"] .ProductionLine .title h4 {
    direction: rtl;
}
html[dir="rtl"] .Press {
    margin-left: 0;
    margin-right: 20px;
    padding-left: 0;
    padding-right: 25px;
    border-left: none;
    border-right: 1px solid #e5e5e5;
}
html[dir="rtl"] .Press .title i {
    float: right;
    margin-right: 0;
    margin-left: 15px;
    flex-shrink: 0;
}
html[dir="rtl"] .Press .slider .press-releases .swiper-scrollbar {
    right: auto;
    left: 4px;
}
html[dir="rtl"] .Press .slider .press-releases .swiper-control-prev,
html[dir="rtl"] .Press .slider .press-releases .swiper-control-next {
    right: auto;
    left: 0;
}
html[dir="rtl"] .Press .slider .press-releases .swiper-wrapper .swiper-slide {
    padding-left: 18px;
    box-sizing: border-box;
}

html[dir="rtl"] .Groups {
    margin-left: 0;
    margin-right: 20px;
    padding-left: 0;
    padding-right: 25px;
    border-left: none;
    border-right: 1px solid #e5e5e5;
}
html[dir="rtl"] .Groups a {
    display: flex;
    align-items: center;
}
html[dir="rtl"] .Groups a .image {
    float: none;
    flex: 0 0 72px;
}
html[dir="rtl"] .Groups a .text {
    float: none;
    flex: 1;
    padding-left: 8px;
    padding-right: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Product Detail, News Swiper & Subpage Sidebar */
html[dir="rtl"] .ProductDetail .FlexRow {
    direction: rtl;
    gap: 24px;
}
html[dir="rtl"] .techspecs {
    min-width: 0;
}
html[dir="rtl"] .techspecs table td {
    text-align: right;
    padding: 6px 10px;
}
html[dir="rtl"] .techspecs table td:last-child {
    direction: ltr;
    unicode-bidi: isolate;
    text-align: left;
    white-space: nowrap;
}
html[dir="rtl"] .Categories .item .title h4 {
    direction: ltr;
    unicode-bidi: isolate;
    text-align: right;
}
html[dir="rtl"] #newsList .swiper-container {
    direction: ltr;
    overflow: hidden;
}
html[dir="rtl"] #newsList .item .title {
    direction: rtl;
    text-align: right;
}
html[dir="rtl"] .Main.Page .Container.FlexRow {
    gap: 24px;
}
html[dir="rtl"] .PageSidebar {
    margin-left: 0;
}

/* Footer */
html[dir="rtl"] .PageBottom .FlexRow {
    direction: rtl;
    gap: 24px;
}
html[dir="rtl"] .PageBottom .l {
    border-right: none;
    text-align: right;
}
html[dir="rtl"] .PageBottom .l .inviva {
    left: auto;
    right: 0;
}
html[dir="rtl"] .PageBottom .m {
    direction: rtl;
}
html[dir="rtl"] .PageBottom .m ul.a {
    text-align: left;
}
html[dir="rtl"] .PageBottom .m ul.b {
    text-align: right;
}
html[dir="rtl"] .PageBottom .r {
    padding-left: 0;
    padding-right: 40px;
    border-left: none;
    border-right: 1px solid rgba(155, 152, 152, 0.5);
    text-align: right;
}
html[dir="rtl"] .PageBottom .r .Contact .text p {
    direction: ltr;
    text-align: right;
}

/* Tablet & Mobile RTL Overrides (prevent stacking collisions <= 1200px) */
@media screen and (max-width: 1200px) {
    html[dir="rtl"] .Main.Home .Groups {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-right: 0;
        padding-right: 0;
        border-right: none;
        width: 100%;
        box-sizing: border-box;
    }
    html[dir="rtl"] .Main.Home .Groups a {
        width: 100%;
        margin: 0;
        box-sizing: border-box;
    }
}

@media screen and (max-width: 960px) {
    html[dir="rtl"] .PageTop .Container .Logo .text {
        margin-right: 14px;
        padding-right: 14px;
        max-width: 190px;
    }
    html[dir="rtl"] .Press,
    html[dir="rtl"] .Groups {
        margin-right: 0;
        padding-right: 0;
        border-right: none;
    }
    html[dir="rtl"] .PageBottom .r {
        padding-right: 0;
        border-right: none;
    }
    html[dir="rtl"] .PageBottom .l .inviva {
        position: static;
        margin-top: 20px;
    }
}

@media screen and (max-width: 768px) {
    html[dir="rtl"] .PageTop {
        height: auto;
        padding: 12px 0;
    }
    html[dir="rtl"] .PageTop .Container {
        height: auto;
        flex-wrap: wrap;
        gap: 10px;
    }
    html[dir="rtl"] .PageTop .Container .Logo {
        flex-direction: column;
        align-items: flex-start;
        max-width: calc(100% - 60px);
    }
    html[dir="rtl"] .PageTop .Container .Logo img {
        max-width: 170px;
    }
    html[dir="rtl"] .PageTop .Container .Logo .text {
        margin-right: 0;
        padding-right: 0;
        border-right: none;
        margin-top: 6px;
        max-width: 100%;
    }
    html[dir="rtl"] .PageCover .Container .title,
    html[dir="rtl"] .PageCover .Container .leftT {
        padding-left: 12px;
        padding-right: 12px;
        box-sizing: border-box;
    }
    html[dir="rtl"] .PageCover .Container .image {
        display: none;
    }
    html[dir="rtl"] .ItemCarousel .Container {
        padding-left: 0 !important;
        padding-right: 0 !important;
        overflow: hidden;
    }
    html[dir="rtl"] .ItemCarousel .item .title {
        padding: 0 12px;
        box-sizing: border-box;
    }
    html[dir="rtl"] .Main.Home .Groups {
        grid-template-columns: 1fr;
    }
    html[dir="rtl"] .ItemCarousel .ItemCarousel__pdf {
        position: static;
        width: 100%;
        height: auto;
        margin-bottom: 12px;
    }
    html[dir="rtl"] .ProductDetail .FlexRow,
    html[dir="rtl"] .PageBottom .FlexRow {
        flex-direction: column;
    }
    html[dir="rtl"] .PageBottom .m ul.a,
    html[dir="rtl"] .PageBottom .m ul.b {
        text-align: right;
    }
}
