.mae-language-switcher { display: inline-flex; align-items: center; gap: 3px; padding: 4px; background: #fff; border: 1px solid #dce4e3; border-radius: 999px; box-shadow: 0 4px 20px #0e272718; font: 500 14px/1.5 system-ui, sans-serif; }
.mae-language-switcher a { display: inline-block; padding: 7px 12px; color: #244943; text-decoration: none; border-radius: 999px; }
.mae-language-switcher a[aria-current="true"] { color: #fff; background: #164f46; }
.mae-language-switcher a:focus-visible { outline: 3px solid #86bfb3; outline-offset: 2px; }
.mae-switcher-floating { position: fixed; inset-inline-start: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 99990; }
html[data-mae-language="en"] { direction: ltr; }
html[data-mae-language="en"] body { direction: ltr; }
html[data-mae-language="ar"], html[data-mae-language="ar"] body { direction: rtl !important; }
html[data-mae-language="ar"] body { text-align: start; }
/* Row and grid layouts follow the reading direction without reversing them twice. */
html[data-mae-language="ar"] :is(.site-header,.site-content,.site-footer,.entry-content,.site-navigation,.main-header-menu,.ast-builder-grid-row,.ast-builder-layout-element,.ast-mobile-header-content,.elementor,.elementor-section,.elementor-container,.elementor-column,.elementor-widget-wrap,.e-con,.e-con-inner,.woocommerce,.woocommerce-page main,.woocommerce-MyAccount-navigation,.woocommerce-MyAccount-content,.wc-block-cart,.wc-block-checkout,.srfm-form) { direction: rtl !important; }
html[data-mae-language="ar"] :is(.woocommerce,.srfm-form,form) :is(label,legend,th) { text-align: start; }
html[data-mae-language="ar"] [data-mae-align="start"] { text-align: start !important; }
html[data-mae-language="ar"] :where(input,textarea,select):not(:where([type="hidden"],[type="checkbox"],[type="radio"],[type="range"],[type="color"],[type="submit"],[type="button"],[type="reset"])) { text-align: start; }
html[data-mae-language="ar"] :is(input:not([type]),input[type="text"],input[type="search"],textarea,select):not([dir="ltr"]):not([dir="auto"]) { direction: rtl; }
html[data-mae-language="ar"] :is(input[type="email"],input[type="url"],input[type="tel"],input[type="number"],input[type="password"]) { direction: ltr !important; unicode-bidi: isolate; text-align: right; }
@media(min-width:769px) {
    html[data-mae-language="ar"] .woocommerce div.product div.images,
    html[data-mae-language="ar"] .woocommerce-MyAccount-navigation,
    html[data-mae-language="ar"] .woocommerce form .form-row-first { float: inline-start; }
    html[data-mae-language="ar"] .woocommerce div.product div.summary,
    html[data-mae-language="ar"] .woocommerce-MyAccount-content,
    html[data-mae-language="ar"] .woocommerce form .form-row-last { float: inline-end; }
}
html[data-mae-language="en"] :is(.elementor-heading-title,.elementor-widget-text-editor,.woocommerce-product-details__short-description,.woocommerce-Tabs-panel,.site-footer,.entry-content) { direction: ltr; }
html[data-mae-language="en"] :is(.woocommerce-product-details__short-description,.woocommerce-Tabs-panel-description) { text-align: start; }

/* Apply the same compact sizing to the storefront's main text buttons. */
html[data-mae-language="en"] :is(
    .elementor-button,
    .wp-block-button__link,
    .srfm-submit-button,
    .woocommerce form button.button,
    .woocommerce button[name="add-to-cart"],
    .woocommerce .single_link_to_cart_button,
    .woocommerce .checkout-button,
    .woocommerce #place_order,
    .wc-block-components-button,
    .mp-wheel-open
) {
    box-sizing: border-box;
    max-inline-size: 100%;
    padding: .625rem 1.125rem;
    font-size: max(14px, .9375rem);
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* These product-page buttons have their sizing set directly in the product copy. */
html[data-mae-language="en"] .single-product :is(.woocommerce-Tabs-panel--description, .woocommerce-product-details__short-description) a[style*="padding"]:is(
    [href="#checkout-section"],
    [href*="add-to-cart="],
    .mdg-open-link,
    [href^="https://wa.me/"]
) {
    box-sizing: border-box;
    max-inline-size: 100%;
    padding: .625rem 1.125rem !important;
    font-size: max(14px, .9375rem) !important;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
}

@media (pointer: coarse) {
    html[data-mae-language="en"] :is(
        .elementor-button,
        .wp-block-button__link,
        .woocommerce .single_add_to_cart_button,
        .woocommerce .checkout-button,
        .woocommerce #place_order,
        .wc-block-components-button
    ) { min-block-size: 44px; }
}

.mae-audit { position: fixed; right: 16px; bottom: 16px; width: min(600px,calc(100vw - 32px)); max-height: 65vh; overflow: auto; padding: 18px; background: #fff; color: #16372f; border: 2px solid #164f46; border-radius: 12px; box-shadow: 0 6px 30px #0003; z-index: 100001; font: 14px/1.5 system-ui,sans-serif; text-align: left; direction: ltr; }
.mae-audit h2 { margin: 0 0 8px; font: 600 18px/1.3 system-ui,sans-serif; }
.mae-audit textarea { width: 100%; min-height: 160px; margin: 10px 0; font: 12px/1.5 monospace; color: #123; background: #f4f8f6; }
.mae-audit button { margin: 4px 8px 4px 0; padding: 7px 12px; cursor: pointer; }
@media(max-width:480px) { .mae-switcher-floating { inset-inline-start: 10px; bottom: max(10px,env(safe-area-inset-bottom)); } .mae-language-switcher a { padding: 6px 9px; } }
