/*
Plugin Name: FoodOrd
Description: RTL (Right-to-Left) support for frontend features (Toppings, Cart, Business Hours)
*/

/* =================================
   Base RTL
   ================================= */
.foodord-wrapper {
    direction: rtl;
}

/* =================================
   Product Cards/Grid RTL
   ================================= */
.foodord-products-grid {
    direction: rtl;
}

.foodord-product-card {
    text-align: right;
}

.foodord-product-card-title {
    text-align: right;
}

.foodord-product-card-description {
    text-align: right;
}

.foodord-product-card-price {
    text-align: right;
}

.foodord-product-card-actions {
    text-align: center;
}

/* =================================
   Product Cards (Shortcode & Blocks) RTL
   ================================= */
body.foodord-rtl-mode .foodord-products-shortcode .foodord-product-card,
body.foodord-rtl-mode .wp-block-foodord-products .foodord-product-card {
    flex-direction: row-reverse;
    text-align: right;
}

body.foodord-rtl-mode .foodord-products-shortcode .foodord-product-card .product-info,
body.foodord-rtl-mode .wp-block-foodord-products .foodord-product-card .product-info {
    text-align: right;
    direction: rtl;
    align-items: stretch;
}

body.foodord-rtl-mode .foodord-products-shortcode .foodord-product-card .product-title,
body.foodord-rtl-mode .wp-block-foodord-products .foodord-product-card .product-title,
body.foodord-rtl-mode .foodord-products-shortcode .foodord-product-card .product-description,
body.foodord-rtl-mode .wp-block-foodord-products .foodord-product-card .product-description {
    text-align: right;
    direction: rtl;
    width: 100%;
}


body.foodord-rtl-mode .foodord-products-shortcode .foodord-product-card .product-title-row,
body.foodord-rtl-mode .wp-block-foodord-products .foodord-product-card .product-title-row,
body.foodord-rtl-mode .foodord-product-card .product-title-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
}

body.foodord-rtl-mode .foodord-products-shortcode .foodord-product-card .product-title-row .product-title,
body.foodord-rtl-mode .wp-block-foodord-products .foodord-product-card .product-title-row .product-title,
body.foodord-rtl-mode .foodord-product-card .product-title-row .product-title {
    width: auto;
    flex: 1 1 auto;
    order: 0;
}

body.foodord-rtl-mode .foodord-products-shortcode .foodord-product-card .product-title-row .foodord-allergy-trigger,
body.foodord-rtl-mode .wp-block-foodord-products .foodord-product-card .product-title-row .foodord-allergy-trigger,
body.foodord-rtl-mode .foodord-product-card .product-title-row .foodord-allergy-trigger {
    order: -1;
    margin-left: 0;
    margin-right: 0;
}

body.foodord-rtl-mode .foodord-product-card .product-description p {
    direction: rtl;
    unicode-bidi: plaintext;
    text-align: right;
}
body.foodord-rtl-mode .foodord-products-shortcode .foodord-product-card .product-bottom,
body.foodord-rtl-mode .wp-block-foodord-products .foodord-product-card .product-bottom {
    direction: rtl;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
    gap: 10px;
}

body.foodord-rtl-mode .foodord-products-shortcode .foodord-product-card .product-actions,
body.foodord-rtl-mode .wp-block-foodord-products .foodord-product-card .product-actions {
    order: 2;
    margin-left: 0;
    margin-right: auto;
    align-self: flex-end;
    justify-content: flex-end;
}

body.foodord-rtl-mode .foodord-products-shortcode .foodord-product-card .product-price-container,
body.foodord-rtl-mode .wp-block-foodord-products .foodord-product-card .product-price-container {
    order: 1;
    text-align: right;
    direction: rtl;
    margin-right: 0;
    margin-left: auto;
}

body.foodord-rtl-mode .foodord-products-shortcode .foodord-product-card .product-price,
body.foodord-rtl-mode .wp-block-foodord-products .foodord-product-card .product-price {
    text-align: right;
    direction: rtl;
}

body.foodord-rtl-mode .foodord-product-card--grid .card-badges {
	left: auto;
	right: 16px;
}

body.foodord-rtl-mode .foodord-product-card--grid .card-header {
	flex-direction: row-reverse;
	text-align: right;
}

body.foodord-rtl-mode .foodord-product-card--grid .card-footer {
	flex-direction: row-reverse;
}

body.foodord-rtl-mode .foodord-product-card--grid .card-price {
	align-items: flex-end;
	text-align: right;
}

body.foodord-rtl-mode .foodord-product-card--grid .product-actions {
	justify-content: flex-start;
}

body.foodord-rtl-mode .foodord-card-count {
    right: auto;
    left: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 12px;
}

/* =================================
   Cart Header
   ================================= */
body.foodord-rtl-mode .wr-card__header {
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

body.foodord-rtl-mode .wr-card__title {
    text-align: right;
    margin: 0;
}

body.foodord-rtl-mode .wr-card__clear-btn {
    margin-right: auto;
    margin-left: 0;
}

body.foodord-rtl-mode .wr-card__items {
    direction: rtl;
}

body.foodord-rtl-mode .wr-card__item {
    flex-direction: row-reverse;
    align-items: center;
}

body.foodord-rtl-mode .wr-card__item-image {
    order: 3;
    margin-left: 0;
    margin-right: 12px;
}

body.foodord-rtl-mode .wr-card__item-details {
    order: 2;
    text-align: right;
}

body.foodord-rtl-mode .wr-card__item-actions {
    order: 1;
    align-items: flex-start;
    margin-left: 0;
    margin-right: auto;
}

body.foodord-rtl-mode .wr-card__item-quantity {
    order: 1;
    margin-left: 0;
    margin-right: 0;
}

@media (max-width: 1024px) {
    body.foodord-rtl-mode .foodord-products-shortcode .foodord-product-card .product-actions,
    body.foodord-rtl-mode .wp-block-foodord-products .foodord-product-card .product-actions {
        right: auto;
        left: 5px;
    }
}

body.foodord-rtl-mode .foodord-product-category,
body.foodord-rtl-mode .foodord-product-category .foodord-product-category-title,
body.foodord-rtl-mode .foodord-product-category-description {
	direction: rtl;
	text-align: right;
}
/* =================================
   Product Modal RTL
   ================================= */
body.foodord-rtl-mode .foodord-product-details {
    direction: rtl;
    text-align: right;
}


body.foodord-rtl-mode .foodord-product-price {
    direction: ltr;
}

body.foodord-rtl-mode .foodord-product-description {
    direction: rtl;
    text-align: right;
    unicode-bidi: plaintext;
}

body.foodord-rtl-mode .foodord-product-description p,
body.foodord-rtl-mode .foodord-product-description li,
body.foodord-rtl-mode .foodord-product-description span,
body.foodord-rtl-mode .foodord-product-description strong,
body.foodord-rtl-mode .foodord-product-description em,
body.foodord-rtl-mode .foodord-product-description b,
body.foodord-rtl-mode .foodord-product-description i {
    direction: rtl;
    unicode-bidi: plaintext;
    text-align: right;
}

body.foodord-rtl-mode .foodord-product-toppings__badge {
    position: relative;
    left: 24px;
}

body.foodord-rtl-mode .foodord-modal-close {
    right: auto;
    left: 16px;
}

body.foodord-rtl-mode .foodord-product-title-row {
	transition: padding 0.2s ease, margin 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

body.foodord-rtl-mode .foodord-product-title-row.sticky-active {
    padding: 10px 2.4rem 15px 1.2rem;
}

body.foodord-rtl-mode .foodord-product-toppings__set-title {
    direction: rtl;
    unicode-bidi: plaintext;
    text-align: right;
}

body.foodord-rtl-mode .foodord-attr-price {
    margin-left: 0;
    margin-right: auto;
    direction: ltr;
    unicode-bidi: isolate;
    text-align: right;
}

body.foodord-rtl-mode .foodord-product-toppings__option-price {
    direction: ltr;
    unicode-bidi: isolate;
    text-align: right;
}
/* Scroll Nav Dropdown layering */
body.foodord-rtl-mode .foodord-scroll-nav__inner,
body.foodord-rtl-mode .foodord-scroll-nav__menu-wrapper,
body.foodord-rtl-mode .foodord-scroll-nav__menu-btn {
    z-index: inherit;
}
/* =================================
   Woocommerce Block Checkout RTL
   ================================= */
body.foodord-rtl-mode .entry-header {
    direction: rtl;
    text-align: right;
}
body.foodord-rtl-mode .wc-block-components-form {
    direction: rtl;
    text-align: right;
}
body.foodord-rtl-mode .wp-block-woocommerce-checkout-order-summary-block .wc-block-components-checkout-order-summary__title {
    direction: rtl;
    text-align: right;
    padding-right: 1rem;
}
body.foodord-rtl-mode .wc-block-components-checkout-order-summary__content {
    direction: rtl;
    text-align: right;
    padding: 1rem;
}
/* =================================
   Woocommerce Shortcode Checkout RTL
   ================================= */
body.foodord-rtl-mode .foodord-checkout__main {
    direction: rtl;
    text-align: right;
}
body.foodord-rtl-mode .woocommerce-form-coupon-toggle {
    direction: rtl;
    text-align: right;
}
body.foodord-rtl-mode .woocommerce form.checkout_coupon {
    direction: rtl;
    text-align: right;
}
body.foodord-rtl-mode .woocommerce form .form-row-first, .woocommerce-page form .form-row-first {
    direction: rtl;
    text-align: right;
    float: right;
}
body.foodord-rtl-mode .foodord-checkout__sidebar {
    direction: rtl;
    text-align: right;
}
/* =================================
   Woocommerce Block Cart Page RTL
   ================================= */
body.foodord-rtl-mode .wc-block-cart__main .wc-block-cart-items {
    direction: rtl;
}
body.foodord-rtl-mode .wc-block-cart__main .wc-block-cart-items th:last-child {
    direction: rtl;
    text-align: left;
}
body.foodord-rtl-mode .editor-styles-wrapper table.wc-block-cart-items .wc-block-cart-items__header .wc-block-cart-items__header-image, table.wc-block-cart-items .wc-block-cart-items__header .wc-block-cart-items__header-image {
    direction: rtl;
    text-align: right;
}
body.foodord-rtl-mode .wc-block-cart .wp-block-woocommerce-cart-order-summary-block {
    direction: rtl;
    text-align: right;
}
body.foodord-rtl-mode .wc-block-cart .wc-block-cart__totals-title {
    direction: rtl;
    text-align: right;
    font-size: 1em;
    padding: 8px 0 8px 0;
}
/* =================================
   Woocommerce Shortcode Cart Page RTL
   ================================= */
body.foodord-rtl-mode .woocommerce-cart-form {
    direction: rtl;
}
body.foodord-rtl-mode .woocommerce .cart-collaterals .cart_totals, .woocommerce-page .cart-collaterals .cart_totals {
    direction: rtl;
    text-align: right;
}
body.foodord-rtl-mode .woocommerce table.shop_table {
    direction: rtl;
    text-align: right;
}
/* =================================
   Woocommerce My Account Pages RTL
   ================================= */
body.foodord-rtl-mode .woocommerce {
    direction: rtl;
    text-align: right;
}

/* RTL: Lock icon to the left and leave space inside inputs */
body.foodord-rtl-mode .foodord-locked-container input[type="text"],
body.foodord-rtl-mode .foodord-locked-container input[type="tel"],
body.foodord-rtl-mode .foodord-locked-container input[type="search"],
body.foodord-rtl-mode .foodord-locked-container .wc-block-components-text-input input,
body.foodord-rtl-mode .foodord-locked-container .wc-block-components-address-form input {
    padding-left: 2rem;
}

.foodord-lock-shell {
    display: block;
    width: 100%;
}

body.foodord-rtl-mode .foodord-input-wrap > .foodord-lockmark {
    right: auto;
    left: 12px;
}

body.foodord-rtl-mode .foodord-input-wrap > .foodord-lockmark::after {
    right: auto;
    left: 0;
}
