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

html[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] body {
    text-align: right;
}

/* Navbar RTL Adjustments */
html[dir="rtl"] .navbar-nav {
    flex-direction: row-reverse;
}

html[dir="rtl"] .navbar-brand {
    margin-right: 0;
    margin-left: 1rem;
}

html[dir="rtl"] .dropdown-menu {
    right: auto;
    left: 0;
}

/* Button and Form RTL Adjustments */
html[dir="rtl"] .btn-group {
    direction: rtl;
}

html[dir="rtl"] input[type="text"],
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="password"],
html[dir="rtl"] input[type="search"],
html[dir="rtl"] textarea,
html[dir="rtl"] select {
    text-align: right;
}

/* Sidebar and Navigation RTL */
html[dir="rtl"] .sidebar {
    right: 0;
    left: auto;
}

html[dir="rtl"] .main-content {
    margin-right: 250px;
    margin-left: 0;
}

/* Cards and Panels RTL */
html[dir="rtl"] .card-body {
    text-align: right;
}

/* List Items RTL */
html[dir="rtl"] ul,
html[dir="rtl"] ol {
    padding-right: 1.5rem;
    padding-left: 0;
}

html[dir="rtl"] .list-unstyled {
    padding-right: 0;
}

/* Badges and Icons RTL */
html[dir="rtl"] .badge {
    margin-left: 0.5rem;
    margin-right: 0;
}

html[dir="rtl"] .icon {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* Modal RTL */
html[dir="rtl"] .modal-header {
    text-align: right;
}

html[dir="rtl"] .modal-footer {
    justify-content: flex-start;
}

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

/* Pagination RTL */
html[dir="rtl"] .pagination {
    direction: rtl;
}

/* Table RTL */
html[dir="rtl"] table {
    text-align: right;
}

html[dir="rtl"] th,
html[dir="rtl"] td {
    text-align: right;
}

/* Flex Direction RTL */
html[dir="rtl"] .d-flex {
    flex-direction: row-reverse;
}

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

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

/* Margin and Padding RTL Utilities */
html[dir="rtl"] .ms-auto {
    margin-left: 0 !important;
    margin-right: auto !important;
}

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

/* Bootstrap Offcanvas RTL */
html[dir="rtl"] .offcanvas-start {
    right: 0;
    left: auto;
    border-left: none;
    border-right: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);
    transform: translateX(100%);
}

html[dir="rtl"] .offcanvas-end {
    left: 0;
    right: auto;
    border-right: none;
    border-left: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);
    transform: translateX(-100%);
}

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

html[dir="rtl"] .alert-dismissible {
    padding-left: 3rem;
    padding-right: 1.25rem;
}

html[dir="rtl"] .alert-dismissible .btn-close {
    left: 0;
    right: auto;
}

/* Forms and Input Groups RTL */
html[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;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: var(--bs-border-radius);
    border-bottom-left-radius: var(--bs-border-radius);
}

html[dir="rtl"] .input-group :not(:last-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: var(--bs-border-radius);
    border-bottom-right-radius: var(--bs-border-radius);
}

/* Tooltips RTL */
html[dir="rtl"] .tooltip {
    text-align: right;
}

/* Progress Bar RTL */
html[dir="rtl"] .progress-bar {
    right: 0;
    left: auto;
}

/* Custom Checkbox/Radio RTL */
html[dir="rtl"] .form-check {
    padding-right: 1.5em;
    padding-left: 0;
}

html[dir="rtl"] .form-check-input {
    float: right;
    margin-right: -1.5em;
    margin-left: 0;
}

html[dir="rtl"] .form-switch .form-check-input {
    margin-right: -2.5em;
}
