﻿/* Fixed RTL Navbar Fix for AdminLTE 4 - Always Top & Right-Aligned */
:dir(rtl) {
    /* Force fixed position برای navbar (همیشه بالا) */
    #navigation.app-header.navbar
{
    position: fixed !important; /* fixed نگه دار */
    top: 0 !important; /* همیشه از بالا */
    left: auto !important; /* در RTL، left رو auto کن */
    right: 0 !important; /* از راست شروع */
    width: 100% !important; /* full width */
    z-index: 1030 !important; /* بالاتر از content */
    justify-content: flex-start !important; /* کلیدی: از راست (start در RTL) شروع کن، نه وسط/چپ */
    align-items: center !important;
    /*background-color: var(--bs-body-bg) !important;*/ /* bg-body حفظ کن */
}

/* Fix navbar-nav داخل navigation */
#navigation .navbar-nav {
    flex-direction: row !important; /* معکوس ترتیب برای RTL */
    margin-right: 250px !important; /* align به راست */
    margin-left: 0 !important;
    justify-content: flex-start !important; /* آیتم‌ها از راست */
}

    #navigation .navbar-nav .nav-item {
        text-align: right !important;
    }

/* Fix dropdown */
/*#navigation .dropdown-menu {
    right: 0 !important;
    left: auto !important;
    text-align: right !important;
}

#navigation .dropdown-item {
    padding-right: 1rem !important;
    padding-left: 0.5rem !important;
}*/

/* Override ms-auto/me-auto برای RTL موبایل */
#navigation .ms-auto {
    margin-right: auto !important;
    margin-left: 0 !important;
}

#navigation .me-auto {
    margin-left: auto !important;
    margin-right: 0 !important;
}

/* Fix responsive موبایل (زیر 768px) */
@media (max-width: 767.98px) {
    #navigation.app-header.navbar {
        padding-right: 0.5rem !important;
        padding-left: 0.5rem !important;
        justify-content: space-between !important; /* اگر space می‌خوای، اما flex-start برای راست */
        flex-direction: row-reverse !important;
    }

    #navigation .navbar-expand .navbar-nav {
        flex-direction: row-reverse !important;
        justify-content: flex-start !important; /* از راست در موبایل */
        text-align: right !important;
    }

    /* Fix collapse در موبایل */
    #navigation .navbar-collapse {
        position: absolute !important; /* برای offcanvas-like */
        top: 100% !important; /* زیر navbar */
        right: 0 !important;
        width: 100% !important;
/*        background: var(--bs-body-bg) !important;
*/        z-index: 1029 !important;
    }
}

/* Fix desktop */
@media (min-width: 768px) {
    #navigation.app-header.navbar {
        padding-right: 1rem !important;
        padding-left: 1rem !important;
        justify-content: flex-start !important;
    }
}

/* Fix sidebar اگر نیاز داری (از قبل) */
.main-sidebar {
    left: auto !important;
    right: 0 !important;
    transform: translateX(100%) !important;
}

    .main-sidebar.sidebar-open {
        transform: translateX(0) !important;
    }

/* Override utilities */
.text-start {
    text-align: right !important;
}

.text-end {
    text-align: left !important;
}
}
