/* RTL Styling for Arabic Language */

/* Force RTL for all elements */
html[dir="rtl"],
html[dir="rtl"] body,
html[dir="rtl"] .body,
body[dir="rtl"] {
    direction: rtl !important;
    text-align: right !important;
}

/* General RTL adjustments */
[dir="rtl"] {
    text-align: right !important;
    direction: rtl !important;
}

/* Flip padding and margins */
[dir="rtl"] .ml-auto {
    margin-left: unset !important;
    margin-right: auto !important;
}

[dir="rtl"] .mr-auto {
    margin-right: unset !important;
    margin-left: auto !important;
}

/* Flip floats */
[dir="rtl"] .float-left {
    float: right !important;
}

[dir="rtl"] .float-right {
    float: left !important;
}

/* Adjust text alignments */
[dir="rtl"] .text-left {
    text-align: right !important;
}

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

/* Adjust Bootstrap grid columns */
[dir="rtl"] .offset-1 {
    margin-left: 0;
    margin-right: 8.333333%;
}

[dir="rtl"] .offset-2 {
    margin-left: 0;
    margin-right: 16.666667%;
}

/* Navbar RTL fixes - CRITICAL */
[dir="rtl"] .navbar-nav {
    padding-right: 0 !important;
    display: flex !important;
    flex-direction: row-reverse !important;
}

[dir="rtl"] .navbar-collapse {
    display: flex !important;
    flex-basis: auto !important;
}

[dir="rtl"] .collapse:not(.show) {
    display: flex !important;
}

[dir="rtl"] .navbar-expand-lg .navbar-collapse {
    display: flex !important;
}

[dir="rtl"] .navbar-expand-lg .navbar-nav {
    flex-direction: row-reverse !important;
    margin-right: 0 !important;
    margin-left: auto !important;
}

[dir="rtl"] .dropdown-menu {
    right: 0 !important;
    left: auto !important;
    text-align: right !important;
}

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

body[dir="rtl"] .dropdown-menu {
    text-align: right;
}

/* Adjust list items */
body[dir="rtl"] ul {
    padding-right: 0;
}

body[dir="rtl"] .fa {
    margin-right: 0;
    margin-left: 8px;
}

/* Adjust form elements */
body[dir="rtl"] .form-check-input {
    margin-right: 0;
    margin-left: 0.3rem;
}

/* Adjust scroll button */
body[dir="rtl"] #myBtn {
    right: unset;
    left: 20px;
}

/* Adjust carousel controls */
body[dir="rtl"] .carousel-control-prev {
    right: 0;
    left: auto;
}

body[dir="rtl"] .carousel-control-next {
    right: auto;
    left: 0;
}

/* Adjust icons in lists */
body[dir="rtl"] li i {
    margin-right: 0;
    margin-left: 10px;
}

/* Adjust input groups */
body[dir="rtl"] .input-group > .form-control: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;
}

body[dir="rtl"] .input-group > .input-group-append > .btn {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
}
