/*
 Theme Name:   Publisher Child
 Template:     publisher
 Description:  Child theme for KDarsi.ir  Author:       Your Name
 Version:      1.0.0
*/
/* ------------------------------------------------------------
   1. GLOBAL VARIABLES & RESET (تنظیمات پایه)
   ------------------------------------------------------------ */
:root {
    --brand-orange: #ff6b00;
    --button-gradient: linear-gradient(135deg, #ff6b00 0%, #ff9e00 100%);
    --brand-white: #ffffff;
    --shared-radius: 12px;
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* جلوگیری از اسکرول افقی در کل سایت */
html, body {
    overflow-x: hidden !important;
    width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*, *:before, *:after {
    box-sizing: inherit;
}

/* ------------------------------------------------------------
   2. CART & CHECKOUT FORCE STRUCTURE (اصلاح اجباری عرض جداول)
   ------------------------------------------------------------ */

/* حذف هرگونه محدودیت عرض از کانتینر اصلی جداول در سبد خرید و پرداخت */
.woocommerce-cart .woocommerce-form-cart-reply,
.woocommerce-cart .cart_totals,
.woocommerce-checkout #customer_details,
.woocommerce-checkout #order_review_heading,
.woocommerce-checkout #order_review,
.woocommerce-checkout #payment {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* تبدیل جداول به بلوک‌های تک‌ستون برای ریسپانسیو کامل */
.woocommerce-cart table.cart, 
.woocommerce-checkout table.shop_table,
.woocommerce-checkout #order_review table.shop_table,
.woocommerce-checkout table.shop_table tr,
.woocommerce-checkout table.shop_table td {
    display: block !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    float: none !important;
}

/* اصلاح ردیف‌ها برای جلوگیری از فشرده شدن */
.woocommerce-cart table.cart tr, 
.woocommerce-checkout table.shop_table tr {
    width: 100% !important;
    margin-bottom: 20px !important;
    background: #ffffff !important;
    border-radius: 15px !important;
    padding: 15px !important;
    border: 1px solid #eeeeee !important;
}

/* ------------------------------------------------------------
   3. PRODUCT BUTTON STYLING (زیباسازی دکمه‌های محصولات)
   ------------------------------------------------------------ */

/* استایل دکمه افزودن به سبد خرید در کارت محصولات */
.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product .add_to_cart_button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 50px !important;
    background: var(--button-gradient) !important;
    color: var(--brand-white) !important;
    text-align: center !important;
    padding: 0 10px !important;
    margin-top: 15px !important;
    border-radius: var(--shared-radius) !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    border: none !important;
    box-shadow: 0 4px 10px rgba(255, 107, 0, 0.2) !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
}

.woocommerce ul.products li.product .button:hover,
.woocommerce ul.products li.product .add_to_cart_button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 15px rgba(255, 107, 0, 0.4) !important;
    filter: brightness(1.1) !important;
}

/* دکمه اصلی در صفحه محصول (Single Product) - ارتفاع بلندتر */
.single-product .cart .single_add_to_cart_button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 60px !important;
    min-height: 60px !important; 
    padding: 0 30px !important;
    font-size: 1.3rem !important;
    font-weight: 800 !important;
    background: var(--button-gradient) !important;
    color: var(--brand-white) !important;
    border-radius: 50px !important;
    border: none !important;
    margin: 20px 0 !important;
    box-shadow: 0 8px 20px rgba(255, 107, 0, 0.3) !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
}

/* دکمه ثبت سفارش در صفحه تسویه حساب */
.woocommerce-checkout #place_order {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: 400px !important;
    height: 60px !important;
    margin: 30px auto !important;
    padding: 0 !important;
    font-size: 1.3rem !important;
    background: var(--button-gradient) !important;
    color: var(--brand-white) !important;
    border-radius: 50px !important;
    font-weight: 800 !important;
    border: none !important;
    box-shadow: 0 10px 20px rgba(255, 107, 0, 0.3) !important;
    text-decoration: none !important;
}
/* انتقال جزئیات دانلود به بالای صفحه برای دسترسی سریع کاربر */
.woocommerce-order-received .woocommerce-order-overview,
.woocommerce-order-received .woocommerce-order-details {
    display: flex !important;
    flex-direction: column !important;
}

.woocommerce-order-received .woocommerce-order-details {
    order: -1 !important; /* جابجایی به بالا */
    margin-bottom: 30px !important;
}
/* ------------------------------------------------------------
   4. DIGIKALA STYLE STICKY BUTTON (دکمه شناور موبایل)
   ------------------------------------------------------------ */

@media (max-width: 768px) {
    /* ایجاد دکمه شناور در پایین صفحه موبایل */
    .single-product .cart .single_add_to_cart_button,
    .woocommerce-cart .wc-proceed-to-checkout a.button {
        position: fixed !important;
        bottom: 20px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 90% !important;
        max-width: 400px !important;
        z-index: 9999 !important;
        height: 60px !important;
        font-size: 1.2rem !important;
        font-weight: 800 !important;
        background: var(--button-gradient) !important;
        color: white !important;
        border-radius: 50px !important;
        box-shadow: 0 10px 30px rgba(255, 107, 0, 0.4) !important;
        border: none !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* حذف کامل سایه body::after */
    body::after {
        display: none !important;
    }

    /* فاصله در پایین بدنه برای اینکه دکمه روی محتوا را نپوشاند */
    body {
        padding-bottom: 100px !important;
    }

    /* اصلاح عرض کانتینرها در موبایل */
    main, article, .container, .site-content, .entry-content {
        width: 100% !important;
        box-sizing: border-box !important;
    }
    /* ------------------------------------------------------------
   2. EXTREME CLEANUP (حذف اجباری عناصر مزاحم)
   ------------------------------------------------------------ */

.woocommerce-message, 
.woocommerce-message .button, 
.woocommerce-message p,
.cart-notification,
.return-to-shop,
.woocommerce-cart .actions,
.woocommerce-cart .update_cart,
.woocommerce-cart input[name="update_cart"],
.woocommerce-cart .cart-subtotal,
.woocommerce-cart .product-subtotal,
.woocommerce-cart .product-quantity,
.woocommerce-cart table.cart td.product-thumbnail,
.woocommerce-cart table.cart td.product-quantity,
.woocommerce-cart table.cart td.product-subtotal,
.woocommerce-cart table.cart img,
.woocommerce-cart table.cart thead,
.woocommerce-checkout .product-thumbnail,
.woocommerce-checkout img,
.woocommerce-checkout .product-quantity,
.woocommerce-checkout .cart-subtotal,
.woocommerce-checkout .order-subtotal,
.woocommerce-checkout #order_review .product-subtotal,
.woocommerce-checkout thead,
.woocommerce-checkout table.shop_table thead {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}
}

/* ------------------------------------------------------------
   5. ORDER RECEIVED PAGE (طراحی مدرن صفحه دانلود)
   ------------------------------------------------------------ */

/* کانتینر اصلی صفحه سپاسگزاری */
.woocommerce-order-received .woocommerce {
    max-width: 800px !important;
    margin: 0 auto !important;
    padding: 20px !important;
}

/* تبدیل جدول به کارت‌های شیک */
.woocommerce-order-received table.shop_table {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.woocommerce-order-received table.shop_table thead {
    display: none !important;
}

.woocommerce-order-received table.shop_table tr {
    display: block !important;
    width: 100% !important;
    background: #ffffff !important;
    border-radius: 20px !important;
    margin-bottom: 25px !important;
    padding: 25px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08) !important;
    border: 1px solid #f0f0f0 !important;
    text-align: center !important;
}

.woocommerce-order-received table.shop_table td {
    display: block !important;
    width: 100% !important;
    border: none !important;
    padding: 10px 0 !important;
    text-align: center !important;
}

/* نام محصول */
.woocommerce-order-received table.shop_table td.product-name {
    font-size: 1.4rem !important;
    font-weight: 800 !important;
    color: #333 !important;
    margin-bottom: 15px !important;
}

/* --- جادوی اصلی: استایل دکمه دانلود --- */
.woocommerce-order-received .woocommerce-downloadable-link--product {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: var(--button-gradient) !important; /* استفاده از همان گرادینت اصلی سایت */
    color: #ffffff !important;
    padding: 15px 40px !important;
    border-radius: 50px !important;
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    box-shadow: 0 8px 20px rgba(255, 107, 0, 0.3) !important;
    transition: all 0.3s ease !important;
    margin-top: 10px !important;
}

.woocommerce-order-received .woocommerce-downloadable-link--product:hover {
    transform: translateY(-3px) scale(1.05) !important;
    box-shadow: 0 12px 25px rgba(255, 107, 0, 0.4) !important;
    filter: brightness(1.1) !important;
}

/* اضافه کردن آیکون دانلود قبل از متن */
.woocommerce-order-received .woocommerce-downloadable-link--product::before {
    content: '⬇' !important; 
    margin-left: 10px !important;
    font-size: 1.4rem !important;
}

/* --- حذف اطلاعات اضافی و انقضا --- */
/* حذف ستون‌های مربوط به تعداد، تاریخ و انقضا که در جدول هستند */
.woocommerce-order-received table.shop_table td:not(.product-name):not(.woocommerce-downloadable-link--product),
.woocommerce-order-received table.shop_table td.product-quantity,
.woocommerce-order-received table.shop_table td.download-expiry,
.woocommerce-order-received table.shop_table td.download-remaining {
    display: none !important; /* حذف کامل از دید کاربر */
}

/* استایل پیام موفقیت (Order Received) */
.woocommerce-order-received h2 {
    font-size: 2rem !important;
    font-weight: 900 !important;
    color: #2ecc71 !important; /* سبز برای تایید پرداخت */
    text-align: center !important;
    margin-bottom: 40px !important;
}

/* ریسپانسیو برای موبایل */
@media (max-width: 768px) {
    .woocommerce-order-received .woocommerce {
        padding: 15px !important;
    }
    
    .woocommerce-order-received table.shop_table tr {
        padding: 20px !important;
    }

    .woocommerce-order-received .woocommerce-downloadable-link--product {
        width: 100% !important; /* دکمه در موبایل تمام عرض باشد */
        font-size: 1.1rem !important;
    }
}
