/* RTL Styles for Arabic language */

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

/* Navbar RTL adjustments */
body[dir="rtl"] .navbar-nav {
    padding-right: 0;
}

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

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

/* Form controls RTL adjustments */
body[dir="rtl"] .form-control {
    text-align: right;
}

body[dir="rtl"] .form-check {
    padding-right: 1.5em;
    padding-left: 0;
}

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

/* Button groups RTL adjustments */
body[dir="rtl"] .btn-group > .btn:not(:last-child):not(.dropdown-toggle),
body[dir="rtl"] .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;
}

body[dir="rtl"] .btn-group > .btn:not(:first-child),
body[dir="rtl"] .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;
}

/* Table RTL adjustments */
body[dir="rtl"] .table th,
body[dir="rtl"] .table td {
    text-align: right;
}

/* Align cells properly in RTL mode */
body[dir="rtl"] .table .request-number-cell,
body[dir="rtl"] .table .incoming-order-number-cell {
    text-align: right;
}

body[dir="rtl"] .table .request-number-cell strong,
body[dir="rtl"] .table .incoming-order-number-cell strong {
    text-align: right;
    direction: rtl;
}

/* Modal RTL adjustments */
body[dir="rtl"] .modal-header .btn-close {
    margin: -0.5rem auto -0.5rem -0.5rem;
}

/* Pagination RTL adjustments */
body[dir="rtl"] .pagination {
    padding-right: 0;
}

body[dir="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;
}

body[dir="rtl"] .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;
}

/* Alert RTL adjustments */
body[dir="rtl"] .alert-dismissible {
    padding-right: 1rem;
    padding-left: 4rem;
}

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

/* Font adjustments for Arabic */
body[dir="rtl"] {
    font-family: 'Tajawal', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Dropdown menu RTL adjustments */
body[dir="rtl"] .dropdown-menu {
    text-align: right;
}

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

/* Input group RTL adjustments */
body[dir="rtl"] .input-group > .form-control:not(:last-child),
body[dir="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;
}

body[dir="rtl"] .input-group > .form-control:not(:first-child),
body[dir="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;
}

/* List group RTL adjustments */
body[dir="rtl"] .list-group {
    padding-right: 0;
}

/* Card RTL adjustments */
body[dir="rtl"] .card-header {
    text-align: right;
}

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

/* View Entry page RTL adjustments */
body[dir="rtl"] .entry-details-table th,
body[dir="rtl"] .entry-details-table td {
    text-align: right;
}

body[dir="rtl"] .entry-table-container {
    direction: rtl;
}

body[dir="rtl"] .card-footer.text-center {
    text-align: center !important;
}

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

/* Fix for Bootstrap icons in RTL */
body[dir="rtl"] .bi {
    margin-left: 0.25rem;
    margin-right: 0;
}

/* Search form RTL adjustments */
body[dir="rtl"] .me-1,
body[dir="rtl"] .me-2 {
    margin-left: 0.25rem !important;
    margin-right: 0 !important;
}

body[dir="rtl"] .ms-2 {
    margin-right: 0.5rem !important;
    margin-left: 0 !important;
}

/* Footer RTL adjustments */
body[dir="rtl"] .footer {
    text-align: right;
}

body[dir="rtl"] .footer .text-center {
    text-align: center !important;
}
