/* ════════════════════════════════════════════════════════
   RTL / BIDI SUPPORT — Glass Theme
   Companion to glass-theme.css + layout.css
   ════════════════════════════════════════════════════════ */

[dir="rtl"] { direction: rtl; }

/* ── Flip directional icons ──────────────────────────── */
[dir="rtl"] .fw-bo-btn-back svg {
    transform: scaleX(-1);
}

/* Isolate LTR content in RTL context (numbers, codes, UIDs) */
.bidi-isolate { unicode-bidi: isolate; direction: ltr; }


/* ══════════════════════════════════════════════════════
   FORM CONTROLS
   ══════════════════════════════════════════════════════ */

/* Select arrow: flip from right to left */
[dir="rtl"] .fw-bo-select {
    background-position: left 12px center;
    padding-right: 16px;
    padding-left: 40px;
}

/* Text inputs: natural alignment */
[dir="rtl"] input,
[dir="rtl"] textarea {
    text-align: start;
}

/* ══════════════════════════════════════════════════════
   FORM ACTIONS / FLEX-END GROUPS
   ══════════════════════════════════════════════════════ */

[dir="rtl"] .fw-bo-form-actions {
    justify-content: flex-start;
}

[dir="rtl"] .fw-bo-actions {
    justify-content: flex-start;
}

[dir="rtl"] .fw-bo-header-actions {
    /* flex-start becomes logical "end" in RTL since flex respects dir */
}


/* ══════════════════════════════════════════════════════
   DROPDOWNS
   ══════════════════════════════════════════════════════ */

[dir="rtl"] .fw-bo-dropdown__menu {
    right: auto;
    left: 0;
}

[dir="rtl"] .fw-bo-dropdown-item {
    text-align: right;
}


/* ══════════════════════════════════════════════════════
   AUTH / LOGIN
   ══════════════════════════════════════════════════════ */

[dir="rtl"] .auth-footer-controls {
    flex-direction: row-reverse;
}


/* ══════════════════════════════════════════════════════
   AMBIENT BACKGROUND BLOBS
   ══════════════════════════════════════════════════════ */

[dir="rtl"] .fw-bo-ambient-bg::before {
    left: auto;
    right: 20%;
}

[dir="rtl"] .fw-bo-ambient-bg::after {
    right: auto;
    left: 20%;
}


/* ══════════════════════════════════════════════════════
   STAT CARD DECORATION
   ══════════════════════════════════════════════════════ */

[dir="rtl"] .fw-bo-stat-card::before {
    right: auto;
    left: 0;
    transform: translate(-30%, -30%);
}


/* ══════════════════════════════════════════════════════
   DETAIL VIEW — 2-column grid border
   ══════════════════════════════════════════════════════ */

/* Already handled in glass-theme.css:
   [dir="rtl"] .fw-bo-detail-field:nth-child(odd) */


/* ══════════════════════════════════════════════════════
   DETAIL 2-COL GRID (franchisee, merchant, etc.)
   ══════════════════════════════════════════════════════ */

[dir="rtl"] .fw-bo-detail-grid-2col {
    direction: rtl;
}


/* ══════════════════════════════════════════════════════
   KEY-VALUE TABLE
   ══════════════════════════════════════════════════════ */

[dir="rtl"] .fw-bo-table--kv td:first-child {
    text-align: right;
}

[dir="rtl"] .fw-bo-table--kv td:last-child {
    text-align: left;
}


/* ══════════════════════════════════════════════════════
   BREADCRUMB
   ══════════════════════════════════════════════════════ */

[dir="rtl"] .fw-bo-breadcrumb__separator {
    transform: scaleX(-1);
}


/* ══════════════════════════════════════════════════════
   UID BADGE — always LTR (alphanumeric codes)
   ══════════════════════════════════════════════════════ */

[dir="rtl"] .fw-bo-uid-badge {
    unicode-bidi: isolate;
    direction: ltr;
}

[dir="rtl"] .fw-bo-mono {
    unicode-bidi: isolate;
    direction: ltr;
}


/* ══════════════════════════════════════════════════════
   FEE / LIMIT GRID ITEMS
   ══════════════════════════════════════════════════════ */

[dir="rtl"] .fw-bo-fee-item,
[dir="rtl"] .fw-bo-limit-item {
    direction: rtl;
}


/* ══════════════════════════════════════════════════════
   PAGINATION — flip prev/next arrows
   ══════════════════════════════════════════════════════ */

[dir="rtl"] .fw-bo-page-btn svg {
    transform: scaleX(-1);
}


/* ══════════════════════════════════════════════════════
   MODAL CLOSE BUTTON
   ══════════════════════════════════════════════════════ */

[dir="rtl"] .fw-bo-modal-header {
    flex-direction: row-reverse;
}


/* ══════════════════════════════════════════════════════
   WIZARD STEPS — flip connector line
   ══════════════════════════════════════════════════════ */

[dir="rtl"] .fw-bo-steps {
    flex-direction: row-reverse;
}


/* ══════════════════════════════════════════════════════
   ANIMATIONS — flip slide direction
   ══════════════════════════════════════════════════════ */

/* Toast slide-in: already handled in glass-theme.css */

/* Fade-in with Y translate: direction-independent, no change needed */


/* ══════════════════════════════════════════════════════
   RESPONSIVE — phone breakpoints
   ══════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    /* Detail grid single-col: remove side borders */
    [dir="rtl"] .fw-bo-detail-field:nth-child(odd) {
        border-left: none;
    }
}


/* ══════════════════════════════════════════════════════
   ARABIC TYPOGRAPHY
   ══════════════════════════════════════════════════════ */

[lang="ar"] {
    line-height: 1.8;
    letter-spacing: 0;
    font-family: 'Noto Sans Arabic', var(--fw-bo-font-sans);
}

[lang="ar"] h1, [lang="ar"] h2, [lang="ar"] h3,
[lang="ar"] .fw-bo-header-title,
[lang="ar"] .fw-bo-detail-card-title,
[lang="ar"] .fw-bo-modal-title,
[lang="ar"] .fw-bo-empty-title,
[lang="ar"] .fw-bo-heading-1,
[lang="ar"] .fw-bo-heading-2 {
    font-family: 'Noto Sans Arabic', var(--fw-bo-font-sans);
    letter-spacing: 0;
    line-height: var(--fw-bo-leading-snug);
}

[lang="ar"] .fw-bo-label,
[lang="ar"] .fw-bo-detail-label,
[lang="ar"] .fw-bo-stat-label,
[lang="ar"] .fw-bo-nav-title,
[lang="ar"] .fw-bo-header-meta,
[lang="ar"] .fw-bo-field-label {
    letter-spacing: 0.02em;
}


/* ══════════════════════════════════════════════════════
   DISPUTE PAGES RTL
   ══════════════════════════════════════════════════════ */

[dir="rtl"] .fw-bo-border-left--success,
[dir="rtl"] .fw-bo-border-left--error,
[dir="rtl"] .fw-bo-border-left--warning,
[dir="rtl"] .fw-bo-border-left--refund,
[dir="rtl"] .fw-bo-border-left--confirm,
[dir="rtl"] .fw-bo-border-left--merge,
[dir="rtl"] .fw-bo-border-left--bulk,
[dir="rtl"] .fw-bo-border-left--extourne {
    border-left: none;
    border-right: 3px solid;
    border-right-color: inherit;
}

[dir="rtl"] .approval-card {
    border-left: none;
    border-right-width: 4px;
    border-right-style: solid;
}

[dir="rtl"] .dashboard-with-sidebar__sidebar {
    order: 2;
}

[dir="rtl"] .correction-panel__type-selector {
    text-align: right;
}

[dir="rtl"] .bulk-progress-steps {
    flex-direction: row-reverse;
}
