/**
 * RTL Overrides pour xbridge24
 * =============================
 * Ce fichier corrige les styles custom qui ne s'adaptent pas
 * automatiquement au mode RTL de Bootstrap.
 *
 * Bootstrap 5.3 RTL gère automatiquement :
 * - Flexbox (justify-content, align-items)
 * - Margins et paddings (ms-*, me-*, ps-*, pe-*)
 * - Text alignment
 * - Floats
 *
 * Ce fichier ne contient que les overrides nécessaires.
 */

/* ==========================================================================
   Base RTL
   ========================================================================== */

[dir="rtl"] body {
    text-align: right;
}

/* ==========================================================================
   Typography
   ========================================================================== */

[dir="rtl"] body {
    font-family: 'Segoe UI', Tahoma, 'Cairo', 'Noto Sans Arabic', Arial, sans-serif;
}

/* ==========================================================================
   Navigation fixes
   ========================================================================== */

/* Dropdown menus alignment */
[dir="rtl"] .dropdown-menu {
    text-align: right;
}

[dir="rtl"] .dropdown-menu-end {
    --bs-position: start;
}

/* Navbar toggler */
[dir="rtl"] .navbar-toggler {
    margin-left: 0;
    margin-right: auto;
}

/* ==========================================================================
   Form elements
   ========================================================================== */

/* Input groups */
[dir="rtl"] .input-group > :not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
    border-top-left-radius: var(--bs-border-radius);
    border-bottom-left-radius: var(--bs-border-radius);
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

[dir="rtl"] .input-group > :not(:last-child):not(.dropdown-menu):not(.dropdown-toggle) {
    border-top-right-radius: var(--bs-border-radius);
    border-bottom-right-radius: var(--bs-border-radius);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Form labels */
[dir="rtl"] .form-label {
    text-align: right;
}

/* ==========================================================================
   Tables
   ========================================================================== */

[dir="rtl"] .table {
    text-align: right;
}

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

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

/* ==========================================================================
   Cards & Badges
   ========================================================================== */

/* Badge positioning */
[dir="rtl"] .badge {
    margin-left: 0;
    margin-right: 0.25rem;
}

/* Card actions */
[dir="rtl"] .card-body .btn + .btn {
    margin-left: 0;
    margin-right: 0.5rem;
}

/* ==========================================================================
   Lists
   ========================================================================== */

[dir="rtl"] .list-group-item {
    text-align: right;
}

/* ==========================================================================
   Alerts
   ========================================================================== */

[dir="rtl"] .alert {
    text-align: right;
}

[dir="rtl"] .alert .btn-close {
    left: 0;
    right: auto;
}

/* ==========================================================================
   Modals
   ========================================================================== */

[dir="rtl"] .modal-header .btn-close {
    margin: -0.5rem auto -0.5rem -0.5rem;
}

/* ==========================================================================
   Progress bars (keep LTR for visual consistency)
   ========================================================================== */

[dir="rtl"] .progress {
    direction: ltr;
}

/* ==========================================================================
   Icons spacing
   ========================================================================== */

[dir="rtl"] .bi + span,
[dir="rtl"] .bi + .text,
[dir="rtl"] i.bi + * {
    margin-left: 0;
    margin-right: 0.35rem;
}

[dir="rtl"] span + .bi,
[dir="rtl"] .text + .bi,
[dir="rtl"] * + i.bi {
    margin-right: 0;
    margin-left: 0.35rem;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

[dir="rtl"] .pagination {
    flex-direction: row-reverse;
}

/* ==========================================================================
   Custom app-specific fixes
   ========================================================================== */

/* Status badges in tables */
[dir="rtl"] td .badge {
    margin-left: 0;
}

/* Price displays */
[dir="rtl"] .h3 small,
[dir="rtl"] .h5 small,
[dir="rtl"] .display-6 small {
    margin-left: 0;
    margin-right: 0.25rem;
}

/* Gap utilities work automatically in RTL */

/* ==========================================================================
   Utilities - Override only when needed
   ========================================================================== */

/* Force LTR for specific elements (numbers, codes, addresses) */
.ltr-force,
[dir="rtl"] .wallet-address,
[dir="rtl"] .tx-hash,
[dir="rtl"] code,
[dir="rtl"] pre,
[dir="rtl"] .font-monospace {
    direction: ltr;
    text-align: left;
    unicode-bidi: isolate;
}
