/* core/static/core/css/l10n.css */
/* ============================================================
   Shared RTL/LTR helpers for every card feature (booking,
   restaurant, shop …). Loaded by cards/themes/custom/base_custom.html.
   ============================================================ */

/* Values that are always LTR (phone, email, coupon, codes) - even on an RTL page.
   !important: older form CSS sets direction:rtl on inputs, which beats dir="ltr". */
.ltr-input,
.ltr-input::placeholder {
    direction: ltr !important;
    text-align: left !important;
}

/* Values that are always written left-to-right - links, e-mail addresses, phone numbers - stay LTR
   on RTL pages (value AND placeholder) without each form having to add .ltr-input: "https://..."
   used to show as "...//:https" and "+1 234 567" as "567 234 1+". Covers the input types and the
   usual field names of text inputs that hold such values (phone, mobile, fax, whatsapp, e-mail, links). */
[dir="rtl"] input:is(
    [type="url"], [type="email"], [type="tel"],
    [inputmode="url"], [inputmode="email"], [inputmode="tel"],
    [type="text"][name$="url"], [type="text"][name$="_link"],
    [type="text"][name*="email"], [type="text"][name*="website"],
    [type="text"][name*="phone"], [type="text"][name*="mobile"],
    [type="text"][name*="whatsapp"], [type="text"][name*="fax"],
    [type="text"][name$="tel"], [type="text"][name*="cellphone"]
),
[dir="rtl"] input:is(
    [type="url"], [type="email"], [type="tel"],
    [inputmode="url"], [inputmode="email"], [inputmode="tel"],
    [type="text"][name$="url"], [type="text"][name$="_link"],
    [type="text"][name*="email"], [type="text"][name*="website"],
    [type="text"][name*="phone"], [type="text"][name*="mobile"],
    [type="text"][name*="whatsapp"], [type="text"][name*="fax"],
    [type="text"][name$="tel"], [type="text"][name*="cellphone"]
)::placeholder {
    direction: ltr !important;
    text-align: left !important;
}

/* OTP / verification boxes read left-to-right in every language */
.code-inputs[dir="ltr"] {
    direction: ltr;
}

/* RTL: horizontal Bootstrap Icons point "forward" in the reading direction.
   Write templates the LTR way (bi-chevron-right = next/open, bi-arrow-left = back); on RTL pages
   these mirror automatically. Only the glyph (::before) is flipped, never the <i> itself: an <i>
   that is a flex child is blockified, so an element flip would stack with this one and cancel it.
   - .rtl-flip     mirror any other icon too (Bootstrap Icons via ::before; FA/SVG/img via the element)
   - .no-rtl-flip  opt out (icon already chosen per language, or a real-world direction) */
html[dir="rtl"] :is(
    .bi-arrow-left, .bi-arrow-right, .bi-arrow-left-short, .bi-arrow-right-short,
    .bi-arrow-left-circle, .bi-arrow-right-circle, .bi-arrow-left-circle-fill, .bi-arrow-right-circle-fill,
    .bi-arrow-left-square, .bi-arrow-right-square, .bi-arrow-left-square-fill, .bi-arrow-right-square-fill,
    .bi-arrow-bar-left, .bi-arrow-bar-right,
    .bi-chevron-left, .bi-chevron-right, .bi-chevron-double-left, .bi-chevron-double-right,
    .bi-chevron-compact-left, .bi-chevron-compact-right,
    .bi-caret-left, .bi-caret-right, .bi-caret-left-fill, .bi-caret-right-fill,
    .bi-box-arrow-left, .bi-box-arrow-right, .bi-box-arrow-in-left, .bi-box-arrow-in-right,
    .bi.rtl-flip
):not(.no-rtl-flip)::before {
    transform: scaleX(-1);
}

html[dir="rtl"] .rtl-flip:not(.bi, .no-rtl-flip) {
    transform: scaleX(-1);
}

/* Equal-width digits for counters, prices and timers so they don't jitter */
.tabular-nums {
    font-variant-numeric: tabular-nums;
}
