/* rtl.css */
/* RTL (Right-to-Left) structural overrides. Supplements layout.css. */

/* ── Global direction ──────────────────────────────────────── */
body {
  direction: rtl;
  unicode-bidi: embed;
}

/* ── Utility alignment classes ─────────────────────────────── */
.text-start { text-align: right; }
.text-end   { text-align: left; }

/* ── Sidebar: explicit RTL placement (right side) ──────────── */
/* layout.css already sets right:0 / left:auto.
   This rule is kept for clarity and overrides any LTR defaults. */
.sidebar {
  right: 0;
  left: auto;
}

/* ── Main layout margin: desktop only ──────────────────────── */
/* layout.css handles mobile (margin-right: 0) at max-width: 767px.
   This rule applies the desktop offset only on >= 768px so it does
   NOT conflict with the mobile media query in layout.css. */
@media (min-width: 768px) {
  .main-layout {
    margin-right: 240px;
    margin-left: 0;
  }
}

/* Mobile: explicitly zero out any margin that could cause overflow */
@media (max-width: 767px) {
  .main-layout {
    margin-right: 0 !important;
    margin-left: 0 !important;
  }

  .sidebar {
    transform: translateX(100%);
  }
}

/* ── Table text direction ───────────────────────────────────── */
.table th,
.table td {
  text-align: right;
}

/* ── Directional icon flips ────────────────────────────────── */
.icon-arrow-next { transform: scaleX(-1); }
.icon-arrow-prev { transform: scaleX(1); }

/* ── Form inputs: right-align for RTL reading ──────────────── */
/* Exception: elements with dir="auto" or dir="ltr" must not be overridden */
input:not([dir]),
select:not([dir]) {
  text-align: right;
}

/* Textareas use dir="auto" to detect Arabic vs Latin content automatically.
   We intentionally do NOT force text-align here. */

/* ── Breadcrumb separator ───────────────────────────────────── */
.breadcrumb-separator {
  transform: scaleX(-1);
  display: inline-block;
}

/* ── RTL-aware active border on sidebar nav items ───────────── */
/* Already handled in layout.css with border-right: 4px solid ... */

/* ── RTL pagination button direction fix ───────────────────── */
/* Pagination previous/next buttons display correctly because
   their label text (السابق / التالي) carries the RTL meaning. */
