/*
 * LG-W11 ("LANGUAGES - main", 2026-11-12): the right-to-left layer of the signed-in website.
 *
 * Loaded ONLY when the page is right-to-left (components/layouts/index.blade.php prints the <link> when
 * App\View\AccountLanguage::direction() is 'rtl': a Hebrew / Arabic account on a signed-in customer page).
 * English and every guest / public page never load this file, so their rendering cannot change.
 *
 * Every rule is scoped to html[dir=rtl] anyway (belt and braces). storefront.css is a FROZEN Tailwind build:
 * a new `rtl:` class written in a view does nothing unless it was already compiled, so the fixes live here.
 */

/* 1. Fonts. Poppins and DM Serif Display have no Hebrew or Arabic letters; name system fonts that do, so every
      phone and computer picks a matching sans-serif instead of the browser's default (often a serif). Latin
      letters still come from Poppins / DM Serif, as in English. */
html[dir=rtl] body {
    font-family: Poppins, system-ui, -apple-system, "Segoe UI", "Noto Sans Hebrew", "Noto Sans Arabic", "Geeza Pro", Tahoma, Arial, sans-serif;
}
html[dir=rtl] .font-dmserif {
    font-family: "DM Serif Display", system-ui, -apple-system, "Segoe UI", "Noto Sans Hebrew", "Noto Sans Arabic", "Geeza Pro", Tahoma, Arial, sans-serif;
}
html[dir=rtl][lang=ar] body {
    line-height: 1.6; /* Arabic letters are taller than Latin ones: the default 1.5 clips the dots */
}

/* 2. Header: the profile menu is pinned to the icon's RIGHT edge (inline style right:0). In right-to-left the icon
      sits at the LEFT end of the header, so the menu opened 113 px off the screen. Pin it to the left edge. */
html[dir=rtl] details[data-vtag-dropdown] > div[style*="right:0"] {
    right: auto !important;
    left: 0 !important;
}

/* 3. Account navigation: sub-rows (Messages > Appointments / Events) are indented with margin-left:36px. */
html[dir=rtl] a[data-vtag-sub] p[style*="margin-left:36px"] {
    margin-left: 0 !important;
    margin-right: 36px !important;
}

/* 4. The desktop "All" categories panel slides in from the start side (right in RTL). */
html[dir=rtl] [data-vtag-drawer] > div.left-0 {
    left: auto;
    right: 0;
}

/* 5. "Are you sure?" box: the message was forced left-aligned. */
html[dir=rtl] #vtag-confirm-message {
    text-align: right;
}

/* 6. Cookie notice placed in a corner: mirror the corner (the centred positions need nothing). */
html[dir=rtl] .js-cookie-consent.left-0 {
    left: auto;
    right: 0;
}
html[dir=rtl] .js-cookie-consent.right-0 {
    right: auto;
    left: 0;
}

/* 7. Physical text alignment classes from the old storefront views mean "start" / "end": mirror them. */
html[dir=rtl] .text-left {
    text-align: right;
}
html[dir=rtl] .text-right {
    text-align: left;
}

/* 8. Arrow icons that have no rtl: twin (icon-arrow-right rtl:icon-arrow-left already swaps): point them the
      reading way. `scale` composes with any transform the page sets (rotations of open/close chevrons). */
html[dir=rtl] :is(.icon-arrow-right, .icon-arrow-left, .icon-arrow-right-stylish, .icon-arrow-left-stylish):not([class*="rtl:icon-"]) {
    display: inline-block;
    scale: -1 1;
}

/* 9. Left-to-right islands. Email addresses, phone numbers, web addresses and passwords are typed and read
      left to right in every language; a phone number like +1 (555) 123-4567 otherwise comes out as
      4567-123 (555) 1+. Fields keep the right-hand alignment of the rest of the form. */
html[dir=rtl] :is(input[type=email], input[type=tel], input[type=url], input[type=password]) {
    direction: ltr;
    text-align: right;
}
html[dir=rtl] :is(input[type=email], input[type=tel], input[type=url], input[type=password])::placeholder {
    text-align: right;
}
/* tel:/mailto: links: each one is its own paragraph for the bidi rules, direction from its own first letter
   (a number or address reads left to right; a Hebrew "Call" label stays right to left). */
html[dir=rtl] :is(a[href^="tel:"], a[href^="mailto:"], a[href^="sms:"]) {
    unicode-bidi: plaintext;
}

/* 10. Lines that are still English inside a right-to-left page: the copyright line under the footer, and the
       account panel's email. plaintext = the line takes its direction from its own first letter, so an English
       sentence keeps its full stop and (c) where English puts them, and a translated one is right to left. */
html[dir=rtl] footer p.text-zinc-600,
html[dir=rtl] .panel-side p.text-zinc-500 {
    unicode-bidi: plaintext;
}
html[dir=rtl] .panel-side p.text-zinc-500 {
    text-align: right;
}

/* 11. Helpers for module views (preferred: <bdi> or dir="ltr" in the markup itself).
       .vt-ltr   a left-to-right island inside right-to-left text (codes, ids, prices with a sign, dates as digits)
       .vt-auto  direction from the element's own first letter (user-written text: names, titles, messages) */
html[dir=rtl] .vt-ltr {
    direction: ltr;
    unicode-bidi: isolate;
}
html[dir=rtl] .vt-auto {
    unicode-bidi: plaintext;
}
