/*
 * RTL adjustments for right-to-left locales (Farsi, etc.).
 * Loaded only when <html dir="rtl"> is set by the i18n runtime.
 *
 * Principle: flip text/flow direction, but keep financial data (numbers, tickers,
 * prices, charts, code) left-to-right so they stay readable and comparable.
 */

 html[dir="rtl"] body {
  direction: rtl;
  text-align: right;
}

/* Navbar: keep the same visual order as the English site.
   Page content is RTL, but the global navigation layout stays brand-left/menu-center/auth-right. */
html[dir="rtl"] .navbar-container {
  direction: ltr;
}
html[dir="rtl"] .navbar-auth {
  direction: ltr;
  margin-left: auto !important;
  margin-right: 0 !important;
  padding-right: 20px !important;
  padding-left: 0 !important;
}
html[dir="rtl"] .navbar-brand,
html[dir="rtl"] .navbar-menu {
  direction: ltr;
}
html[dir="rtl"] .dropdown-menu-pro {
  direction: rtl;
  text-align: right;
}
html[dir="rtl"] .navbar-link i,
html[dir="rtl"] .dropdown-item-pro i {
  margin-left: 6px;
  margin-right: 0;
}

/* Bootstrap helper margins used across the app (ms- / me-*) get visually mirrored. */
html[dir="rtl"] .ms-1, html[dir="rtl"] .ms-2, html[dir="rtl"] .ms-3 { margin-left: 0 !important; }
html[dir="rtl"] .me-1 { margin-right: 0 !important; margin-left: 0.25rem !important; }
html[dir="rtl"] .me-2 { margin-right: 0 !important; margin-left: 0.5rem !important; }
html[dir="rtl"] .me-3 { margin-right: 0 !important; margin-left: 1rem !important; }

/* Keep numeric / market data LTR even inside an RTL document. */
html[dir="rtl"] .ltr,
html[dir="rtl"] [data-ltr],
html[dir="rtl"] .price,
html[dir="rtl"] .ticker,
html[dir="rtl"] .symbol,
html[dir="rtl"] .mono,
html[dir="rtl"] code,
html[dir="rtl"] .chart,
html[dir="rtl"] table.dataTable td.num,
html[dir="rtl"] .text-monospace {
  direction: ltr;
  unicode-bidi: embed;
}

/* Tables: header text aligns to the row direction, numeric cells stay LTR. */
html[dir="rtl"] table th,
html[dir="rtl"] table td {
  text-align: right;
}
html[dir="rtl"] table td.num,
html[dir="rtl"] table td.price,
html[dir="rtl"] table td.change {
  text-align: left;
  direction: ltr;
}

/* The injected language switcher mirrors cleanly. */
html[dir="rtl"] .lang-switcher .lang-menu {
  right: 0;
  left: auto;
  direction: rtl;
}
