/**
 * Additive RTL for design-system classes
 * Existing public/css/rtl.css remains the base RTL layer
 */

html[dir="rtl"] body:not(.lockscreen) aside.side-bar {
    border-inline-end: 1px solid var(--border);
    border-left: none;
}

html[dir="rtl"] .ds-header-inner {
    flex-direction: row;
}

html[dir="rtl"] .ds-page-header {
    text-align: right;
}

html[dir="rtl"] .ds-stat-card {
    text-align: right;
}

html[dir="rtl"] .ds-filter-bar {
    flex-direction: row;
}

html[dir="rtl"] body:not(.lockscreen) .input-group .input-group-addon:first-child,
html[dir="rtl"] body:not(.lockscreen) .input-group-addon:first-child {
    border-radius: 0 var(--radius-input) var(--radius-input) 0;
    border-right: 1px solid var(--border);
    border-left: 0;
}

html[dir="rtl"] body:not(.lockscreen) .input-group .input-group-addon:last-child,
html[dir="rtl"] body:not(.lockscreen) .input-group-addon:last-child {
    border-radius: var(--radius-input) 0 0 var(--radius-input);
    border-left: 1px solid var(--border);
    border-right: 0;
}

html[dir="rtl"] body:not(.lockscreen) .input-group .form-control:first-child {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: var(--radius-input);
    border-bottom-right-radius: var(--radius-input);
}

html[dir="rtl"] body:not(.lockscreen) .input-group .form-control:last-child,
html[dir="rtl"] body:not(.lockscreen) .input-group .form-control:not(:first-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: var(--radius-input);
    border-bottom-left-radius: var(--radius-input);
}

html[dir="rtl"] body:not(.lockscreen) .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-left: 2.1rem;
    padding-right: 0.95rem;
    text-align: right;
}

html[dir="rtl"] body:not(.lockscreen) .select2-container--default .select2-selection--single .select2-selection__arrow {
    left: 8px;
    right: auto;
}

html[dir="rtl"] body:not(.lockscreen) .modal-footer {
    justify-content: flex-start;
    flex-direction: row-reverse;
}

html[dir="rtl"] body:not(.lockscreen) .modal-footer .btn + .btn,
html[dir="rtl"] body:not(.lockscreen) .modal-footer .tw-dw-btn + .tw-dw-btn {
    margin-left: 0;
    margin-right: 0.35rem;
}

html[dir="rtl"] body:not(.lockscreen) .icheckbox_square-blue,
html[dir="rtl"] body:not(.lockscreen) .iradio_square-blue {
    margin-right: 0;
    margin-left: 0.4rem;
}

html[dir="rtl"] body:not(.lockscreen) .box-footer {
    flex-direction: row-reverse;
}

html[dir="rtl"] .small-view-side-active {
    left: auto !important;
    right: 0 !important;
}

html[dir="rtl"] .ds-header details ul[role="menu"] {
    left: auto;
    right: 0;
}

/* POS header input groups in RTL */
html[dir="rtl"] body.lockscreen #add_pos_sell_form .box-body.pb-0 > .row:not(:has(.pos_product_div)) .input-group-addon,
html[dir="rtl"] body.lockscreen #edit_pos_sell_form .box-body.pb-0 > .row:not(:has(.pos_product_div)) .input-group-addon,
html[dir="rtl"] body.lockscreen .pos-header .input-group-addon {
    border-radius: 0 var(--radius-input, 12px) var(--radius-input, 12px) 0;
}

html[dir="rtl"] body.lockscreen #add_pos_sell_form .box-body.pb-0 > .row:not(:has(.pos_product_div)) .input-group .form-control,
html[dir="rtl"] body.lockscreen #edit_pos_sell_form .box-body.pb-0 > .row:not(:has(.pos_product_div)) .input-group .form-control {
    border-top-left-radius: var(--radius-input, 12px) !important;
    border-bottom-left-radius: var(--radius-input, 12px) !important;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}
