/* Persian typography, scoped to right-to-left pages. */
html[dir="rtl"] body, html[dir="rtl"] button, html[dir="rtl"] input, html[dir="rtl"] select, html[dir="rtl"] textarea {
    font-family: IRANSansX, Tahoma, sans-serif;
}
html[dir="rtl"] code, html[dir="rtl"] pre, html[dir="rtl"] input[type="url"], html[dir="rtl"] input[type="email"] { direction: ltr; text-align: left; }

/* Keep the original theme and correct only Persian layout details. */
html[dir="rtl"] :is(.tooltip,.tooltip-inner,.popover,.popover-header,.popover-body,.select2-container,.apexcharts-text) {
    font-family: IRANSansX, Tahoma, sans-serif !important;
}
html[dir="rtl"] :is(.app-sidebar-links > li,.admin-sidebar-links > li) { padding: .125rem 1rem; }
html[dir="rtl"] .admin-sidebar-links > div > li { padding-block: .125rem; }
html[dir="rtl"] :is(.app-sidebar-links,.admin-sidebar-links) a > :is(.svg-inline--fa,i.fa-fw) { flex-shrink: 0; }
html[dir="rtl"] body[data-theme-style="light"]:has(.app-container,.admin-container) { background: #fafbfc; }
html[dir="rtl"] [data-theme-style="light"] :is(.app-content,.admin-content) { background: #fafbfc; }
html[dir="rtl"] body[data-theme-style="light"]:not(.bg-white) { background: #fafbfc; }
.empty-state-symbol { display: inline-flex; align-items: center; justify-content: center; width: 72px; height: 72px; border: 1px solid var(--gray-200); border-radius: 18px; background: var(--gray-100); color: var(--gray-600); font-size: 26px; margin-bottom: 20px; }
.navbar-main { border-radius: 12px !important; }
.plan-price-row { display: flex; align-items: baseline; justify-content: center; gap: .4rem; flex-wrap: nowrap; white-space: nowrap; }
.plan-price-row > :is(div,span) { margin-bottom: .5rem; }
html[dir="rtl"] .custom-breadcrumbs :is(.fa-angle-right,.fa-chevron-right,.fa-arrow-right) { transform: scaleX(-1); }
/* User navigation uses the teal/navy palette approved for the sidebar. */
html[dir="rtl"] .app-sidebar {
    background: #12354a;
    border: 1px solid #254b60;
    border-radius: 18px;
    box-shadow: 0 12px 32px rgba(15, 40, 60, .12);
}
html[dir="rtl"] .app-sidebar-title { height: 60px; min-height: 60px; margin: 0; padding: 10px 14px; flex-shrink: 0; }
html[dir="rtl"] .app-sidebar-links { padding-block: 4px; }
html[dir="rtl"] .app-sidebar-links > li { padding: 1px 10px; }
html[dir="rtl"] .app-sidebar-links > li > a {
    min-height: 38px;
    padding: 7px 10px;
    line-height: 1.6;
    background: transparent;
    border-radius: 10px;
    color: #deebf3;
}
html[dir="rtl"] .app-sidebar-links > li > a:hover { background: #1d465b; color: #fff; }
html[dir="rtl"] .app-sidebar-links > li.active > a:not(.default) {
    background: #205369;
    color: #fff;
    box-shadow: inset -3px 0 0 #5eead4;
}
html[dir="rtl"] .app-sidebar-links > li > a.default { background: #1d465b; }
html[dir="rtl"] .app-sidebar-links > li > a > .svg-inline--fa { opacity: .9; width: 18px; }
html[dir="rtl"] .app-sidebar-footer-text { color: #f1f7fa; }
html[dir="rtl"] .app-sidebar-footer-text small { color: #bbd0dc; direction: ltr; text-align: right; }
html[dir="rtl"] .app-sidebar-avatar { border-radius: 10px; border: 1px solid #426579; }
html[dir="rtl"] .app-sidebar > .app-sidebar-links:last-child { border-top: 1px solid #31566a; padding-block: 6px; margin-top: 4px; }
html[dir="rtl"] [data-theme-style="dark"] .app-sidebar { background: #102838; border-color: #29495e; }
html[dir="rtl"] [data-theme-style="dark"] .app-sidebar-links > li > a { background: transparent; color: #deebf3; }
html[dir="rtl"] [data-theme-style="dark"] .app-sidebar-links > li.active > a:not(.default) { background: #205369; color: #fff; }
html[dir="rtl"] [data-theme-style="light"] .app-content :is(.card:not([class*="bg-"]),.table-custom-container) {
    background: #fff;
    border: 1px solid #dce3eb;
    box-shadow: 0 3px 12px rgba(30, 50, 75, .04);
}
html[dir="rtl"] [data-theme-style="light"] .app-content .table-custom { background: #fff; }
html[dir="rtl"] [data-theme-style="light"] .app-content .table-custom thead { background: #eef2f6; }
html[dir="rtl"] [data-theme-style="light"] .app-content .table-custom thead th { color: #48576b; border-bottom: 1px solid #dce3eb; }
html[dir="rtl"] [data-theme-style="light"] .app-content hr.border-gray-50 { border-color: #dce3eb !important; }
.footer-links-layout { display: grid; grid-template-columns: minmax(0,1.3fr) repeat(2,minmax(0,1fr)); gap: 32px; margin: 0; padding-block: 24px; }
.footer-links-layout > div { width: auto; max-width: none; padding: 0 !important; }
.footer-links-layout ul { padding: 0; }
@media (min-width: 992px) {
    .navbar-main #main_navbar { justify-content: flex-start; }
    .navbar-main .navbar-brand { margin-inline-end: 24px; }
    .navbar-main .navbar-nav { width: 100%; align-items: center; flex-wrap: wrap; }
    .navbar-main .navbar-nav > .nav-account-start { margin-inline-start: auto; }
    .navbar-main .navbar-nav .nav-link { padding-inline: 12px; }
}
@media (max-width: 767.98px) {
    .footer-links-layout { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px; }
    .footer-links-layout > div:first-child { grid-column: 1 / -1; }
}

/* Compact user sidebar and subdued scrollbars. */
html[dir="rtl"] .app-sidebar { margin-top: 12px; margin-bottom: 12px; }
html[dir="rtl"] .app-sidebar > .overflow-auto { min-height: 0; }
html[dir="rtl"] .app-sidebar > .app-sidebar-links:last-child { flex-shrink: 0; }
html[dir="rtl"] .app-sidebar :is(.overflow-auto,.app-sidebar-links-wrapper) {
    scrollbar-width: thin;
    scrollbar-color: #52788b transparent !important;
}
html[dir="rtl"] .app-sidebar *::-webkit-scrollbar { width: 5px; height: 5px; }
html[dir="rtl"] .app-sidebar *::-webkit-scrollbar-track { background: transparent; }
html[dir="rtl"] .app-sidebar *::-webkit-scrollbar-thumb { background: #52788b; border-radius: 8px; }
html[dir="rtl"] .app-sidebar *::-webkit-scrollbar-thumb:hover { background: #79a0b2; }
@media (min-width: 992px) {
    html[dir="rtl"] .app-sidebar { margin-right: 12px; }
}
html[dir="rtl"] body.app-sidebar-opened .app-sidebar { margin-right: 12px; }


/* Account dropdown uses independent rows and theme-aware surfaces. */
html[dir="rtl"] .app-sidebar .dropdown-menu {
    padding: 6px;
    border: 1px solid #dce4eb;
    border-radius: 12px;
    background: #fff;
    color: #334155;
    box-shadow: 0 12px 32px rgba(15, 30, 50, .16);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    scrollbar-width: thin;
}
html[dir="rtl"] .app-sidebar .dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 8px 12px;
    margin: 2px 0;
    line-height: 22px;
    border-radius: 7px;
    color: #334155;
    background: transparent;
}
html[dir="rtl"] .app-sidebar .dropdown-menu .dropdown-item > :is(i,.svg-inline--fa) { margin: 0 !important; flex-shrink: 0; width: 18px; }
html[dir="rtl"] .app-sidebar .dropdown-menu .dropdown-item:hover,
html[dir="rtl"] .app-sidebar .dropdown-menu .dropdown-item:focus { background: #edf4f7; color: #164b60; }
html[dir="rtl"] .app-sidebar .dropdown-menu .dropdown-item.active { background: #dcefeb; color: #135e52; }
html[dir="rtl"] .app-sidebar .dropdown-menu .dropdown-divider { margin: 6px 4px; border-color: #e3e9ef; }
html[dir="rtl"] [data-theme-style="dark"] .app-sidebar .dropdown-menu { background: #1c2b3c; color: #e5edf5; border-color: #34465a; }
html[dir="rtl"] [data-theme-style="dark"] .app-sidebar .dropdown-menu .dropdown-item { color: #e5edf5; }
html[dir="rtl"] [data-theme-style="dark"] .app-sidebar .dropdown-menu .dropdown-item:hover,
html[dir="rtl"] [data-theme-style="dark"] .app-sidebar .dropdown-menu .dropdown-item:focus { background: #2b4055; color: #fff; }
html[dir="rtl"] [data-theme-style="dark"] .app-sidebar .dropdown-menu .dropdown-item.active { background: #214d4c; color: #baf2df; }
html[dir="rtl"] [data-theme-style="dark"] .app-sidebar .dropdown-menu .dropdown-divider { border-color: #34465a; }

html[dir="rtl"] .rtl-detail-arrow { transform: scaleX(-1); }
@media (max-width: 991.98px) {
    .monitor-summary { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-inline: 0; }
    .monitor-summary > div { width: 100%; max-width: none; padding: 0 !important; }
    .monitor-summary > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
    .monitor-summary .card-body { padding: 12px !important; align-items: center; }
    .monitor-summary .card-body > div { min-width: 0; }
    .monitor-summary .card-body > div:first-child .card { margin-inline-end: 10px !important; }
    .monitor-summary .card-body > div:first-child .p-3 { padding: 10px !important; }
    .monitor-summary .font-size-small { font-size: .75rem; }
}
@media (max-width: 479.98px) { .monitor-summary .card-body { flex-direction: column; align-items: flex-start; gap: 10px; } .monitor-summary .card-title { font-size: .85rem; line-height: 1.7; } }

html[dir="rtl"] #bulk_group { direction: rtl; }
html[dir="rtl"] #bulk_group > .btn-group { margin-left: 0; margin-right: 0; }
html[dir="rtl"] #bulk_group #bulk_actions { border-radius: 0 8px 8px 0 !important; display: inline-flex; align-items: center; gap: 8px; }
html[dir="rtl"] #bulk_group #bulk_actions::after { margin: 0; }
html[dir="rtl"] #bulk_group #bulk_disable { border-radius: 8px 0 0 8px !important; margin-right: -1px; margin-left: 0; }
