/* RTL Modal Dialog Fixes */

/* Modal header alignment */
html[dir="rtl"] .modal-header {
    flex-direction: row-reverse;
}

html[dir="rtl"] .modal-header .btn-close {
    margin: -0.5rem auto -0.5rem -0.5rem;
}

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

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

/* Modal footer alignment */
html[dir="rtl"] .modal-footer {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

/* Modal dialog animation */
html[dir="rtl"] .modal.fade .modal-dialog {
    transform: translate(25px, 0);
    transition: transform 0.3s ease-out;
}

html[dir="rtl"] .modal.fade.show .modal-dialog {
    transform: translate(0, 0);
}

/* Modal dialog positioning */
@media (min-width: 576px) {
    html[dir="rtl"] .modal-dialog {
        margin-right: auto;
        margin-left: auto;
    }
}

/* Align form elements inside modals */
html[dir="rtl"] .modal-body .form-group,
html[dir="rtl"] .modal-body .form-check,
html[dir="rtl"] .modal-body .custom-control {
    text-align: right;
}

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

/* Adjust dropdown menus in modals */
html[dir="rtl"] .modal .dropdown-menu {
    text-align: right;
    right: 0;
    left: auto;
}

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

/* Modal tabs in RTL */
html[dir="rtl"] .modal-body .nav-tabs {
    padding-right: 0;
}

/* Modal form groups */
html[dir="rtl"] .modal-body .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;
}

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

/* Modal icons */
html[dir="rtl"] .modal-body .bi,
html[dir="rtl"] .modal-body .fa,
html[dir="rtl"] .modal-body .fas,
html[dir="rtl"] .modal-body .far {
    margin-right: 0;
    margin-left: 0.5rem;
}

/* Status badges in modals */
html[dir="rtl"] .modal-body .badge {
    margin-right: 0;
    margin-left: 0.5rem;
}

/* Custom modal dialog sizes */
@media (min-width: 576px) {
    html[dir="rtl"] .modal-sm {
        max-width: 300px;
    }
}

@media (min-width: 992px) {
    html[dir="rtl"] .modal-lg,
    html[dir="rtl"] .modal-xl {
        max-width: 800px;
    }
}

@media (min-width: 1200px) {
    html[dir="rtl"] .modal-xl {
        max-width: 1140px;
    }
}

/* Event Detail Modal specific fixes */
html[dir="rtl"] #eventDetailBody p {
    text-align: right;
}

/* Training Session confirmation modal */
html[dir="rtl"] .confirmation-details {
    text-align: right;
}

/* Image gallery modal */
html[dir="rtl"] .modal-gallery .carousel-control-prev {
    right: auto;
    left: 0;
}

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

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

/* Modal loading spinner */
html[dir="rtl"] .modal-spinner {
    margin-right: 0;
    margin-left: 0.5rem;
} 