/* ═══════════════════════════════════════════════════════════════
   portal/css/rtl.css — RTL overrides for Arabic layout
   Loaded conditionally when dir="rtl"
   ═══════════════════════════════════════════════════════════════ */

/* ── General RTL fixes ───────────────────────────────────────── */

/* Bootstrap's me-* / ms-* utilities use margins, override directional ones */
[dir="rtl"] .me-1 { margin-right: 0 !important; margin-left: 0.25rem !important; }
[dir="rtl"] .me-2 { margin-right: 0 !important; margin-left: 0.5rem !important; }
[dir="rtl"] .ms-1 { margin-left: 0 !important; margin-right: 0.25rem !important; }
[dir="rtl"] .ms-auto { margin-left: 0 !important; margin-right: auto !important; }

/* ── Login / Register pages ──────────────────────────────────── */

[dir="rtl"] .login-hero-orb--1 {
    left: auto;
    right: -8%;
}

[dir="rtl"] .login-hero-orb--2 {
    right: auto;
    left: -6%;
}

[dir="rtl"] .login-forgot-link {
    text-align: end;
}

/* ── Navbar ───────────────────────────────────────────────────── */

[dir="rtl"] .dashboard-controls {
    margin-right: auto !important;
    margin-left: 0 !important;
}

[dir="rtl"] .dropdown-menu-end {
    right: auto !important;
    left: 0 !important;
}

/* ── Signal bar & legend ──────────────────────────────────────── */

[dir="rtl"] .signal-legend {
    direction: rtl;
}

[dir="rtl"] .signal-bar {
    direction: rtl;
}

[dir="rtl"] .signal-chip i {
    margin-right: 0;
    margin-left: 0.25rem;
}

[dir="rtl"] .last-updated {
    direction: rtl;
}

/* ── Tooltip ──────────────────────────────────────────────────── */

[dir="rtl"] .bubble-tooltip .tooltip-row {
    direction: rtl;
}

[dir="rtl"] .bubble-tooltip .tooltip-value {
    direction: ltr;
    unicode-bidi: embed;
}

/* ── Panel metric values — keep numbers LTR ───────────────────── */

[dir="rtl"] .panel-metric-value,
[dir="rtl"] .rsi-gauge-label,
[dir="rtl"] .signal-badge {
    direction: ltr;
    unicode-bidi: embed;
}

/* ── Mobile cards ─────────────────────────────────────────────── */

[dir="rtl"] .symbol-card {
    direction: rtl;
}

[dir="rtl"] .symbol-card .card-rsi {
    text-align: left;
}

[dir="rtl"] .card-details .detail-row {
    direction: rtl;
}

/* ── Toast container ──────────────────────────────────────────── */

[dir="rtl"] .toast-container {
    right: auto;
    left: 1rem;
}

/* ── Form input-group — keep button order correct ─────────────── */

[dir="rtl"] .input-group > .form-control {
    border-radius: 0 0.375rem 0.375rem 0 !important;
}

[dir="rtl"] .input-group > .btn:last-child,
[dir="rtl"] .input-group > .input-group-text:first-child {
    border-radius: 0.375rem 0 0 0.375rem !important;
}

/* ── Filter buttons in RTL ────────────────────────────────────── */

[dir="rtl"] .btn-group > .btn:first-child {
    border-radius: 0 20px 20px 0;
}

[dir="rtl"] .btn-group > .btn:last-child {
    border-radius: 20px 0 0 20px;
}

[dir="rtl"] .btn-group > .btn:not(:first-child):not(:last-child) {
    border-radius: 0;
}

/* ── Symbol Detail Panel RTL ──────────────────────────────────── */

[dir="rtl"] .symbol-panel {
    right: auto;
    left: 0;
    border-left: none;
    border-right: 1px solid var(--portal-border);
    transform: translateX(-100%);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.2);
}

[dir="rtl"] .symbol-panel.open {
    transform: translateX(0);
}

[dir="rtl"] .symbol-panel-body {
    direction: rtl;
}

/* ── Trading Account Bar tables RTL ──────────────────────────── */

[dir="rtl"] .acct-positions-table {
    direction: rtl;
}

[dir="rtl"] .acct-positions-table th,
[dir="rtl"] .acct-positions-table td {
    text-align: right;
}

[dir="rtl"] .acct-positions-table th:last-child,
[dir="rtl"] .acct-positions-table td:last-child {
    text-align: left;
}

[dir="rtl"] .acct-positions-table .dir-pill,
[dir="rtl"] .acct-positions-table .acct-pnl-positive,
[dir="rtl"] .acct-positions-table .acct-pnl-negative,
[dir="rtl"] .acct-positions-table .td-ticket-id {
    direction: ltr;
    unicode-bidi: embed;
}

[dir="rtl"] .trading-account-summary {
    direction: rtl;
}

[dir="rtl"] .acct-history-presets {
    direction: rtl;
}

[dir="rtl"] .acct-tabs-nav {
    direction: rtl;
}
