/* ==============================================================
   style.custom.rtl.css — Direction-only RTL overrides
   Loads conditionally in RTL mode, after style.custom.css.
   Visual styling is in style.custom.css; this file handles
   only direction flips, layout mirroring, and RTL alignment.
   ============================================================== */

/* -- 1. Core RTL Direction & Layout -- */

body {
    overflow-y: visible;
    direction: rtl;
    /* font-family handled by C13 token system in style.custom.css */
}

@media (max-width: 1200px) {
    body {
        overflow: scroll !important;
    }
}

@media (min-width: 992px) {
    .aside-enabled.aside-fixed .wrapper {
        transition: padding-left 0.3s ease;
        padding-right: 60px !important;
        padding-left: 0px !important;
    }
}

@media (min-width: 992px) {
    .aside-enabled.aside-fixed.header-fixed .header {
        transition: right 0.3s ease;
    }
}

@media only screen and (min-width: 1400px) {
    .container-xxl {
        width: 100%;
        padding-right: 10px !important;
        padding-left: 15px !important;
    }
}

@media (min-width: 992px) {
    .container-xxl {
        max-width: 100%;
        padding-left: 10px !important;
        padding-right: 15px !important;
    }
}

@media (min-width: 992px) {
    div#kt_content_container {
        padding: 30px 30px 30px 30px;
    }
}

@media (min-width: 992px) {
    #kt_header.more-page {
        left: 0px;
        padding-right: 30px;
    }
}

.footer {
    padding-right: 30px;
}

.aside-fixed .aside {
    left: auto;
    right: 0;
}

.drawer.drawer-end {
    left: 0 !important;
    right: inherit;
    transform: translateX(-700%);
}

.drawer.drawer-on {
    transform: none;
}

@media (min-width: 992px) and (max-width: 1280px) {
    .hover-scroll-y:hover {
        border-left: 0px;
        margin-right: 0rem;
    }
    .hover-scroll-y {
        border-right: 0;
    }
}

@media (min-width: 992px) {
    .hover-scroll-y {
        border-left: 0;
        margin-right: 0rem;
    }
    .hover-scroll-y:hover {
        overflow-y: overlay;
    }
}

/* -- 2. Header RTL -- */

html[dir="rtl"] #kt_header .anx-header-actions-group > .d-flex.ms-1.ms-lg-3 {
    margin-right: 0 !important;
    margin-left: 0 !important;
}

html[dir="rtl"] #kt_header > .container-fluid {
    padding-left: 15px !important;
    padding-right: 15px !important;
}

/* -- 3. Sidebar & Menu RTL -- */

.aside-menu .menu-item .menu-icon {
    justify-content: center;
}

.menu-sub.menu-sub-dropdown.w-225px.w-lg-250px.px-1.py-4.show {
    transform: translate(-60px, 0px) !important;
}

.menu-item .menu-link .menu-icon {
    margin-right: 0 !important;
}

html[dir="rtl"] .menu-link .menu-icon {
    margin-left: 0.5rem;
    margin-right: 0;
}

html[dir="rtl"] .menu-link .menu-icon.me-0 {
    margin-left: 0;
}

html[dir="rtl"] .aside-menu .menu-link {
    padding-right: 25px;
    padding-left: 25px;
}

html[dir="rtl"] .menu-sub:not([data-popper-placement]) .menu-link {
    padding-right: calc(0.75rem + 25px);
    padding-left: 25px;
}

html[dir="rtl"] .setting-link {
    text-align: right;
}

html[dir="rtl"] .setting-link .anx-icon {
    margin-left: 0.4rem;
    margin-right: 0;
}

html[dir="rtl"] .setting-title {
    text-align: right;
}

html[dir="rtl"] .drawer.drawer-end .card-header .card-title {
    text-align: right;
}

html[dir="rtl"] .drawer.drawer-end .card-footer .d-flex.justify-content-end {
    justify-content: flex-start !important;
}

/* -- 4. Buttons & Icons RTL -- */

html[dir="rtl"] .btn > i + span,
html[dir="rtl"] .btn > svg + span {
    margin-right: 0.35rem;
    margin-left: 0;
}

html[dir="rtl"] .badge > i:first-child {
    margin-left: 0.25rem;
    margin-right: 0;
}

a.btn.btn-light.btn-active-light-primary.btn-sm {
    margin-left: 10px;
}

/* -- 5. Forms & Inputs RTL -- */

input.form-control.form-control-solid {
    text-align: right;
}

.form-control-sm {
    text-align: right !important;
}

.form-check {
    padding-left: 0;
}
.form-check .form-check-input {
    float: right;
    margin-right: -2.25rem;
    margin-left: 0;
}
.form-check-inline {
    margin-left: 1rem;
    margin-right: 0;
}

.form-switch {
    padding-left: 0;
}
.form-switch .form-check-input {
    margin-right: -3.75rem;
    margin-left: 0;
    float: right;
}

.form-select {
    padding: .75rem 1rem .75rem 3rem;
    background-position: left 1rem center;
}

.input-group > :not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
    margin-right: -1px;
    margin-left: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.input-group:not(.has-validation) > :not(:last-child):not(.dropdown-toggle):not(.dropdown-menu) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

html[dir="rtl"] .input-group > .input-group-text:first-child {
    border-top-right-radius: .475rem;
    border-bottom-right-radius: .475rem;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

html[dir="rtl"] .input-group > .input-group-text:last-child {
    border-top-left-radius: .475rem;
    border-bottom-left-radius: .475rem;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.form-floating > label {
    right: 0;
    left: auto;
}

html[dir="rtl"] .form-label {
    text-align: right;
}

/* -- 6. Select2 RTL -- */

.select2-results__option {
    text-align: right !important;
}

span.select2-selection.select2-selection--single.form-control.form-control-sm.item.item-t-b {
    justify-content: right;
}

.select2-container--bootstrap5 .select2-dropdown .select2-results__option.select2-results__option--selected {
    background-position: center left 1.25rem;
}

.select2-container--bootstrap5 .select2-selection__clear {
    left: 3rem;
}

span.select2-selection.select2-selection--multiple.form-select.custom-select2.form-select-md.select2-selection--clearable {
    text-align: right;
}

.select2-search__field {
    text-align: right;
}

html[dir="rtl"] .select2-container--bootstrap5 .select2-selection--single {
    direction: rtl;
    text-align: right;
    justify-content: flex-start;
    padding-left: 13px;
}

html[dir="rtl"] .select2-container--bootstrap5 .select2-selection--single .select2-selection__rendered {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .select2-container--bootstrap5 .select2-selection--single .select2-selection__arrow {
    left: 13px;
    right: auto;
}

html[dir="rtl"] .select2-container--bootstrap5 .select2-dropdown {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .select2-container--bootstrap5 .select2-search--dropdown .select2-search__field {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .select2-container--bootstrap5 .select2-selection--single .select2-selection__clear {
    left: 2.5rem;
    right: auto;
}

html[dir="rtl"] .select2-container--bootstrap5 .select2-selection--multiple .select2-selection__choice {
    padding-right: 1.75rem;
    padding-left: 0.75rem;
    position: relative;
}

html[dir="rtl"] .select2-container--bootstrap5 .select2-selection--multiple .select2-selection__choice__remove {
    right: 0.5rem;
    left: auto;
    margin: 0;
}

html[dir="rtl"] .select2-container--bootstrap5 .select2-selection--multiple .select2-selection__choice__display {
    display: inline-block;
}

html[dir="rtl"] .select2-container--bootstrap5 .select2-selection--multiple .select2-selection__choice .select2-selection__choice__display {
    margin-left: 0;
    margin-right: 1.2rem;
}

html[dir="rtl"] .select2-container--bootstrap5 .select2-search--dropdown .select2-search__field,
html[dir="rtl"] .select2-container--bootstrap5 .select2-search--inline .select2-search__field,
html[dir="rtl"] textarea.select2-search__field {
    font-family: var(--anx-font-family);
}

/* -- 7. Tables & DataTables RTL -- */

table.dataTable > thead .sorting_desc:after,
table.dataTable > thead .sorting_asc:after {
    margin-right: 10px !important;
}

.table td:first-child,
.table th:first-child,
.table tr:first-child {
    padding-right: 10px !important;
}

.table tbody tr:last-child td,
.table tbody tr:last-child th,
.table tfoot tr:last-child td,
.table tfoot tr:last-child th {
    border-left: 0 !important;
}

.item-t-b {
    justify-content: right;
}

th.text-end.sorting_disabled {
    text-align: right !important;
}

td.text-end {
    text-align: right !important;
    padding-right: 10px !important;
}

.table > :not(:last-child) > :last-child > * {
    padding-right: 10px;
}

.table tr:last-child,
.table th:last-child,
.table td:last-child {
    padding-right: 10px;
}

div.dataTables_length + div.dataTables_info {
    margin-right: 1rem;
}

th.add-f {
    padding-right: 10px !important;
}

table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after,
table.dataTable thead .sorting_asc_disabled:after,
table.dataTable thead .sorting_desc_disabled:after {
    left: 0.5em !important;
    right: auto !important;
}

table.dataTable thead .sorting:before,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_desc:before,
table.dataTable thead .sorting_asc_disabled:before,
table.dataTable thead .sorting_desc_disabled:before {
    left: 0.5em !important;
    right: auto !important;
}

table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
    display: none;
}

table.dataTable.dtr-column > tbody > tr.parent td.dtr-control:before,
table.dataTable.dtr-column > tbody > tr.parent th.dtr-control:before,
table.dataTable.dtr-column > tbody > tr.parent td.control:before,
table.dataTable.dtr-column > tbody > tr.parent th.control:before {
    display: none;
}

html[dir="rtl"] div.dataTables_wrapper div.dataTables_info {
    text-align: right;
}

html[dir="rtl"] div.dataTables_wrapper div.dataTables_length label {
    text-align: right;
}

html[dir="rtl"] [data-kt-docs-table-toolbar="base"] {
    gap: 0.35rem;
    flex-direction: row-reverse;
}

/* -- 8. Page-Scoped RTL Fixes -- */

#kt_accordion_2.mb-5.mb-accordion:before {
    position: absolute;
    content: "";
    background-color: var(--theme-color);
    right: 0;
    top: 0;
    height: 72%;
    width: 4px;
    opacity: 1;
    transition: opacity 0.2s ease 0s;
}

.accordion-button::after {
    margin-left: 0;
}

.stepper.stepper-pills .stepper-item .stepper-icon {
    margin-right: 0 !important;
    margin-left: 1.5rem !important;
}

.stepper.stepper-pills.stepper-column .stepper-line {
    display: block;
    content: " ";
    justify-content: center;
    position: absolute;
    z-index: 0;
    right: 0px;
    top: 0px;
    bottom: 0px;
    width: 40px;
    transform: translate(50%);
    border-left-width: 1px;
    border-left-style: dashed;
    border-left-color: rgb(228, 230, 239);
}

.timeline .timeline-icon {
    margin-right: 0 !important;
}

.timeline .timeline-line {
    right: 0 !important;
}

.tafqet {
    text-align: left;
}

.realtive-custom-search-center {
    transform: translate(-50%);
}

html[dir="rtl"] .card-header {
    padding-right: 1.5rem;
    padding-left: 1.5rem;
}

html[dir="rtl"] .modal-header .btn-close {
    margin-left: 0;
    margin-right: auto;
}

html[dir="rtl"] .alert-dismissible .btn-close {
    left: 0;
    right: auto;
}

html[dir="rtl"] h1.anx-page-title {
    flex-direction: row-reverse;
}

html[dir="rtl"] .show-toolbar .actions {
    flex-direction: row-reverse;
}

html[dir="rtl"] body:not(.pos-layout) #view-area .view-content .tab-content .show-toolbar > .actions {
    flex-direction: row;
    justify-content: flex-start;
}

html[dir="rtl"] body:not(.pos-layout) #view-area.view-collapse.show .tab-pane#details > .row.d-flex.justify-content-between.flex-wrap {
    padding-inline: 1rem;
}

/* -- 9. Safe Utility Overrides -- */

/* 9a. Margin-start flips */
.ms-0 { margin-right: 0 !important; margin-left: 0 !important; }
.ms-1 { margin-right: .25rem !important; margin-left: 0 !important; }
.ms-2 { margin-right: .5rem !important; margin-left: 0 !important; }
.ms-3 { margin-right: .75rem !important; margin-left: 0 !important; }
.ms-4 { margin-right: 1rem !important; margin-left: 0 !important; }
.ms-5 { margin-right: 1.25rem !important; margin-left: 0 !important; }
.ms-6 { margin-right: 1.5rem !important; margin-left: 0 !important; }
.ms-7 { margin-right: 1.75rem !important; margin-left: 0 !important; }
.ms-10 { margin-right: 2.5rem !important; margin-left: 0 !important; }
.ms-auto { margin-right: auto !important; margin-left: 0 !important; }
.ms-n1 { margin-right: -.25rem !important; margin-left: 0 !important; }
.ms-n2 { margin-right: -.5rem !important; margin-left: 0 !important; }
.ms-n5 { margin-right: -1.25rem !important; margin-left: 0 !important; }

/* 9b. Margin-end flips */
.me-0 { margin-left: 0 !important; }
.me-1 { margin-left: .25rem !important; }
.me-2 { margin-left: .5rem !important; }
.me-3 { margin-left: .75rem !important; }
.me-4 { margin-left: 1rem !important; }
.me-5 { margin-left: 1.25rem !important; }
.me-6 { margin-left: 1.5rem !important; }
.me-7 { margin-left: 1.75rem !important; }
.me-9 { margin-left: 2.25rem !important; }
.me-10 { margin-left: 2.5rem !important; }
.me-auto { margin-left: auto !important; margin-right: 0 !important; }
.me-n2 { margin-left: -.5rem !important; }
.me-n3 { margin-left: -.75rem !important; }
.me-n5 { margin-left: -1.25rem !important; }

/* 9c. Padding-start flips */
.ps-0 { padding-right: 0 !important; padding-left: 0 !important; }
.ps-1 { padding-right: .25rem !important; padding-left: 0 !important; }
.ps-2 { padding-right: .5rem !important; padding-left: 0 !important; }
.ps-3 { padding-right: .75rem !important; padding-left: 0 !important; }
.ps-4 { padding-right: 1rem !important; padding-left: 0 !important; }
.ps-5 { padding-right: 1.25rem !important; padding-left: 0 !important; }
.ps-10 { padding-right: 2.5rem !important; padding-left: 0 !important; }
.ps-15 { padding-right: 3.75rem !important; padding-left: 0 !important; }

/* 9d. Padding-end flips */
.pe-0 { padding-left: 0 !important; }
.pe-1 { padding-left: .25rem !important; }
.pe-2 { padding-left: .5rem !important; }
.pe-3 { padding-left: .75rem !important; }
.pe-4 { padding-left: 1rem !important; }
.pe-5 { padding-left: 1.25rem !important; }
.pe-7 { padding-left: 1.75rem !important; }
.pe-10 { padding-left: 2.5rem !important; }
.pe-15 { padding-left: 3.75rem !important; }

/* 9e. Text alignment */
.text-start { text-align: right !important; }
.text-end { text-align: left !important; }

/* 9f. Float */
.float-start { float: right !important; }
.float-end { float: left !important; }

/* 9g. Position start/end */
.start-0 { right: 0 !important; left: auto !important; }
.start-50 { right: 50% !important; left: auto !important; }
.start-100 { right: 100% !important; left: auto !important; }
.end-0 { left: 0 !important; right: auto !important; }
.end-50 { left: 50% !important; right: auto !important; }
.end-100 { left: 100% !important; right: auto !important; }

/* 9h. Transform */
.translate-middle { transform: translate(50%, -50%) !important; }
.translate-middle-x { transform: translateX(50%) !important; }

/* 9i. Border directional */
.border-start { border-right: var(--bs-border-width, 1px) var(--bs-border-style, solid) var(--bs-border-color, #dee2e6) !important; border-left: 0 !important; }
.border-end { border-left: var(--bs-border-width, 1px) var(--bs-border-style, solid) var(--bs-border-color, #dee2e6) !important; border-right: 0 !important; }
.border-start-0 { border-right: 0 !important; }
.border-end-0 { border-left: 0 !important; }

/* 9j. Border-radius directional */
.rounded-start {
    border-top-right-radius: .475rem !important;
    border-bottom-right-radius: .475rem !important;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}
.rounded-end {
    border-top-left-radius: .475rem !important;
    border-bottom-left-radius: .475rem !important;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}
.rounded-start-0 { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }
.rounded-end-0 { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; }

/* 9k. Responsive spacing variants */
@media (min-width: 576px) {
    .ms-sm-auto { margin-right: auto !important; margin-left: 0 !important; }
    .text-sm-end { text-align: left !important; }
}
@media (min-width: 768px) {
    .ms-md-auto { margin-right: auto !important; margin-left: 0 !important; }
    .me-md-3 { margin-left: .75rem !important; }
    .text-md-end { text-align: left !important; }
}
@media (min-width: 992px) {
    .ms-lg-3 { margin-right: .75rem !important; margin-left: 0 !important; }
    .ps-lg-2 { padding-right: .5rem !important; padding-left: 0 !important; }
    .text-lg-start { text-align: right !important; }
    .text-lg-end { text-align: left !important; }
}
@media (min-width: 1200px) {
    .text-xl-start { text-align: right !important; }
    .text-xl-end { text-align: left !important; }
}

/* 9l. Breadcrumb */
.breadcrumb-item + .breadcrumb-item {
    padding-right: .5rem;
    padding-left: 0;
}
.breadcrumb-item + .breadcrumb-item::before {
    float: right;
    padding-left: .5rem;
    padding-right: 0;
}

/* 9m. Pagination */
.pagination {
    padding-right: 0;
}
.page-item:first-child .page-link {
    border-top-right-radius: .475rem;
    border-bottom-right-radius: .475rem;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}
.page-item:last-child .page-link {
    border-top-left-radius: .475rem;
    border-bottom-left-radius: .475rem;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* 9n. Close button */
.btn-close {
    left: 0;
    right: auto;
}

/* 9o. List group */
.list-group {
    padding-right: 0;
}

/* 9p. Dropdown menu */
.dropdown-menu-end {
    --bs-position: end;
    right: auto;
    left: 0;
}

/* 9q. Nav tabs */
.nav.nav-tabs {
    padding-inline-start: 0;
}

.nav-tabs .nav-link {
    border-top-right-radius: .475rem;
    border-top-left-radius: .475rem;
}

/* 9r. Tooltip/popover */
.bs-tooltip-end .tooltip-arrow,
.bs-tooltip-auto[data-popper-placement^=right] .tooltip-arrow {
    right: auto;
    left: -4px;
}
.bs-tooltip-start .tooltip-arrow,
.bs-tooltip-auto[data-popper-placement^=left] .tooltip-arrow {
    left: auto;
    right: -4px;
}

/* ============================================================
 * 10. RESPONSIVE RTL OVERRIDES
 * ============================================================ */

/* ── Header RTL ── */
.aside-enabled.aside-fixed .anx-header {
    left: 0;
    right: 60px;
    transition: right 0.3s ease;
}
.aside-enabled.aside-fixed[data-kt-aside-minimize=on] .anx-header {
    right: 60px;
}
@media (max-width: 991.98px) {
    .anx-header {
        left: 0 !important;
        right: 0 !important;
    }
    .aside-enabled.aside-fixed .anx-header {
        right: 0 !important;
    }
    /* Drawer covers full screen in RTL too */
    .anx-header__search {
        left: 0 !important;
        right: 0 !important;
    }
    /* Flip back arrow for RTL */
    .anx-header__search-back svg {
        transform: scaleX(-1);
    }
}

@media (max-width: 991.98px) {
    /* Sidebar: slide from right in RTL */
    .aside {
        transform: translateX(100%);
        right: 0;
        left: auto;
    }
    .aside.drawer-on {
        transform: translateX(0) !important;
    }

    /* Parent menu item: flip icon margin for RTL */
    .aside .menu > .menu-item > .menu-link > .menu-icon {
        margin-right: 0;
        margin-left: 12px;
    }
    .aside .menu-icon.menu-icon-pos {
        margin-right: 0;
        margin-left: 10px;
    }

    /* Submenu: slide from right in RTL */
    .aside .menu-sub.menu-sub-dropdown {
        left: auto !important;
        right: 0 !important;
        transform: translateX(100%) !important;
    }
    .aside .menu-item.anx-sub-open > .menu-sub.menu-sub-dropdown {
        transform: translateX(0) !important;
        box-shadow: -4px 0 12px rgba(0,0,0,0.08) !important;
    }

    /* Header: no left offset */
    #kt_header.more-page {
        right: 0 !important;
        left: 0 !important;
    }

    /* Wrapper: no right padding */
    .aside-enabled.aside-fixed .wrapper {
        padding-right: 0 !important;
        padding-left: 0 !important;
    }
}

@media (max-width: 767.98px) {
    /* Split view: slide from left in RTL */
    #view-area.flex-60 {
        transform: translateX(-100%);
    }
    #view-area.flex-60:not(.view-collapse) {
        transform: translateX(0);
    }
}

/* ==============================================================
   ASIDE PANEL — RTL overrides
   ============================================================== */
.anx-aside-panel {
    left: auto;
    right: 60px;
    border-right: none;
    border-left: 1px solid #edf2f7;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.06);
    transform: translateX(100%);
}
body.anx-panel-open .anx-aside-panel {
    transform: translateX(0);
}
@media (max-width: 991.98px) {
    .anx-aside-panel {
        right: 0;
        transform: translateX(100%);
    }
}
.anx-aside-panel__group.anx-collapsed .anx-aside-panel__section-arrow {
    transform: rotate(90deg);
}
.anx-fav-star {
    margin-left: 0;
    margin-right: auto;
}
.anx-fav-badge {
    right: auto;
    left: 4px;
}
