/* ============================================================
   ACTOREIN — RTL corrections
   Loaded after every component stylesheet (priority 200), so it
   can mirror the physical left/right values those files rely on.
   Applies to the Persian locale (lang="fa") and to the manual
   right-to-left switch in the accessibility panel (dir="rtl").
   ============================================================ */

/* A real RTL document even when WordPress cannot infer it. */
:is(html[dir="rtl"], html[lang^="fa"]) { direction: rtl; }
:is(html[dir="rtl"], html[lang^="fa"]) body { direction: rtl; }

/* Latin identifiers keep their own direction. */
:is(html[dir="rtl"], html[lang^="fa"]) :is(
    input[type="tel"],
    input[type="email"],
    input[type="url"],
    input[type="number"],
    input[type="password"],
    .af-browser-icons
) { direction: ltr; text-align: left; }

/* ============================================================
   1. MOBILE HEADER
   The actions are absolutely anchored to the right for LTR; on
   RTL they must sit on the left, away from the logo.
   ============================================================ */
@media (max-width: 900px) {
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-tools {
        right: auto;
        left: 0;
    }
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-brand {
        padding-right: 0;
        padding-left: 60px;
    }
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-logo__mark {
        transform-origin: right center;
    }
}

@media (max-width: 640px) {
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-brand {
        padding-right: 0;
        padding-left: 56px;
    }
}

/* ============================================================
   2. MOBILE MENU DRAWER
   The drawer opens from the right in LTR; mirror its side,
   rounded corners, shadow and slide-in direction.
   ============================================================ */
@media (max-width: 900px) {
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-sheet__panel {
        left: 0 !important;
        right: auto !important;
        border-radius: 0 22px 22px 0 !important;
        box-shadow: 24px 0 60px -30px rgba(6, 24, 42, 0.55) !important;
        transform: translateX(-100%);
    }
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-sheet.is-open .nc-sheet__panel {
        transform: translateX(0);
    }
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-sheet__hero {
        border-radius: 0 22px 0 0 !important;
    }

    /* Chevrons point towards the trailing edge (left). */
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-sheet__nav > ul > li > a::after {
        margin-left: 0;
        margin-right: auto;
        border-right: 0;
        border-left: 1.5px solid #9db0c2;
        transform: rotate(-45deg);
    }
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-sheet__nav > ul > li > a:hover::after,
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-sheet__nav > ul > li > a:active::after {
        transform: translateX(-3px) rotate(-45deg);
    }
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-sheet__nav > ul > li.menu-item-has-children > a::after {
        transform: rotate(-135deg);
    }
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-sheet__nav > ul > li.menu-item-has-children.is-open > a::after {
        transform: rotate(45deg);
    }
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-sheet__nav > ul > li.menu-item-has-children > a:hover::after,
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-sheet__nav > ul > li.menu-item-has-children > a:active::after {
        transform: rotate(-135deg);
    }
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-sheet__nav > ul > li.menu-item-has-children.is-open > a:hover::after,
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-sheet__nav > ul > li.menu-item-has-children.is-open > a:active::after {
        transform: rotate(45deg);
    }

    /* Sub-menus indent from the reading side. */
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-sheet__nav .sub-menu {
        margin: 0 30px 12px 0 !important;
        padding-left: 0 !important;
        padding-right: 16px !important;
        border-left: 0;
        border-right: 1px solid #d7e4ef;
    }
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-sheet__nav.is-accordion .sub-menu {
        margin: 0 8px 8px 0 !important;
        padding-left: 0 !important;
        padding-right: 12px !important;
    }

    /* Quick-access chevrons and language codes follow the trailing edge. */
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-sheet__contact-item::after {
        margin-left: 0;
        margin-right: auto;
        border-right: 0;
        border-left: 1.6px solid #a6b8c8;
        transform: rotate(-45deg);
    }
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-sheet__contact-item--primary::after {
        border-left-color: rgba(255, 255, 255, 0.55);
    }
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-sheet__code {
        margin-left: 0 !important;
        margin-right: auto !important;
    }
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-sheet__lang-item,
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-sheet__contact-item {
        text-align: start;
    }
}

/* ============================================================
   3. MOBILE FOOTER ACCORDION
   ============================================================ */
:is(html[dir="rtl"], html[lang^="fa"]) .af-brand__img { object-position: right center; }

@media (max-width: 640px) {
    :is(html[dir="rtl"], html[lang^="fa"]) .af-widget__title {
        padding: 13px 0 13px 24px;
    }
    :is(html[dir="rtl"], html[lang^="fa"]) .af-widget__title::after {
        right: auto;
        left: 4px;
        border-right: 0;
        border-left: 2px solid #7b8ea3;
        transform: translateY(-70%) rotate(-45deg);
    }
    :is(html[dir="rtl"], html[lang^="fa"]) .af-widget__title.is-open::after {
        transform: translateY(-30%) rotate(135deg);
    }
}

/* ============================================================
   4. CATALOG & HOME PRODUCT GRIDS
   ============================================================ */
@media (max-width: 700px) {
    :is(html[dir="rtl"], html[lang^="fa"]) .actorein-catalog .acto-page-hero__content {
        text-align: right !important;
    }
    :is(html[dir="rtl"], html[lang^="fa"]) .actorein-catalog .ac-catalog-toolbar .ac-brand-filter summary .ac-brand-filter__caret {
        margin-left: 0 !important;
        margin-right: auto !important;
    }
    :is(html[dir="rtl"], html[lang^="fa"]) .rh-products .rh-products__filter-toggle,
    :is(html[dir="rtl"], html[lang^="fa"]) .rh-products .rh-products__filters button {
        text-align: right;
    }
    :is(html[dir="rtl"], html[lang^="fa"]) .rh-products__filter-caret {
        margin-left: 0;
        margin-right: auto;
    }
    :is(html[dir="rtl"], html[lang^="fa"]) .rh-categories .rh-categories__stack,
    :is(html[dir="rtl"], html[lang^="fa"]) .rh-areas .rh-areas__directory {
        scroll-padding-inline: var(--actorein-gutter, 16px);
    }
}

/* Dropdown panels that hang off a trigger on the left. */
:is(html[dir="rtl"], html[lang^="fa"]) .ac-brand-filter__panel {
    right: auto;
    left: 0;
}

/* List-view accent rail moves to the reading edge. */
:is(html[dir="rtl"], html[lang^="fa"]) .actorein-catalog[data-view="list"] .acto-products__grid .ac-product::before {
    inset: 0 0 0 auto;
}

/* Row arrows point into the reading direction. */
:is(html[dir="rtl"], html[lang^="fa"]) .ac-product__action svg {
    transform: scaleX(-1);
}
:is(html[dir="rtl"], html[lang^="fa"]) .ac-product:hover .ac-product__action svg,
:is(html[dir="rtl"], html[lang^="fa"]) .ac-product:focus-visible .ac-product__action svg,
:is(html[dir="rtl"], html[lang^="fa"]) .actorein-catalog[data-view="list"] .ac-product:hover .ac-product__action svg {
    transform: translateX(-3px) scaleX(-1);
}

/* Section headings that are explicitly left aligned in the LTR sheets. */
:is(html[dir="rtl"], html[lang^="fa"]) :is(
    .acto-sec-head,
    .acto-sec-head--between,
    .acto-sectors__head,
    .acto-stats__head,
    .acto-brands__title,
    .acto-clients__title,
    .acto-blog__head,
    .acto-products__head
) {
    text-align: start !important;
}

/* ============================================================
   5. SEARCH OVERLAY
   ============================================================ */
:is(html[dir="rtl"], html[lang^="fa"]) .nc-search__panel .nc-search__shell {
    transform: translateX(-40px);
}
:is(html[dir="rtl"], html[lang^="fa"]) .nc-search__panel.is-open .nc-search__shell {
    transform: translateX(0);
}
:is(html[dir="rtl"], html[lang^="fa"]) .nc-search__close {
    right: auto;
    left: 28px;
}
:is(html[dir="rtl"], html[lang^="fa"]) .nc-search__item-cat {
    margin-left: 0;
    margin-right: auto;
}

@media (max-width: 600px) {
    :is(html[dir="rtl"], html[lang^="fa"]) .nc-search__close {
        right: auto;
        left: 16px;
    }
}

/* ============================================================
   6. ACCESSIBILITY PANEL, LANGUAGE DRAWER, FLOATING TRIGGERS
   ============================================================ */
/* The settings window handles its own RTL layout in settings.css. */

/* The language drawer uses logical inset properties, so it mirrors on its own. */

/* Desktop dropdowns open towards the page instead of off it. */
:is(html[dir="rtl"], html[lang^="fa"]) .nc-lang__menu,
:is(html[dir="rtl"], html[lang^="fa"]) .nc-sites__menu {
    right: auto;
    left: 0;
    text-align: right;
}
:is(html[dir="rtl"], html[lang^="fa"]) .nc-lang__menu-code {
    margin-left: 0 !important;
    margin-right: auto !important;
}

/* ============================================================
   7. PRODUCT DETAIL
   ============================================================ */
:is(html[dir="rtl"], html[lang^="fa"]) .acto-pd__arrow--prev {
    left: auto !important;
    right: 12px !important;
}
:is(html[dir="rtl"], html[lang^="fa"]) .acto-pd__arrow--next {
    right: auto !important;
    left: 12px !important;
}
:is(html[dir="rtl"], html[lang^="fa"]) .acto-pd__arrow svg {
    transform: scaleX(-1);
}
:is(html[dir="rtl"], html[lang^="fa"]) .acto-pd__tag {
    left: auto !important;
    right: 14px !important;
}
:is(html[dir="rtl"], html[lang^="fa"]) .acto-pd__zoom {
    left: auto !important;
    right: 14px !important;
}
:is(html[dir="rtl"], html[lang^="fa"]) .acto-pd__counter {
    right: auto !important;
    left: 14px !important;
}

/* Bullets and steps that are pinned to the left edge. */
:is(html[dir="rtl"], html[lang^="fa"]) .acto-pd-specs-block__list li,
:is(html[dir="rtl"], html[lang^="fa"]) .acto-about__checks li {
    padding-left: 0;
    padding-right: 26px;
}
:is(html[dir="rtl"], html[lang^="fa"]) .acto-pd-specs-block__list li::before,
:is(html[dir="rtl"], html[lang^="fa"]) .acto-about__checks li::before {
    left: auto;
    right: 0;
}
:is(html[dir="rtl"], html[lang^="fa"]) .pdt-steps li {
    padding-left: 0;
    padding-right: 58px;
}
:is(html[dir="rtl"], html[lang^="fa"]) .pdt-steps li::before {
    left: auto;
    right: 0;
}
:is(html[dir="rtl"], html[lang^="fa"]) .acto-prose ul li {
    padding-left: 0;
    padding-right: 30px;
}
:is(html[dir="rtl"], html[lang^="fa"]) .acto-prose ul li::before {
    left: auto;
    right: 0;
}

/* Rows whose action is pushed to the far edge with an auto margin. */
:is(html[dir="rtl"], html[lang^="fa"]) :is(
    .acto-pd-doc__action,
    .pdt-doc__action,
    .pdt-store__go,
    .acto-pd-buy__go
) {
    margin-left: 0;
    margin-right: auto;
}

:is(html[dir="rtl"], html[lang^="fa"]) .ac-product-breadcrumb__sep {
    display: inline-block;
    transform: scaleX(-1);
}

/* Mobile product detail micro-adjustments. */
@media (max-width: 900px) {
    :is(html[dir="rtl"], html[lang^="fa"]) body.single-product .acto-pd__counter {
        right: auto !important;
        left: 10px !important;
    }
    :is(html[dir="rtl"], html[lang^="fa"]) body.single-product .acto-pd__zoom {
        left: auto !important;
        right: 10px !important;
    }
    :is(html[dir="rtl"], html[lang^="fa"]) body.single-product .acto-pd__panels .rg-table :is(th, td) {
        text-align: right !important;
    }
}

/* ============================================================
   8. MISC. PHYSICAL POSITIONS
   ============================================================ */
:is(html[dir="rtl"], html[lang^="fa"]) .eds-back-to-top {
    right: auto !important;
    left: 16px !important;
}
:is(html[dir="rtl"], html[lang^="fa"]) .acto-contactpage__directions {
    right: auto;
    left: 16px;
}
@media (max-width: 640px) {
    :is(html[dir="rtl"], html[lang^="fa"]) .acto-contactpage__directions {
        right: auto;
        left: 12px;
    }
}
