/* ============================================================
   RTL support — additive overrides, scoped to [dir="rtl"] only.
   English (dir="ltr") rendering is completely untouched.
   Escape hatch: add class "ltr-content" to force LTR content
   inside an RTL page.
   ============================================================ */

/* ---- sidebar: flip to the right side ---- */
[dir="rtl"] .page-menu {
  left: auto;
  right: 0;
}

[dir="rtl"] .page-menu~.page-content {
  margin-left: 0;
  margin-right: 250px;
}

[dir="rtl"] .page-menu.menu-large~.page-content {
  margin-left: 0;
  margin-right: 80px;
}

[dir="rtl"] .page-menu~.header {
  margin-left: 0;
  margin-right: 250px;
}

[dir="rtl"] .page-menu.menu-large~.header {
  margin-left: 0;
  margin-right: 70px;
}

/* base header offset (when no sidebar sibling overrides it) */
[dir="rtl"] .header {
  padding-left: 0 !important;
  padding-right: 70px !important;
}

[dir="rtl"] .page-menu~.header {
  padding-right: 0 !important;
}

/* sidebar expand/collapse trigger */
[dir="rtl"] .admin-panel .page-menu .btn-menu-trigger {
  left: auto;
  right: 20px;
}

[dir="rtl"] .admin-panel .page-menu.menu-large .btn-menu-trigger {
  left: auto;
  right: 206px;
}

/* sidebar logo text */
[dir="rtl"] .page-menu .logo span {
  padding-left: 0 !important;
  padding-inline-start: 10px !important;
}

/* sidebar nav icon spacing (margin-right: 20px in LTR) */
[dir="rtl"] .page-menu ul li a i {
  margin-right: 0;
  margin-inline-end: 20px;
}

/* sidebar active/hover marker (border-left in LTR) */
[dir="rtl"] .page-menu ul li.active-submenu,
[dir="rtl"] .page-menu ul li.active,
[dir="rtl"] .page-menu ul li:hover {
  border-left: none;
  border-right: 5px outset #d8dafd;
}

/* sidebar submenu indent (padding-left: 33px in LTR) */
[dir="rtl"] .page-menu ul li ul li {
  padding-left: 0;
  padding-inline-start: 33px;
}

/* ---- header bits ---- */
[dir="rtl"] .admin-panel .dropdown-user-details::before {
  right: auto;
  left: 0;
}

/* language toggle inside the header widget */
[dir="rtl"] .lang-toggle-label {
  direction: ltr;
  display: inline-block;
}

/* ---- tables: flip text alignment ---- */
[dir="rtl"] .table th,
[dir="rtl"] .table td {
  text-align: right;
}

[dir="rtl"] .text-left {
  text-align: right !important;
}

[dir="rtl"] .text-right {
  text-align: left !important;
}

/* ---- breadcrumbs: mirror the chevron separator ---- */
[dir="rtl"] #breadcrumbs ul li {
  margin: 0 2px 0 0;
}

[dir="rtl"] #breadcrumbs ul li:first-child {
  margin-left: 0;
  margin-right: 0;
}

[dir="rtl"] #breadcrumbs ul li:before {
  margin-right: 0;
  margin-inline-end: 4px;
  transform: translate(0%, 5%) scaleX(-1);
}

/* ---- bootstrap spacing utilities: ml-*/mr-* (margin) and pl-*/pr-* (padding).
   Systemic pattern: hundreds of physical utilities across templates
   (ml-*: 76 uses, mr-*: 79 uses, pl-*/pr-*: 12+ uses). Mirrored via logical
   properties; *-0 and mx-*/px-* are symmetric and intentionally skipped. ---- */
[dir="rtl"] .ml-1 { margin-left: 0 !important; margin-inline-start: 0.25rem !important; }
[dir="rtl"] .ml-2 { margin-left: 0 !important; margin-inline-start: 0.5rem !important; }
[dir="rtl"] .ml-3 { margin-left: 0 !important; margin-inline-start: 1rem !important; }
[dir="rtl"] .ml-4 { margin-left: 0 !important; margin-inline-start: 1.5rem !important; }
[dir="rtl"] .ml-5 { margin-left: 0 !important; margin-inline-start: 3rem !important; }

[dir="rtl"] .mr-1 { margin-right: 0 !important; margin-inline-end: 0.25rem !important; }
[dir="rtl"] .mr-2 { margin-right: 0 !important; margin-inline-end: 0.5rem !important; }
[dir="rtl"] .mr-3 { margin-right: 0 !important; margin-inline-end: 1rem !important; }
[dir="rtl"] .mr-4 { margin-right: 0 !important; margin-inline-end: 1.5rem !important; }
[dir="rtl"] .mr-5 { margin-right: 0 !important; margin-inline-end: 3rem !important; }

[dir="rtl"] .pl-1 { padding-left: 0 !important; padding-inline-start: 0.25rem !important; }
[dir="rtl"] .pl-2 { padding-left: 0 !important; padding-inline-start: 0.5rem !important; }
[dir="rtl"] .pl-3 { padding-left: 0 !important; padding-inline-start: 1rem !important; }
[dir="rtl"] .pl-4 { padding-left: 0 !important; padding-inline-start: 1.5rem !important; }
[dir="rtl"] .pl-5 { padding-left: 0 !important; padding-inline-start: 3rem !important; }

[dir="rtl"] .pr-1 { padding-right: 0 !important; padding-inline-end: 0.25rem !important; }
[dir="rtl"] .pr-2 { padding-right: 0 !important; padding-inline-end: 0.5rem !important; }
[dir="rtl"] .pr-3 { padding-right: 0 !important; padding-inline-end: 1rem !important; }
[dir="rtl"] .pr-4 { padding-right: 0 !important; padding-inline-end: 1.5rem !important; }
[dir="rtl"] .pr-5 { padding-right: 0 !important; padding-inline-end: 3rem !important; }

[dir="rtl"] .uk-float-right {
  float: left;
}

/* ---- inline style="float: left/right" — systemic (~180 occurrences across
   templates, e.g. courses.html card buttons, addCourse.html plus buttons,
   workshopChats.html bubbles). Mirrored via attribute substring match. ---- */
[dir="rtl"] [style*="float:right"],
[dir="rtl"] [style*="float: right"] {
  float: left !important;
}

[dir="rtl"] [style*="float:left"],
[dir="rtl"] [style*="float: left"] {
  float: right !important;
}

/* ---- inline style="padding-right: 0" on dialog rows (21 files). Keep the
   zeroed right padding and zero the left too so the row stays symmetric. ---- */
[dir="rtl"] [style*="padding-right: 0"],
[dir="rtl"] [style*="padding-right:0"] {
  padding-left: 0 !important;
}

/* ---- mobile sidebar (max-width: 1220px) ---- */
@media (max-width: 1220px) {
  [dir="rtl"] .page-menu {
    margin-left: 0;
    margin-right: -250px;
  }

  [dir="rtl"] .mobile-active .page-menu {
    margin-left: 0;
    margin-right: 0;
    /* LTR dims the content with a shadow cast to the right of the drawer;
       in RTL the drawer sits on the right, so cast it leftwards instead */
    box-shadow: -1px 1px 0px 1000px #0000003b;
  }

  [dir="rtl"] .mobile-active .btn-menu-close {
    left: auto;
    right: 232px;
  }

  /* LTR removes the 70px header offset on small screens; mirror that */
  [dir="rtl"] .header {
    padding-right: 0 !important;
  }

  /* header widget is absolutely pinned to the right on small screens */
  [dir="rtl"] .header .header-widget {
    right: auto;
    left: 0;
  }
}

/* ---- sidebar submenu indicator chevron (positioned right:35px in LTR) ---- */
[dir="rtl"] .page-menu ul li a:after {
  right: auto;
  left: 35px;
}

/* ---- header search box: submit icon sits on the right in LTR ---- */
[dir="rtl"] .searchbox {
  margin-right: 0;
  margin-inline-end: 20px;
}

[dir="rtl"] .searchbox .btn-searchbox {
  right: auto;
  left: 8px;
}

[dir="rtl"] .searchbox .btn-searchbox::after {
  right: auto;
  left: 10px;
}

/* ---- header logo text gap (margin-left in LTR) ---- */
[dir="rtl"] .header .logo span {
  margin-left: 0;
  margin-inline-start: 10px;
}

/* ---- notifications dropdown: settings icon floats right in LTR ---- */
[dir="rtl"] .dropdown-notifications-headline a {
  float: left;
  right: auto;
  left: -8px;
}

/* ---- profile dropdown menu icon gap (margin-right in LTR) ---- */
[dir="rtl"] ul.dropdown-user-menu li a i {
  margin-right: 0;
  margin-inline-end: 7px;
}

/* ---- breadcrumbs: ul has physical padding-right: 8px in LTR ---- */
[dir="rtl"] #breadcrumbs ul {
  padding: 0 0 0px 8px;
}

/* ---- course card corner ribbon (absolute right:-5px, rotated 45deg) ---- */
[dir="rtl"] .course-label {
  right: auto;
  left: -5px;
  transform: rotateZ(-45deg) scale(1.5, 1);
}

/* ---- courses header: add button nudged with inline translateX(-15px) ---- */
[dir="rtl"] .card-header a[style*="translateX(-15px)"] {
  transform: translateX(15px) !important;
}

/* ---- quill toolbar: format groups carry margin-right in LTR ---- */
[dir="rtl"] .ql-toolbar.ql-snow .ql-formats {
  margin-right: 0;
  margin-left: 15px;
}

/* ---- addCourse page: editor clear button floats right in LTR ---- */
[dir="rtl"] .addcourse-page .clear-btn {
  float: left;
}

/* ---- accountingPeriods page-local .plus-btn (margin-right in LTR) ---- */
[dir="rtl"] .plus-btn {
  margin: 0 0 0 10px;
}

/* ---- escape hatch: force LTR content inside an RTL page ---- */
[dir="rtl"] .ltr-content {
  direction: ltr;
  text-align: left;
}
