/* ==========================================================================
   Commerce Template — RTL (Right-to-Left) Overrides
   Loaded only when the current language is RTL (Arabic, Hebrew, Farsi…)
   ========================================================================== */

/* ---------- Global Direction ---------- */
body.ct-rtl {
    direction: rtl;
    text-align: right;
}

/* ---------- General Spacing Flips ---------- */
/* Utility: flip margin-left ↔ margin-right, padding-left ↔ padding-right
   where directional spacing was used explicitly */

/* ---------- Header ---------- */
body.ct-rtl .site-header .header-actions {
    flex-direction: row-reverse;
}

body.ct-rtl .promo-banner .promo-close {
    left: var(--space-4);
    right: auto;
}

/* Logo stays on the right in RTL, nav on left */
body.ct-rtl .header-inner {
    direction: rtl;
}

/* Mobile menu icon */
body.ct-rtl .mobile-menu-toggle {
    margin-left: 0;
    margin-right: auto;
}

/* Language dropdown */
body.ct-rtl .lang-dropdown {
    left: 0;
    right: auto;
}

/* ---------- Navigation ---------- */
body.ct-rtl .main-navigation ul {
    direction: rtl;
}

body.ct-rtl .main-navigation ul li ul {
    left: auto;
    right: 0;
}

/* ---------- Breadcrumbs ---------- */
body.ct-rtl .breadcrumb-nav .breadcrumb .sep {
    transform: scaleX(-1);
}

/* ---------- Hero ---------- */
body.ct-rtl .hero-content {
    text-align: right;
}

body.ct-rtl .hero-actions {
    justify-content: flex-start;
}

body.ct-rtl .hero-actions .btn svg {
    transform: scaleX(-1);
}

/* ---------- Sections / Cards ---------- */
body.ct-rtl .section-header {
    text-align: right;
}

/* ---------- Product Cards ---------- */
body.ct-rtl .woocommerce span.onsale {
    left: auto;
    right: var(--space-4);
}

body.ct-rtl .woocommerce ul.products li.product .woocommerce-loop-product__title,
body.ct-rtl .woocommerce ul.products li.product h2 {
    text-align: right;
}

body.ct-rtl .woocommerce ul.products li.product .price {
    justify-content: flex-start;
    direction: rtl;
}

body.ct-rtl .woocommerce ul.products li.product .star-rating {
    margin-left: auto;
    margin-right: var(--space-4);
}

body.ct-rtl .woocommerce ul.products li.product .added_to_cart {
    text-align: right;
}

/* ---------- Single Product ---------- */
body.ct-rtl .woocommerce div.product {
    direction: rtl;
}

body.ct-rtl .woocommerce div.product .product_meta > span {
    text-align: right;
}

body.ct-rtl .woocommerce div.product p.price del {
    margin-right: 0;
    margin-left: var(--space-2);
}

/* ---------- Product Tabs ---------- */
body.ct-rtl .woocommerce div.product .woocommerce-tabs ul.tabs {
    direction: rtl;
}

/* ---------- Cart Page ---------- */
body.ct-rtl .woocommerce table.shop_table {
    direction: rtl;
    text-align: right;
}

body.ct-rtl .woocommerce table.shop_table .product-thumbnail {
    padding-right: var(--space-5);
    padding-left: var(--space-2);
}

body.ct-rtl .woocommerce table.shop_table .product-name a {
    text-align: right;
}

body.ct-rtl .woocommerce .coupon {
    flex-direction: row-reverse;
}

body.ct-rtl .woocommerce .cart-collaterals .cart_totals table td {
    text-align: left;
}

body.ct-rtl .woocommerce .cart-collaterals .cart_totals table th {
    text-align: right;
}

/* ---------- Checkout ---------- */
body.ct-rtl .ct-checkout-grid {
    direction: rtl;
}

body.ct-rtl .ct-section-header {
    flex-direction: row-reverse;
    text-align: right;
}

body.ct-rtl .ct-section-body {
    direction: rtl;
    text-align: right;
}

body.ct-rtl .ct-checkout-form .form-row label {
    text-align: right;
}

body.ct-rtl .ct-checkout-form .form-row input.input-text,
body.ct-rtl .ct-checkout-form .form-row textarea,
body.ct-rtl .ct-checkout-form .form-row select {
    text-align: right;
    direction: rtl;
}

body.ct-rtl .ct-checkout-form #order_review .shop_table {
    direction: rtl;
    text-align: right;
}

body.ct-rtl .ct-checkout-form #payment ul.payment_methods li label {
    direction: rtl;
}

/* Ship to different address checkbox */
body.ct-rtl .ct-checkout-form .woocommerce-shipping-fields #ship-to-different-address {
    flex-direction: row-reverse;
}

/* ---------- My Account ---------- */
body.ct-rtl .woocommerce-account .woocommerce-MyAccount-navigation ul {
    direction: rtl;
}

/* ---------- Messages ---------- */
body.ct-rtl .woocommerce-message,
body.ct-rtl .woocommerce-info,
body.ct-rtl .woocommerce-error {
    direction: rtl;
    text-align: right;
}

body.ct-rtl .woocommerce-message a,
body.ct-rtl .woocommerce-info a {
    margin-left: 0;
    margin-right: auto;
}

/* ---------- Ordering & Pagination ---------- */
body.ct-rtl .woocommerce .woocommerce-ordering select {
    padding-right: var(--space-5);
    padding-left: var(--space-10);
    background-position: left 12px center;
}

body.ct-rtl .woocommerce .woocommerce-result-count {
    text-align: right;
}

/* ---------- Footer ---------- */
body.ct-rtl .footer-main {
    direction: rtl;
    text-align: right;
}

body.ct-rtl .footer-bottom {
    direction: rtl;
}

body.ct-rtl .footer-newsletter .newsletter-content {
    text-align: right;
}

/* ---------- Sidebar / Widgets ---------- */
body.ct-rtl .widget {
    text-align: right;
}

/* ---------- Floating Cart ---------- */
body.ct-rtl .floating-cart-btn {
    right: auto;
    left: var(--space-6);
}

/* ---------- Sticky Add-to-Cart Bar ---------- */
body.ct-rtl .sticky-add-to-cart .sticky-bar-inner {
    direction: rtl;
}

/* ---------- General Form Inputs ---------- */
body.ct-rtl input[type="text"],
body.ct-rtl input[type="email"],
body.ct-rtl input[type="tel"],
body.ct-rtl input[type="number"],
body.ct-rtl input[type="search"],
body.ct-rtl input[type="password"],
body.ct-rtl textarea,
body.ct-rtl select {
    direction: rtl;
    text-align: right;
}

/* ---------- Select2 (WooCommerce Country Selects) ---------- */
body.ct-rtl .select2-container--default .select2-selection--single .select2-selection__rendered {
    text-align: right;
    padding-right: 8px;
    padding-left: 20px;
}

body.ct-rtl .select2-container--default .select2-selection--single .select2-selection__arrow {
    right: auto;
    left: 1px;
}

body.ct-rtl .select2-results__option {
    text-align: right;
}

/* ---------- Responsive RTL Tweaks ---------- */
@media (max-width: 768px) {
    body.ct-rtl .ct-section-header {
        flex-direction: row-reverse;
    }

    body.ct-rtl .hero-content {
        text-align: center;
    }

    body.ct-rtl .hero-actions {
        justify-content: center;
    }
}
