/* ========================================
   Lightweight Commerce - RTL Styles
   Optimized for Persian/Farsi
   ======================================== */

/* ========================================
   TABLE OF CONTENTS
   1. Global RTL
   2. Navigation
   3. Cards & Grids
   4. Meta & Breadcrumbs
   5. Forms & Inputs
   6. Comments
   7. WooCommerce
   8. Footer
   9. Responsive
   ======================================== */

/* ========================================
   1. GLOBAL RTL
   ======================================== */

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

/* ========================================
   2. NAVIGATION
   ======================================== */

/* ========================================
   Persian Number Optimization
   ======================================== */

[dir="rtl"] {
    font-family: 'YekanBakh', sans-serif;
}

/* Persian numbers in prices and counts */
[dir="rtl"] .woocommerce-Price-amount,
[dir="rtl"] .price,
[dir="rtl"] .lc-cart-badge,
[dir="rtl"] .lc-search-count,
[dir="rtl"] .woocommerce-result-count,
[dir="rtl"] .woocommerce-pagination .page-numbers {
    font-feature-settings: "tnum";
    font-variant-numeric: normal;
}

/* Remove negative letter-spacing for Persian */
[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3,
[dir="rtl"] h4 {
    letter-spacing: -0.02em;
    /* Keep subtle spacing */
}

/* Better line-height for RTL paragraphs */
[dir="rtl"] p,
[dir="rtl"] .woocommerce-product-details__short-description,
[dir="rtl"] .woocommerce-Tabs-panel {
    line-height: 1.9;
}

.rtl-layout .lc-primary-navigation .menu {
    padding-right: 0;
    padding-left: 0;
}

.rtl-layout .lc-primary-navigation .sub-menu {
    right: 0;
    left: auto;
}

.rtl-layout .lc-primary-navigation .sub-menu .sub-menu {
    right: 100%;
    left: auto;
    margin-right: 0;
    margin-left: 0;
}

.rtl-layout .lc-primary-navigation .menu-item-has-children>a::after {
    margin-left: 0;
    transform: rotate(180deg);
}

/* ========================================
   3. CARDS & GRIDS
   ======================================== */

.rtl-layout .lc-posts-grid,
.rtl-layout .lc-products-grid,
.rtl-layout .lc-related-posts-grid {
    direction: rtl;
}

.rtl-layout .lc-post-card,
.rtl-layout .lc-product-card,
.rtl-layout .lc-related-post {
    text-align: right;
}

/* ========================================
   4. META & BREADCRUMBS
   ======================================== */

.rtl-layout .lc-post-meta,
.rtl-layout .lc-article-meta,
.rtl-layout .lc-product-meta,
.rtl-layout .lc-post-card-meta {
    direction: rtl;
}

.rtl-layout .lc-breadcrumbs-list {
    direction: rtl;
}

.rtl-layout .lc-breadcrumb-separator-icon {
    transform: rotate(180deg);
}

/* ========================================
   5. FORMS & INPUTS
   ======================================== */

.rtl-layout input[type="text"],
.rtl-layout input[type="email"],
.rtl-layout input[type="url"],
.rtl-layout input[type="password"],
.rtl-layout input[type="search"],
.rtl-layout input[type="number"],
.rtl-layout input[type="tel"],
.rtl-layout textarea,
.rtl-layout select {
    direction: rtl;
    text-align: right;
}

.rtl-layout .lc-search-form-inner {
    direction: rtl;
}

/* ========================================
   6. COMMENTS
   ======================================== */

.rtl-layout .comment-list,
.rtl-layout .lc-comment-list {
    padding-right: 0;
    padding-left: 0;
}

.rtl-layout .comment .children,
.rtl-layout .lc-comment-list .children {
    padding-right: 2rem;
    padding-left: 0;
    border-right: 1px solid var(--lc-color-border, #e0e0e0);
    border-left: none;
}

.rtl-layout .lc-comment-body {
    direction: rtl;
}

/* ========================================
   7. WOOCOMMERCE
   ======================================== */

/* Tables */
.rtl-layout .woocommerce table.shop_table,
.rtl-layout .woocommerce-cart table.shop_table {
    text-align: right;
}

.rtl-layout .woocommerce table.shop_table thead th,
.rtl-layout .woocommerce-cart table.shop_table thead th {
    text-align: right;
}

/* Products Grid */
.rtl-layout .woocommerce ul.products,
.rtl-layout .woocommerce-page ul.products {
    margin-right: 0;
    margin-left: 0;
    padding-right: 0;
    padding-left: 0;
}

/* Forms */
.rtl-layout .woocommerce form .form-row {
    float: right;
    text-align: right;
}

.rtl-layout .woocommerce form .form-row-first {
    float: right;
    margin-left: 4%;
    margin-right: 0;
}

.rtl-layout .woocommerce form .form-row-last {
    float: left;
    margin-left: 0;
    margin-right: 0;
}

/* Payment */
.rtl-layout .woocommerce #payment .payment_methods li {
    text-align: right;
}

.rtl-layout .woocommerce #payment .payment_methods li input {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* Cart Totals */
.rtl-layout .woocommerce .cart_totals {
    float: left;
    text-align: right;
}

/* Buttons */
.rtl-layout .woocommerce a.button,
.rtl-layout .woocommerce button.button {
    float: left;
}

.rtl-layout .woocommerce a.button.alt,
.rtl-layout .woocommerce button.button.alt {
    float: left;
}

/* Notices */
.rtl-layout .woocommerce-message,
.rtl-layout .woocommerce-info,
.rtl-layout .woocommerce-error {
    text-align: right;
}

.rtl-layout .woocommerce-message .button,
.rtl-layout .woocommerce-info .button,
.rtl-layout .woocommerce-error .button {
    float: left;
    margin-right: 1rem;
    margin-left: 0;
}

/* Product Meta */
.rtl-layout .woocommerce div.product .product_meta>span {
    display: block;
    text-align: right;
}

/* Star Rating */
.rtl-layout .woocommerce .star-rating {
    float: right;
}

.rtl-layout .woocommerce .star-rating::before {
    left: 0;
    right: 0;
}

.rtl-layout .woocommerce .star-rating span {
    float: right;
    left: auto;
    right: 0;
}

/* Quantity Input */
.rtl-layout .woocommerce .quantity .qty {
    direction: ltr;
    text-align: center;
}

/* ========================================
   8. FOOTER
   ======================================== */

.rtl-layout .lc-footer-inner {
    text-align: right;
}

.rtl-layout .lc-footer-navigation {
    text-align: left;
}

.rtl-layout .lc-footer-navigation .menu {
    justify-content: flex-start;
}

/* ========================================
   9. POST NAVIGATION
   ======================================== */

.rtl-layout .lc-post-navigation .nav-previous {
    text-align: right;
}

.rtl-layout .lc-post-navigation .nav-next {
    text-align: left;
}

/* ========================================
   10. AUTHOR BOX
   ======================================== */

.rtl-layout .lc-author-box {
    text-align: right;
    direction: rtl;
}

/* ========================================
   11. ICONS
   ======================================== */

.rtl-layout .lc-search-submit svg,
.rtl-layout .lc-menu-toggle .lc-menu-icon {
    transform: scaleX(-1);
}

/* ========================================
   12. RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .rtl-layout .lc-footer-inner {
        text-align: center;
    }

    .rtl-layout .lc-footer-navigation {
        text-align: center;
    }

    .rtl-layout .lc-footer-navigation .menu {
        justify-content: center;
    }

    .rtl-layout .lc-post-navigation .nav-previous,
    .rtl-layout .lc-post-navigation .nav-next {
        text-align: right;
    }

    .rtl-layout .woocommerce form .form-row-first,
    .rtl-layout .woocommerce form .form-row-last {
        width: 100%;
        float: none;
        margin-left: 0;
        margin-right: 0;
    }

    .rtl-layout .woocommerce a.button,
    .rtl-layout .woocommerce button.button {
        float: none;
        width: 100%;
    }

    .rtl-layout .comment .children,
    .rtl-layout .lc-comment-list .children {
        padding-right: 1rem;
    }
}

/* ========================================
   13. REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {

    .rtl-layout *,
    .rtl-layout *::before,
    .rtl-layout *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}