/* ==========================================================================
   1. کانتینر اصلی کارت محصول
   ========================================================================== */
.custom_product_card {
    position: relative;
    background-color: #f7f0ea; /* رنگ پس‌زمینه کرم/نود کارت */
    border-radius: 18px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 12px;
    direction: rtl;
    box-sizing: border-box;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.custom_product_card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px rgba(180, 150, 130, 0.18);
}

/* لینک سراسری کلیک روی کارت */
.custom_product_card .card_full_link {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ==========================================================================
   2. بخش تصویر و بج‌ها
   ========================================================================== */
.custom_product_card .product_img_wrap {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
    background-color: #f0eae4;
}

.custom_product_card .product_thumb_img {
    width: 100%;
    aspect-ratio: 1 / 1.08;
    object-fit: cover;
    display: block;
    mix-blend-mode: multiply; /* ادغام تمیز عکس روی پس‌زمینه نود */
    transition: transform 0.35s ease;
}

.custom_product_card:hover .product_thumb_img {
    transform: scale(1.03);
}

/* بج درصد تخفیف گرد/قرمز */
.custom_product_card .sale_badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: #e53935;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 3px 8px rgba(229, 57, 53, 0.3);
}

/* بج ناموجود */
.custom_product_card .stock_badge.out {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(30, 30, 30, 0.75);
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    z-index: 2;
}

/* گالری شناور روی هاور */
.custom_product_card .hover_gallery {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    display: flex;
    gap: 5px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    border-radius: 8px;
    opacity: 0;
    transition: all 0.25s ease;
    z-index: 3;
}

.custom_product_card:hover .hover_gallery {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.custom_product_card .gallery_thumb {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 2px solid transparent;
    overflow: hidden;
    cursor: pointer;
}

.custom_product_card .gallery_thumb.active {
    border-color: #e53935;
}

.custom_product_card .gallery_thumb_img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==========================================================================
   3. جزئیات متن (عنوان و قیمت)
   ========================================================================== */
.custom_product_card .product_details {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.custom_product_card .product_title {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
    text-align: right;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 42px;
}

.custom_product_card .product_title a {
    color: #2b2b2b;
    text-decoration: none;
    transition: color 0.2s ease;
}

.custom_product_card .product_title a:hover {
    color: #e53935;
}

/* باکس ۲ سطری قیمت چپ‌چین */
.custom_product_card .product_price_box {
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* فرستادن قیمت به سمت چپ در RTL */
    justify-content: flex-end;
    gap: 3px;
    margin-bottom: 12px;
    min-height: 44px;
}

/* قیمت اصلی/فروش با رنگ بولد */
.custom_product_card .product_price_box ins,
.custom_product_card .product_price_box > .woocommerce-Price-amount {
    text-decoration: none;
    color: #24292e; /* یا در صورت تمایل رنگ نارنجی/قرمز #d93829 */
    font-size: 16px;
    font-weight: 800;
}

/* قیمت قبلی خط‌خورده کم‌رنگ */
.custom_product_card .product_price_box del {
    color: #9e9e9e;
    font-size: 12px;
    font-weight: 400;
    text-decoration: line-through;
}

.custom_product_card .product_price_box del .woocommerce-Price-amount {
    color: inherit;
}

.custom_product_card .product_price_box .woocommerce-Price-currencySymbol {
    font-size: 11px;
    font-weight: 500;
    margin-right: 2px;
}

/* ==========================================================================
   4. دکمه خرید تمام عرض
   ========================================================================== */
.custom_product_card .card_action_btn_wrap {
    width: 100%;
    margin-top: auto;
}

.custom_product_card .always_cart_btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 42px;
    background-color: #292d32; /* رنگ مشکی/ذغالی تصویر دوم - یا #e53935 برای قرمز */
    color: #ffffff !important;
    font-size: 13.5px;
    font-weight: 700;
    border-radius: 10px;
    text-decoration: none !important;
    box-sizing: border-box;
    transition: background-color 0.25s ease, transform 0.15s ease;
    cursor: pointer;
}

.custom_product_card .always_cart_btn:hover {
    background-color: #e53935; /* قرمز شدن در حالت هاور */
}

.custom_product_card .always_cart_btn:active {
    transform: scale(0.98);
}

/* دکمه غیرفعال/ناموجود */
.custom_product_card .always_cart_btn.btn-disabled {
    background-color: #cfc7c0;
    color: #6d6660 !important;
}

/* انیمیشن لودینگ آژاکس ووکامرس */
.custom_product_card .always_cart_btn.loading {
    opacity: 0.75;
    position: relative;
    pointer-events: none;
}

.custom_product_card .always_cart_btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: cart_btn_spin 0.6s linear infinite;
}

@keyframes cart_btn_spin {
    to { transform: rotate(360deg); }
}
