/*
 * Arabic (right-to-left) pages. Loaded only when the page language is RTL (App\Http\Middleware\SetLocale::direction,
 * which also sets dir="rtl" on <html>). Flex rows, grids and text already mirror with dir="rtl"; this file fixes the
 * places written with left/right on purpose (layouts/app.blade.php and common inline styles) and sets the Arabic font.
 */
[dir=rtl] body, [dir=rtl] button, [dir=rtl] input, [dir=rtl] select, [dir=rtl] textarea {
  font-family: 'Noto Sans Arabic', var(--f, 'Inter'), system-ui, sans-serif;
}
[dir=rtl] .sb-sec { letter-spacing: 0; text-transform: none; }
[dir=rtl] .tbl th, [dir=rtl] .st-unit-table thead th { letter-spacing: 0; text-transform: none; }

/* sidebar menu */
[dir=rtl] .ni { text-align: right; }
[dir=rtl] .ni-b { margin-left: 0; margin-right: auto; }

/* tooltips, toggles, badges */
[dir=rtl] .tip::after { left: auto; right: 0; }
[dir=rtl] .tog-t::before { left: auto; right: 3px; }
[dir=rtl] .tog input:checked + .tog-t::before { transform: translateX(-16px); }
[dir=rtl] .st-count-badge { right: auto; left: -5px; }
[dir=rtl] .st-type-count { margin-left: 0; margin-right: 6px; }
[dir=rtl] .qs-help-ic { margin-left: 0; margin-right: 2px; }
[dir=rtl] .content input[type=file]::file-selector-button { margin-right: 0; margin-left: 10px; }

/* tables: start-aligned headers, amounts column (.r) on the end side */
[dir=rtl] .tbl th, [dir=rtl] .st-unit-table thead th, [dir=rtl] th { text-align: right; }
[dir=rtl] .tbl td.r, [dir=rtl] .tbl th.r, [dir=rtl] .bc-val { text-align: left; }

/* search box: icon on the right */
[dir=rtl] #globalSearch { padding: 6px 32px 6px 12px !important; }
[dir=rtl] #searchWrap > i, [dir=rtl] #searchWrap > .ti { left: auto !important; right: 10px !important; }

/* phone drawer comes from the right */
@media (max-width: 640px) {
  [dir=rtl] .sb { left: auto; right: 0; transform: translateX(100%); }
  [dir=rtl] .sb.open { transform: translateX(0); box-shadow: -10px 0 30px rgba(0,0,0,.25); }
}

/* arrows and chevrons point the reading way */
[dir=rtl] .ti-arrow-right, [dir=rtl] .ti-arrow-left, [dir=rtl] .ti-chevron-right, [dir=rtl] .ti-chevron-left,
[dir=rtl] .ti-chevrons-right, [dir=rtl] .ti-chevrons-left, [dir=rtl] .ti-arrow-narrow-right, [dir=rtl] .ti-arrow-narrow-left,
[dir=rtl] .ti-logout, [dir=rtl] .ti-login, [dir=rtl] .ti-send {
  display: inline-block; transform: scaleX(-1);
}

/* things that are always written left to right: e-mails, web addresses, phone numbers, codes */
[dir=rtl] input[type=email], [dir=rtl] input[type=url], [dir=rtl] input[type=tel], [dir=rtl] .ltr {
  direction: ltr; text-align: right;
}

/* common inline styles in the views (style="margin-left:auto" pushes to the end side) */
[dir=rtl] [style*="margin-left:auto"] { margin-left: 0 !important; margin-right: auto !important; }
[dir=rtl] [style*="text-align:left"] { text-align: right !important; }
