/* ==========================================
   RTL (Right-to-Left) Support for Arabic
   ========================================== */

/* Sidebar RTL Fixes */
[dir="rtl"] .sidebar-profile .ms-3 {
    margin-right: 1rem !important;
    margin-left: 0 !important;
}

[dir="rtl"] .slide-menu .slide.active > .side-menu__item {
    border-left: none;
    border-right: 3px solid #845adf;
    padding-left: 0;
    padding-right: 20px;
}

[dir="rtl"] .side-menu__icon {
    margin-right: 0 !important;
    margin-left: 10px !important;
}

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

/* Breadcrumbs RTL Fixes */
[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before {
    float: right;
    padding-right: 0.5rem;
    padding-left: 0;
    content: "/";
}

[dir="rtl"] .breadcrumb-item {
    padding-right: 0;
    padding-left: 0.5rem;
}

[dir="rtl"] .breadcrumb-item:first-child {
    padding-left: 0;
}

[dir="rtl"] .page-header-breadcrumb .ms-md-1 {
    margin-left: 0 !important;
    margin-right: 0.25rem !important;
}

/* Dashboard Cards RTL Fixes */
[dir="rtl"] .flex-fill.ms-3 {
    margin-right: 1rem !important;
    margin-left: 0 !important;
}

[dir="rtl"] .card-body .d-flex .ms-3 {
    margin-right: 1rem !important;
    margin-left: 0 !important;
}

/* Button Groups RTL Fixes */
[dir="rtl"] .btn-group .btn {
    margin-left: 0 !important;
    margin-right: -1px !important;
}

[dir="rtl"] .btn-group .btn:first-child {
    border-top-right-radius: 0.25rem !important;
    border-bottom-right-radius: 0.25rem !important;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

[dir="rtl"] .btn-group .btn:last-child {
    border-top-left-radius: 0.25rem !important;
    border-bottom-left-radius: 0.25rem !important;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

/* Icons RTL Fixes */
[dir="rtl"] .bx.me-1,
[dir="rtl"] .bx-home-alt.me-1 {
    margin-right: 0 !important;
    margin-left: 0.25rem !important;
}

[dir="rtl"] .bx-right-arrow-alt {
    transform: rotate(180deg);
}

[dir="rtl"] .fe-chevron-right {
    transform: rotate(180deg);
}

/* Tables RTL Fixes */
[dir="rtl"] .table th,
[dir="rtl"] .table td {
    text-align: right;
}

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

/* Forms RTL Fixes */
[dir="rtl"] .form-label {
    text-align: right;
}

[dir="rtl"] .input-group > :not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
    margin-right: -1px;
    margin-left: 0;
}

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

/* Alerts RTL Fixes */
[dir="rtl"] .alert {
    text-align: right;
}

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

/* Dropdowns RTL Fixes */
[dir="rtl"] .dropdown-menu {
    text-align: right;
}

/* Pagination RTL Fixes */
[dir="rtl"] .page-link {
    margin-right: -1px;
    margin-left: 0;
}

/* Card Actions RTL Fixes */
[dir="rtl"] .card-header .ms-auto {
    margin-left: 0 !important;
    margin-right: auto !important;
}

/* Flex Utilities RTL Fixes */
[dir="rtl"] .ms-1 { margin-right: 0.25rem !important; margin-left: 0 !important; }
[dir="rtl"] .ms-2 { margin-right: 0.5rem !important; margin-left: 0 !important; }
[dir="rtl"] .ms-3 { margin-right: 1rem !important; margin-left: 0 !important; }
[dir="rtl"] .ms-4 { margin-right: 1.5rem !important; margin-left: 0 !important; }
[dir="rtl"] .ms-5 { margin-right: 3rem !important; margin-left: 0 !important; }

[dir="rtl"] .me-1 { margin-left: 0.25rem !important; margin-right: 0 !important; }
[dir="rtl"] .me-2 { margin-left: 0.5rem !important; margin-right: 0 !important; }
[dir="rtl"] .me-3 { margin-left: 1rem !important; margin-right: 0 !important; }
[dir="rtl"] .me-4 { margin-left: 1.5rem !important; margin-right: 0 !important; }
[dir="rtl"] .me-5 { margin-left: 3rem !important; margin-right: 0 !important; }

[dir="rtl"] .ps-1 { padding-right: 0.25rem !important; padding-left: 0 !important; }
[dir="rtl"] .ps-2 { padding-right: 0.5rem !important; padding-left: 0 !important; }
[dir="rtl"] .ps-3 { padding-right: 1rem !important; padding-left: 0 !important; }
[dir="rtl"] .ps-4 { padding-right: 1.5rem !important; padding-left: 0 !important; }
[dir="rtl"] .ps-5 { padding-right: 3rem !important; padding-left: 0 !important; }

[dir="rtl"] .pe-1 { padding-left: 0.25rem !important; padding-right: 0 !important; }
[dir="rtl"] .pe-2 { padding-left: 0.5rem !important; padding-right: 0 !important; }
[dir="rtl"] .pe-3 { padding-left: 1rem !important; padding-right: 0 !important; }
[dir="rtl"] .pe-4 { padding-left: 1.5rem !important; padding-right: 0 !important; }
[dir="rtl"] .pe-5 { padding-left: 3rem !important; padding-right: 0 !important; }

/* Text Alignment RTL Fixes */
[dir="rtl"] .text-start { text-align: right !important; }
[dir="rtl"] .text-end { text-align: left !important; }

/* Float RTL Fixes */
[dir="rtl"] .float-start { float: right !important; }
[dir="rtl"] .float-end { float: left !important; }

/* Border Radius RTL Fixes */
[dir="rtl"] .rounded-start {
    border-top-right-radius: 0.375rem !important;
    border-bottom-right-radius: 0.375rem !important;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

[dir="rtl"] .rounded-end {
    border-top-left-radius: 0.375rem !important;
    border-bottom-left-radius: 0.375rem !important;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

/* Avatar RTL Fixes */
[dir="rtl"] .avatar + * {
    margin-right: 0.5rem;
    margin-left: 0;
}

/* List Group RTL Fixes */
[dir="rtl"] .list-group-item {
    text-align: right;
}

/* Navigation RTL Fixes */
[dir="rtl"] .nav-link {
    text-align: right;
}

/* Progress Bar RTL Fixes */
[dir="rtl"] .progress-bar {
    direction: ltr;
}
