/* =====================================================================
   ShaFX — RTL Hardening (global layout flip)  [RTL FIX]
   Loaded LAST so it wins. Covers components the legacy rtl.css misses,
   especially the Pulse feed and the Batch B/C liveness & social-proof
   bars. Uses html[dir="rtl"] scoping so LTR is never affected.
   ===================================================================== */

/* ---- Foundational direction ---- */
html[dir="rtl"] body { direction: rtl; text-align: right; }
html[dir="rtl"] .container,
html[dir="rtl"] main,
html[dir="rtl"] section,
html[dir="rtl"] article,
html[dir="rtl"] .card,
html[dir="rtl"] .panel { direction: rtl; }

/* Keep Latin/number/code fragments LTR inside an RTL page */
html[dir="rtl"] .ltr,
html[dir="rtl"] [dir="ltr"],
html[dir="rtl"] code, html[dir="rtl"] pre, html[dir="rtl"] kbd,
html[dir="rtl"] .num, html[dir="rtl"] .mono, html[dir="rtl"] time,
html[dir="rtl"] .price, html[dir="rtl"] .amount,
html[dir="rtl"] [class*="usd"], html[dir="rtl"] [class*="lots"] {
  direction: ltr; unicode-bidi: embed;
}

/* ---- Generic alignment flips ---- */
html[dir="rtl"] .text-left  { text-align: right !important; }
html[dir="rtl"] .text-right { text-align: left  !important; }
html[dir="rtl"] th, html[dir="rtl"] td { text-align: right; }
html[dir="rtl"] table { direction: rtl; }
html[dir="rtl"] ul, html[dir="rtl"] ol { padding-right: 1.4em; padding-left: 0; }

/* Inputs / forms */
html[dir="rtl"] input, html[dir="rtl"] select, html[dir="rtl"] textarea { text-align: right; }
html[dir="rtl"] input[type="number"], html[dir="rtl"] input[type="tel"],
html[dir="rtl"] input[type="email"], html[dir="rtl"] input[type="url"] { direction: ltr; text-align: right; }

/* ---- Flex rows that visually order things ---- */
html[dir="rtl"] .nav, html[dir="rtl"] .nav-links,
html[dir="rtl"] .row-between, html[dir="rtl"] .hstack { direction: rtl; }

/* Brand / logo stays internally LTR but sits on the right */
html[dir="rtl"] .brand-mark, html[dir="rtl"] .brand { direction: ltr; }

/* ---- Mega menu / dropdowns align to the inline-end ---- */
html[dir="rtl"] .nav-mega-panel { left: auto; right: 0; }
html[dir="rtl"] .nav-mega-panel { transform: translateX(50%) translateY(2px); }
html[dir="rtl"] .nav-user-panel,
html[dir="rtl"] .dropdown-menu,
html[dir="rtl"] .menu-pop { left: 0; right: auto; }
html[dir="rtl"] .lang-switch__menu { left: 0; right: auto; }

/* Chevron / arrow icons mirror */
html[dir="rtl"] .btn svg.arrow,
html[dir="rtl"] .arrow-icon { transform: scaleX(-1); }

/* =====================================================================
   PULSE FEED + Batch B/C components (these are the ones that "stay LTR")
   ===================================================================== */

/* The feed column + cards */
html[dir="rtl"] .feed, html[dir="rtl"] .feed-list,
html[dir="rtl"] .feed-card, html[dir="rtl"] .pulse-post,
html[dir="rtl"] .post, html[dir="rtl"] .post-card { direction: rtl; text-align: right; }

html[dir="rtl"] .feed-card-head, html[dir="rtl"] .post-meta,
html[dir="rtl"] .feed-meta { flex-direction: row-reverse; }

/* avatars / meta gap that used physical margins */
html[dir="rtl"] .feed-card-head .avatar,
html[dir="rtl"] .post-avatar { margin-left: 0; margin-right: 0; }

/* Batch B — liveness bar */
html[dir="rtl"] .lv-bar { direction: rtl; }
html[dir="rtl"] .lv-ticker { direction: ltr; } /* ticker animates; keep its own flow */
html[dir="rtl"] .lv-tick { direction: rtl; }

/* Batch C — social proof strip */
html[dir="rtl"] .sp-strip, html[dir="rtl"] .sp-mood, html[dir="rtl"] .sp-joins { direction: rtl; }

/* Bottom nav + mobile drawer already use logical props (Batch E) — nothing to flip */

/* =====================================================================
   Catch-all: flip the MOST COMMON physical-margin utility patterns.
   These mirror Tailwind-ish / ad-hoc class names seen across views.
   Scoped to RTL only, so they never touch the LTR site.
   ===================================================================== */
html[dir="rtl"] .ml-auto { margin-left: 0 !important; margin-right: auto !important; }
html[dir="rtl"] .mr-auto { margin-right: 0 !important; margin-left: auto !important; }
html[dir="rtl"] .float-left  { float: right !important; }
html[dir="rtl"] .float-right { float: left  !important; }
html[dir="rtl"] .pull-left   { float: right !important; }
html[dir="rtl"] .pull-right  { float: left  !important; }

/* Borders used as side accents (cards, alerts) */
html[dir="rtl"] .border-l,
html[dir="rtl"] [class*="border-left"] { border-left: 0; border-right: 3px solid var(--brand, #ffcc00); }

/* RTL typography legibility (Arabic/Kurdish read smaller at same px) */
html[dir="rtl"] body { font-family: "Noto Kufi Arabic","Noto Sans Arabic","Inter",system-ui,Tahoma,Arial,sans-serif; }
html[dir="rtl"] p, html[dir="rtl"] li { line-height: 1.9; }

/* Persian/Urdu prefer their own faces where available; fall back gracefully */
html[lang="fa"][dir="rtl"] body { font-family: "Vazirmatn","Noto Naskh Arabic","Noto Sans Arabic","Inter",Tahoma,sans-serif; }
html[lang="ur"][dir="rtl"] body { font-family: "Noto Nastaliq Urdu","Noto Naskh Arabic","Noto Sans Arabic","Inter",Tahoma,sans-serif; }
