/* ==========================================================
   کارت محصول در گرید (آرشیو/شاپ): تصویر، عنوان، قیمت، دکمه‌ها،
   برچسب ناموجود، پیش‌نمایش هاور (fade-in-block)، جعبه تعداد
   ========================================================== */

.fade-in-block .wrap-quickview-button,
.fade-in-block .wrap-wishlist-button {
    display: none;
}

.out-of-stock.product-label,
.wd-entities-title a {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}
.out-of-stock.product-label {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 38px !important;
    min-width: 120px !important;
    max-width: 220px !important;
    padding: 6px 14px !important;
    margin: 0 !important;
    background: #ef4444 !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    text-align: center !important;
    border: none !important;
    border-radius: 999px !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, .25) !important;
    user-select: none !important;
}
.out-of-stock.product-label::before {
    content: "" !important;
    width: 8px !important;
    height: 8px !important;
    margin-left: 8px !important;
    background: #fff !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
}
.product-labels .out-of-stock {
    background: #e74c3c !important;
    color: #fff !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    letter-spacing: .3px;
    box-shadow: 0 4px 12px rgba(231, 76, 60, .3);
    text-transform: uppercase;
}

.wd-entities-title a:hover,
.wd-product-cats a:hover,
.wrapp-product-price .price .amount {
    color: #c4161c !important;
}

.products .product-grid-item {
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .04);
    transition: .35s cubic-bezier(.25, .46, .45, .94);
    border: 1px solid rgba(0, 0, 0, .03);
}
.products .product-grid-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, .08);
    border-color: rgba(196, 22, 28, .1);
}

.product-element-top {
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    position: relative;
}
.product-element-top img { transition: transform .5s; }
.product-grid-item:hover .product-element-top img { transform: scale(1.04); }

.wd-entities-title {
    font-size: 16px !important;
    font-weight: 600 !important;
    margin: 12px 0 6px !important;
    line-height: 1.4 !important;
}
.wd-entities-title a {
    color: #1a1a2e !important;
    transition: color .2s;
    display: block !important;
    max-width: 100% !important;
}

.wd-product-cats {
    font-size: 13px !important;
    color: #8e9aab !important;
    margin-bottom: 6px;
}
.wd-product-cats a {
    color: #8e9aab !important;
    transition: color .2s;
}

.wrapp-product-price .price {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #c4161c !important;
}

.quick-view a:hover,
.wd-add-btn-replace .button {
    background: #c4161c !important;
    color: #fff !important;
}
.wd-add-btn-replace .button {
    border-radius: 30px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    transition: .3s !important;
    box-shadow: 0 4px 14px rgba(196, 22, 28, .25);
    border: none !important;
    text-transform: none !important;
}
.wd-add-btn-replace .button:hover {
    background: #a01218 !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(196, 22, 28, .35);
}
.wd-add-btn-replace .button.added {
    background: #27ae60 !important;
    box-shadow: 0 4px 14px rgba(39, 174, 96, .3);
}
.quick-view a {
    background: #f5f7fa !important;
    border-radius: 30px !important;
    padding: 6px 14px !important;
    transition: .3s !important;
    font-size: 13px !important;
}
.quick-view a:hover { transform: translateY(-2px); }

/* تعداد ستون‌های گرید محصولات */
.products.wd-products,
.wd-products-element .wd-products {
    --wd-col-lg: 4 !important;
    --wd-col-md: 3 !important;
    --wd-col-sm: 2 !important;
}

/* پیش‌نمایش هاور کارت محصول (توضیحات، اکشن‌های پایین کارت) */
.fade-in-block {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: .5s cubic-bezier(.23, 1, .32, 1);
    transform: translateY(10px);
    visibility: hidden;
}
.product-grid-item:hover .fade-in-block {
    opacity: 1;
    max-height: 300px;
    transform: translateY(0);
    visibility: visible;
    transition-delay: 50ms;
}
.fade-in-block.wd-scroll,
.fade-in-block.wd-scroll .hover-content {
    max-height: none !important;
    opacity: 1 !important;
}
.fade-in-block .wd-more-desc {
    background: #f8f9fc;
    border-radius: 12px;
    padding: 12px 16px;
    margin: 8px 0 12px;
    border-right: 3px solid #c4161c;
    font-size: 13px;
    line-height: 1.6;
    color: #3d4a5c;
}
.fade-in-block .wd-more-desc-btn {
    display: inline-block;
    margin-top: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #c4161c;
    background: 0 0;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: color .2s;
}
.fade-in-block .wd-more-desc-btn:hover {
    color: #a01218;
    text-decoration: underline;
}
.fade-in-block .wd-bottom-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(0, 0, 0, .04);
    margin-top: 6px;
}
.fade-in-block .wd-action-btn a {
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 20px;
    background: #f0f2f5;
    transition: .2s;
}
.fade-in-block .wd-action-btn a:hover {
    background: #c4161c;
    color: #fff;
}
.fade-in-block.wd-scroll {
    transform: none !important;
    animation: none !important;
    transition: none !important;
    visibility: visible !important;
    overflow: visible !important;
}
.fade-in-block.wd-scroll .wd-more-desc-btn { display: none !important; }

/* جعبه تعداد سفارشی (استپر +/-) */
.custom-qty-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0;
    justify-content: flex-end;
    border-radius: 12px;
    overflow: hidden;
}
.custom-qty-wrapper button {
    width: 44px;
    height: 44px;
    border: 0;
    background: #f8fafc;
    color: #111827;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: .25s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.custom-qty-wrapper button:hover { background: #2563eb; color: #fff; }
.custom-qty-wrapper button:active { transform: scale(.95); }
.custom-qty-wrapper .cqty {
    width: 60px;
    height: 44px;
    border: 0;
    outline: 0;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    background: #fff;
    -moz-appearance: textfield;
}
.custom-qty-wrapper .cqty::-webkit-inner-spin-button,
.custom-qty-wrapper .cqty::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.custom-qty-wrapper:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .15);
}
/* هماهنگی رنگ استپر تعداد با برند (این قانون بعد از قانون بالا می‌آید و رنگ آبی را در حالت هاور/فوکوس به قرمز برند تغییر می‌دهد) */
.custom-qty-wrapper button:hover {
    background: var(--tl-primary);
    color: #fff;
}
.custom-qty-wrapper:focus-within {
    border-color: var(--tl-primary);
    box-shadow: 0 0 0 4px rgba(196, 22, 28, .15);
}

@media (max-width: 768px) {
    .products .product-grid-item { border-radius: 12px; }
    .wd-entities-title { font-size: 14px !important; }
    .wrapp-product-price .price { font-size: 16px !important; }
    .wd-add-btn-replace .button { padding: 6px 16px !important; font-size: 13px !important; }
    .fade-in-block {
        opacity: 1 !important;
        max-height: none !important;
        transform: none !important;
        visibility: visible !important;
        padding-top: 8px;
    }
    .fade-in-block .wd-more-desc { font-size: 13px; padding: 10px 14px; }
    .product-grid-item:hover .fade-in-block { transition: none; }
}

@media (max-width: 480px) {
    .products.wd-products,
    .wd-products-element .wd-products {
        --wd-col-sm: 1 !important;
    }
}
