/* =========================
   MODERN CART (RTL) - FIXED
   فقط صفحه سبد خرید (Mini Cart خراب نمی‌شود)
   ========================= */

/* 1. کانتینر اصلی اصلاح شده */
@media (min-width: 992px) {
    /* فقط در دسکتاپ فلکس شود */
    body.woocommerce-cart .ct-woocommerce-cart-form { 
        display: flex !important;
        flex-wrap: nowrap !important; /* جلوگیری از شکستن خط */
        gap: 30px;
        align-items: flex-start; /* تراز از بالا */
        max-width: 1200px;
        margin: 0 auto;
    }

    /* جلوگیری از اعمال فلکس روی کل بادی ووکامرس */
    body.woocommerce-cart .woocommerce {
        display: block !important;
    }
}

/* =========================
   فاصله هدر و محتوا - فقط همین صفحه
   ========================= */

body .ct-container-full[data-vertical-spacing="top:bottom"]{ padding-top: 10px !important; }
body .hero-section{ margin-bottom: 10px !important; padding-bottom: 10px !important; }
body .entry-content{ margin-top: 0 !important; padding-top: 0 !important; }
body .entry-content > .woocommerce{ margin-top: 0 !important; padding-top: 0 !important; }
body .woocommerce{ margin-bottom: 10px !important; padding-bottom: 0 !important; }
body .entry-content p{ margin-top: 6px !important; margin-bottom: 6px !important; }
body .wp-block-shortcode{ margin-top: 6px !important; }


/* 2. ستون محصولات */
body.woocommerce-cart .woocommerce-cart-form {
    flex: 1 1 60%;
    min-width: 300px;
}

/* 3. ستون جمع کل (Sticky) */
body.woocommerce-cart .cart-collaterals {
    flex: 1 1 35%;
    min-width: 280px;
}

/* ✅ تراز بالا به بالا (حل اختلاف 15-20px) */
body.woocommerce-cart .ct-woocommerce-cart-form{
    align-items: flex-start !important;
}
body.woocommerce-cart .ct-woocommerce-cart-form > .cart_totals{
    margin-top: 0 !important;
    padding-top: 0 !important;
    align-self: flex-start !important;
}

/* کارت جمع کل */
body.woocommerce-cart .cart_totals {
    position: sticky;
    top: 120px;
    background: #fff;
    padding: 10px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.04);
}
body.woocommerce-cart .cart_totals h2 {
    font-size: 18px;
    font-weight: 800;
    margin: 0 0 20px 0 !important;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

/* 4. استایل کارت محصول (همان دیزاین قبلی) */
body.woocommerce-cart .shop_table { border: none !important; width: 100%; border-collapse: separate; border-spacing: 0 15px; }
body.woocommerce-cart .shop_table thead { display: none; }
body.woocommerce-cart .shop_table td { border: none !important; }

body.woocommerce-cart form.woocommerce-cart-form table.shop_table tbody tr.cart_item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    background: #fff;
    padding: 20px 20px 20px 60px !important; /* پدینگ چپ زیاد برای دکمه حذف */
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.05);
    position: relative;
    gap: 15px;
    margin-bottom: 15px;
}

/* تصویر */
body.woocommerce-cart td.product-thumbnail { flex: 0 0 90px; width: 90px; height: 90px; }
body.woocommerce-cart td.product-thumbnail img {
    width: 100% !important; height: 100% !important;
    object-fit: cover; border-radius: 12px;
}

/* نام محصول */
body.woocommerce-cart td.product-name {
    flex: 1; display: flex; flex-direction: column; justify-content: center;
    padding-right: 15px !important;
}
body.woocommerce-cart td.product-name a {
    font-size: 16px; font-weight: 800; color: #333;
    text-decoration: none; margin-bottom: 5px;
}

/* ✅ دکمه حذف */
body.woocommerce-cart td.product-remove {
    position: absolute !important;
    left: 15px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
}
body.woocommerce-cart a.remove {
    width: 35px !important; height: 35px !important;
    display: flex !important; align-items: center; justify-content: center;
    border-radius: 10px !important; background: #fff0f0 !important;
    color: #fff !important;
    font-size: 20px !important;
    transition: all 0.2s;
}
body.woocommerce-cart a.remove:hover { background: #FDFAF5 !important; color: #fff !important; }

/* ✅ تعداد (همون نسخه‌ای که “منفی” رو درست می‌کرد)
   نکته: فقط داخل صفحه سبد خرید اعمال میشه، پس مینی‌کارت خراب نمیشه */
body.woocommerce-cart td.product-quantity { margin-right: auto; margin-left: 20px; }
body.woocommerce-cart td.product-quantity .quantity {
    display: inline-flex !important;
    align-items: center !important;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 2px;
}

/* آیکون‌های مثبت و منفی Blocksy */
body.woocommerce-cart td.product-quantity .quantity .ct-increase,
body.woocommerce-cart td.product-quantity .quantity .ct-decrease {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 16px;
    color: #555;
    line-height: 1 !important;
}

/* عدد */
body.woocommerce-cart td.product-quantity .quantity .qty {
    width: 100px !important;
    height: 30px !important;
    border: none !important;
    background: transparent !important;
    text-align: center;
    font-weight: bold;
    padding: 0 !important;
}

/* قیمت کل */
body.woocommerce-cart td.product-subtotal { font-weight: 900; color: #C59D5F; font-size: 16px; }

/* 5. کوپن */
body.woocommerce-cart td.actions { padding: 0 !important; background: transparent !important; }
body.woocommerce-cart .coupon { display: flex; gap: 10px; margin-top: 15px; }
body.woocommerce-cart .coupon input {
    flex: 1; border-radius: 10px !important; border: 1px solid #ddd !important;
    padding: 0 15px !important; height: 45px !important;
}
body.woocommerce-cart .coupon button.button {
    background: #f2f2f2 !important; color: #333 !important;
    border: 1px solid #ddd !important; border-radius: 10px !important;
    height: 45px !important; font-weight: bold;
}
body.woocommerce-cart .coupon button.button:hover { background: #e0e0e0 !important; }
body.woocommerce-cart button[name="update_cart"] { display: none !important; }

/* 6. دکمه تسویه حساب */
body.woocommerce-cart .checkout-button {
    background: var(--nikahd-gold, #C59D5F) !important;
    color: #fff !important; padding: 15px !important;
    border-radius: 12px !important; width: 100%; font-weight: 800 !important;
    display: block; text-align: center; margin-top: 20px;
}

/* =========================
   ✅ Shipping Calculator (دکمه مداد برگشت)
   ========================= */
body.woocommerce-cart .shipping-calculator-button {
    display: inline-flex !important; align-items: center; gap: 8px;
    padding: 8px 12px !important; border-radius: 8px !important;
    background: rgba(197, 157, 95, 0.1) !important;
    color: #C59D5F !important; font-size: 13px !important; font-weight: bold !important;
    text-decoration: none !important; border: 1px solid rgba(197, 157, 95, 0.2) !important;
    transition: all 0.2s;
}
body.woocommerce-cart .shipping-calculator-button::before { content: "✎"; font-size: 14px; }
body.woocommerce-cart .shipping-calculator-button:hover { background: rgba(197, 157, 95, 0.2) !important; }

body.woocommerce-cart .shipping-calculator-form {
    margin-top: 15px; background: #fafafa; padding: 15px;
    border-radius: 12px; border: 1px solid #eee;
}
body.woocommerce-cart .shipping-calculator-form p.form-row { margin-bottom: 8px !important; }
body.woocommerce-cart .shipping-calculator-form input,
body.woocommerce-cart .shipping-calculator-form select {
    width: 100%; height: 38px !important; border-radius: 8px !important;
    border: 1px solid #ddd !important; padding: 0 10px !important; font-size: 13px;
    background: #fff !important;
}
body.woocommerce-cart .shipping-calculator-form button.button {
    width: 100%; height: 38px !important; margin-top: 5px;
    background: #333 !important; color: #fff !important; border-radius: 8px !important;
}

/* موبایل */
@media (max-width: 768px) {
    body.woocommerce-cart .woocommerce { flex-direction: column; }

    body.woocommerce-cart form.woocommerce-cart-form table.shop_table tbody tr.cart_item {
        padding: 15px !important;
        justify-content: center;
        text-align: center;
    }

    body.woocommerce-cart td.product-remove {
        position: absolute !important;
        top: 10px !important;
        left: 10px !important;
        transform: none !important;
    }

    body.woocommerce-cart td.product-name { padding: 0 !important; margin-top: 10px; width: 100%; }
    body.woocommerce-cart td.product-quantity { margin: 10px auto; }
    body.woocommerce-cart td.product-subtotal { width: 100%; display: block; margin-top: 5px; }
    body.woocommerce-cart .cart_totals { position: static; }
}

/* =========================
   فاصله هدر و محتوا - فقط همین صفحه
   ========================= */
body.page-id-10271 .ct-container-full[data-vertical-spacing="top:bottom"]{ padding-top: 10px !important; }
body.page-id-10271 .hero-section{ margin-bottom: 10px !important; padding-bottom: 10px !important; }
body.page-id-10271 .entry-content{ margin-top: 0 !important; padding-top: 0 !important; }
body.page-id-10271 .entry-content > .woocommerce{ margin-top: 0 !important; padding-top: 0 !important; }
body.page-id-10271 .woocommerce{ margin-bottom: 10px !important; padding-bottom: 0 !important; }
body.page-id-10271 .entry-content p{ margin-top: 6px !important; margin-bottom: 6px !important; }
body.page-id-10271 .wp-block-shortcode{ margin-top: 6px !important; }

/* استایل خود عدد (Input) */
body.woocommerce-cart td.product-quantity .qty {
    width: 100px !important;
    height: 100% !important;
    border: none !important;
    background: #fff !important;
    color: #333 !important;
    text-align: center !important;
    margin: 0 !important;
    padding: 0 !important;
    -moz-appearance: textfield !important; /* حذف فلش‌های پیش‌فرض مرورگر */
}
