/* Frontend Navbar RTL/LTR Fixes */

/* Fix navbar direction based on language */
[dir="rtl"] .navbar {
    direction: rtl;
}

[dir="ltr"] .navbar {
    direction: ltr;
}

/* Fix navbar nav positioning */
[dir="rtl"] .navbar-nav {
    margin-left: 0 !important;
    margin-right: auto !important;
}

[dir="ltr"] .navbar-nav {
    margin-left: auto !important;
    margin-right: 0 !important;
}

/* Fix navbar collapse positioning */
[dir="rtl"] .navbar-collapse {
    text-align: right !important;
}

[dir="ltr"] .navbar-collapse {
    text-align: left !important;
}

/* Fix cta-btn positioning */
[dir="rtl"] .cta-btn {
    margin-left: 0 !important;
    margin-right: auto !important;
}

[dir="ltr"] .cta-btn {
    margin-left: auto !important;
    margin-right: 0 !important;
}

/* Fix language switcher button layout */
[dir="rtl"] .language-switcher .btn {
    display: flex !important;
    flex-direction: row-reverse !important;
    align-items: center !important;
    gap: 0.5rem !important;
}

[dir="ltr"] .language-switcher .btn {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.5rem !important;
}

/* Fix dropdown positioning */
[dir="rtl"] .language-switcher .dropdown-menu {
    right: 0 !important;
    left: auto !important;
    text-align: right !important;
    transform-origin: top right !important;
}

[dir="ltr"] .language-switcher .dropdown-menu {
    left: 0 !important;
    right: auto !important;
    text-align: left !important;
    transform-origin: top left !important;
}

/* Fix dropdown items alignment */
[dir="rtl"] .language-switcher .dropdown-item {
    text-align: right !important;
    display: flex !important;
    flex-direction: row-reverse !important;
    align-items: center !important;
    gap: 0.5rem !important;
}

[dir="ltr"] .language-switcher .dropdown-item {
    text-align: left !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.5rem !important;
}

/* Fix dropdown arrow positioning */
[dir="rtl"] .language-switcher .btn::after {
    margin-left: 0 !important;
    margin-right: 0.5rem !important;
}

[dir="ltr"] .language-switcher .btn::after {
    margin-right: 0 !important;
    margin-left: 0.5rem !important;
}

/* Fix navbar container positioning */
[dir="rtl"] .navbar .container {
    direction: rtl !important;
}

[dir="ltr"] .navbar .container {
    direction: ltr !important;
}

/* Fix navbar collapse order */
[dir="rtl"] .navbar-collapse {
    order: 1 !important;
}

[dir="rtl"] .cta-btn {
    order: 2 !important;
}

[dir="ltr"] .navbar-collapse {
    order: 2 !important;
}

[dir="ltr"] .cta-btn {
    order: 1 !important;
}

/* Fix mobile navbar positioning */
@media (max-width: 768px) {
    [dir="rtl"] .mobile-nav {
        text-align: right !important;
    }
    
    [dir="ltr"] .mobile-nav {
        text-align: left !important;
    }
    
    [dir="rtl"] .mobile-nav .logo {
        margin-right: auto !important;
        margin-left: 0 !important;
    }
    
    [dir="ltr"] .mobile-nav .logo {
        margin-left: auto !important;
        margin-right: 0 !important;
    }
}

/* Fix dropdown items alignment */
[dir="rtl"] .language-switcher .dropdown-item {
    text-align: right !important;
    padding-right: 1rem !important;
    padding-left: 0.5rem !important;
}

[dir="ltr"] .language-switcher .dropdown-item {
    text-align: left !important;
    padding-left: 1rem !important;
    padding-right: 0.5rem !important;
}

/* Fix navbar brand positioning */
[dir="rtl"] .navbar-brand {
    margin-left: 0 !important;
    margin-right: auto !important;
}

[dir="ltr"] .navbar-brand {
    margin-left: 0 !important;
    margin-right: auto !important;
}

/* Fix navbar collapse positioning */
[dir="rtl"] .navbar-collapse {
    text-align: right !important;
}

[dir="ltr"] .navbar-collapse {
    text-align: left !important;
}

/* Fix navbar nav items spacing */
[dir="rtl"] .navbar-nav .nav-item {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

[dir="rtl"] .navbar-nav .nav-item:first-child {
    margin-left: 0 !important;
}

[dir="ltr"] .navbar-nav .nav-item {
    margin-right: 0.5rem !important;
    margin-left: 0 !important;
}

[dir="ltr"] .navbar-nav .nav-item:last-child {
    margin-right: 0 !important;
}

/* Fix cta-btn positioning */
[dir="rtl"] .cta-btn {
    margin-left: 1rem !important;
    margin-right: 0 !important;
}

[dir="ltr"] .cta-btn {
    margin-right: 1rem !important;
    margin-left: 0 !important;
}

/* Fix language switcher icon and text spacing */
[dir="rtl"] .language-switcher .btn i {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

[dir="ltr"] .language-switcher .btn i {
    margin-right: 0.5rem !important;
    margin-left: 0 !important;
}

/* Fix dropdown arrow positioning */
[dir="rtl"] .language-switcher .dropdown-toggle::after {
    margin-left: 0 !important;
    margin-right: 0.5rem !important;
}

[dir="ltr"] .language-switcher .dropdown-toggle::after {
    margin-right: 0 !important;
    margin-left: 0.5rem !important;
}

/* Fix mobile navbar positioning */
@media (max-width: 991px) {
    [dir="rtl"] .navbar-collapse {
        text-align: right !important;
    }
    
    [dir="ltr"] .navbar-collapse {
        text-align: left !important;
    }
    
    [dir="rtl"] .navbar-nav {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
    
    [dir="ltr"] .navbar-nav {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* Fix dropdown menu positioning for RTL */
[dir="rtl"] .dropdown-menu-end {
    right: 0 !important;
    left: auto !important;
}

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

/* Fix navbar toggle button positioning */
[dir="rtl"] .navbar-toggler {
    margin-left: 0 !important;
    margin-right: auto !important;
}

[dir="ltr"] .navbar-toggler {
    margin-left: auto !important;
    margin-right: 0 !important;
}

/* Fix navbar container alignment */
[dir="rtl"] .navbar .container {
    text-align: right !important;
}

[dir="ltr"] .navbar .container {
    text-align: left !important;
}

/* Fix navbar brand alignment */
[dir="rtl"] .navbar-brand {
    text-align: right !important;
}

[dir="ltr"] .navbar-brand {
    text-align: left !important;
}

/* Fix language switcher button alignment */
[dir="rtl"] .language-switcher {
    text-align: right !important;
}

[dir="ltr"] .language-switcher {
    text-align: left !important;
}

/* Fix dropdown menu items hover */
[dir="rtl"] .dropdown-item:hover {
    background-color: #f8f9fa !important;
    color: #000 !important;
}

[dir="ltr"] .dropdown-item:hover {
    background-color: #f8f9fa !important;
    color: #000 !important;
}

/* Fix navbar nav links alignment */
[dir="rtl"] .navbar-nav .nav-link {
    text-align: right !important;
    padding-right: 1rem !important;
    padding-left: 0.5rem !important;
}

[dir="ltr"] .navbar-nav .nav-link {
    text-align: left !important;
    padding-left: 1rem !important;
    padding-right: 0.5rem !important;
}

/* Fix navbar active states */
[dir="rtl"] .navbar-nav .nav-link.active {
    background-color: transparent !important;
    color: #007bff !important;
    border-right: 2px solid #007bff !important;
    border-left: none !important;
}

[dir="ltr"] .navbar-nav .nav-link.active {
    background-color: transparent !important;
    color: #007bff !important;
    border-left: 2px solid #007bff !important;
    border-right: none !important;
}

/* Fix language switcher button focus */
[dir="rtl"] .language-switcher .btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
    outline: none !important;
}

[dir="ltr"] .language-switcher .btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
    outline: none !important;
}

/* Fix dropdown menu animation */
[dir="rtl"] .dropdown-menu {
    animation: slideInFromRight 0.3s ease-out !important;
}

[dir="ltr"] .dropdown-menu {
    animation: slideInFromLeft 0.3s ease-out !important;
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fix navbar responsive behavior */
@media (max-width: 768px) {
    [dir="rtl"] .navbar-nav {
        text-align: right !important;
    }
    
    [dir="ltr"] .navbar-nav {
        text-align: left !important;
    }
    
    [dir="rtl"] .language-switcher {
        text-align: right !important;
        margin-top: 1rem !important;
    }
    
    [dir="ltr"] .language-switcher {
        text-align: left !important;
        margin-top: 1rem !important;
    }
}

/* Fix navbar brand logo positioning */
[dir="rtl"] .navbar-brand img {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

[dir="ltr"] .navbar-brand img {
    margin-right: 0.5rem !important;
    margin-left: 0 !important;
}

/* Fix navbar nav items order */
[dir="rtl"] .navbar-nav {
    flex-direction: row-reverse !important;
}

[dir="ltr"] .navbar-nav {
    flex-direction: row !important;
}

/* Fix language switcher button order */
[dir="rtl"] .language-switcher .btn {
    flex-direction: row-reverse !important;
}

[dir="ltr"] .language-switcher .btn {
    flex-direction: row !important;
}

/* Fix dropdown menu positioning for small screens */
@media (max-width: 576px) {
    [dir="rtl"] .language-switcher .dropdown-menu {
        right: 0 !important;
        left: auto !important;
        min-width: 120px !important;
    }
    
    [dir="ltr"] .language-switcher .dropdown-menu {
        left: 0 !important;
        right: auto !important;
        min-width: 120px !important;
    }
}

/* Fix navbar collapse button positioning */
[dir="rtl"] .navbar-toggler {
    order: -1 !important;
}

[dir="ltr"] .navbar-toggler {
    order: 1 !important;
}

/* Fix navbar brand positioning in collapsed state */
[dir="rtl"] .navbar-brand {
    order: 1 !important;
}

[dir="ltr"] .navbar-brand {
    order: -1 !important;
}
