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

/* Mobile responsive fix - stack navigation items vertically on mobile */
@media (max-width: 991.98px) {
    [dir="rtl"] .navbar-nav {
        flex-direction: column !important;
    }
    
    [dir="rtl"] .navbar-nav .nav-item {
        width: 100%;
    }
    
    [dir="rtl"] .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #f0f0f0;
    }
    
    [dir="rtl"] .navbar-nav .nav-link:last-child {
        border-bottom: none;
    }
    
    /* Fix auth buttons alignment on mobile */
    [dir="rtl"] .navbar-nav .btn {
        margin: 0.5rem 0;
        width: 100%;
        text-align: center;
    }
    
    /* Ensure proper spacing between nav sections on mobile */
    [dir="rtl"] .navbar-nav + .navbar-nav {
        border-top: 1px solid #f0f0f0;
        padding-top: 1rem;
        margin-top: 1rem;
    }
    
    /* Fix collapsed navigation display */
    [dir="rtl"] .navbar-collapse.show,
    [dir="rtl"] .navbar-collapse.collapsing {
        display: block;
    }
}

[dir="rtl"] .navbar-nav .nav-link {
    padding-right: 0;
    padding-left: 1rem;
}

[dir="rtl"] .navbar-toggler {
    border: none;
}

[dir="rtl"] .ms-2 {
    margin-left: 0 !important;
    margin-right: 0.5rem !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"] .me-auto {
    margin-left: 0 !important;
    margin-right: auto !important;
}

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

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

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

[dir="rtl"] .btn {
    margin-left: 0.5rem;
    margin-right: 0;
}

[dir="rtl"] .btn:last-child {
    margin-left: 0;
}

/* Fix Bootstrap flex utilities for RTL */
[dir="rtl"] .justify-content-end {
    justify-content: flex-start !important;
}

[dir="rtl"] .justify-content-start {
    justify-content: flex-end !important;
}