/*
 * RTL overrides — every rule is scoped to [dir="rtl"], so this file is completely
 * inert on LTR pages and safe to load unconditionally.
 *
 * The theme is mostly Bootstrap-5 logical utilities (ms-*/me-*/text-end/float-end)
 * which already mirror automatically via the <html dir="rtl"> attribute. These rules
 * only cover the physical Bootstrap-4 leftovers still used in a few views, plus the
 * common hand-authored LTR patterns. Refine visually for pixel-perfect mirroring.
 */

/* --- Physical text alignment / float utilities --- */
[dir="rtl"] .text-left   { text-align: right !important; }
[dir="rtl"] .text-right  { text-align: left  !important; }
[dir="rtl"] .float-left  { float: right !important; }
[dir="rtl"] .float-right { float: left  !important; }
[dir="rtl"] .pull-left   { float: right !important; }
[dir="rtl"] .pull-right  { float: left  !important; }

/* --- Physical Bootstrap-4 margin utilities (ml-*/mr-*) --- */
[dir="rtl"] .ml-1 { margin-left: 0 !important; margin-right: .25rem !important; }
[dir="rtl"] .ml-2 { margin-left: 0 !important; margin-right: .5rem  !important; }
[dir="rtl"] .ml-3 { margin-left: 0 !important; margin-right: 1rem   !important; }
[dir="rtl"] .ml-4 { margin-left: 0 !important; margin-right: 1.5rem !important; }
[dir="rtl"] .ml-5 { margin-left: 0 !important; margin-right: 3rem   !important; }
[dir="rtl"] .mr-1 { margin-right: 0 !important; margin-left: .25rem !important; }
[dir="rtl"] .mr-2 { margin-right: 0 !important; margin-left: .5rem  !important; }
[dir="rtl"] .mr-3 { margin-right: 0 !important; margin-left: 1rem   !important; }
[dir="rtl"] .mr-4 { margin-right: 0 !important; margin-left: 1.5rem !important; }
[dir="rtl"] .mr-5 { margin-right: 0 !important; margin-left: 3rem   !important; }
[dir="rtl"] .ml-auto { margin-left: 0 !important; margin-right: auto !important; }
[dir="rtl"] .mr-auto { margin-right: 0 !important; margin-left: auto !important; }
[dir="rtl"] .pl-1,[dir="rtl"] .pl-2,[dir="rtl"] .pl-3,[dir="rtl"] .pl-4,[dir="rtl"] .pl-5 { padding-left: 0 !important; }
[dir="rtl"] .pr-1,[dir="rtl"] .pr-2,[dir="rtl"] .pr-3,[dir="rtl"] .pr-4,[dir="rtl"] .pr-5 { padding-right: 0 !important; }

/* --- Lists / form inputs read right-to-left --- */
[dir="rtl"] ul, [dir="rtl"] ol { padding-right: 0; }
[dir="rtl"] .form--control,
[dir="rtl"] input:not([type="checkbox"]):not([type="radio"]),
[dir="rtl"] textarea,
[dir="rtl"] select { text-align: right; }

/* --- Dropdowns / popovers align to the start (right) edge --- */
[dir="rtl"] .dropdown-menu      { text-align: right; }
[dir="rtl"] .dropdown-menu-end  { right: auto !important; left: 0 !important; }
[dir="rtl"] .dropdown-menu-right{ right: auto !important; left: 0 !important; }
