/**
 * PayEfb Dashboard — RTL overrides
 *
 * All rules are scoped to .payefb-dashboard-wrapper[dir="rtl"] so they
 * NEVER leak into the host WordPress theme.
 *
 * Loaded only when the customer's language is Arabic (or any future RTL lang).
 */

/* ── Base direction ──────────────────────────────────────────────────────── */
.payefb-dashboard-wrapper[dir="rtl"] {
    direction: rtl;
    text-align: right;
    font-family: 'Noto Sans Arabic', Tahoma, Arial, sans-serif;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.payefb-dashboard-wrapper[dir="rtl"] .payefb-dashboard-header {
    flex-direction: row-reverse;
}

.payefb-dashboard-wrapper[dir="rtl"] .payefb-user-info {
    flex-direction: row-reverse;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.payefb-dashboard-wrapper[dir="rtl"] .payefb-dashboard-sidebar {
    border-right: none;
    border-left: 1px solid #dee2e6;
}

.payefb-dashboard-wrapper[dir="rtl"] .payefb-nav-link {
    flex-direction: row-reverse;
}

.payefb-dashboard-wrapper[dir="rtl"] .payefb-nav-link:hover {
    transform: translateX(-4px);
}

.payefb-dashboard-wrapper[dir="rtl"] .payefb-nav-icon {
    text-align: center;
}

/* ── Bootstrap flex / gap helpers ────────────────────────────────────────── */
.payefb-dashboard-wrapper[dir="rtl"] .d-flex:not(.flex-column) {
    /* flex-direction stays row; RTL handles visual order */
}

/* ── Subscription cards ──────────────────────────────────────────────────── */
.payefb-dashboard-wrapper[dir="rtl"] .list-group-item {
    text-align: right;
}

.payefb-dashboard-wrapper[dir="rtl"] .card-header {
    flex-direction: row-reverse;
}

.payefb-dashboard-wrapper[dir="rtl"] .card-footer {
    flex-direction: row-reverse;
}

/* Plan change modal arrow should point left for RTL */
.payefb-dashboard-wrapper[dir="rtl"] #planChangeArrow.bi-arrow-right::before {
    content: "\F138"; /* bi-arrow-left */
}

/* ── Stats row (licenses module) ─────────────────────────────────────────── */
.payefb-dashboard-wrapper[dir="rtl"] .stat-icon {
    margin-right: 0;
    margin-left: 1rem;
}

.payefb-dashboard-wrapper[dir="rtl"] .flex-grow-1.ms-3 {
    margin-left: 0 !important;
    margin-right: 1rem;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.payefb-dashboard-wrapper[dir="rtl"] th,
.payefb-dashboard-wrapper[dir="rtl"] td {
    text-align: right;
}

.payefb-dashboard-wrapper[dir="rtl"] .payefb-table thead th:first-child {
    border-radius: 0 0.5rem 0 0;
}

.payefb-dashboard-wrapper[dir="rtl"] .payefb-table thead th:last-child {
    border-radius: 0.5rem 0 0 0;
}

/* ── Alerts & badges ─────────────────────────────────────────────────────── */
.payefb-dashboard-wrapper[dir="rtl"] .alert {
    text-align: right;
}

.payefb-dashboard-wrapper[dir="rtl"] .alert i,
.payefb-dashboard-wrapper[dir="rtl"] .badge i {
    margin-right: 0;
    margin-left: 0.4rem;
}

/* ── Dropdowns ───────────────────────────────────────────────────────────── */
.payefb-dashboard-wrapper[dir="rtl"] .dropdown-menu {
    text-align: right;
    right: 0;
    left: auto;
}

.payefb-dashboard-wrapper[dir="rtl"] .dropdown-item {
    text-align: right;
    flex-direction: row-reverse;
}

.payefb-dashboard-wrapper[dir="rtl"] .dropdown-item i {
    margin-right: 0;
    margin-left: 0.5rem;
}

/* ── Domain downgrade selection ──────────────────────────────────────────── */
.payefb-dashboard-wrapper[dir="rtl"] .payefb-domain-item {
    flex-direction: row-reverse;
}

.payefb-dashboard-wrapper[dir="rtl"] #domainDowngradeSelection .d-flex {
    flex-direction: row-reverse;
}

/* ── Buttons with icons ──────────────────────────────────────────────────── */
.payefb-dashboard-wrapper[dir="rtl"] .btn i {
    margin-right: 0;
    margin-left: 0.35rem;
}

/* ── Modals ──────────────────────────────────────────────────────────────── */
.payefb-dashboard-wrapper[dir="rtl"] .modal-header {
    flex-direction: row-reverse;
}

.payefb-dashboard-wrapper[dir="rtl"] .modal-footer {
    flex-direction: row-reverse;
}

.payefb-dashboard-wrapper[dir="rtl"] .modal-body {
    text-align: right;
}

.payefb-dashboard-wrapper[dir="rtl"] .modal-body .row {
    direction: rtl;
}

/* ── Code blocks (license keys) ──────────────────────────────────────────── */
.payefb-dashboard-wrapper[dir="rtl"] code {
    direction: ltr;       /* always LTR for codes */
    display: inline-block;
    text-align: left;
}

/* ── Cancel option cards ─────────────────────────────────────────────────── */
.payefb-dashboard-wrapper[dir="rtl"] .cancel-option {
    flex-direction: row-reverse;
}

/* ── Credit card display (card info modal) ───────────────────────────────── */
.payefb-dashboard-wrapper[dir="rtl"] .credit-card-display {
    direction: ltr; /* physical card always LTR */
}

/* ── Progress bars ───────────────────────────────────────────────────────── */
.payefb-dashboard-wrapper[dir="rtl"] .progress {
    direction: ltr; /* progress bar fills left-to-right always */
}

/* ── Input groups ────────────────────────────────────────────────────────── */
.payefb-dashboard-wrapper[dir="rtl"] .input-group {
    flex-direction: row-reverse;
}

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

.payefb-dashboard-wrapper[dir="rtl"] .input-group > .btn,
.payefb-dashboard-wrapper[dir="rtl"] .input-group > .input-group-text {
    border-radius: 0 0.375rem 0.375rem 0;
}

/* ── Sidebar layout on desktop ───────────────────────────────────────────── */
@media (min-width: 992px) {
    .payefb-dashboard-wrapper[dir="rtl"] .payefb-dashboard-container {
        flex-direction: row-reverse;
    }

    .payefb-dashboard-wrapper[dir="rtl"] .payefb-dashboard-sidebar {
        border-left: 1px solid #dee2e6;
        border-right: none;
    }
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .payefb-dashboard-wrapper[dir="rtl"] .payefb-dashboard-sidebar {
        border-left: none;
        border-bottom: 1px solid #dee2e6;
    }
}
