/*
 * Right-to-left adjustments for Arabic pages (html[dir="rtl"]).
 * Legacy Elementor widget styles are swapped for their published -rtl
 * variants at build time; this file covers the storefront's own styles.
 */

/* Arabic typography: Cairo ships Arabic glyphs and is already loaded. */
html[dir="rtl"] body
    :is(h1, h2, h3, h4, h5, h6, p, a, span, li, label, button, input, select,
        option, textarea, td, th, strong, em, small, div, blockquote, figcaption)
    :not([class*="fa-"]):not([class*="icon"]):not(.ec):not(.mega-indicator) {
    font-family: Cairo, sans-serif !important;
    letter-spacing: normal !important;
}

html[dir="rtl"] body {
    text-align: right;
}

/* Values that must stay left-to-right inside Arabic text. */
html[dir="rtl"] a[href^="tel:"],
html[dir="rtl"] a[href^="mailto:"],
html[dir="rtl"] input[type="tel"],
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="url"] {
    direction: ltr;
    unicode-bidi: embed;
}

html[dir="rtl"] input[type="tel"],
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="url"] {
    text-align: right;
}

/* Header */
html[dir="rtl"] #masthead.header-v12 .img-header-logo {
    padding-right: 25px;
    padding-left: 0;
}

html[dir="rtl"]
    #masthead.header-v12
    .otrac-header-search
    .input-group
    .input-group-btn
    button.btn[type="submit"] {
    border-radius: 6px 0 0 6px !important;
}

@media only screen and (min-width: 1200px) {
    html[dir="rtl"] #mega-menu-wrap-primary-nav #mega-menu-primary-nav {
        text-align: right;
    }
}

html[dir="rtl"] #mega-menu-wrap-primary-nav #mega-menu-primary-nav li.mega-menu-item ul.mega-sub-menu,
html[dir="rtl"] #mega-menu-wrap-primary-nav #mega-menu-primary-nav li.mega-menu-item a.mega-menu-link {
    text-align: right;
}

html[dir="rtl"] #mega-menu-wrap-primary-nav #mega-menu-primary-nav > li.mega-menu-flyout ul.mega-sub-menu {
    left: auto;
    right: 0;
}

html[dir="rtl"]
    #mega-menu-wrap-primary-nav
    #mega-menu-primary-nav
    > li.mega-menu-flyout
    ul.mega-sub-menu
    li.mega-menu-item
    ul.mega-sub-menu {
    left: auto;
    right: 100%;
}

html[dir="rtl"] .mega-menu-wrap .mega-menu-link .mega-indicator {
    margin-left: 0 !important;
    margin-right: 6px !important;
}

/*
 * Hero slider: Swiper keeps dir="ltr" for its slide maths, which left the
 * slide text parked on the left. Mirror only the slide content.
 */
html[dir="rtl"] .elementor-slides .swiper-slide-inner {
    direction: rtl;
    text-align: right;
}

/*
 * The legacy theme right-aligns every Elementor widget on .rtl pages, which
 * overrode centred widgets such as the homepage "Our Partners" heading. Let
 * each widget keep its own alignment; unaligned ones still inherit right.
 */
html[dir="rtl"] .elementor-widget-container {
    text-align: inherit;
}

/*
 * Gallery and News banners go full width with left: calc(50% - 50vw). In RTL
 * a set `right` wins over `left`, so Elementor's stretch offset (wrong in RTL)
 * shifted the banner. Clear it so the full-width rule applies.
 */
html[dir="rtl"] [data-managed-news-hero],
html[dir="rtl"] [data-managed-gallery-hero] {
    right: auto !important;
    /* In RTL the wider box overflows its container to the left, so the
       full-bleed offset runs the other way. */
    left: calc(50vw - 50%) !important;
}

/* Catalog header: the theme pins the result count to the right edge, where
   the page title sits in Arabic. Mirror it to the left edge. */
html[dir="rtl"] .woocommerce-page .page-header .woocommerce-result-count {
    right: auto;
    left: 0;
}

/*
 * Mobile drawer: the theme parks it at left:-350px. Overflow on the left is
 * scrollable in RTL documents, so mirror it to slide in from the right.
 */
html[dir="rtl"] .off-canvas-navigation {
    right: -350px;
    left: auto !important;
    border-right: 0;
    border-left: 1px solid #e3e9ef;
}

html[dir="rtl"] .off-canvas-navigation-wrapper.toggled .off-canvas-navigation {
    right: 0;
}

html[dir="rtl"] .off-canvas-navigation ul li a i {
    margin-right: 0;
    margin-left: 10px;
}

/*
 * Off-screen honeypot: a large negative left offset becomes scrollable
 * overflow in RTL documents, so park it on the non-scrollable side instead.
 */
html[dir="rtl"] .otrac-contact-form__honeypot {
    left: auto;
    right: -10000px;
}

/*
 * The theme drops #page's clipping while the drawer is open. Content that
 * overflows to the left (LTR carousels inside RTL sections) would then become
 * scrollable, so keep horizontal clipping without creating a scroll container.
 */
html[dir="rtl"] .off-canvas-wrapper #page,
html[dir="rtl"] .off-canvas-wrapper #page.off-canvas-bg-opacity {
    overflow-x: clip;
}
