html[dir="rtl"] body {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] input,
html[dir="rtl"] textarea,
html[dir="rtl"] select {
    text-align: right;
}

html[dir="rtl"] .dropdown-menu {
    text-align: right;
}

html[dir="rtl"] #footer,
html[dir="rtl"] .footer,
html[dir="rtl"] .footer-body,
html[dir="rtl"] .footer-bottom {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .footer ul,
html[dir="rtl"] .footer-menu-list,
html[dir="rtl"] .mb-info,
html[dir="rtl"] .nav-ul-mb,
html[dir="rtl"] .tf-quicklink-list {
    padding-right: 0;
}

html[dir="rtl"] .footer-bottom-wrap {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .tf-social-icon,
html[dir="rtl"] .group-icon {
    direction: rtl;
    justify-content: flex-start;
}

html[dir="rtl"] .offcanvas.offcanvas-start.canvas-mb {
    left: auto;
    right: 0;
}

html[dir="rtl"] .offcanvas.offcanvas-end.canvas-search {
    right: auto;
    left: 0;
}

html[dir="rtl"] .nav-ul-mb,
html[dir="rtl"] .mb-other-content,
html[dir="rtl"] .canvas-search,
html[dir="rtl"] .tf-search-content,
html[dir="rtl"] .tf-search-head,
html[dir="rtl"] .tf-mini-cart-wrap,
html[dir="rtl"] .tf-mini-cart-main,
html[dir="rtl"] .tf-mini-cart-bottom,
html[dir="rtl"] .modal-shopping-cart {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .tf-mini-cart-item {
    direction: rtl;
}

html[dir="rtl"] .tf-mini-cart-remove,
html[dir="rtl"] .toolbar-label,
html[dir="rtl"] .footer-menu_item {
    text-align: right;
}

html[dir="rtl"] .auth-modal-content,
html[dir="rtl"] .auth-modal-forms,
html[dir="rtl"] .auth-form,
html[dir="rtl"] .auth-panel-header,
html[dir="rtl"] .auth-field,
html[dir="rtl"] .auth-row,
html[dir="rtl"] .auth-toast-content,
html[dir="rtl"] .quickview-modal-content,
html[dir="rtl"] .quickview-info,
html[dir="rtl"] .tf-product-info-list {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .auth-close-btn,
html[dir="rtl"] .icon-close-popup {
    right: auto;
    left: 18px;
}

html[dir="rtl"] .auth-toast {
    right: auto;
    left: 30px;
}

html[dir="rtl"] .toolbar-count {
    right: auto;
    left: -8px;
}

html[dir="rtl"] .offcanvas.canvas-mb {
    right: 0 !important;
    left: auto !important;
    text-align: right;
}

html[dir="rtl"] .canvas-mb .icon-close {
    right: auto !important;
    left: 15px !important;
}

html[dir="rtl"] .nav-ul-mb {
    direction: rtl;
    text-align: right;
    padding-right: 0;
}

html[dir="rtl"] .nav-ul-mb .nav-mb-item a {
    text-align: right;
    display: block;
}

html[dir="rtl"] .group-icon .site-nav-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* ===== Header RTL clean fix ===== */

html[dir="rtl"] #header .header-rtl-row {
    direction: rtl;
}

html[dir="rtl"] #header .box-nav-ul,
html[dir="rtl"] #header .nav-icon-rtl {
    padding-right: 0;
    margin-bottom: 0;
    list-style: none;
}

html[dir="rtl"] #header .box-nav-ul {
    justify-content: center;
}

html[dir="rtl"] #header .nav-icon-rtl {
    direction: ltr;
    justify-content: flex-start;
}

html[dir="rtl"] #header .nav-account .nav-icon-item {
    direction: rtl;
}

html[dir="rtl"] #header .nav-icon-item {
    display: inline-flex;
    align-items: center;
}

html[dir="rtl"] #header .count-box {
    right: auto !important;
    left: -6px !important;
}

html[dir="rtl"] #header .dropdown-menu {
    left: auto !important;
    right: 0 !important;
    text-align: right;
}

html[dir="rtl"] #header .logo-header {
    display: inline-flex;
    align-items: center;
}

@media (max-width: 991.98px) {
    html[dir="rtl"] #header .nav-icon-rtl {
        gap: 12px !important;
    }

    html[dir="rtl"] #header .logo-header {
        justify-content: center;
    }
}


@media (max-width: 767.98px) {
    html[dir="rtl"] .footer-col-block .footer-heading.footer-heading-moblie {
        position: relative !important;
        display: block !important;
        text-align: right !important;
        padding-left: 24px !important;
        padding-right: 0 !important;
    }

    html[dir="rtl"] .footer-col-block .footer-heading.footer-heading-moblie h6 {
        text-align: right !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* انقل أي أيقونة/علامة يضيفها القالب إلى اليسار */
    html[dir="rtl"] .footer-col-block .footer-heading.footer-heading-moblie::before,
    html[dir="rtl"] .footer-col-block .footer-heading.footer-heading-moblie::after {
        position: absolute !important;
        left: 0 !important;
        right: auto !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        margin: 0 !important;
    }

    /* لو القالب واضع العلامة على h6 نفسه نلغيها من h6 */
    html[dir="rtl"] .footer-col-block .footer-heading.footer-heading-moblie h6::before,
    html[dir="rtl"] .footer-col-block .footer-heading.footer-heading-moblie h6::after {
        left: auto !important;
        right: auto !important;
        margin: 0 !important;
    }
}
/* ===== Quantity input center fix ===== */

.wg-quantity,
.quantity-box,
.quantity {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.wg-quantity input,
.wg-quantity .quantity-product,
.wg-quantity .qty,
.mini-cart-qty-input,
.cart-qty-input,
#quickViewQty {
    text-align: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin: 0 auto !important;
}

.wg-quantity .btn-quantity,
.quantity .btn-quantity {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.wg-quantity.small,
.wg-quantity {
    gap: 0 !important;
}

.wg-quantity input[type="number"],
.mini-cart-qty-input,
.cart-qty-input,
#quickViewQty {
    appearance: textfield;
    -moz-appearance: textfield;
}

.wg-quantity input[type="number"]::-webkit-outer-spin-button,
.wg-quantity input[type="number"]::-webkit-inner-spin-button,
.mini-cart-qty-input::-webkit-outer-spin-button,
.mini-cart-qty-input::-webkit-inner-spin-button,
.cart-qty-input::-webkit-outer-spin-button,
.cart-qty-input::-webkit-inner-spin-button,
#quickViewQty::-webkit-outer-spin-button,
#quickViewQty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ===== Cart mobile small balance fix only ===== */
/* ===== Cart mobile RTL balance fix only ===== */
@media (max-width: 991.98px) {
    html[dir="rtl"] .tf-page-cart-wrap,
    html[dir="rtl"] .tf-page-cart-item,
    html[dir="rtl"] .tf-page-cart-footer,
    html[dir="rtl"] .tf-cart-footer-inner,
    html[dir="rtl"] .tf-page-cart-checkout {
        width: 100% !important;
    }

    html[dir="rtl"] .flat-spacing-11 .container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    html[dir="rtl"] .tf-table-page-cart {
        width: 100% !important;
    }

    html[dir="rtl"] .tf-page-cart-footer {
        margin-top: 20px !important;
    }

    html[dir="rtl"] .tf-page-cart-checkout {
        width: 100% !important;
        max-width: 100% !important;
        padding: 20px !important;
        text-align: right !important;
    }

    html[dir="rtl"] .tf-cart-totals-discounts {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 12px !important;
    }

    html[dir="rtl"] .tf-cart-totals-discounts h3,
    html[dir="rtl"] .tf-cart-totals-discounts .total-value {
        margin: 0 !important;
    }

    html[dir="rtl"] .tf-cart-totals-discounts .total-value {
        direction: ltr !important;
        text-align: left !important;
    }

    html[dir="rtl"] .cart-checkout-btn {
        margin-top: 16px !important;
    }
}
