[data-theme="dark"] body,
html[data-theme="dark"] body,
body[data-theme="dark"] {
    background-color: #121417 !important;
    color: #e8eaed !important;
}

[data-theme="dark"] .card,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .dash,
[data-theme="dark"] .filemanager-file {
    background-color: #1c1f24 !important;
    color: #e8eaed !important;
    border-color: #2a2f36 !important;
}

[data-theme="dark"] .table,
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: #1c1f24;
    color: #e8eaed;
    border-color: #2a2f36;
}

[data-theme="dark"] a { color: #8ab4ff; }

html[dir="rtl"] body {
    direction: rtl;
    text-align: right;
    font-family: "Almarai", "Roboto", sans-serif;
}

/* Keep Font Awesome icons working under RTL body font overrides */
html[dir="rtl"] .fa,
html[dir="rtl"] .fas,
html[dir="rtl"] .far,
html[dir="rtl"] .fal,
html[dir="rtl"] .fad {
    font-family: "Font Awesome 5 Free" !important;
}
html[dir="rtl"] .fab {
    font-family: "Font Awesome 5 Brands" !important;
}
html[dir="rtl"] .fas,
html[dir="rtl"] .fa {
    font-weight: 900;
}
html[dir="rtl"] .far {
    font-weight: 400;
}

html[dir="rtl"] .me-1 { margin-left: 0.25rem !important; margin-right: 0 !important; }
html[dir="rtl"] .me-2 { margin-left: 0.5rem !important; margin-right: 0 !important; }
html[dir="rtl"] .me-3 { margin-left: 1rem !important; margin-right: 0 !important; }
html[dir="rtl"] .me-4 { margin-left: 1.5rem !important; margin-right: 0 !important; }
html[dir="rtl"] .ms-2 { margin-right: 0.5rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ms-3 { margin-right: 1rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ms-4 { margin-right: 1.5rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ms-auto { margin-right: auto !important; margin-left: 0 !important; }
html[dir="rtl"] .me-auto { margin-left: auto !important; margin-right: 0 !important; }
html[dir="rtl"] .dropdown-menu-end { right: auto; left: 0; }
html[dir="rtl"] .text-end { text-align: left !important; }

html[dir="rtl"] .fb-header .fb-nav-links,
html[dir="rtl"] .fb-header .fb-auth-actions,
html[dir="rtl"] .fb-header .nav-bar-actions {
    direction: rtl;
}

html[dir="rtl"] .fb-header.fb-header-pro .fb-brand {
    flex-direction: row;
}

html[dir="rtl"] .fb-header.fb-header-pro .fb-brand-copy {
    text-align: right;
}

html[dir="rtl"] .fb-header.fb-header-pro .fb-nav-link::after {
    transform-origin: center;
}

html[dir="rtl"] .header .nav-bar .nav-bar-menu .nav-bar-links {
    right: auto;
    left: -300px;
}

html[dir="rtl"] .header .nav-bar .nav-bar-menu.active .nav-bar-links {
    left: 0;
    right: auto;
}

.file-context-menu .dropdown-item {
    display: block;
    color: inherit;
    text-decoration: none;
}

@media (prefers-color-scheme: dark) {
    html[data-theme="auto"] body,
    body[data-theme="auto"] {
        background-color: #121417 !important;
        color: #e8eaed !important;
    }
}

/* RTL responsive polish */
html[dir="rtl"] .dash .dash-navbar .dash-navbar-content {
    padding-right: 12px;
    padding-left: 0;
}

@media (max-width: 499.98px) {
    html[dir="rtl"] .dash .dash-navbar .dash-navbar-content {
        padding-right: 10px;
    }
}

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

html[dir="rtl"] .dataTables_wrapper .dataTables_filter input {
    margin-right: 0.5em;
    margin-left: 0;
}

@media (max-width: 991.98px) {
    html[dir="rtl"] .fb-header .fb-auth-actions {
        flex-direction: row-reverse;
    }
}

/* ==========================================================================
   Admin panel (vironeer) RTL — flip fixed sidebar / content / header
   ========================================================================== */
html[dir="rtl"] .vironeer-sidebar {
    left: auto;
    right: 0;
}

html[dir="rtl"] .vironeer-sidebar.active {
    left: auto;
    right: -240px;
}

@media (max-width: 1199.98px) {
    html[dir="rtl"] .vironeer-sidebar {
        left: auto;
        right: -240px;
    }

    html[dir="rtl"] .vironeer-sidebar.active {
        left: auto;
        right: 0;
    }
}

html[dir="rtl"] .vironeer-page-content {
    margin-left: 0;
    margin-right: auto;
}

html[dir="rtl"] .vironeer-sidebar .vironeer-sidebar-menu .vironeer-sidebar-links .vironeer-sidebar-links-cont .vironeer-sidebar-link .vironeer-sidebar-link-title .arrow,
html[dir="rtl"] .vironeer-sidebar .vironeer-sidebar-menu .vironeer-sidebar-links .vironeer-sidebar-links-cont .vironeer-sidebar-link .vironeer-sidebar-link-title .counter {
    margin-left: 0;
    margin-right: auto;
}

html[dir="rtl"] .vironeer-sidebar .vironeer-sidebar-menu .vironeer-sidebar-links .vironeer-sidebar-links-cont .vironeer-sidebar-link .vironeer-sidebar-link-menu .vironeer-sidebar-link .vironeer-sidebar-link-title {
    padding: 0.8rem 48px 0.8rem 1.25rem;
}

html[dir="rtl"] .vironeer-page-content .vironeer-page-header .vironeer-language-menu {
    margin-left: 0;
    margin-right: 0.5rem;
}

html[dir="rtl"] .vironeer-page-content .vironeer-page-header .vironeer-language-menu .dropdown-menu {
    --bs-position: start;
}

html[dir="rtl"] .vironeer-page-content .vironeer-page-header .vironeer-notifications {
    margin-left: 0.5rem;
    margin-right: auto;
}

html[dir="rtl"] .vironeer-page-content .vironeer-page-header .vironeer-notifications .vironeer-notifications-menu {
    right: auto;
    left: 0;
}

html[dir="rtl"] .vironeer-page-content .vironeer-page-header .vironeer-notifications .vironeer-notifications-menu::before {
    right: auto;
    left: 10px;
}

html[dir="rtl"] .vironeer-page-content .vironeer-page-header .vironeer-notifications .vironeer-notifications-title .counter {
    right: auto;
    left: 5px;
}

html[dir="rtl"] .vironeer-page-content .vironeer-page-header .vironeer-notifications .vironeer-notifications-menu .vironeer-notifications-body .vironeer-notification .vironeer-notification-image {
    margin-right: 0;
    margin-left: 0.75rem;
}

html[dir="rtl"] .vironeer-page-content .vironeer-page-header .vironeer-user-menu .vironeer-user .vironeer-user-info {
    margin-left: 0;
    margin-right: 0.5rem;
}

html[dir="rtl"] .vironeer-page-content .vironeer-page-header .vironeer-user-menu .dropdown-menu {
    left: 10px !important;
    right: auto !important;
}

html[dir="rtl"] .vironeer-page-content footer .ms-auto,
html[dir="rtl"] .vironeer-page-content footer p.ms-auto {
    margin-left: 0 !important;
    margin-right: auto !important;
}

/* Bootstrap form-check: mirror padding/float for RTL (LTR-only bootstrap.min.css) */
html[dir="rtl"] .form-check {
    padding-left: 0;
    padding-right: 1.5em;
}

html[dir="rtl"] .form-check .form-check-input {
    float: right;
    margin-left: 0;
    margin-right: -1.5em;
}

html[dir="rtl"] .form-check-inline {
    margin-right: 0;
    margin-left: 1rem;
}

html[dir="rtl"] .form-switch {
    padding-left: 0;
    padding-right: 2.5em;
}

html[dir="rtl"] .form-switch .form-check-input {
    float: right;
    margin-left: 0;
    margin-right: -2.5em;
    background-position: right center;
}

html[dir="rtl"] .form-switch .form-check-input:checked {
    background-position: left center;
}

/* ==========================================================================
   Member dashboard (.dash) — Arabic: sidebar on the RIGHT
   English (LTR) keeps sidebar on the LEFT via dashboard.css
   ========================================================================== */
html[dir="rtl"] .dash .dash-sidebar {
    left: auto;
    right: 0;
}

html[dir="rtl"] .dash .dash-sidebar .dash-sidebar-container {
    left: auto;
    right: 0;
}

html[dir="rtl"] .dash .dash-body {
    margin-left: 0;
    margin-right: auto;
}

html[dir="rtl"] .dash .dash-navbar .dash-navbar-actions {
    margin-left: 0;
    margin-right: auto;
}

html[dir="rtl"] .dash .dash-navbar .logo {
    justify-content: flex-end;
}

html[dir="rtl"] .dash .dash-sidebar .dash-sidebar-links .dash-sidebar-link .dash-sidebar-link-title {
    flex-direction: row;
}

html[dir="rtl"] .dash .dash-sidebar .dash-sidebar-links .dash-sidebar-link .dash-sidebar-link-title i {
    text-align: center;
}

/* Collapsed / mobile toggle (mirrors LTR left:-260px) */
html[dir="rtl"] .dash.toggle .dash-sidebar {
    left: auto;
    right: -260px;
}

html[dir="rtl"] .dash.toggle .dash-sidebar .dash-sidebar-container {
    left: auto;
    right: -260px;
}

@media (max-width: 1199.98px) {
    html[dir="rtl"] .dash .dash-sidebar .dash-sidebar-container {
        left: auto;
        right: -260px;
    }

    html[dir="rtl"] .dash.toggle .dash-sidebar {
        left: auto;
        right: 0;
        visibility: visible;
        opacity: 1;
    }

    html[dir="rtl"] .dash.toggle .dash-sidebar .dash-sidebar-container {
        left: auto;
        right: 0;
    }
}
