/**
 * Product Badge & Tag Images – Frontend Styles
 * Anchor: wd-carousel-item / product item (NOT image)
 * Behavior: overlay – allow overflow like price-ratio
 */

/* =====================================================
   CORE ANCHOR (GIỐNG .product-item)
===================================================== */

.wd-carousel-item,
.woocommerce ul.products li.product {
    position: relative;
    overflow: visible;
}

/* =====================================================
   BASE BADGE CONTAINER
===================================================== */

.product-badge-container {
    cursor: unset;
    position: absolute;
    z-index: 60;
    pointer-events: none;
}


/* =====================================================
   INSTALLMENT LABEL – TOP LEFT (AUTO SHINE)
===================================================== */

.product-installment-label {
    top: 6px;
    left: 15px;
}

.single-product .wd-single-fbt .product-installment-label {
    left: 20px;
}

.installment-label-box {
    position: relative;
    overflow: hidden;

    height: 23px;
    padding: 0 9px;
    display: inline-flex;
    align-items: center;

    border-radius: 6px;
    background: rgb(240, 0, 36);
    background-size: cover;
}

/* Hiệu ứng ánh sáng chạy */
.installment-label-box::before {
    content: "";
    position: absolute;
    inset: -40%;
    background: linear-gradient(120deg,
            transparent 35%,
            rgba(255, 255, 255, 0.55) 50%,
            transparent 65%);
    transform: translateX(-60%);
    animation: installment-shine 1.8s linear infinite;
    z-index: 1;
}

/* Text */
.installment-label-text {
    position: relative;
    z-index: 2;

    font-style: normal;
    font-weight: bold;
    font-size: 12px;
    line-height: 1;
    color: #ffffff;
    white-space: nowrap;
}

/* Animation */
@keyframes installment-shine {
    from {
        transform: translateX(-60%);
    }

    to {
        transform: translateX(60%);
    }
}

/* =====================================================
   DISCOUNT LABEL – TOP RIGHT (PREMIUM GLOW)
===================================================== */

.product-discount-label {
    top: 6px;
    right: 18px;
}

/* BOX TRÒN */
.discount-label-box {
    position: relative;
    width: 30px;
    height: 30px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    background: radial-gradient(circle at 30% 30%, #ff4d5e, #e60023);
    border-radius: 50%;

    box-shadow:
        0 4px 10px rgba(221, 36, 118, 0.35),
        0 0 0 0 rgba(240, 0, 36, 0.55);

    transform: translateZ(0);
    animation: discount-pulse 2.6s ease-in-out infinite;
    overflow: hidden;
}

/* LỚP SHIMMER XOAY NHẸ */
.discount-label-box::before {
    content: "";
    position: absolute;
    inset: -30%;
    background: conic-gradient(from 0deg,
            transparent 0deg,
            rgba(255, 255, 255, 0.35) 40deg,
            transparent 80deg);
    opacity: 0.35;
    animation: discount-rotate 5s linear infinite;
}

/* TEXT */
.discount-label-text {
    position: relative;
    z-index: 2;

    font-weight: 800;
    font-size: 11px;
    line-height: 1;
    letter-spacing: 0.3px;
    color: #ffffff;
    white-space: nowrap;

    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

/* =====================================================
   ANIMATIONS
===================================================== */

/* Nhịp phát sáng nhẹ – cảm giác “premium badge” */
@keyframes discount-pulse {
    0% {
        box-shadow:
            0 4px 10px rgba(221, 36, 118, 0.35),
            0 0 0 0 rgba(240, 0, 36, 0.45);
    }

    50% {
        box-shadow:
            0 6px 14px rgba(221, 36, 118, 0.45),
            0 0 0 6px rgba(240, 0, 36, 0.15);
    }

    100% {
        box-shadow:
            0 4px 10px rgba(221, 36, 118, 0.35),
            0 0 0 0 rgba(240, 0, 36, 0.45);
    }
}

/* Shimmer xoay chậm – khác hẳn ánh quét ngang */
@keyframes discount-rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* =====================================================
   IMAGE BADGE (BOTTOM – GIỮ NGUYÊN)
===================================================== */

.product-image-badge {
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

.product-image-badge img {
    width: 100%;
    height: auto;
    display: block;
}

/* =====================================================
   REMOVE IMAGE-BOX CONSTRAINTS (QUAN TRỌNG)
===================================================== */

.wd-carousel-item .product-wrapper,
.wd-carousel-item .product-element-top,
.wd-carousel-item .product-image-link,
.wd-carousel-item .wd-product {
    position: static !important;
    overflow: visible !important;
}

/* =====================================================
   NON-CAROUSEL FALLBACK
===================================================== */

.woocommerce ul.products li.product:not(.wd-carousel-item) {
    position: relative;
    overflow: visible;
}

/* =====================================================
   PRODUCT TAGS (KHÔNG LIÊN QUAN LABEL)
===================================================== */

.product-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.product-tags-container .tag-image {
    height: 40px;
    width: auto;
    object-fit: contain;
    display: block;
}

/* =====================================================
   RESPONSIVE
===================================================== */

@media (max-width: 767px) {

    .product-installment-label {
        left: 10px;
    }

    .product-discount-label {
        right: 11px;
    }

    .installment-label-box,
    .discount-label-box {
        height: 26px;
        padding: 0 12px;
        border-radius: 5px;
    }

    .installment-label-text,
    .discount-label-text {
        font-size: 11px;
    }

    .product-tags-container .tag-image {
        height: 30px;
    }
}

/* =====================================================
   HIGH DPI
===================================================== */

@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

    .product-image-badge img,
    .product-tags-container .tag-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

