/*
    The Arabic admin panel. Loaded only when the staff language is Arabic
    (header.php), after style.css. style.css is written in logical properties
    (margin-inline, inset-inline, text-align: start/end), so most of the
    design system reads right to left on its own; this file holds what cannot:

      1  Arabic type: IBM Plex Sans Arabic (header.php loads it for Arabic
         only), a base of 15px / 1.65 and every size one step up, no letter
         spacing (it breaks the joins between Arabic letters)
      2  Direction and the template's one-sided utilities (Bootstrap 4.0 beta
         has no logical ml-/mr-/pl-/pr-, text-left/right, float-left/right)
      3  Shell: the sidebar on the right, its drawer from the right on phones
      4  Mirrors: chevrons and arrows point the way Arabic reads; the CSS
         chevrons inside selects move to the left
      5  Plugins: bootstrap-select, the date range picker, FullCalendar
*/

/* ---------- 1  Arabic type ----------------------------------------------- */
html[lang="ar"] {
    /* Inter first: Latin and figures stay in Inter; Arabic, which Inter does not
       have, falls through to IBM Plex Sans Arabic */
    --font: "Inter", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", "Geeza Pro", Arial, sans-serif;
    --fs-xs: 13px;
    --fs-sm: 14px;
    --fs: 15px;
    --fs-lg: 17px;
    --fs-xl: 21px;
    --fs-title: 26px;
    --fs-figure: 28px;
    --lh: 1.65;
}
html[lang="ar"] body { font-size: 15px; line-height: 1.65; }
/* figures, money, phones and times stay in Inter's tabular digits */
html[lang="ar"] :is([dir="ltr"], .num, .money, .kpi-figure, .q-n, .bell-n, .count, .side-count, .pager, .pagination, time, kbd, .top-bell .dot) { font-family: "Inter", "IBM Plex Sans Arabic", system-ui, sans-serif; }
html[dir="rtl"] :is(h1, h2, h3, h4, h5, h6, .page-title, .card-title, .modal-title, .section-head h2, .card > h3, .content h3, .jconfirm-title) { letter-spacing: 0 !important; }
html[dir="rtl"] .badge, html[dir="rtl"] .btn, html[dir="rtl"] .tabs a { letter-spacing: 0 !important; }
html[lang="ar"] .btn { line-height: 1.3; }
html[lang="ar"] .badge { height: 24px; }
html[lang="ar"] .meta { line-height: 1.5; }

/* ---------- 2  Direction and one-sided utilities ------------------------- */
html[dir="rtl"] body { direction: rtl; text-align: right; }
html[dir="rtl"] .card, html[dir="rtl"] .content, html[dir="rtl"] .card h3, html[dir="rtl"] .card h4, html[dir="rtl"] .card h5,
html[dir="rtl"] table th, html[dir="rtl"] table td, html[dir="rtl"] .dropdown-menu { text-align: right; }
/* light-bootstrap-dashboard.css sets header cells to text-align:left !important */
html[dir="rtl"] .table > thead > tr > th:not(.text-center):not(.text-right):not(.num) { text-align: right !important; }

html[dir="rtl"] .text-right { text-align: left !important; }
html[dir="rtl"] .text-left { text-align: right !important; }
html[dir="rtl"] .float-right { float: left !important; }
html[dir="rtl"] .float-left { float: right !important; }
/*
    The float bug: the line above outranked style.css's
    `.content .float-right { float: none; display: flex }`, so in Arabic the
    old pagination wrapper floated over the "Total" line beside it. Inside
    the page it stays a flex row; flex-end is the left in Arabic.
*/
html[dir="rtl"] .content .float-right, html[dir="rtl"] .content .float-left { float: none !important; }

html[dir="rtl"] .mr-1 { margin-right: 0 !important; margin-left: .25rem !important; }
html[dir="rtl"] .mr-2 { margin-right: 0 !important; margin-left: .5rem !important; }
html[dir="rtl"] .mr-3 { margin-right: 0 !important; margin-left: 1rem !important; }
html[dir="rtl"] .mr-4 { margin-right: 0 !important; margin-left: 1.5rem !important; }
html[dir="rtl"] .mr-5 { margin-right: 0 !important; margin-left: 3rem !important; }
html[dir="rtl"] .ml-1 { margin-left: 0 !important; margin-right: .25rem !important; }
html[dir="rtl"] .ml-2 { margin-left: 0 !important; margin-right: .5rem !important; }
html[dir="rtl"] .ml-3 { margin-left: 0 !important; margin-right: 1rem !important; }
html[dir="rtl"] .ml-4 { margin-left: 0 !important; margin-right: 1.5rem !important; }
html[dir="rtl"] .ml-5 { margin-left: 0 !important; margin-right: 3rem !important; }
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; }
/* one-sided padding: the value moves to the right; the left is cleared only
   when the element has no pr-* of its own, so a pl-4 pr-4 pair stays even */
html[dir="rtl"] .pl-1 { padding-right: .25rem !important; }
html[dir="rtl"] .pl-2 { padding-right: .5rem !important; }
html[dir="rtl"] .pl-3 { padding-right: 1rem !important; }
html[dir="rtl"] .pl-4 { padding-right: 1.5rem !important; }
html[dir="rtl"] .pl-5 { padding-right: 3rem !important; }
html[dir="rtl"] .pr-1 { padding-left: .25rem !important; }
html[dir="rtl"] .pr-2 { padding-left: .5rem !important; }
html[dir="rtl"] .pr-3 { padding-left: 1rem !important; }
html[dir="rtl"] .pr-4 { padding-left: 1.5rem !important; }
html[dir="rtl"] .pr-5 { padding-left: 3rem !important; }
html[dir="rtl"] :is(.pl-1, .pl-2, .pl-3, .pl-4, .pl-5):not([class*="pr-"]) { padding-left: 0 !important; }
html[dir="rtl"] :is(.pr-1, .pr-2, .pr-3, .pr-4, .pr-5):not([class*="pl-"]) { padding-right: 0 !important; }

/* typed left-to-right values (phones, amounts, emails, dates) sit at the
   field's start like the Arabic words around them */
html[dir="rtl"] input.form-control:is([dir="ltr"], [type="number"], [type="email"], [type="tel"], [type="date"], [type="time"], [type="datetime-local"]),
html[dir="rtl"] input.daterange { direction: ltr; text-align: right; }
/* a figure set left to right inside an Arabic block still lines up at the start */
html[dir="rtl"] .kpi-figure, html[dir="rtl"] .facts dd[dir="ltr"] { text-align: right; }
html[dir="rtl"] :is(.q-n, .bell-n) { text-align: end; }
html[dir="rtl"] .modal-body label > input[type="checkbox"], html[dir="rtl"] .modal-body label > input[type="radio"] { margin-inline: 0 6px; }

/* ---------- 3  Shell ----------------------------------------------------- */
/* sidebar to the right, content to the left (LBD: a fixed sidebar and a floated panel) */
html[dir="rtl"] .wrapper .sidebar, html[dir="rtl"] .sidebar { right: 0; left: auto; }
html[dir="rtl"] .main-panel { float: left; }
html[dir="rtl"] .sidebar .list-group { padding-right: 10px; }
/* the current page's bar sits on the leading (right) edge */
html[dir="rtl"] .sidebar .list-group-item.bg-dark.active { box-shadow: inset -3px 0 0 var(--accent-mark) !important; }
html[dir="rtl"] .sidebar .list-group-item.bg-dark.active:focus-visible { box-shadow: inset -3px 0 0 var(--accent-mark), inset 0 0 0 2px var(--sidebar-focus, #8AB4F8) !important; }
@media (max-width: 991px) {
    /* the drawer opens from the menu button's side: the right */
    html[dir="rtl"] .sidebar { right: 0 !important; left: auto !important; transform: translate3d(102%, 0, 0) !important; }
    html[dir="rtl"].nav-open .sidebar { transform: translate3d(0, 0, 0) !important; }
    /* the sideways-scroll hint sits on the edge the rest of the table hides behind: the left */
    html[dir="rtl"] .table-responsive.can-scroll { background: linear-gradient(to right, rgba(0, 0, 0, .08), rgba(0, 0, 0, 0) 24px) left center / 24px 100% no-repeat; }
}
/* menus that drop from the top bar open inward from its left end */
html[dir="rtl"] .app-topbar .top-tools .dropdown-menu:not(.dropdown-menu-right) { left: 0; right: auto; }
/* a row's "More" menu: Popper sets left inline; the LTR right:0 would hang it off the left edge */
html[dir="rtl"] .table-responsive .single-action .dropdown-menu { right: auto; }
html[dir="rtl"] .more-sm .dropdown-menu-right { right: auto; left: 0; }

/* ---------- 4  Mirrors --------------------------------------------------- */
/* arrows and chevrons point the way the page reads: "back" points right */
html[dir="rtl"] :is(.fa-chevron-left, .fa-chevron-right, .fa-arrow-left, .fa-arrow-right, .fa-angle-left, .fa-angle-right,
    .fa-angle-double-left, .fa-angle-double-right, .fa-long-arrow-alt-left, .fa-long-arrow-alt-right, .fa-arrow-left-long,
    .fa-arrow-right-long, .fa-caret-left, .fa-caret-right, .fa-chevron-circle-left, .fa-chevron-circle-right) { transform: scaleX(-1); }
html[dir="rtl"] .back .i, html[dir="rtl"] .pager .i, html[dir="rtl"] .queue .i { transform: scaleX(-1); }
/* the CSS chevrons inside selects and pills move to the left */
html[dir="rtl"] select.form-control:not([size]):not([multiple]) { background-position: left 12px center; }
html[dir="rtl"] .fb-field select, html[dir="rtl"] .per-page select { background-position: left 8px center; }
html[dir="rtl"] .bulkbar select, html[dir="rtl"] .table-toolbar .bulk-action select { background-position: left 10px center; }
html[dir="rtl"] .bootstrap-select > .btn.dropdown-toggle, html[dir="rtl"] .bootstrap-select > .btn.dropdown-toggle:hover,
html[dir="rtl"] .bootstrap-select > .btn.dropdown-toggle:focus, html[dir="rtl"] .bootstrap-select.show > .btn.dropdown-toggle { background-position: left 12px center !important; padding: 0 12px 0 32px !important; }
html[dir="rtl"] .fb-field .bootstrap-select > .btn.dropdown-toggle { padding: 0 2px 0 26px !important; background-position: left 8px center !important; }
/* a left-to-right search box (a date range) keeps its text clear of the icon on the right */
html[dir="rtl"] .fb-search input[dir="ltr"], html[dir="rtl"] .fb-search input.daterange { padding-left: 12px !important; padding-right: 36px !important; }
/* show password: the eye sits at the end of the Arabic line (the left), so the space for it does
   too, whatever the field's own direction (style.css .pw-field) */
html[dir="rtl"] .pw-field > input { padding-right: 12px; padding-left: 46px; }
/* the search boxes' drawn magnifier moves to the right */
html[dir="rtl"] .fb-search:not(:has(> i, > .i, > svg)) input { background-position: right 13px center; }
html[dir="rtl"] .bootstrap-select .bs-searchbox .form-control { background-position: right 11px center; }
/* jquery-confirm and notify.js */
html[dir="rtl"] .jconfirm .jconfirm-box { text-align: right; }
html[dir="rtl"] .jconfirm .jconfirm-box div.jconfirm-closeIcon { left: 14px; right: auto; }
/* the gallery runs right to left, so "earlier" points right */
html[dir="rtl"] .trainer-gallery-tools .fa-arrow-left, html[dir="rtl"] .trainer-gallery-tools .fa-arrow-right { transform: scaleX(-1); }

/* ---------- 5  Plugins --------------------------------------------------- */
/* bootstrap-select: the chosen value reads from the right */
html[dir="rtl"] .bootstrap-select .dropdown-toggle .filter-option { text-align: right; }
html[dir="rtl"] .bootstrap-select .dropdown-menu li a { text-align: right; }
html[dir="rtl"] .bootstrap-select .dropdown-menu li a span.check-mark { right: auto; left: 15px; }

/*
    The date picker, mirrored. scripts.js gives every picker locale.direction
    "rtl" in Arabic, which adds .rtl to it; the vendor sheet still forces
    direction:ltr from 564px up. Now, at every width: Sunday on the right, the
    earlier month on the right, "previous" on the right pointing right, the
    quick ranges on the right. Times and the chosen range ("01-10-2026 -
    31-10-2026") still read left to right.
*/
.daterangepicker.rtl { direction: rtl; text-align: right; }
.daterangepicker.rtl .ranges { text-align: right; }
.daterangepicker.rtl .calendar-table .prev span { transform: rotate(-45deg); }
.daterangepicker.rtl .calendar-table .next span { transform: rotate(135deg); }
.daterangepicker.rtl .drp-calendar.left { padding: 8px 8px 8px 0; }
.daterangepicker.rtl td.start-date { border-radius: 0 4px 4px 0; }
.daterangepicker.rtl td.end-date { border-radius: 4px 0 0 4px; }
.daterangepicker.rtl td.start-date.end-date { border-radius: 4px; }
.daterangepicker.rtl select.monthselect { margin-right: 0; margin-left: 2%; }
.daterangepicker.rtl .calendar-time { direction: ltr; }
.daterangepicker.rtl .drp-buttons { text-align: left; }
.daterangepicker.rtl .drp-buttons .btn { margin-left: 0; margin-right: 8px; }
.daterangepicker.rtl .drp-selected { padding-right: 0; padding-left: 8px; direction: ltr; }
@media (min-width: 564px) {
    .daterangepicker.rtl .ranges,
    .daterangepicker.rtl .drp-calendar,
    .daterangepicker.rtl.single .ranges,
    .daterangepicker.rtl.single .drp-calendar { float: right; }
    .daterangepicker.rtl .drp-calendar.left { clear: right; }
    .daterangepicker.rtl .drp-calendar.left .calendar-table { padding-right: 0; padding-left: 8px; }
    .daterangepicker.show-ranges.rtl .drp-calendar.right { border-right: 0; }
    .daterangepicker.show-ranges.rtl .drp-calendar.left { border-right: 1px solid var(--line); }
}

/* FullCalendar: its own .fc-direction-rtl does the layout; the pill ends swap */
html[dir="rtl"] .fc .fc-button-group > .fc-button:first-child { border-radius: 0 var(--r-pill) var(--r-pill) 0; }
html[dir="rtl"] .fc .fc-button-group > .fc-button:last-child { border-radius: var(--r-pill) 0 0 var(--r-pill); }

/* polish round (2026-11-14): the menu rail's button shows the panel's bar on the right, where the menu is */
html[dir="rtl"] .side-rail-toggle .tb-svg-rail { transform: scaleX(-1); }
/* the "Saved" tick's words stay after its mark */
html[dir="rtl"] .ds-saved { direction: rtl; }
