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

/* Global RTL text alignment */
[dir="rtl"] {
    text-align: right;
    direction: rtl;
}

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

/* Keep navbar items in the same visual order, don't reverse */
[dir="rtl"] .navbar-nav {
    flex-direction: row;
    /* Keep normal order */
}

[dir="rtl"] .navbar-nav .nav-item {
    margin-left: 0;
    margin-right: 0;
}

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

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

/* Form elements */
[dir="rtl"] .form-label {
    text-align: right;
}

[dir="rtl"] .form-control,
[dir="rtl"] .form-select {
    text-align: right;
}

/* Fix caret position in input fields - keep caret on LEFT */
[dir="rtl"] input[type="text"],
[dir="rtl"] input[type="number"],
[dir="rtl"] input[type="email"],
[dir="rtl"] input[type="tel"],
[dir="rtl"] input[type="search"],
[dir="rtl"] input[type="password"],
[dir="rtl"] textarea,
[dir="rtl"] .form-control {
    text-align: right;
    direction: rtl;
}

/* Fix button order in RTL - reverse flex direction */
[dir="rtl"] .d-flex.gap-2 {
    flex-direction: row-reverse !important;
    gap: 0.5rem !important;
}

[dir="rtl"] .btn-group {
    flex-direction: row-reverse !important;
}

/* Keep text direction correct inside buttons */
[dir="rtl"] .btn {
    direction: rtl;
    text-align: center;
}

/* Fix spacing between buttons in RTL */
[dir="rtl"] .btn+.btn {
    margin-right: 0.5rem;
    margin-left: 0;
}

[dir="rtl"] .btn-group>.btn+.btn {
    margin-right: 0.25rem;
    margin-left: 0;
}