/* RTL (Right-to-Left) Styles for Arabic */

body {
    direction: rtl;
    text-align: right;
}

/* Bootstrap RTL Adjustments */
.navbar-nav {
    margin-right: auto !important;
    margin-left: 0 !important;
}

.dropdown-menu {
    right: 0;
    left: auto;
    max-width: calc(100vw - 20px);
    transform: translateX(0);
}

.dropdown-menu-end {
    right: 0 !important;
    left: auto !important;
    transform: translateX(0) !important;
}

/* Form RTL fixes */
.dropdown-menu form[dir="rtl"] .form-check {
    text-align: right;
    padding-right: 1.5em;
    padding-left: 0;
}

.dropdown-menu form[dir="rtl"] .form-check-input {
    margin-right: -1.5em;
    margin-left: 0;
    float: right;
}

/* Responsive dropdown positioning */
@media (max-width: 768px) {
    .dropdown-menu {
        right: 0 !important;
        left: auto !important;
        min-width: 200px !important;
        max-width: calc(100vw - 40px) !important;
        transform: translateX(0) !important;
    }
}

@media (max-width: 576px) {
    .dropdown-menu {
        right: 5px !important;
        left: auto !important;
        min-width: 260px !important;
        max-width: calc(100vw - 20px) !important;
    }
}

.me-2, .me-3, .me-4 {
    margin-right: 0 !important;
    margin-left: 0.5rem !important;
}

.ms-2, .ms-3, .ms-4 {
    margin-left: 0 !important;
    margin-right: 0.5rem !important;
}

.text-end {
    text-align: left !important;
}

.text-start {
    text-align: right !important;
}

/* Card and Form Adjustments */
.card-body {
    text-align: right;
}

.form-label {
    text-align: right;
}

.input-group-text {
    border-radius: 0 0.375rem 0.375rem 0;
}

.input-group > :not(:first-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Breadcrumb */
.breadcrumb-item + .breadcrumb-item::before {
    float: right;
    padding-left: 0.5rem;
    padding-right: 0;
}

/* Table */
.table {
    text-align: right;
}

/* Admin Sidebar */
.sidebar {
    right: 0 !important;
    left: auto !important;
}

.main-content {
    margin-left: 0 !important;
    margin-right: var(--sidebar-width, 220px) !important;
}

/* Buttons with icons */
.btn i {
    margin-left: 0.25rem;
    margin-right: 0;
}

/* Alerts */
.alert {
    text-align: right;
}

/* Modal */
.modal-header .btn-close {
    margin: 0 auto 0 0;
}

/* Pagination */
.pagination {
    direction: ltr;
}

/* Product Cards */
.product-card {
    text-align: right;
}

/* Cart */
.cart-item {
    text-align: right;
}

/* Checkboxes and Radios */
.form-check {
    padding-right: 1.5em;
    padding-left: 0;
}

.form-check-input {
    float: right;
    margin-right: -1.5em;
    margin-left: 0;
}

/* Navbar Toggler */
.navbar-toggler {
    margin-left: 0;
    margin-right: auto;
}

/* Badge positioning */
.position-absolute.top-0.end-0 {
    right: auto !important;
    left: 0 !important;
}

.position-absolute.top-0.start-0 {
    left: auto !important;
    right: 0 !important;
}



/* List group */
.list-group-item {
    text-align: right;
}

/* Offcanvas */
.offcanvas-end {
    right: auto;
    left: 0;
}

.offcanvas-start {
    left: auto;
    right: 0;
}


/* Footer RTL Fixes */
[dir="rtl"] footer .row {
    direction: rtl;
}

[dir="rtl"] footer .col-md-4,
[dir="rtl"] footer .col-md-3,
[dir="rtl"] footer .col-md-2 {
    text-align: right;
}

[dir="rtl"] footer ul {
    padding-right: 0;
}

[dir="rtl"] footer .list-unstyled {
    text-align: right;
}

/* Arrow-Free Header RTL Support */
[dir="rtl"] .arrow-free-row {
    flex-direction: row-reverse;
}

[dir="rtl"] .arrow-free-nav {
    flex-direction: row-reverse;
}

[dir="rtl"] .arrow-free-nav-link {
    text-align: right;
}

[dir="rtl"] .arrow-free-nav-link i {
    margin-left: 0.5rem;
    margin-right: 0;
}

[dir="rtl"] .arrow-free-language-btn i {
    margin-left: 0.5rem;
    margin-right: 0;
}

[dir="rtl"] .arrow-free-contact a {
    margin-left: 1rem;
    margin-right: 0;
}

[dir="rtl"] .arrow-free-contact a:last-child {
    margin-left: 0;
}

[dir="rtl"] .arrow-free-actions {
    flex-direction: row-reverse;
}

[dir="rtl"] .arrow-free-btn i {
    margin-left: 0.5rem;
    margin-right: 0;
}

[dir="rtl"] footer .bi {
    margin-left: 0.5rem;
    margin-right: 0;
}

[dir="rtl"] footer .d-flex {
    flex-direction: row-reverse;
}

[dir="rtl"] footer .text-md-end {
    text-align: right !important;
}

/* Arabic Font Support */
[dir="rtl"] {
    font-family: 'Segoe UI', 'Tahoma', 'Arial', sans-serif;
}

[dir="rtl"] .arrow-free-nav-link,
[dir="rtl"] .arrow-free-btn,
[dir="rtl"] footer {
    font-family: 'Segoe UI', 'Tahoma', 'Arial', sans-serif;
}

/* Mobile RTL Adjustments */
@media (max-width: 768px) {
    [dir="rtl"] .arrow-free-contact {
        display: none;
    }
    
    [dir="rtl"] .arrow-free-topbar .arrow-free-row {
        justify-content: center;
    }
    
    [dir="rtl"] .arrow-free-nav-link span {
        display: none;
    }
    
    [dir="rtl"] .arrow-free-btn span {
        display: none;
    }
}
