/* RTL Support and Language Switcher Styles */

/* Language Switcher Styling */
.language-switcher {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 15px;
}

.language-switcher li {
    margin: 0;
}

.language-link {
    color: #666;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.language-link:hover {
    color: #333;
    background-color: rgba(0, 0, 0, 0.05);
    text-decoration: none;
}

.language-link.active {
    color: #007bff;
    background-color: rgba(0, 123, 255, 0.1);
    font-weight: 600;
}

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

[dir="rtl"] .rtl {
    direction: rtl;
    text-align: right;
}

/* Navigation RTL */
[dir="rtl"] .navbar-nav {
    flex-direction: row-reverse;
}

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

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

/* Float and Alignment RTL */
[dir="rtl"] .float-left {
    float: right !important;
}

[dir="rtl"] .float-right {
    float: left !important;
}

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

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

/* Margin and Padding RTL */
[dir="rtl"] .ml-auto {
    margin-left: unset !important;
    margin-right: auto !important;
}

[dir="rtl"] .mr-auto {
    margin-right: unset !important;
    margin-left: auto !important;
}

[dir="rtl"] .ml-1 { margin-left: unset !important; margin-right: 0.25rem !important; }
[dir="rtl"] .ml-2 { margin-left: unset !important; margin-right: 0.5rem !important; }
[dir="rtl"] .ml-3 { margin-left: unset !important; margin-right: 1rem !important; }
[dir="rtl"] .ml-4 { margin-left: unset !important; margin-right: 1.5rem !important; }
[dir="rtl"] .ml-5 { margin-left: unset !important; margin-right: 3rem !important; }

[dir="rtl"] .mr-1 { margin-right: unset !important; margin-left: 0.25rem !important; }
[dir="rtl"] .mr-2 { margin-right: unset !important; margin-left: 0.5rem !important; }
[dir="rtl"] .mr-3 { margin-right: unset !important; margin-left: 1rem !important; }
[dir="rtl"] .mr-4 { margin-right: unset !important; margin-left: 1.5rem !important; }
[dir="rtl"] .mr-5 { margin-right: unset !important; margin-left: 3rem !important; }

[dir="rtl"] .pl-1 { padding-left: unset !important; padding-right: 0.25rem !important; }
[dir="rtl"] .pl-2 { padding-left: unset !important; padding-right: 0.5rem !important; }
[dir="rtl"] .pl-3 { padding-left: unset !important; padding-right: 1rem !important; }
[dir="rtl"] .pl-4 { padding-left: unset !important; padding-right: 1.5rem !important; }
[dir="rtl"] .pl-5 { padding-left: unset !important; padding-right: 3rem !important; }

[dir="rtl"] .pr-1 { padding-right: unset !important; padding-left: 0.25rem !important; }
[dir="rtl"] .pr-2 { padding-right: unset !important; padding-left: 0.5rem !important; }
[dir="rtl"] .pr-3 { padding-right: unset !important; padding-left: 1rem !important; }
[dir="rtl"] .pr-4 { padding-right: unset !important; padding-left: 1.5rem !important; }
[dir="rtl"] .pr-5 { padding-right: unset !important; padding-left: 3rem !important; }

/* Bootstrap Grid RTL */
[dir="rtl"] .row {
    flex-direction: row-reverse;
}

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

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

[dir="rtl"] .input-group > .form-control: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;
}

/* Button Groups RTL */
[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;
}

[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;
}

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

/* Alert RTL */
[dir="rtl"] .alert-dismissible .close {
    position: absolute;
    top: 0;
    left: 0;
    right: auto;
    padding: 0.75rem 1.25rem;
}

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

/* List Group RTL */
[dir="rtl"] .list-group-item {
    text-align: right;
}

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

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

/* Pagination RTL */
[dir="rtl"] .pagination {
    justify-content: flex-end;
}

/* Breadcrumb RTL */
[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before {
    padding-left: 0.5rem;
    padding-right: 0;
}

/* Progress Bar RTL */
[dir="rtl"] .progress-bar {
    float: right;
}

/* Custom RTL Classes */
.rtl-text-right {
    text-align: right !important;
}

.rtl-text-left {
    text-align: left !important;
}

.rtl-float-right {
    float: right !important;
}

.rtl-float-left {
    float: left !important;
}

/* Responsive RTL */
@media (max-width: 768px) {
    [dir="rtl"] .language-switcher {
        flex-direction: column;
        gap: 5px;
    }

    [dir="rtl"] .navbar-nav {
        flex-direction: column;
    }
}

/* Arabic (RTL) topbar: keep items on one line and centered on mobile */
@media (max-width: 768px) {
    [dir="rtl"] .top-bar .row {
        flex-wrap: nowrap;
        justify-content: center;
    }
    [dir="rtl"] .top-bar .topbar-right,
    [dir="rtl"] .top-bar .topbar-left {
        display: flex;
        align-items: center;
    }
    [dir="rtl"] .top-bar .language-switcher,
    [dir="rtl"] .top-bar .topbar-right ul,
    [dir="rtl"] .top-bar .topbar-left ul {
        display: flex;
        gap: 10px;
        flex-wrap: nowrap;
        white-space: nowrap;
        justify-content: center;
    }
}
