/* RTL specific styles */

body {
    text-align: right;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

.dropdown-menu-end {
    left: 0;
    right: auto;
}

.ms-auto {
    margin-right: auto !important;
    margin-left: 0 !important;
}

.me-auto {
    margin-left: auto !important;
    margin-right: 0 !important;
}

.me-2 {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

.ms-2 {
    margin-right: 0.5rem !important;
    margin-left: 0 !important;
}

.float-end {
    float: left !important;
}

.float-start {
    float: right !important;
}

.text-start {
    text-align: right !important;
}

.text-end {
    text-align: left !important;
}

/* Form control specific styling */
.form-control {
    text-align: right;
}

.input-group > .form-control,
.input-group > .form-select {
    position: relative;
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
}

.input-group:not(.has-validation) > :not(:last-child):not(.dropdown-toggle):not(.dropdown-menu),
.input-group:not(.has-validation) > .dropdown-toggle:nth-last-child(n+3) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 0.25rem;
    border-bottom-right-radius: 0.25rem;
}

.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;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
}

/* Tables in RTL */
.table th, .table td {
    text-align: right;
}

/* List groups in RTL */
.list-group {
    padding-right: 0;
}

/* Button groups in RTL */
.btn-group > .btn:not(:last-child):not(.dropdown-toggle),
.btn-group > .btn-group:not(:last-child) > .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 0.25rem;
    border-bottom-right-radius: 0.25rem;
}

.btn-group > .btn:not(:first-child),
.btn-group > .btn-group:not(:first-child) > .btn {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
}

/* Modal RTL fixes */
.modal-header .btn-close {
    margin: -0.5rem auto -0.5rem -0.5rem;
}

/* Fix for pagination in RTL */
.page-item:first-child .page-link {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 0.25rem;
    border-bottom-right-radius: 0.25rem;
}

.page-item:last-child .page-link {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
}

/* Arabic font styling */
.arabic-text {
    font-family: 'Tajawal', sans-serif;
    line-height: 1.7;
}

/* Navbar direction fixes */
.navbar-nav {
    padding-right: 0;
}

/* Dropdown adjustments for RTL */
.dropdown-menu {
    text-align: right;
}

/* RTL Tab navigation styles - تصميم شريط التبويبات للغة العربية */
.nav-tabs .nav-link {
    margin-right: 0;
    margin-left: 0.25rem;
}

/* Card header in RTL */
.card-header {
    text-align: right;
}

/* Fix for form switches */
.form-switch {
    padding-right: 2.5em;
    padding-left: 0;
}

.form-switch .form-check-input {
    margin-right: -2.5em;
    margin-left: 0;
    background-position: right center;
}

/* Fix for checkboxes and radios */
.form-check {
    padding-right: 1.25rem;
    padding-left: 0;
}

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

/* Dashboard specific RTL adjustments */
.dashboard-widget .widget-header {
    text-align: right;
}

/* Calendar RTL adjustments */
.fc-direction-ltr {
    direction: rtl !important;
}

.fc-toolbar-chunk {
    display: flex;
}
