/* ============================================================
   OKAZ SMP — right-to-left
   Loaded only when the person is reading Arabic, on top of style.css.

   Kept as a separate sheet rather than rewriting style.css because the
   English layout then cannot be broken by Arabic work, and vice versa.
   Everything here mirrors a specific rule in style.css; the comments say
   which, so the two stay in step.

   Numbers stay left-to-right inside an RTL page — that is correct Arabic
   typography for figures, and it keeps columns of money readable.
   ============================================================ */

/* ---------- the shell ---------- */

/* style.css: .sidebar { left: 0 } → the sidebar belongs on the right */
.sidebar { left: auto; right: 0; }

/* style.css: .main { margin-left: var(--sidebar-w) } */
.main { margin-left: 0; margin-right: var(--sidebar-w); }

/* style.css: .sidebar-nav a:hover { transform: translateX(4px) } —
   the nudge on hover should move inward, which is now leftward */
.sidebar-nav a:hover { transform: translateX(-4px); }

/* style.css: .sidebar-nav a.active carries a left accent bar */
.sidebar-nav a.active { border-left-width: 0; border-right: 3px solid #fff; }
.sidebar-nav a { border-left: 0; }

@media (max-width: 900px) {
    /* style.css: the drawer slides in from the left */
    .sidebar { transform: translateX(100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-right: 0; }
}

/* ---------- text alignment ---------- */

/* Tables, forms and summary rows all read from the right. */
th, td { text-align: right; }

/* Figures are the exception. A column of money is read as a number, so it
   stays left-to-right and aligned with its neighbours. */
.bp-grid td.bp-tot,
.bp-input input,
.bp-cellnote,
.mb-wait-amt,
td.num, th.num { direction: ltr; unicode-bidi: embed; }

.bp-grid td.bp-tot, .bp-input input, .bp-cellnote { text-align: left; }

/* ---------- icons that imply a direction ---------- */

/* Chevrons and arrows point the other way in a mirrored layout. */
.fa-chevron-right, .fa-arrow-right, .fa-angle-right,
.fa-arrow-right-long, .fa-caret-right { transform: scaleX(-1); }

/* ---------- components ---------- */

/* style.css: .mb-brand::before draws a 4px accent on the left edge */
.mb-brand::before { left: auto; right: 0;
    border-radius: 0 var(--radius) var(--radius) 0; }

/* style.css: .ob-card { border-left: 5px solid } */
.ob-card { border-left: 0; border-right: 5px solid var(--warning); }
.ob-card.is-waiting { border-right-color: var(--warning); }
.ob-card.is-allowed { border-right-color: var(--success); }
.ob-card.is-refused { border-right-color: var(--danger); }

/* style.css: .db-budget { border-left: 5px solid } */
.db-budget { border-left: 0; border-right: 5px solid var(--bar, var(--success)); }

/* style.css: .returned-panel rows nudge right on hover */
.returned-row:hover { transform: translateX(-3px); }
.mb-wait-row:hover  { transform: translateX(-2px); }

/* style.css: .bp-qtab divides with a right border */
.bp-qtab { border-right: 0; border-left: 1px solid var(--border); }
.bp-qtab:last-child { border-left: 0; }
@media (max-width: 900px) { .bp-qtab { border-left: 1px solid var(--border); } }

/* style.css: the SAR/% toggle divides its second chip with a left border */
.bp-toggle label + label span { border-left: 0; border-right: 1.5px solid var(--border); }

/* style.css: .bp-rg-dot and .bp-split-legend i sit to the left of their text */
.bp-rg-dot { margin-right: 0; margin-left: 7px; }
.bp-split-legend i { margin-right: 0; margin-left: 5px; }
.bp-key { margin-right: 0; margin-left: 6px; }
.mb-foot-note { margin-left: 0; margin-right: auto; }
.bp-big-val small { margin-left: 0; margin-right: 6px; }
.mb-figure-val small { margin-left: 0; margin-right: 8px; }
.mb-figure-sub i { margin-right: 0; margin-left: 5px; }
.ob-wait-note i { margin-right: 0; margin-left: 6px; }
.bp-qt-name em { margin-left: 0; margin-right: 5px; }

/* style.css: the unit label sits at the right of the input, with the input's
   padding reserving room for it. Moving the label to the left without moving
   the padding leaves the number running underneath it, so both flip. */
.bp-unit { right: auto; left: 10px; }
.bp-input input { padding: 9px 11px 9px 42px; }

/* style.css: pending hatching on the budget bar is positioned from the right */
.mb-bar-pending { right: auto; }

/* style.css: the notification count sits on the bell's right shoulder */
.notif-count { right: auto; left: -2px; }

/* The waiting-list row ends with a chevron, which belongs on the left now. */
.mb-wait-row { grid-template-columns: 16px auto 1fr 120px; }
.mb-wait-row > i { order: -1; }
.mb-wait-amt { text-align: left; }
.mb-wait-ref { order: 2; }
@media (max-width: 820px) { .mb-wait-row { grid-template-columns: auto 1fr; } }

/* ---------- the language switcher ---------- */
.lang-switch { margin-left: 0; margin-right: auto; }

/* ---------- typography ---------- */

/* Tajawal carries both scripts, so the family is already right. Arabic needs
   a little more line height to sit comfortably, and no uppercasing — Arabic
   has no letter case and text-transform on it does nothing useful while
   breaking the look of any Latin text mixed in. */
body { line-height: 1.7; }
th, .sidebar-section, .bp-big-cap, .mb-hs-cap, .mb-hero-who,
.bp-qt-months, .ob-facts em, .mb-brand-num span, .stat-label,
.bp-strip-head span, .mb-mon-name, .bp-key, .eyebrow {
    text-transform: none;
    letter-spacing: 0;
}

/* Arabic glyphs are taller; give the big figures a touch more room. */
.mb-figure-val, .bp-big-val { line-height: 1.25; }

/* ---------- mixed Arabic and English in the same page ---------- */

/* In an RTL paragraph, a run of English gets its trailing punctuation thrown
   to the wrong end: "Nothing waiting on you." renders as ".Nothing waiting on
   you". The same happens to customer names, references and anything else the
   team typed in English.

   unicode-bidi: plaintext makes each element take its direction from its own
   first strong character, so an Arabic sentence reads right-to-left and an
   English one reads left-to-right, each with its punctuation in the right
   place. It is what keeps a half-translated page looking correct, and it
   keeps working for data nobody will ever translate.

   The numeric elements above set their own direction and are left alone. */
/* Applied to everything inside the page rather than a hand-picked list: any
   element can end up holding an English sentence, a customer name typed in
   English, or a reference like W-003, and each of them needs its own
   direction. The numeric elements below re-assert theirs afterwards. */
.content *, .topbar *, .sidebar-nav a, .alert, .badge {
    unicode-bidi: plaintext;
}

/* An input the person types into should follow what they type, too. */
input[type="text"], input[type="search"], input[type="email"], textarea {
    unicode-bidi: plaintext;
}

/* Figures need no direction of their own. The bidi algorithm already renders
   a run of digits left-to-right inside an Arabic line, so "1,300.00" is
   correct without help — and forcing direction:ltr only pushed the number to
   the wrong end of its card.

   The exceptions are places where column alignment or typing order matters:
   an input the person types a number into, and a table column of money that
   has to line up with the column beside it. */
.bp-input input,
.bp-grid td.bp-tot,
td.num, th.num {
    direction: ltr;
    unicode-bidi: embed;
    text-align: left;
}
.bp-cellnote { text-align: left; }

/* ---------- where the figures sit ---------- */

/* A figure like "1,300.00 SAR" contains a strong Latin run (the currency),
   so the plaintext rule above resolves the whole line as left-to-right and
   parks it at the wrong end of its card. The digits themselves are fine —
   it is only the alignment that needs saying, so each figure is pinned to
   wherever its card already puts it. */
.db-bm-val, .db-bm-cap, .db-bm-sub,
.bp-big-val, .bp-big-cap,
.stat-value, .stat-label,
.bp-qt-amt, .bp-qt-name, .bp-qt-months,
.mb-wait-amt, .mb-wait-amt * {
    text-align: right;
}

/* these sit in cards that centre their contents */
.mb-figure-val, .mb-figure-cap, .mb-figure-sub,
.mb-hs-num, .mb-hs-cap,
.ob-facts span, .ob-facts em {
    text-align: center;
}

/* .mb-brand-num is right-aligned in the English layout, so it flips */
.mb-brand-num, .mb-brand-num strong, .mb-brand-num span { text-align: left; }

/* ---- Marketing Operations ---- */
.mo-money input, .mo-spct input { text-align: right; }
.mo-receipt li b, .mo-row-amt, .mo-lines td.num, .mo-samt, .mo-split-read em,
.mo-receipt-total strong, .mo-total-row strong, .mo-hero-side strong { direction: ltr; unicode-bidi: isolate; }
.fa-arrow-left { transform: scaleX(-1); }

/* Budget Overview meeting view */
.mb-toast { transform: translateX(50%); left: auto; right: 50%; }
.mt-amt, .mb-ribbon strong, .res-left strong { direction: ltr; unicode-bidi: plaintext; }
