/* ==========================================================
   کارت محصول در گرید (آرشیو/شاپ): تصویر، عنوان، قیمت، دکمه‌ها،
   برچسب ناموجود، پیش‌نمایش هاور (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: var(--r-pill) !important;
    box-shadow: none !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: none;
    text-transform: uppercase;
}

.wd-entities-title a:hover,
.wd-product-cats a:hover,
.wrapp-product-price .price .amount {
    color: var(--tamyar-brand-red) !important;
}

.products .product-grid-item {
    border-radius: var(--r-md);
    overflow: hidden;
    background: #fff;
    box-shadow: none;
    transition: .3s ease;
}
.products .product-grid-item:hover {
    box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
}

.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: 16px 2px 8px !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: 0 2px 8px;
}
.wd-product-cats a {
    color: #8e9aab !important;
    transition: color .2s;
}

.wrapp-product-price .price {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: var(--tamyar-brand-red) !important;
    margin: 0 2px 4px;
}

.quick-view a:hover,
.wd-add-btn-replace .button {
    background: var(--tamyar-brand-red) !important;
    color: #fff !important;
}
.wd-add-btn-replace .button {
    border-radius: var(--r-pill) !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    transition: .25s !important;
    box-shadow: none;
    border: none !important;
    text-transform: none !important;
}
.wd-add-btn-replace .button:hover {
    background: var(--tamyar-brand-red-hover) !important;
}
.wd-add-btn-replace .button.added {
    background: #27ae60 !important;
    box-shadow: none;
}
.quick-view a {
    background: #f5f7fa !important;
    border-radius: var(--r-pill) !important;
    padding: 6px 14px !important;
    transition: .25s !important;
    font-size: 13px !important;
}

/* تعداد ستون‌های گرید محصولات */
.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 var(--tamyar-brand-red);
    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: var(--tamyar-brand-red);
    background: 0 0;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: color .2s;
}
.fade-in-block .wd-more-desc-btn:hover {
    color: var(--tamyar-brand-red-hover);
    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: var(--r-pill);
    background: #f0f2f5;
    transition: .2s;
}
.fade-in-block .wd-action-btn a:hover {
    background: var(--tamyar-brand-red);
    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: var(--r-sm);
    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: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 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: var(--r-sm); }
    .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;
    }
}
