/* Guidance Suite v1.0.2 — Arabic-only RTL text defaults.
   Deliberately do not mirror layout, transform icons or force RTL in LTR data.
   Elementor's explicit centered alignment has priority over :where() defaults. */

/* Arabic pages: reset the page direction and default text alignment.
   Polylang determines the request language server-side before this CSS loads. */
:where(html:lang(ar), html[dir="rtl"]) {
  direction: rtl;
}
:where(html:lang(ar), html[dir="rtl"]) body,
body.rtl {
  direction: rtl;
  text-align: right;
}

/* Theme / WooCommerce / Guidance main text containers. Do not apply to
   grids, buttons or the inner contents of centered Elementor widgets. */
:where(body.rtl) :where(
  #page, #main, main, article, .site, .site-content, .main-page-content,
  .content-page, .content-page-inner, .entry-content, .post-content,
  .page-content, .single-content, .gva-element,
  .woocommerce, .woocommerce-page, .woocommerce-account,
  .product, .product .summary, .woocommerce-Tabs-panel,
  .guidance-blog, .guidance-single, .blog-prose,
  .gds-main, .gds-main .gds-course-card,
  .gpdu-page, .gpdu-page .gpdu-details-card,
  .gca-portal, .acc-workspace, .acc-page
) {
  direction: rtl;
  text-align: right;
}

/* Ordinary titles and paragraphs, except content controlled by Elementor.
   :not(.elementor *) ensures we never force right over an Elementor Center
   setting stored on the widget or an explicitly centered block. */
body.rtl :where(
  h1, h2, h3, h4, h5, h6,
  p, blockquote, figcaption, ul, ol, li, dt, dd, th, td, label,
  .entry-title, .page-title, .post-title, .post-excerpt,
  .wp-block-heading, .wp-block-paragraph,
  .woocommerce-product-details__short-description,
  .woocommerce-Tabs-panel, .woocommerce-MyAccount-content
):not(:where(
  .elementor *,
  .elementor-location-header *,
  .elementor-location-footer *,
  [style*="text-align:center"],
  [style*="text-align: center"],
  [style*="text-align:centre"],
  .has-text-align-center,
  .aligncenter
)) {
  direction: rtl;
  text-align: right !important;
}

/* The Elementor defaults intentionally have zero specificity.
   Elementor's align:center, including its responsive CSS, will win.
   Don't set text-align directly on <p> inside an Elementor text-editor. */
:where(body.rtl) :where(
  .elementor,
  .elementor-widget-heading,
  .elementor-widget-text-editor,
  .elementor-widget-icon-box,
  .elementor-widget-image-box,
  .elementor-widget-icon-list,
  .elementor-widget-accordion,
  .elementor-widget-toggle,
  .elementor-widget-tabs,
  .elementor-widget-theme-post-content,
  .elementor-widget-woocommerce-products,
  .elementor-widget-woocommerce-product-content
) {
  direction: rtl;
  text-align: right;
}

/* Elementor heading/title and editor content: inherit the widget's chosen
   alignment. A widget explicitly configured Center will thus stay Center. */
:where(body.rtl) :where(
  .elementor-widget-text-editor p,
  .elementor-widget-text-editor li,
  .elementor-widget-text-editor h1,
  .elementor-widget-text-editor h2,
  .elementor-widget-text-editor h3,
  .elementor-widget-heading .elementor-heading-title,
  .elementor-widget-icon-box .elementor-icon-box-title,
  .elementor-widget-icon-box .elementor-icon-box-description,
  .elementor-widget-image-box .elementor-image-box-title,
  .elementor-widget-image-box .elementor-image-box-description
) {
  text-align: inherit;
}

/* Native menus and text-heavy WooCommerce UI. Preserve flex layout and order. */
body.rtl :where(
  .gva-navigation-menu .submenu-inner,
  .gva-navigation-menu .submenu-inner li,
  .gva-navigation-menu .submenu-inner a,
  .woocommerce-breadcrumb,
  .woocommerce .woocommerce-message,
  .woocommerce .woocommerce-info,
  .woocommerce .woocommerce-error,
  .woocommerce .form-row,
  .woocommerce .woocommerce-MyAccount-navigation,
  .woocommerce .woocommerce-MyAccount-content,
  .woocommerce .woocommerce-Address,
  .woocommerce .woocommerce-checkout,
  .woocommerce .woocommerce-cart-form
) {
  direction: rtl;
  text-align: right;
}

/* Existing theme CSS forces submenu links to center with !important.
   This target is outside Elementor's explicit per-widget Align control. */
body.rtl ul.gva-nav-menu > li .submenu-inner li,
body.rtl .gva-navigation-menu ul.gva-nav-menu > li ul.submenu-inner li {
  text-align: right !important;
}

/* Keep numeric/coded content readable without changing text direction. */
body.rtl :where(input[type="email"], input[type="number"], input[type="tel"],
  input[type="url"], .woocommerce .input-text[type="email"], pre, code, kbd,
  .wp-block-code, .gpdu-native-cart input.qty, .acc-otp-input) {
  direction: ltr;
  unicode-bidi: isolate;
}
body.rtl :where([dir="ltr"], [dir="ltr"] *, .woocommerce-Price-amount bdi) {
  direction: ltr;
}

/* Elementor editors may explicitly center text via inline style or classes.
   Retain these, including common Elementor container-level controls. */
body.rtl :where(.elementor-align-center, .elementor-align-center *,
  .has-text-align-center, .has-text-align-center *,
  .elementor-widget[data-settings*='"align":"center"'],
  .elementor-widget[data-settings*='"align":"center"'] *) {
  text-align: center;
}
