/* مهستان: نشان تخفیف نقدی فعال روی تصویر کارت محصول در وودمارت. */
.wd-product .product-element-top,
.products .product .product-element-top {
    position: relative;
}

.wd-product .mehestan-loop-cash-badge,
.products .product .mehestan-loop-cash-badge {
    position: absolute;
    z-index: 35;
    top: 36px; /* زیر نشان کوچک گوشه تصویر در قالب وودمارت */
    left: 10px;
    right: auto;
    direction: rtl;
    display: none; /* اگر هوک قالب خارج تصویر باشد، جاوااسکریپت برچسب را به آن منتقل می‌کند */
    align-items: center;
    justify-content: center;
    width: max-content;
    max-width: calc(100% - 20px);
    padding: 8px 11px;
    border: 1px solid rgba(255, 255, 255, 0.58);
    border-radius: 9px;
    background: linear-gradient(125deg, #f48220, #e66b0b);
    box-shadow: 0 4px 13px rgba(166, 71, 6, 0.23);
    color: #ffffff !important;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
    text-align: center;
    pointer-events: none;
    box-sizing: border-box;
}

/* برچسب فقط وقتی داخل خود کانتینر عکس باشد دیده می‌شود. */
.wd-product .product-element-top .mehestan-loop-cash-badge,
.products .product .product-element-top .mehestan-loop-cash-badge {
    display: inline-flex;
}

@media (max-width: 767px) {
    .wd-product .mehestan-loop-cash-badge,
    .products .product .mehestan-loop-cash-badge {
        top: 32px;
        left: 7px;
        max-width: calc(100% - 14px);
        padding: 6px 8px;
        border-radius: 7px;
        font-size: 10px;
    }
}

/* قیمت نقدی فقط در آرشیو وودمارت: هر قیمت یک ردیف مستقل، بدون تغییر منطق محاسبه */
.wd-product .product-element-bottom .wrap-price,
.products .product .product-element-bottom .wrap-price {
    min-width: 0;
    height: auto;
    max-height: none;
    overflow: visible;
}
.wd-product .product-element-bottom .wrap-price > .price:has(.mehestan-loop-promo-prices),
.products .product .product-element-bottom .wrap-price > .price:has(.mehestan-loop-promo-prices) {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    margin: 6px 0 9px !important;
    padding: 0 !important;
    overflow: visible !important;
    text-align: right !important;
    opacity: 1 !important;
    visibility: visible !important;
    line-height: 1.65 !important;
}
.wd-product .wrap-price .price .mehestan-loop-promo-prices,
.products .product .wrap-price .price .mehestan-loop-promo-prices {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    container-type: inline-size;
    gap: 4px;
    direction: rtl;
    color: #222 !important;
    opacity: 1 !important;
    visibility: visible !important;
}
.wd-product .wrap-price .mehestan-loop-promo-top,
.products .product .wrap-price .mehestan-loop-promo-top {
    display: grid !important;
    grid-template-columns: max-content max-content minmax(0, 1fr);
    direction: rtl;
    align-items: center;
    column-gap: 8px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}
.wd-product .wrap-price .mehestan-loop-promo-top .mehestan-loop-cash-label,
.products .product .wrap-price .mehestan-loop-promo-top .mehestan-loop-cash-label {
    flex: 0 0 auto;
    color: #777 !important;
    font-size: 11px !important;
    font-weight: 500;
}
.wd-product .wrap-price .mehestan-loop-promo-percent,
.products .product .wrap-price .mehestan-loop-promo-percent {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    background: #ee7817 !important;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    border-radius: 6px;
    padding: 2px 7px;
    line-height: 1.5 !important;
    font-weight: 800 !important;
    font-size: 11px !important;
    white-space: nowrap;
}
.wd-product .wrap-price .mehestan-loop-promo-old,
.products .product .wrap-price .mehestan-loop-promo-old {
    display: inline-block !important;
    justify-self: end;
    min-width: 0;
    margin: 0 !important;
    white-space: nowrap;
    font-size: 12px !important;
    font-weight: 500 !important;
    opacity: 1 !important;
    visibility: visible !important;
    line-height: 1.6 !important;
}
.wd-product .wrap-price .mehestan-loop-promo-old *,
.products .product .wrap-price .mehestan-loop-promo-old * {
    color: #707070 !important;
    -webkit-text-fill-color: #707070 !important;
    font-size: inherit !important;
    font-weight: 500 !important;
    text-decoration-color: #858585 !important;
}
.wd-product .wrap-price .mehestan-loop-promo-current,
.products .product .wrap-price .mehestan-loop-promo-current {
    display: block !important;
    width: 100%;
    direction: rtl;
    text-align: right;
    opacity: 1 !important;
    visibility: visible !important;
}
.wd-product .wrap-price .mehestan-loop-promo-current *,
.products .product .wrap-price .mehestan-loop-promo-current * {
    color: #242424 !important;
    -webkit-text-fill-color: #242424 !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    line-height: 1.6 !important;
    opacity: 1 !important;
    visibility: visible !important;
}
/* کارت‌های باریک فروشگاه: عدد قبلی داخل ستون خودش جا بگیرد و روی درصد نیفتد. */
@media (max-width: 767px) {
    .wd-product .wrap-price .mehestan-loop-promo-top,
    .products .product .wrap-price .mehestan-loop-promo-top { column-gap: 5px; }
    .wd-product .wrap-price .mehestan-loop-promo-current *,
    .products .product .wrap-price .mehestan-loop-promo-current * { font-size: 13px !important; }
    .wd-product .wrap-price .mehestan-loop-promo-old,
    .products .product .wrap-price .mehestan-loop-promo-old { font-size: 11px !important; }
    .wd-product .wrap-price .mehestan-loop-promo-percent,
    .products .product .wrap-price .mehestan-loop-promo-percent { padding: 2px 5px; }
}
@container (max-width: 205px) {
    .wd-product .wrap-price .mehestan-loop-promo-top,
    .products .product .wrap-price .mehestan-loop-promo-top {
        grid-template-columns: max-content 1fr;
        row-gap: 5px;
    }
    .wd-product .wrap-price .mehestan-loop-promo-old,
    .products .product .wrap-price .mehestan-loop-promo-old {
        grid-column: 1 / -1;
        justify-self: start;
    }
}
