/*
 * Stay Healthy Libya - Comprehensive RTL Fixes
 * Enhanced RTL support for Arabic language
 * Fixes layout issues and improves Arabic text display
 */

/* ==============================================
   GLOBAL RTL IMPROVEMENTS
   ============================================== */

body.rtl {
    direction: rtl;
    unicode-bidi: embed;
    text-align: right;
}

body.rtl #header-outer,
body.rtl #header-space,
body.rtl #header-secondary-outer,
body.rtl #search-outer,
body.rtl #slide-out-widget-area,
body.rtl #ajax-content-wrap,
body.rtl #footer-outer,
body.rtl #call-to-action,
body.rtl #copyright {
    text-align: right;
}

/* Adjustments for specific elements */
body.rtl .container,
body.rtl .row,
body.rtl .col {
    text-align: right;
}

/* Navigation */
body.rtl #top nav > ul > li {
    float: right;
    margin-left: 0;
    margin-right: 20px; /* Adjust as needed */
}
body.rtl #top nav > ul > li:last-child {
    margin-right: 0;
}
body.rtl #top nav > ul > li > a {
    padding-left: 0;
    padding-right: 15px;
}
body.rtl #top nav > ul > li.menu-item-has-children > a:after {
    left: auto;
    right: 0;
    transform: rotate(180deg);
}

/* Sub-menus */
body.rtl #top .sf-menu ul {
    left: auto;
    right: 0;
    text-align: right;
}
body.rtl #top .sf-menu ul li.menu-item-has-children > a:after {
    left: 10px;
    right: auto;
    transform: rotate(0deg);
}
body.rtl #top .sf-menu ul li ul {
    left: auto;
    right: 100%;
}

/* WooCommerce Specifics */
body.rtl .woocommerce .products ul.products li.product,
body.rtl .woocommerce-page .products ul.products li.product {
    float: right;
    margin-left: 2.8%; /* Adjust spacing */
    margin-right: 0;
}
body.rtl .woocommerce .products ul.products li.product:nth-child(4n),
body.rtl .woocommerce-page .products ul.products li.product:nth-child(4n) {
    margin-left: 0;
}
body.rtl .woocommerce .products ul.products li.product:nth-child(3n),
body.rtl .woocommerce-page .products ul.products li.product:nth-child(3n) {
    margin-left: 2.8%;
}
body.rtl .woocommerce .products ul.products li.product:nth-child(2n),
body.rtl .woocommerce-page .products ul.products li.product:nth-child(2n) {
    margin-left: 2.8%;
}

body.rtl .woocommerce .product .summary,
body.rtl .woocommerce-page .product .summary {
    float: right;
    text-align: right;
}
body.rtl .woocommerce .product .images,
body.rtl .woocommerce-page .product .images {
    float: left;
    text-align: left;
}

body.rtl .woocommerce .cart-collaterals .cart_totals,
body.rtl .woocommerce-page .cart-collaterals .cart_totals {
    float: left;
    text-align: right;
}
body.rtl .woocommerce .cart-collaterals .shipping_calculator,
body.rtl .woocommerce-page .cart-collaterals .shipping_calculator {
    float: right;
    text-align: right;
}

body.rtl .woocommerce table.shop_table td.product-name,
body.rtl .woocommerce table.shop_table td.product-price,
body.rtl .woocommerce table.shop_table td.product-quantity,
body.rtl .woocommerce table.shop_table td.product-subtotal {
    text-align: right;
}

body.rtl .woocommerce .widget_shopping_cart .cart_list li a.remove {
    left: 0;
    right: auto;
}

/* Forms - Fixed aggressive RTL styling */
body.rtl .form-row label {
    float: right;
}

/* Only apply RTL text alignment to Arabic content, not form controls */
body.rtl .form-row input[type="text"]:lang(ar),
body.rtl .form-row input[type="email"]:lang(ar),
body.rtl .form-row input[type="tel"]:lang(ar),
body.rtl .form-row textarea:lang(ar) {
    text-align: right;
    direction: rtl;
}

/* Fix select dropdown styling for RTL */
body.rtl select {
    text-align: right;
    direction: rtl;
}

/* Fix WooCommerce account page form issues */
body.rtl .woocommerce-form-row {
    text-align: right;
}

body.rtl .woocommerce-form-row label {
    display: inline-block;
    margin-bottom: 5px;
}

/* Fix B2B King dropdown specifically - COMPREHENSIVE FIX */
body.rtl .b2bking_registration_roles_dropdown_section select {
    width: 100% !important;
    max-width: 100% !important;
    text-align: right !important;
    direction: rtl !important;
    padding: 12px 15px !important;
    font-size: 14px !important;
    color: #333 !important;
    background-color: #fff !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    box-sizing: border-box !important;
    float: none !important;
    position: relative !important;
    left: auto !important;
    right: auto !important;
    margin: 0 !important;
    display: block !important;
}

/* Fix dropdown options visibility */
body.rtl .b2bking_registration_roles_dropdown_section select option {
    color: #333 !important;
    background-color: #fff !important;
    padding: 8px 12px !important;
    text-align: right !important;
    direction: rtl !important;
}

/* Override any B2B King specific styling */
body.rtl #b2bking_registration_roles_dropdown {
    width: 100% !important;
    max-width: 100% !important;
    color: #333 !important;
    background-color: #fff !important;
    border: 1px solid #ddd !important;
    text-align: right !important;
    direction: rtl !important;
    float: none !important;
    position: static !important;
    transform: none !important;
}

/* Fix form row spacing */
body.rtl .woocommerce-form-row--wide {
    margin-bottom: 1rem;
}

/* Buttons */
body.rtl .button,
body.rtl input[type="submit"] {
    float: right;
}

/* General Text Alignment */
body.rtl p,
body.rtl li,
body.rtl h1,
body.rtl h2,
body.rtl h3,
body.rtl h4,
body.rtl h5,
body.rtl h6 {
    text-align: right;
}

/* Specific elements that need LTR for numbers/codes - EXCEPT Arabic prices */
body.rtl code,
body.rtl pre,
body.rtl .product_meta .sku {
    direction: ltr;
    text-align: left;
}

/* Fix WooCommerce price display for Arabic currency (د.ل) */
body.rtl .price,
body.rtl .amount,
body.rtl .woocommerce-Price-amount,
body.rtl .price .woocommerce-Price-amount {
    direction: rtl !important; /* render amount then symbol */
    text-align: right !important;
    display: inline-flex !important;
    align-items: center !important;
}

/* Ensure currency symbol appears correctly in RTL */
body.rtl .woocommerce-Price-currencySymbol {
    direction: rtl !important;
    order: 2;
    margin-left: 0 !important;
    margin-right: 5px !important;
}

/* Fix price range display in RTL */
body.rtl .price .woocommerce-Price-amount bdi {
    direction: rtl !important; /* keep symbol on the right */
    unicode-bidi: isolate !important;
}

/* Ensure price separators display correctly in RTL */
body.rtl .price [aria-hidden="true"] {
    direction: rtl !important;
}

/* Adjustments for Nectar Blocks theme specific elements */
/* REMOVED: .nectar-blocks-button__text__inner RTL override - was breaking button animations */

/* Header and Footer */
body.rtl #header-outer #logo {
    float: right;
}
body.rtl #header-outer #top nav {
    float: left;
}
body.rtl #footer-outer .widget {
    text-align: right;
}

/* Blog posts */
body.rtl .post-area.standard-style article .post-header .meta-author,
body.rtl .post-area.standard-style article .post-header .meta-comment-count {
    float: right;
    margin-left: 15px;
    margin-right: 0;
}
body.rtl .post-area.standard-style article .post-header .meta-date {
    float: right;
}

/* Comments */
body.rtl #comments ol.commentlist li.comment .comment-text {
    margin-left: 0;
    margin-right: 90px;
}
body.rtl #comments ol.commentlist li.comment img.avatar {
    float: right;
}

/* Widgets */
body.rtl .widget ul li {
    text-align: right;
}
body.rtl .widget_product_search form input[type="search"] {
    padding-left: 0;
    padding-right: 10px;
}
body.rtl .widget_product_search form button {
    left: 0;
    right: auto;
}

/* Custom Nectar Blocks elements - REMOVED PROBLEMATIC TRANSFORMS
   These were overriding theme's native hover effects */

/* Ensure icons are correctly positioned */
body.rtl .fa {
    margin-left: 5px;
    margin-right: 0;
}
body.rtl .fa.fa-angle-right {
    transform: rotate(180deg);
}
body.rtl .fa.fa-angle-left {
    transform: rotate(180deg);
}

/* Specific WooCommerce block styles */
body.rtl .wc-block-components-button {
    text-align: right;
}
body.rtl .wc-block-components-button.is-link {
    text-align: right;
}

/* Adjustments for the "Shop" button found */
body.rtl .wp-block-nectar-blocks-button .nectar-blocks-button__text__inner[data-text="Shop"] {
    text-align: right;
    direction: rtl;
}

/* Additional My Account Page Fixes */
body.rtl .woocommerce-MyAccount-navigation {
    text-align: right;
}

body.rtl .woocommerce-MyAccount-content {
    text-align: right;
}

/* Fix login/register forms layout */
body.rtl .u-columns {
    direction: rtl;
}

body.rtl .u-column1,
body.rtl .u-column2 {
    text-align: right;
}

/* Fix form input alignment without breaking functionality */
body.rtl .woocommerce-form-login input[type="text"],
body.rtl .woocommerce-form-login input[type="email"],
body.rtl .woocommerce-form-login input[type="password"],
body.rtl .woocommerce-form-register input[type="text"],
body.rtl .woocommerce-form-register input[type="email"],
body.rtl .woocommerce-form-register input[type="password"] {
    text-align: right;
}

/* Ensure dropdown options are properly aligned and visible */
body.rtl select option {
    text-align: right !important;
    direction: rtl !important;
    color: #333 !important;
    background-color: #fff !important;
    padding: 8px 12px !important;
}

/* Fix all select dropdowns in RTL - MORE AGGRESSIVE FOR VISIBILITY */
body.rtl select {
    color: #333 !important;
    background-color: #fff !important;
    text-align: right !important;
    direction: rtl !important;
    border: 1px solid #ddd !important;
}

/* NUCLEAR OPTION: Override any plugin CSS that breaks dropdown */
.b2bking_registration_roles_dropdown_section select,
#b2bking_registration_roles_dropdown {
    background: #ffffff !important;
    color: #333333 !important;
    border: 1px solid #dddddd !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 12px 15px !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    height: auto !important;
    min-height: 44px !important;
    position: relative !important;
    float: none !important;
    margin: 0 !important;
    text-align: right !important;
    direction: rtl !important;
    border-radius: 4px !important;
    display: block !important;
    -webkit-appearance: menulist !important;
    -moz-appearance: menulist !important;
    appearance: menulist !important;
}

/* Force dropdown options to be visible */
.b2bking_registration_roles_dropdown_section select option,
#b2bking_registration_roles_dropdown option {
    background: #ffffff !important;
    color: #333333 !important;
    padding: 8px 12px !important;
    text-align: right !important;
    direction: rtl !important;
    border: none !important;
    font-size: 14px !important;
}

/* ULTIMATE OVERRIDE - Target the exact element with highest specificity */
body.rtl.woocommerce-account .woocommerce-MyAccount-content .b2bking_registration_roles_dropdown_section select#b2bking_registration_roles_dropdown {
    background-color: #ffffff !important;
    color: #333333 !important;
    border: 1px solid #cccccc !important;
    width: 100% !important;
    padding: 12px 15px !important;
    font-size: 14px !important;
    text-align: right !important;
    direction: rtl !important;
    position: relative !important;
    float: none !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    height: auto !important;
    min-height: 44px !important;
    display: block !important;
    border-radius: 4px !important;
}

/* ULTIMATE OVERRIDE for dropdown options */
body.rtl.woocommerce-account .woocommerce-MyAccount-content .b2bking_registration_roles_dropdown_section select#b2bking_registration_roles_dropdown option {
    background-color: #ffffff !important;
    color: #333333 !important;
    padding: 8px 12px !important;
    text-align: right !important;
    direction: rtl !important;
    font-size: 14px !important;
}

/* HIDE DUPLICATE DROPDOWNS - Remove Select2 and other enhanced dropdowns */
.b2bking_registration_roles_dropdown_section .select2-container,
.b2bking_registration_roles_dropdown_section .select2,
.b2bking_registration_roles_dropdown_section .fancy-select,
.b2bking_registration_roles_dropdown_section .nice-select,
.b2bking_registration_roles_dropdown_section .chosen-container {
    display: none !important;
    visibility: hidden !important;
}

/* Ensure the original select is visible and not hidden by theme enhancements */
.b2bking_registration_roles_dropdown_section select#b2bking_registration_roles_dropdown {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 999 !important;
}

/* Hide any enhanced dropdown that might be created after the original */
.b2bking_registration_roles_dropdown_section select#b2bking_registration_roles_dropdown + * {
    display: none !important;
}

/* Prevent theme from hiding the original select */
body[data-form-select-js="1"] .b2bking_registration_roles_dropdown_section select#b2bking_registration_roles_dropdown {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Removed problematic positioning and focus overrides that broke dropdown functionality */

/* Fix checkbox alignment */
body.rtl .woocommerce-form__input-checkbox {
    margin-left: 10px;
    margin-right: 0;
}

/* Fix privacy policy text alignment */
body.rtl .woocommerce-privacy-policy-text {
    text-align: right;
    direction: rtl;
}

/* Fix oversized form labels - BLACK COLOR */
body.rtl .woocommerce-form-row label,
body.rtl .form-row label {
    font-size: 14px !important;
    font-weight: normal !important;
    color: #000 !important;
    margin-bottom: 5px;
    display: block;
}

/* Fix B2B King dropdown label specifically - BLACK COLOR */
body.rtl .b2bking_registration_roles_dropdown_section label {
    font-size: 14px !important;
    font-weight: normal !important;
    color: #000 !important;
    margin-bottom: 5px;
    display: block;
}

/* Ensure required asterisk styling */
body.rtl .required {
    color: #e74c3c !important;
    font-size: 14px !important;
}

/* Fix form field spacing */
body.rtl .woocommerce-form-row {
    margin-bottom: 15px;
}

/* Style consistency for all form elements - BLACK LABELS */
body.rtl .woocommerce-form-login label,
body.rtl .woocommerce-form-register label {
    font-size: 14px !important;
    font-weight: normal !important;
    color: #000 !important;
}

/* ==============================================
   COMPREHENSIVE PRICE RTL FIXES
   ============================================== */

/* All price-related elements should follow RTL */
body.rtl .price,
body.rtl .amount,
body.rtl .woocommerce-price,
body.rtl .product-price,
body.rtl .cart-item-price,
body.rtl .order-total,
body.rtl .shop_table .amount {
    direction: rtl !important;
    text-align: right !important;
}

/* Product page price display */
body.rtl .single-product .price,
body.rtl .woocommerce div.product p.price,
body.rtl .woocommerce div.product span.price {
    direction: rtl !important;
    text-align: right !important;
}

/* Cart and checkout price display */
body.rtl .woocommerce table.shop_table .amount,
body.rtl .woocommerce-checkout-review-order-table .amount,
body.rtl .cart_totals .amount {
    direction: rtl !important;
    text-align: right !important;
}

/* Product listing price display */
body.rtl .woocommerce ul.products li.product .price,
body.rtl .woocommerce-page ul.products li.product .price {
    direction: rtl !important;
    text-align: right !important;
}

/* Ensure consistent currency symbol spacing */
body.rtl .woocommerce-Price-currencySymbol {
    margin-left: 0 !important;
    margin-right: 3px !important;
}

/* ==============================================
   CHECKOUT FORM RTL FIXES
   ============================================== */

/* Fix checkout form field layout in RTL */
body.rtl .woocommerce-checkout .form-row {
    direction: rtl;
    text-align: right;
}

/* Proper label positioning in RTL checkout - FIXED FOR TWO-COLUMN LAYOUT */
body.rtl .woocommerce-checkout .form-row label,
body.rtl .woocommerce-billing-fields .form-row label,
body.rtl .woocommerce-shipping-fields .form-row label,
body.rtl .woocommerce-additional-fields .form-row label {
    text-align: right !important;
    width: 100% !important;
    margin-bottom: 5px !important;
    display: block !important;
    float: none !important;
    clear: none !important;
}

/* Input fields RTL alignment - PRESERVE ORIGINAL LAYOUT */
body.rtl .woocommerce-checkout .form-row input[type="text"],
body.rtl .woocommerce-checkout .form-row input[type="email"],
body.rtl .woocommerce-checkout .form-row input[type="tel"],
body.rtl .woocommerce-checkout .form-row select,
body.rtl .woocommerce-checkout .form-row textarea {
    text-align: right !important;
    direction: rtl !important;
    width: 100% !important;
    display: block !important;
    float: none !important;
    clear: none !important;
}

/* Fix billing and shipping field containers */
body.rtl .woocommerce-billing-fields,
body.rtl .woocommerce-shipping-fields,
body.rtl .woocommerce-additional-fields {
    direction: rtl;
    text-align: right;
}

/* Fix checkout column layout in RTL - RESTORE TWO-COLUMN LAYOUT */
body.rtl .woocommerce-checkout .col2-set {
    direction: rtl;
}

body.rtl .woocommerce-checkout .col2-set .col-1 {
    float: right !important;
    width: 48% !important;
    margin-left: 0 !important;
    margin-right: 4% !important;
    direction: rtl;
    text-align: right;
}

body.rtl .woocommerce-checkout .col2-set .col-2 {
    float: left !important;
    width: 48% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    direction: rtl;
    text-align: right;
}

/* Fix order review section in RTL */
body.rtl .woocommerce-checkout-review-order {
    direction: rtl;
    text-align: right;
}

/* Fix payment methods section */
body.rtl .woocommerce-checkout #payment {
    direction: rtl;
    text-align: right;
}

body.rtl .woocommerce-checkout #payment ul.payment_methods {
    text-align: right;
}

body.rtl .woocommerce-checkout #payment ul.payment_methods li {
    text-align: right;
}

/* Fix payment method labels and content */
body.rtl .woocommerce-checkout #payment .payment_method_cod label,
body.rtl .woocommerce-checkout #payment .payment_method_bacs label {
    font-size: 16px !important;
    font-weight: 500 !important;
    color: #333 !important;
    margin-bottom: 8px !important;
}

/* Fix shipping method labels */
body.rtl .woocommerce-checkout #shipping_method label {
    font-size: 16px !important;
    font-weight: 500 !important;
    color: #333 !important;
}

/* Fix checkout headings consistency */
body.rtl .woocommerce-checkout h3,
body.rtl .woocommerce-billing-fields h3,
body.rtl .woocommerce-shipping-fields h3 {
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #333 !important;
    margin-bottom: 15px !important;
    text-align: right !important;
}

/* Fix required field asterisk positioning */
body.rtl .woocommerce-checkout .required {
    float: right !important;
    margin-right: 0 !important;
    margin-left: 3px !important;
}

/* Fix checkbox and radio button alignment - IMPROVED SPACING */
body.rtl .woocommerce-checkout input[type="checkbox"],
body.rtl .woocommerce-checkout input[type="radio"] {
    float: right !important;
    margin-left: 10px !important;
    margin-right: 0 !important;
    margin-top: 2px !important;
    vertical-align: top !important;
}

/* Fix payment method radio buttons specifically */
body.rtl .woocommerce-checkout #payment ul.payment_methods li {
    padding: 15px 0 !important;
    border-bottom: 1px solid #eee !important;
    margin-bottom: 0 !important;
}

body.rtl .woocommerce-checkout #payment ul.payment_methods li:last-child {
    border-bottom: none !important;
}

body.rtl .woocommerce-checkout #payment ul.payment_methods li input[type="radio"] {
    float: right !important;
    margin-right: 0 !important;
    margin-left: 10px !important;
    margin-top: 2px !important;
    vertical-align: middle !important;
}

body.rtl .woocommerce-checkout #payment ul.payment_methods li label {
    display: inline-block !important;
    width: calc(100% - 35px) !important;
    padding-right: 0 !important;
    line-height: 1.5 !important;
    cursor: pointer !important;
}

/* Fix terms and conditions checkbox */
body.rtl .woocommerce-checkout .form-row.terms {
    float: right !important;
    text-align: right !important;
}

body.rtl .woocommerce-checkout .form-row.terms label {
    float: none !important;
    display: inline !important;
    width: auto !important;
}

/* ==============================================
   TEXT SIZE NORMALIZATION & ADDITIONAL RTL FIXES
   ============================================== */

/* Override Nectar blocks oversized text for checkout specific elements */
body.rtl .woocommerce-checkout .woocommerce-info,
body.rtl .woocommerce-checkout .woocommerce-message {
    font-size: 14px !important;
    line-height: 1.5 !important;
}

/* Normalize delivery/shipping text sizes */
body.rtl .woocommerce-checkout #shipping_method li label,
body.rtl .woocommerce-checkout .shipping-methods li label {
    font-size: 16px !important;
    font-weight: 500 !important;
    color: #333 !important;
    line-height: 1.4 !important;
}

/* Normalize payment method text sizes */
body.rtl .woocommerce-checkout #payment ul.payment_methods li label {
    font-size: 16px !important;
    font-weight: 500 !important;
    color: #333 !important;
    line-height: 1.4 !important;
}

/* Fix order review table text sizes */
body.rtl .woocommerce-checkout-review-order-table th,
body.rtl .woocommerce-checkout-review-order-table td {
    font-size: 15px !important;
    line-height: 1.6 !important;
    vertical-align: middle !important;
}

/* Hide header cell text for shipping title inside totals to avoid visual duplication */
body.rtl .woocommerce-checkout-review-order-table .woocommerce-shipping-totals th {
    color: transparent !important;
    width: 0 !important;
}
body.rtl .woocommerce-checkout-review-order-table .woocommerce-shipping-totals th::after {
    content: '' !important;
}

/* Fix product names in order review */
body.rtl .woocommerce-checkout-review-order-table .product-name {
    font-size: 15px !important;
    font-weight: 500 !important;
}

/* Fix totals text size */
body.rtl .woocommerce-checkout-review-order-table .order-total th,
body.rtl .woocommerce-checkout-review-order-table .order-total td {
    font-size: 16px !important;
    font-weight: 600 !important;
    vertical-align: middle !important;
}

/* Fix place order button */
body.rtl .woocommerce-checkout #place_order {
    font-size: 16px !important;
    font-weight: 600 !important;
    text-align: center !important;
}

/* Fix coupon form */
body.rtl .woocommerce-checkout .checkout_coupon {
    direction: rtl;
    text-align: right;
}

body.rtl .woocommerce-checkout .checkout_coupon input[type="text"] {
    text-align: right !important;
    direction: rtl !important;
}

/* Fix select2 dropdowns in RTL */
body.rtl .woocommerce-checkout .select2-container--default .select2-selection--single {
    text-align: right !important;
    direction: rtl !important;
}

body.rtl .woocommerce-checkout .select2-container--default .select2-selection--single .select2-selection__rendered {
    text-align: right !important;
    direction: rtl !important;
    padding-left: 20px !important;
    padding-right: 8px !important;
}

/* Fix validation error messages */
body.rtl .woocommerce-checkout .woocommerce-error,
body.rtl .woocommerce-checkout .woocommerce-invalid {
    text-align: right !important;
    direction: rtl !important;
}

/* Fix privacy policy and terms text */
body.rtl .woocommerce-checkout .woocommerce-privacy-policy-text,
body.rtl .woocommerce-checkout .woocommerce-terms-and-conditions-wrapper {
    text-align: right !important;
    direction: rtl !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
}

/* Fix address fields layout - MAINTAIN SIDE-BY-SIDE LAYOUT WITH PROPER SPACING */
body.rtl .woocommerce-checkout .form-row-first {
    float: right !important;
    width: 48% !important;
    margin-left: 0 !important;
    margin-right: 0 !important; /* remove default theme spacing */
    margin-bottom: 15px !important;
    padding-right: 0 !important;
}

body.rtl .woocommerce-checkout .form-row-last {
    float: left !important;
    width: 48% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 15px !important;
    padding-left: 0 !important;
}

/* Ensure proper clearfix for form rows */
body.rtl .woocommerce-checkout .form-row-first::after,
body.rtl .woocommerce-checkout .form-row-last::after {
    content: "";
    display: table;
    clear: both;
}

/* Fix specific first name and last name fields */
body.rtl .woocommerce-checkout #billing_first_name_field,
body.rtl .woocommerce-checkout #billing_last_name_field,
body.rtl .woocommerce-checkout #shipping_first_name_field,
body.rtl .woocommerce-checkout #shipping_last_name_field {
    margin-bottom: 15px !important;
}

/* Ensure form row containers have proper spacing */
body.rtl .woocommerce-checkout .woocommerce-billing-fields .form-row,
body.rtl .woocommerce-checkout .woocommerce-shipping-fields .form-row {
    margin-bottom: 15px !important;
}

/* Fix wide form rows */
body.rtl .woocommerce-checkout .form-row-wide {
    width: 100% !important;
    float: none !important;
    clear: both !important;
}

/* Fix additional information section */
body.rtl .woocommerce-additional-fields h3 {
    font-size: 18px !important;
    margin-bottom: 15px !important;
}

body.rtl .woocommerce-additional-fields textarea {
    text-align: right !important;
    direction: rtl !important;
}

/* Add left margin to additional fields wrapper (Arabic RTL layout) */
body.rtl .woocommerce-additional-fields {
    margin-left: 50px !important;
}

/* Fix login/register links */
body.rtl .woocommerce-checkout .showlogin,
body.rtl .woocommerce-checkout .showcoupon {
    text-align: right !important;
    direction: rtl !important;
    font-size: 14px !important;
}

/* ==============================================
   ADDITIONAL COMPREHENSIVE RTL FIXES
   ============================================== */

/* Fix cart table in checkout review */
body.rtl .woocommerce-checkout-review-order-table table {
    direction: rtl !important;
    text-align: right !important;
}

body.rtl .woocommerce-checkout-review-order-table table th,
body.rtl .woocommerce-checkout-review-order-table table td {
    text-align: right !important;
}

/* Fix quantity display in order review */
body.rtl .woocommerce-checkout-review-order-table .product-quantity {
    direction: rtl !important;
}

/* Fix button alignment */
body.rtl .woocommerce-checkout .button,
body.rtl .woocommerce-checkout input[type="submit"] {
    text-align: center !important;
}

/* Fix notices and messages */
body.rtl .woocommerce-checkout .woocommerce-notices-wrapper {
    direction: rtl !important;
    text-align: right !important;
}

/* Fix breadcrumbs if present */
body.rtl .woocommerce-checkout .woocommerce-breadcrumb {
    direction: rtl !important;
    text-align: right !important;
}

body.rtl .woocommerce-checkout .woocommerce-breadcrumb a {
    direction: rtl !important;
}

/* Fix any icons or arrows */
body.rtl .woocommerce-checkout .fa-angle-right {
    transform: rotate(180deg) !important;
}

body.rtl .woocommerce-checkout .fa-angle-left {
    transform: rotate(180deg) !important;
}

/* Fix mobile responsive issues */
@media only screen and (max-width: 768px) {
    body.rtl .woocommerce-checkout .col2-set .col-1,
    body.rtl .woocommerce-checkout .col2-set .col-2 {
        float: none !important;
        width: 100% !important;
        margin: 0 !important;
    }
    
    body.rtl .woocommerce-checkout .form-row-first,
    body.rtl .woocommerce-checkout .form-row-last {
        float: none !important;
        width: 100% !important;
        margin: 0 0 15px 0 !important;
    }
}

/* Trustindex Arabic rating text correction: replace flipped phrase with proper Arabic */
.ti-widget.ti-goog[data-language="ar"] .ti-rating-text {
    position: relative;
}
.ti-widget.ti-goog[data-language="ar"] .ti-rating-text .nowrap {
    display: none !important;
}
.ti-widget.ti-goog[data-language="ar"] .ti-rating-text:first-of-type::after {
    content: "استنادًا إلى 23 مشاركة";
    visibility: visible;
    display: inline-block;
    direction: rtl;
    unicode-bidi: plaintext;
    text-align: center;
}

/* Hide any subsequent duplicated rating text rows */
.ti-widget.ti-goog[data-language="ar"] .ti-rating-text:not(:first-of-type) {
    display: none !important;
}

/* Fix any remaining floating elements */
body.rtl .woocommerce-checkout::after,
body.rtl .woocommerce-billing-fields::after,
body.rtl .woocommerce-shipping-fields::after {
    content: "";
    display: table;
    clear: both;
}

/* Ensure consistent spacing */
body.rtl .woocommerce-checkout .form-row {
    margin-bottom: 15px !important;
}

/* Fix any tooltip or help text */
body.rtl .woocommerce-checkout .woocommerce-help-tip,
body.rtl .woocommerce-checkout .help_tip {
    float: left !important;
    margin-right: 0 !important;
    margin-left: 5px !important;
}

/* ==============================================
   FINAL SPACING AND ALIGNMENT FIXES
   ============================================== */

/* Ensure consistent form field spacing throughout checkout */
body.rtl .woocommerce-checkout .form-row {
    margin-bottom: 15px !important;
    clear: none !important;
}

/* Fix the gap issue between first/last name and other fields */
body.rtl .woocommerce-checkout .form-row-first + .form-row-last {
    margin-bottom: 15px !important;
}

/* Ensure full-width fields have proper spacing */
body.rtl .woocommerce-checkout .form-row-wide {
    margin-bottom: 15px !important;
    clear: both !important;
}

/* Fix payment description text spacing */
body.rtl .woocommerce-checkout #payment .payment_box {
    padding: 15px !important;
    margin-top: 10px !important;
    background-color: #f9f9f9 !important;
    border: 1px solid #ddd !important;
    text-align: right !important;
    direction: rtl !important;
}

/* Fix shipping method spacing */
body.rtl .woocommerce-checkout #shipping_method li {
    margin-bottom: 10px !important;
    padding: 8px 0 !important;
}

body.rtl .woocommerce-checkout #shipping_method li:last-child {
    margin-bottom: 0 !important;
}

/* Fix overall form container spacing */
body.rtl .woocommerce-checkout .woocommerce-billing-fields,
body.rtl .woocommerce-checkout .woocommerce-shipping-fields {
    margin-bottom: 25px !important;
}

/* ==============================================
   PAGE MARGINS FOR BETTER BREATHING ROOM
   ============================================== */

/* Add 100px space between header and content for checkout, cart, and account pages */
body.woocommerce-checkout #nectar-content-wrap,
body.woocommerce-cart #nectar-content-wrap,
body.woocommerce-account #nectar-content-wrap {
    margin-top: 0px !important;
}

/* Add bottom spacing for better visual separation */
body.woocommerce-checkout .woocommerce,
body.woocommerce-cart .woocommerce,
body.woocommerce-account .woocommerce {
    margin-bottom: 100px !important;
}

/* Alternative selectors for different theme structures */
body.woocommerce-checkout .container-wrap,
body.woocommerce-cart .container-wrap,
body.woocommerce-account .container-wrap {
    padding-top: 100px !important;
}

/* Ensure mobile responsive margins */
@media only screen and (max-width: 768px) {
    body.woocommerce-checkout #nectar-content-wrap,
    body.woocommerce-cart #nectar-content-wrap,
    body.woocommerce-account #nectar-content-wrap {
        margin-top: 50px !important;
    }
    
    body.woocommerce-checkout .woocommerce,
    body.woocommerce-cart .woocommerce,
    body.woocommerce-account .woocommerce {
        margin-bottom: 50px !important;
    }
    
    body.woocommerce-checkout .container-wrap,
    body.woocommerce-cart .container-wrap,
    body.woocommerce-account .container-wrap {
        padding-top: 50px !important;
    }
}
/* ==============================================
   CHECKOUT INFO BARS – LIGHT, SUBTLE STYLE
   ============================================== */
/* Use theme brand colors for info bars */
body.rtl.woocommerce-checkout .woocommerce-info {
    /* Brand styling */
    background-color: rgba(103, 172, 68, 0.08) !important; /* #67ac44 @ 8% */
    color: var(--brand-dark, #0f172a) !important;
    border: 1px solid rgba(103, 172, 68, 0.25) !important;
    border-right: 4px solid var(--brand-green, #67ac44) !important;
    border-radius: 8px !important;
    padding: 12px 16px !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04) !important;
}
body.rtl.woocommerce-checkout .woocommerce-info::before {
    display: none !important;
}
body.rtl.woocommerce-checkout .woocommerce-info a {
    color: var(--brand-orange, #f48020) !important;
    text-decoration: underline !important;
}

/* Brand variables for consistent colors */
:root {
    --brand-green: #67ac44;
    --brand-orange: #f48020;
    --brand-red: #e6303a;
    --brand-dark: #0f172a;
}

/* Hide any optional "Enter Other City" inputs as a defensive fallback */
body.rtl.woocommerce-checkout input[placeholder*="Enter Other City"],
body.rtl.woocommerce-checkout input[placeholder*="Enter City"] {
    display: none !important;
}

/* ==============================================
   SHOP ARCHIVE CARD ALIGNMENT FIXES
   - Center product titles
   - Ensure price is on its own line below the title
   ============================================== */
body.rtl.woocommerce ul.products li.product .woocommerce-loop-product__title,
body.rtl .woocommerce ul.products li.product .woocommerce-loop-product__title {
    text-align: center !important;
}

/* Ensure inner anchor is centered as some themes style the <a> directly */
body.rtl.woocommerce ul.products li.product .woocommerce-loop-product__title a,
body.rtl .woocommerce ul.products li.product .woocommerce-loop-product__title a,
body.rtl .woocommerce ul.products li.product h2.woocommerce-loop-product__title a {
    display: block !important;
    text-align: center !important;
    margin: 0 auto !important;
}

/* Nectar/Theme wrappers often set alignment on these containers */
body.rtl .woocommerce ul.products li.product .product-meta,
body.rtl .woocommerce ul.products li.product .product-main-meta {
    text-align: center !important;
}

/* Ensure the heading itself spans full width for centering */
body.rtl .woocommerce ul.products li.product h2.woocommerce-loop-product__title {
    display: block !important;
    width: 100% !important;
    margin: 0.35rem auto 0 !important;
}

/* High-specificity rule for markup: <div class="product-main-meta"><a><h2 class="woocommerce-loop-product__title"> ... */
body.rtl .woocommerce ul.products li.product .product-main-meta > a > h2.woocommerce-loop-product__title {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    margin: 0.35rem auto 0 !important;
}

/* Ensure the anchor itself doesn't impose different alignment */
body.rtl .woocommerce ul.products li.product .product-main-meta > a {
    display: block !important;
    text-align: center !important;
}

/* Use grid to force centering of both title and price within meta */
body.rtl .woocommerce ul.products li.product .product-main-meta {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
}

body.rtl.woocommerce ul.products li.product .price,
body.rtl .woocommerce ul.products li.product .price {
    display: block !important;        /* block to drop below title */
    text-align: center !important;    /* center price in card */
    margin-top: 6px !important;       /* breathing room under title */
}

.woocommerce .products .product {
    text-align: center !important;
}