/*
 * Gemini WooLinguist — RTL safety stylesheet.
 *
 * Loaded ONLY when the active language is Arabic. Intentionally minimal:
 * does NOT try to mirror every theme element (themes that ship their own
 * RTL stylesheet do that better). Fixes the universal breakage patterns we
 * see when themes weren't built with RTL in mind:
 *
 *   1. Text alignment defaults
 *   2. Floats and inline-block elements that disappear off the edge
 *   3. WooCommerce icon directionals (back-to-shop arrow, breadcrumb sep)
 *   4. Form input direction
 *   5. The language switcher itself, which should stay LTR even in AR
 *      (English-looking "AR | EN" is universally clearer than mirrored)
 */

html[dir="rtl"] body,
body.rtl,
body.woolinguist-lang-ar {
    direction: rtl;
    text-align: right;
    unicode-bidi: embed;
}

/* Restore numerals / Latin brand names to render correctly */
html[dir="rtl"] .price,
html[dir="rtl"] .amount,
body.woolinguist-lang-ar .price,
body.woolinguist-lang-ar .amount {
    unicode-bidi: plaintext;
}

/* WooCommerce: keep prices / SKU readable */
html[dir="rtl"] .woocommerce-Price-amount bdi,
body.woolinguist-lang-ar .woocommerce-Price-amount bdi {
    unicode-bidi: plaintext;
    direction: ltr;
    display: inline-block;
}

/* Switcher itself stays LTR for universal "AR | EN" recognizability */
body.woolinguist-lang-ar .woolinguist-switcher {
    direction: ltr !important;
    text-align: left;
    unicode-bidi: embed;
}

/* WooCommerce mini-cart / quantity inputs — common breakage spot */
body.woolinguist-lang-ar .quantity .qty,
body.woolinguist-lang-ar input[type="number"] {
    direction: ltr;
    text-align: center;
}

/* Flexbox row reversal where the theme uses explicit margin-left/right
   for spacing. The cleanest universal fix is logical-property fallbacks
   handled per-component; this catches a few common cases. */
body.woolinguist-lang-ar .woocommerce ul.products li.product {
    text-align: right;
}

/* Forms: align labels right */
body.woolinguist-lang-ar .woocommerce form .form-row label,
body.woolinguist-lang-ar .woocommerce-checkout form label {
    text-align: right;
    display: block;
}

/* Star ratings: the CSS gradient method some themes use can show "empty"
   in RTL because the gradient direction is hard-coded. Force LTR on the
   widget itself; the surrounding label can stay RTL. */
body.woolinguist-lang-ar .star-rating,
body.woolinguist-lang-ar .woocommerce .star-rating {
    direction: ltr;
}
