/**
 * LTR layout overrides for #zertiAdmin.
 * Default zerti-admin.css assumes RTL; this file mirrors the shell when text_direction = ltr.
 */

body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] {
    direction: ltr;
    text-align: left;
}

/* Nested dir="rtl" from PHP templates should follow LTR shell (price RTL re-applied below). */
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] [dir='rtl'] {
    direction: ltr;
    text-align: left;
}

body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-scrollbar-thin {
    direction: ltr;
}

body.toplevel_page_zerti-admin .zerti-jalali-datepicker[data-zerti-admin-dir='ltr'],
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] ~ .zerti-jalali-datepicker {
    direction: ltr;
}

/* Fixed chrome: mobile menu on the opposite side from RTL default. */
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-global-search {
    left: auto;
    right: 10px;
}

@media (max-width: 991.98px) {
    body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-global-search--expanded {
        left: calc(10px + var(--zerti-control-pill-h));
        right: 10px;
        width: auto;
    }
}

body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-mobile-menu-trigger {
    right: auto;
    left: 10px;
}

@media (min-width: 992px) {
    body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-body > .zerti-sidebar {
        right: auto;
        left: 0;
    }

    body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-body > .zerti-main-content {
        padding-right: 1rem;
        padding-left: calc(260px + 1rem);
    }
}

body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-sidebar {
    border-left: 0;
    border-right: 1px solid var(--zerti-docs-border);
}

body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-main-content .zerti-panel {
    direction: ltr;
    text-align: left;
}

body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] input[type='checkbox']:not(.zerti-settings-toggle-input):checked::before {
    float: left;
}

@media (min-width: 992px) {
    body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-settings-layout__body {
        flex-direction: row;
    }
}

@media (min-width: 992px) {
    body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-inv-ie-layout__body {
        flex-direction: row;
    }
}

@media (min-width: 992px) {
    /* RTL default: editor order 1 (physical right), tree order 2 (physical left). */
    body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-inv-categories__tree-panel {
        order: 1;
    }

    body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-inv-categories__editor,
    body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-inv-categories__editor.zerti-inv-categories__editor--collapsed,
    body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-inv-categories__editor:not(.zerti-inv-categories__editor--collapsed) {
        order: 2;
    }
}

/* Product editor: main column left, publish sidebar right (desktop only). */
@media (min-width: 1200px) {
    body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-wc-product-editor__form > .row {
        direction: ltr;
        grid-template-columns: 1fr var(--zerti-wc-editor-sidebar-w);
    }
}

body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-inv-categories__tree-scroll,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-inv-categories__tree-scroll-inner,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-inv-categories__editor-scroll,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-inv-ie__scroll,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-settings-scroll,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-component-settings,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-shop-order-notes__content,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-admin-select,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] select.form-select:not(.zerti-ltr-field),
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-shop-grid-filter-select,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-payments-grid-filter-select,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-coupons-grid-filter-select,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-rich-editor__quill,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .ql-editor {
    direction: ltr;
    text-align: left;
    text-align-last: left;
}

/* Chevron on the right; label/options on the left (LTR). */
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-admin-select,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-settings-form .zerti-settings-timezone-select,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] select.form-select:not(.zerti-ltr-field),
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-inventory-product-edit__form .form-select,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-inv-categories__form select.form-select,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-component-inventory-import-export select.zerti-admin-select {
    padding-inline-start: 0.5rem;
    padding-inline-end: 1.85rem;
    background-position: right 0.55rem center;
}

body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-inv-categories__form select.form-select,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-inv-categories__form .zerti-admin-select {
    padding-inline-end: 1.75rem;
    background-position: right 0.4rem center;
}

body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-inventory-product-edit__form .form-select {
    background-position: right 0.45rem center;
}

body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-shop-grid-filter-select,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-payments-grid-filter-select,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-coupons-grid-filter-select {
    padding-inline-start: 0.75rem;
    padding-inline-end: 2rem;
    background-position: right 0.55rem center;
    text-align: center;
    text-align-last: center;
}

body.toplevel_page_zerti-admin .zerti-inv-reviews__edit-modal[dir='ltr'] select.form-select,
body.toplevel_page_zerti-admin .zerti-inv-reviews__edit-modal[dir='ltr'] select.zerti-admin-select,
body.toplevel_page_zerti-admin:has(#zertiAdmin[dir='ltr']) .zerti-inv-reviews__edit-modal select.form-select,
body.toplevel_page_zerti-admin:has(#zertiAdmin[dir='ltr']) .zerti-inv-reviews__edit-modal select.zerti-admin-select {
    padding-inline-start: 0.5rem;
    padding-inline-end: 1.85rem;
    background-position: right 0.55rem center;
    direction: ltr;
    text-align: left;
    text-align-last: left;
}

body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .select2-container,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .select2-container.zerti-admin-select2 {
    direction: ltr;
    text-align: left;
}

body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-confirm-alert-dialog,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-confirm-alert-message {
    direction: ltr;
    text-align: left;
}

/* AG Grid / numeric cells stay LTR in both modes; ensure alignment follows shell. */
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-wc-price-rtl {
    direction: rtl;
}

body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-wc-price-ltr {
    direction: ltr;
}

/* Lists, trees, and Bootstrap list groups follow shell direction. */
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .list-group,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-inv-categories__terms-list,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-inv-categories__tree,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-inv-categories__tree-scroll-inner,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-inv-categories__tree-level,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-inv-categories__tree-row,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-inv-categories__tree-name,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-shop-order-notes__list,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-nav-submenu-inner {
    direction: ltr;
    text-align: left;
}

body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-nav-submenu-inner {
    padding-inline-start: 0.25rem;
    padding-inline-end: 0;
}

/* AG Grid tables and pagination in LTR mode. */
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .ag-root,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .ag-header,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .ag-body-viewport,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .ag-center-cols-viewport,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .ag-center-cols-container,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .ag-paging-panel,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .ag-paging-page-summary-panel,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .ag-paging-row-summary-panel,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .ag-paging-description {
    direction: ltr;
}

body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .ag-paging-row-summary-panel {
    right: auto;
    left: clamp(0.65rem, 1.5vw, 1rem);
    text-align: left;
    unicode-bidi: normal;
}

/* Home dashboard stat counts stay readable in LTR shell. */
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-home-stat-label,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-home-stat-value,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-home-stat-price {
    direction: ltr;
    text-align: center;
}

/* Prefer lining numerals for Western digit mode; keep Vazirmatn as the UI face. */
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'][data-zerti-digit-script='western'] .zerti-home-stat-value,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'][data-zerti-digit-script='western'] .zerti-home-stat-price,
body.toplevel_page_zerti-admin #zertiAdmin[lang^='en'][data-zerti-digit-script='western'] .zerti-home-stat-value,
body.toplevel_page_zerti-admin #zertiAdmin[lang^='en'][data-zerti-digit-script='western'] .zerti-home-stat-price {
    font-family: var(--zerti-font-family);
    font-variant-numeric: lining-nums;
    font-feature-settings: 'lnum' 1;
}

body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-inventory-product-edit__cat-tree,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-product-cat-tree,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-product-cat-tree__level,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-product-cat-tree__row,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-product-cat-tree__check {
    direction: ltr;
    text-align: left;
}

body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-sidebar,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-nav-tab,
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-nav-submenu-item {
    direction: ltr;
    text-align: left;
}

/* Notes panel: opposite the LTR nav sidebar (nav is on the left → panel on the right). */
body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-notes-panel {
    left: auto;
    right: 0;
    border-inline-end: none;
    border-inline-start: 1px solid var(--zerti-docs-border);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--zerti-docs-border) 60%, transparent),
        -12px 0 28px rgba(15, 23, 42, 0.12);
    transform: translateX(105%);
}

body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'].zerti-notes-open .zerti-notes-panel {
    transform: translateX(0);
}

@media (max-width: 991.98px) {
    body.toplevel_page_zerti-admin #zertiAdmin[dir='ltr'] .zerti-notes-panel {
        left: 0;
        right: 0;
        width: 100%;
        max-width: none;
        border-inline-start: none;
        box-shadow: none;
    }
}
