/**
 * Xemry Commerce Refined v3.9.8 — visitor-language RTL layout.
 * Loaded only for /ar/, after the theme, WooCommerce and product CSS.
 * Maintain the existing markup, proportions, colours, typography and spacing.
 * LTR /en/ does not load this file.
 */
html[dir="rtl"] body.xm-refined {
  direction: rtl;
  text-align: start;
}

/* The main header, navigation, hero, product and footer grids follow the
 * document direction automatically. Only explicit physical offsets need
 * mirroring; don't reverse flex order twice. */
html[dir="rtl"] body.xm-refined .xm-header-actions {
  margin-left: 0;
  margin-right: auto;
}
html[dir="rtl"] body.xm-refined .xm-desktop-search {
  padding: 3px 14px 3px 5px;
}
html[dir="rtl"] body.xm-refined .xm-drawer-search {
  padding: 4px 15px 4px 5px;
}
html[dir="rtl"] body.xm-refined .xm-cart-badge {
  right: auto;
  left: -1px;
}
html[dir="rtl"] body.xm-refined .xm-hero-stage {
  border-radius: 8px 8px 8px 58px;
}
html[dir="rtl"] body.xm-refined .xm-hero-side span {
  left: auto;
  right: 6px;
}

/* Native WordPress desktop dropdowns anchor to their right edge and cascade
 * toward the left. Original hover/focus/keyboard logic stays untouched. */
html[dir="rtl"] body.xm-refined .xm-desktop-links .xm-wp-primary-menu .sub-menu {
  left: auto !important;
  right: 0 !important;
  text-align: right;
}
html[dir="rtl"] body.xm-refined .xm-desktop-links .xm-wp-primary-menu .sub-menu .sub-menu {
  left: auto !important;
  right: 100% !important;
}

/* Mobile menu and shopping drawer open from the left in Arabic. The JavaScript
 * uses is-open exactly as before, and no widths or markup are changed. */
html[dir="rtl"] body.xm-refined .xm-mobile-drawer {
  right: auto;
  left: 0;
  transform: translateX(-105%);
  box-shadow: 10px 0 50px #071d1835;
}
html[dir="rtl"] body.xm-refined .xm-mobile-drawer.is-open {
  transform: translateX(0);
}
html[dir="rtl"] body.xm-refined .xm-cart-drawer {
  right: auto;
  left: 0;
  transform: translateX(-105%);
  box-shadow: 20px 0 65px #071c174a;
}
html[dir="rtl"] body.xm-refined .xm-cart-drawer.is-open {
  transform: translateX(0);
}
html[dir="rtl"] body.xm-refined .xm-mobile-drawer .xm-wordpress-mobile-menu > li > a {
  padding: 13px 3px 13px 50px !important;
}
html[dir="rtl"] body.xm-refined .xm-mobile-drawer .xm-wordpress-mobile-menu .sub-menu {
  padding: 2px 15px 13px 0 !important;
  border-left: 0;
  border-right: 2px solid #d1e1d6;
}
html[dir="rtl"] body.xm-refined .xm-mobile-drawer .xm-wordpress-mobile-menu .sub-menu a {
  padding: 11px 13px 11px 44px !important;
}
html[dir="rtl"] body.xm-refined .xm-mobile-drawer .xm-wordpress-mobile-menu .xm-wp-submenu-toggle {
  right: auto;
  left: 0;
}
html[dir="rtl"] body.xm-refined .xm-mobile-support-nav .xm-menu-help .sub-menu,
html[dir="rtl"] body.xm-refined .xm-footer .xm-footer-menu .sub-menu {
  padding-left: 0 !important;
  padding-right: 13px !important;
}
html[dir="rtl"] body.xm-refined .xm-search-results {
  right: auto;
  left: 0;
  text-align: right;
}
/* Mobile drawer search results are in normal document flow as before. */
html[dir="rtl"] body.xm-refined .xm-drawer-search-control .xm-search-results {
  right: auto;
  left: auto;
}

/* Product pages, reviews, variation selectors and the theme's own help areas. */
html[dir="rtl"] body.xm-refined.single-product .xm-unavailable {
  border-left: 0;
  border-right: 3px solid #ac7457;
}
html[dir="rtl"] body.xm-refined.single-product .xm-pdp-trust {
  text-align: right;
}
html[dir="rtl"] body.xm-refined.single-product .xm-full-description-content :is(th,td) {
  text-align: right;
}
html[dir="rtl"] body.xm-refined .xm-review-inner #comments .star-rating {
  float: left;
}
html[dir="rtl"] body.xm-refined .xm-cart-item-meta dt,
html[dir="rtl"] body.xm-refined .xm-cart-item-meta dd {
  margin: 0 0 0 4px;
}

/* WooCommerce classic and block checkout: Arabic reading direction, with
 * no changes to input names, payment controls, totals or form submissions. */
html[dir="rtl"] body.xm-refined .woocommerce,
html[dir="rtl"] body.xm-refined .woocommerce-page,
html[dir="rtl"] body.xm-refined .wc-block-checkout,
html[dir="rtl"] body.xm-refined .wc-block-cart,
html[dir="rtl"] body.xm-refined .wc-block-components-form,
html[dir="rtl"] body.xm-refined .elementor-widget-text-editor,
html[dir="rtl"] body.xm-refined .elementor-heading-title {
  direction: rtl;
}
html[dir="rtl"] body.xm-refined .woocommerce form .form-row-first {
  float: right;
}
html[dir="rtl"] body.xm-refined .woocommerce form .form-row-last {
  float: left;
}
html[dir="rtl"] body.xm-refined .woocommerce table.shop_table,
html[dir="rtl"] body.xm-refined .woocommerce table.shop_table th,
html[dir="rtl"] body.xm-refined .woocommerce table.shop_table td,
html[dir="rtl"] body.xm-refined .wc-block-cart,
html[dir="rtl"] body.xm-refined .wc-block-checkout {
  text-align: right;
}
/* Preserve normal number formatting and email/phone entry direction. */
html[dir="rtl"] body.xm-refined :is(.woocommerce-Price-amount,.wc-block-components-formatted-money-amount) {
  direction: ltr;
  unicode-bidi: isolate;
}
html[dir="rtl"] body.xm-refined :is(input[type="email"],input[type="tel"],input[type="number"],input[inputmode="numeric"],.qty) {
  direction: ltr;
}
html[dir="rtl"] body.xm-refined .woocommerce .quantity .qty,
html[dir="rtl"] body.xm-refined .xm-cart-quantity .xm-cart-qty-input {
  text-align: center;
}
html[dir="rtl"] body.xm-refined .woocommerce .star-rating {
  direction: ltr;
}

/* Xemry's bespoke cart page has physical left/right overrides, independent of
 * WooCommerce's inherited direction. Flip only those alignment overrides. */
html[dir="rtl"] body.xm-refined.woocommerce-cart .luania-cart-template table.cart td,
html[dir="rtl"] body.xm-refined.woocommerce-cart .luania-cart-template table.cart tr.cart_item td,
html[dir="rtl"] body.xm-refined.woocommerce-cart .luania-cart-template .cart_totals .shipping-calculator-form {
  text-align: right !important;
}
html[dir="rtl"] body.xm-refined.woocommerce-cart .luania-cart-template table.cart tr.cart_item .product-subtotal,
html[dir="rtl"] body.xm-refined.woocommerce-cart .luania-cart-template .cart_totals table.shop_table tr td,
html[dir="rtl"] body.xm-refined.woocommerce-cart .luania-cart-template table.cart td.actions {
  text-align: left !important;
}
html[dir="rtl"] body.xm-refined.woocommerce-cart .luania-cart-template table.cart tr.cart_item .product-remove {
  right: auto;
  left: 15px;
}
html[dir="rtl"] body.xm-refined.woocommerce-cart .luania-cart-template .woocommerce-message,
html[dir="rtl"] body.xm-refined.woocommerce-cart .luania-cart-template .woocommerce-info {
  border-left: 0;
  border-right: 4px solid var(--xm-cart-green);
}
html[dir="rtl"] body.xm-refined .xm-track-native-form form.track_order label {
  text-align: right !important;
}

/* The language selector and editor are administrative controls: keep their
 * English option labels and controls readable even on Arabic pages. */
html[dir="rtl"] body.xm-refined .fps-language-switcher,
html[dir="rtl"] body.xm-refined .fps-language-switcher select,
html[dir="rtl"] body.xm-refined .fps-editor-panel,
html[dir="rtl"] body.xm-refined .fps-machine-status {
  direction: ltr;
  text-align: left;
}
html[dir="rtl"] body.xm-refined .fps-floating,
html[dir="rtl"] body.xm-refined :is(.fps-editor-link,.fps-editor-launch,.fps-editor-exit,.fps-machine-status,.fps-editor-panel) {
  right: auto;
  left: 18px;
}
@media (max-width: 600px) {
  html[dir="rtl"] body.xm-refined .fps-floating,
  html[dir="rtl"] body.xm-refined :is(.fps-editor-link,.fps-editor-launch,.fps-editor-exit,.fps-machine-status,.fps-editor-panel) {
    right: auto;
    left: 8px;
  }
}
