/* RTL Support for Arabic Language */

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

[dir="rtl"] .sidebar {
    /* Sidebar adjustments for RTL */
    border-right: none;
    border-left: 2px solid rgba(255,255,255,0.1);
}

[dir="rtl"] .sidebar .nav-link {
    /* Navigation link adjustments */
    padding-right: 20px;
    padding-left: 12px;
}

[dir="rtl"] .sidebar .nav-link:hover,
[dir="rtl"] .sidebar .nav-link.active {
    /* Hover and active state adjustments */
    transform: translateX(-5px);
}

[dir="rtl"] .sidebar .nav-link i {
    /* Icon positioning */
    margin-right: 0;
    margin-left: 10px;
}

[dir="rtl"] .header {
    /* Header adjustments */
    flex-direction: row-reverse;
}

[dir="rtl"] .user-info {
    /* User info positioning */
    margin-right: 0;
    margin-left: 1rem;
}

[dir="rtl"] .language-switcher {
    /* Language switcher positioning */
    margin-left: 0;
    margin-right: 1rem;
}

[dir="rtl"] .btn {
    /* Button icon positioning */
    flex-direction: row-reverse;
}

[dir="rtl"] .btn i {
    /* Button icon margins */
    margin-right: 0;
    margin-left: 0.5rem;
}

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

[dir="rtl"] .form-control,
[dir="rtl"] .form-select {
    /* Form input text alignment */
    text-align: right;
}

[dir="rtl"] .modal-header .btn-close {
    /* Modal close button positioning */
    margin: calc(-.5 * var(--bs-modal-header-padding-y)) auto calc(-.5 * var(--bs-modal-header-padding-y)) calc(-.5 * var(--bs-modal-header-padding-x));
}

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

[dir="rtl"] .dropdown-item {
    /* Dropdown item text alignment */
    text-align: right;
}

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

[dir="rtl"] .card-title {
    /* Card title text alignment */
    text-align: right;
}

[dir="rtl"] .alert {
    /* Alert text alignment */
    text-align: right;
}

[dir="rtl"] .badge {
    /* Badge positioning */
    margin-right: 0;
    margin-left: 0.5rem;
}

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

[dir="rtl"] .pe-1 { padding-right: 0 !important; padding-left: 0.25rem !important; }
[dir="rtl"] .pe-2 { padding-right: 0 !important; padding-left: 0.5rem !important; }
[dir="rtl"] .pe-3 { padding-right: 0 !important; padding-left: 1rem !important; }
[dir="rtl"] .ps-1 { padding-left: 0 !important; padding-right: 0.25rem !important; }
[dir="rtl"] .ps-2 { padding-left: 0 !important; padding-right: 0.5rem !important; }
[dir="rtl"] .ps-3 { padding-left: 0 !important; padding-right: 1rem !important; }

/* Float adjustments for RTL */
[dir="rtl"] .float-start { float: right !important; }
[dir="rtl"] .float-end { float: left !important; }

/* Text alignment utilities for RTL */
[dir="rtl"] .text-start { text-align: right !important; }
[dir="rtl"] .text-end { text-align: left !important; }

/* Border adjustments for RTL */
[dir="rtl"] .border-start { border-left: none !important; border-right: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color) !important; }
[dir="rtl"] .border-end { border-right: none !important; border-left: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color) !important; }

/* Position adjustments for RTL */
[dir="rtl"] .position-absolute {
    right: auto;
    left: 0;
}

[dir="rtl"] .position-fixed {
    right: auto;
    left: 20px;
}

/* Animation adjustments for RTL */
[dir="rtl"] .slide-in-right {
    animation: slideInLeft 0.3s ease-out;
}

[dir="rtl"] .slide-out-right {
    animation: slideOutLeft 0.3s ease-out;
}

/* Language switcher specific adjustments */
[dir="rtl"] .language-switcher .dropdown-menu {
    right: 0;
    left: auto;
    text-align: right;
}

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

[dir="rtl"] .language-switcher .dropdown-item .me-2 {
    margin-right: 0 !important;
    margin-left: 0.5rem !important;
}

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

/* Ensure language switcher button works in RTL */
[dir="rtl"] .language-switcher .btn {
    flex-direction: row-reverse;
}

[dir="rtl"] .language-switcher .btn i {
    margin-right: 0;
    margin-left: 0.25rem;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}
