/* RTL Form Layout Fixes */

/* General form element alignment */
html[dir="rtl"] .form-label {
    text-align: right;
}

/* Checkboxes and radio buttons */
html[dir="rtl"] .form-check {
    padding-right: 1.5em;
    padding-left: 0;
    text-align: right;
}

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

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

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

html[dir="rtl"] .input-group > .input-group-text:first-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"] .input-group > .input-group-text:last-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
}

/* Form validation messages */
html[dir="rtl"] .invalid-feedback,
html[dir="rtl"] .valid-feedback {
    text-align: right;
}

/* Form floating labels */
html[dir="rtl"] .form-floating > label {
    right: 0;
    left: auto;
}

html[dir="rtl"] .form-floating > .form-control,
html[dir="rtl"] .form-floating > .form-select {
    padding-right: 0.75rem;
    padding-left: 0.75rem;
}

/* Multi-column form layouts */
html[dir="rtl"] .row {
    flex-direction: row;
}

/* Form buttons alignment */
html[dir="rtl"] .d-md-flex.justify-content-md-end {
    justify-content: flex-start !important;
}

html[dir="rtl"] .d-md-flex.justify-content-md-end .me-md-2 {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

/* Form icons */
html[dir="rtl"] .form-control-feedback {
    right: auto;
    left: 0;
}

/* Date and time inputs */
html[dir="rtl"] input[type="date"],
html[dir="rtl"] input[type="time"],
html[dir="rtl"] input[type="datetime-local"] {
    direction: ltr;
    text-align: right;
}

/* Select with icons */
html[dir="rtl"] .select-with-icon {
    background-position: left 0.75rem center;
    padding-left: 2.25rem;
    padding-right: 0.75rem;
}

/* Fix checkbox and radio inline alignment */
html[dir="rtl"] .form-check-inline {
    margin-right: 0;
    margin-left: 1rem;
}

/* Bootstrap card form fixes */
html[dir="rtl"] .card-header, 
html[dir="rtl"] .card-body, 
html[dir="rtl"] .card-footer {
    text-align: right;
}

/* Form group spacing */
html[dir="rtl"] .form-group {
    text-align: right;
}

/* Bootstrap button groups in forms */
html[dir="rtl"] .btn-group > .btn:not(:last-child):not(.dropdown-toggle) {
    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"] .btn-group > .btn: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;
} 