/*
 * اصلاح چیدمان Frest در حالت RTL فارسی.
 * نوار بالا (navbar) نباید روی هدر سایدبار (app-brand) بیفتد.
 * همچنین وقتی منو باز است، صفحه نباید اسکرول افقی بگیرد.
 */

/* —— جلوگیری از اسکرول افقی کل صفحه وقتی محتوا (جدول) عریض است —— */
html[dir="rtl"],
html[dir="rtl"] body {
    max-width: 100%;
    overflow-x: hidden;
}

html[dir="rtl"] .layout-wrapper,
html[dir="rtl"] .layout-container {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* flex پیش‌فرض min-width:auto است و جدول عریض کل صفحه را پهن می‌کند */
html[dir="rtl"] .layout-page,
html[dir="rtl"] .content-wrapper {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

html[dir="rtl"] .content-wrapper > .container-fluid {
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
}

/* 100vw با اسکرول‌بار عمودی باعث اسکرول افقی می‌شود */
html[dir="rtl"] .content-backdrop {
    width: 100% !important;
    max-width: 100vw;
}

@media (min-width: 1200px) {
    /* منوی ثابت از جریان flex خارج شود تا عرض دوبل نشود */
    html[dir="rtl"].layout-menu-fixed .layout-menu,
    html[dir="rtl"].layout-menu-fixed-offcanvas .layout-menu {
        position: fixed !important;
        top: 0;
        bottom: 0;
        right: 0 !important;
        left: auto !important;
        width: 16.25rem;
        margin: 0 !important;
        flex: none !important;
        z-index: 1080;
    }

    html[dir="rtl"].layout-menu-fixed.layout-menu-collapsed .layout-menu,
    html[dir="rtl"].layout-menu-fixed-offcanvas.layout-menu-collapsed .layout-menu {
        width: 5rem;
    }

    html[dir="rtl"].layout-menu-fixed:not(.layout-menu-collapsed) .layout-wrapper.layout-content-navbar .layout-page,
    html[dir="rtl"].layout-menu-fixed-offcanvas:not(.layout-menu-collapsed) .layout-wrapper.layout-content-navbar .layout-page {
        padding-right: 16.25rem !important;
        padding-left: 0 !important;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    html[dir="rtl"].layout-menu-fixed.layout-navbar-fixed:not(.layout-menu-collapsed) .layout-wrapper.layout-content-navbar .layout-navbar {
        right: 16.25rem !important;
        left: 0 !important;
        width: auto !important;
    }

    html[dir="rtl"].layout-menu-fixed.layout-menu-collapsed .layout-wrapper.layout-content-navbar .layout-page {
        padding-right: 5rem !important;
        padding-left: 0 !important;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    html[dir="rtl"].layout-menu-fixed.layout-navbar-fixed.layout-menu-collapsed .layout-wrapper.layout-content-navbar .layout-navbar {
        right: 5rem !important;
        left: 0 !important;
        width: auto !important;
    }
}

/* فاصله‌گذاری درست منوی کناری در RTL */
html[dir="rtl"] .layout-menu .app-brand {
    padding-inline: 1.15rem;
    min-height: 4.5rem;
}

html[dir="rtl"] .layout-menu .app-brand-link {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 11rem;
}

html[dir="rtl"] .layout-menu .menu-inner > .menu-item > .menu-link {
    padding-inline: 1.15rem 1.35rem;
}

html[dir="rtl"] .layout-menu .menu-header {
    padding-inline: 1.15rem 1.35rem;
}

@media (max-width: 1199.98px) {
    html[dir="rtl"].layout-menu-fixed .layout-wrapper.layout-content-navbar .layout-page {
        padding-right: 0 !important;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    html[dir="rtl"].layout-menu-fixed .layout-wrapper.layout-content-navbar .layout-navbar {
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
    }
}

/* دکمه راهنمای درون‌صفحه (مرکز آموزش) */
.page-help-link-bar {
    display: flex;
    justify-content: flex-end;
}

.page-help-link-btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    border-radius: 50rem;
    font-weight: 500;
}

.page-help-link-label::before {
    content: "—";
    margin-inline: .25rem;
    opacity: .65;
}
