/* General RTL fixes */
body.rtl {
    text-align: right;
}

/* Arabic font */
@font-face {
    font-family: 'Cairo';
    src: url('../fonts/Cairo-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Cairo';
    src: url('../fonts/Cairo-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}

body.rtl {
    font-family: 'Cairo', sans-serif;
}
/* Fix sidebar positioning */
body.rtl .main-sidebar {
    right: 0;
    left: auto;
}

body.rtl .content-wrapper,
body.rtl .main-header,
body.rtl .main-footer {
    margin-right: 250px;
    margin-left: 0;
}

/* Fix form elements */
body.rtl .custom-control {
    padding-right: 1.5rem;
    padding-left: 0;
}

body.rtl .custom-control-label::before,
body.rtl .custom-control-label::after {
    right: -1.5rem;
    left: auto;
}

body.rtl .custom-switch {
    padding-right: 2.25rem;
    padding-left: 0;
}

body.rtl .custom-switch .custom-control-label::before {
    right: -2.25rem;
    left: auto;
}

body.rtl .custom-switch .custom-control-label::after {
    right: calc(-2.25rem + 2px);
    left: auto;
}

body.rtl .custom-select {
    padding: .375rem .75rem .375rem 1.75rem;
    background-position: left .75rem center;
}

body.rtl .input-group > .form-control:not(:first-child),
body.rtl .input-group > .custom-select:not(:first-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
}

body.rtl .input-group > .form-control:not(:last-child),
body.rtl .input-group > .custom-select:not(:last-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 0.25rem;
    border-bottom-right-radius: 0.25rem;
}

/* Fix icons */
body.rtl .fa-angle-left:before {
    content: "\f105";
}

body.rtl .fa-angle-right:before {
    content: "\f104";
}

body.rtl .fa-arrow-left:before {
    content: "\f061";
}

body.rtl .fa-arrow-right:before {
    content: "\f060";
}

/* Fix breadcrumb */
body.rtl .breadcrumb-item+.breadcrumb-item {
    padding-right: 0.5rem;
    padding-left: 0;
}

body.rtl .breadcrumb-item+.breadcrumb-item::before {
    padding-left: 0.5rem;
    padding-right: 0;
    content: "/";
}

/* Fix dropdown menus */
body.rtl .dropdown-menu-right {
    right: auto !important;
    left: 0 !important;
}

/* Fix card headers and footers */
body.rtl .card-header > .card-tools {
    right: auto;
    left: 1rem;
}

/* Fix input groups */
body.rtl .input-group > .input-group-append > .btn,
body.rtl .input-group > .input-group-append > .input-group-text,
body.rtl .input-group > .input-group-prepend:not(:first-child) > .btn,
body.rtl .input-group > .input-group-prepend:not(:first-child) > .input-group-text,
body.rtl .input-group > .input-group-prepend:first-child > .btn:not(:first-child),
body.rtl .input-group > .input-group-prepend:first-child > .input-group-text:not(:first-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
}

/* Fix control sidebar */
body.rtl .control-sidebar {
    right: auto;
    left: -250px;
}

body.rtl .control-sidebar.control-sidebar-open {
    right: auto;
    left: 0;
}

/* Fix tables */
body.rtl .table-responsive {
    direction: rtl;
}

/* Fix form check */
body.rtl .form-check {
    padding-right: 1.25rem;
    padding-left: 0;
}

body.rtl .form-check-input {
    margin-right: -1.25rem;
    margin-left: 0;
}

/* Fix nav pills */
body.rtl .nav-pills .nav-link.active,
body.rtl .nav-pills .show > .nav-link {
    border-radius: 0.25rem;
}

/* Fix modal dialog */
body.rtl .modal-header .close {
    margin: -1rem auto -1rem -1rem;
}

/* Fix bootstrap grid */
body.rtl .offset-1 {
    margin-right: 8.333333%;
    margin-left: 0;
}

body.rtl .offset-2 {
    margin-right: 16.666667%;
    margin-left: 0;
}

body.rtl .offset-3 {
    margin-right: 25%;
    margin-left: 0;
}

body.rtl .offset-4 {
    margin-right: 33.333333%;
    margin-left: 0;
}

/* Fix timeline */
body.rtl .timeline {
    padding-right: 0;
}

body.rtl .timeline > div > .timeline-item {
    margin-right: 30px;
    margin-left: 0;
}

body.rtl .timeline > div > .fa,
body.rtl .timeline > div > .fas,
body.rtl .timeline > div > .far,
body.rtl .timeline > div > .fab,
body.rtl .timeline > div > .glyphicon,
body.rtl .timeline > div > .ion {
    right: 18px;
    left: auto;
}

/* Fix direct chat */
body.rtl .direct-chat-messages,
body.rtl .direct-chat-contacts {
    direction: rtl;
}

/* Fix sidebar nav */
body.rtl .sidebar-collapse .main-sidebar, 
body.rtl .sidebar-collapse .main-sidebar::before {
    margin-right: -250px;
    margin-left: 0;
}

body.rtl .sidebar-collapse.sidebar-open .main-sidebar, 
body.rtl .sidebar-collapse.sidebar-open .main-sidebar::before {
    margin-right: 0;
}

body.rtl .nav-sidebar .nav-link > p > .right {
    right: auto;
    left: 1rem;
}

body.rtl .nav-sidebar .nav-link > .right {
    right: auto;
    left: 1rem;
}

/* Fix control sidebar */
body.rtl .control-sidebar-slide-open .control-sidebar {
    left: 0;
    right: auto;
}

/* Fix small box */
body.rtl .small-box .icon > i {
    right: auto;
    left: 15px;
}

/* Fix info box */
body.rtl .info-box .info-box-icon {
    float: right;
}

body.rtl .info-box .info-box-content {
    margin-right: 90px;
    margin-left: 0;
}

/* Fix for collapsed sidebar */
@media (min-width: 992px) {
    body.rtl .sidebar-mini.sidebar-collapse .content-wrapper,
    body.rtl .sidebar-mini.sidebar-collapse .main-footer,
    body.rtl .sidebar-mini.sidebar-collapse .main-header {
        margin-right: 4.6rem !important;
        margin-left: 0 !important;
    }
    
    body.rtl .sidebar-mini.sidebar-collapse .main-sidebar:hover {
        margin-right: 0;
    }
}

/* Fix for mobile view */
@media (max-width: 991.98px) {
    body.rtl .main-sidebar, 
    body.rtl .main-sidebar::before {
        margin-right: -250px;
        margin-left: 0;
    }
    
    body.rtl .content-wrapper,
    body.rtl .main-footer,
    body.rtl .main-header {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
    
    body.rtl .sidebar-open .main-sidebar, 
    body.rtl .sidebar-open .main-sidebar::before {
        margin-right: 0;
    }
}