/* Frontend Badge Styles */

.wcb-sale-badge-wrapper {
    position: absolute;
    z-index: 10;
    pointer-events: none;
}

.wcb-sale-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    line-height: 1;
    position: absolute;
    white-space: nowrap;
    animation: wcb-badge-entrance 0.3s ease-out;
}

@keyframes wcb-badge-entrance {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.wcb-badge-text {
    position: relative;
    z-index: 1;
}

/* Badge vertical layout */
.wcb-badge-percentage {
    line-height: 1.1;
}

.wcb-badge-text-label {
    line-height: 1.1;
    margin-top: 2px;
}

/* Position Classes */
.wcb-position-top-left .wcb-sale-badge {
    left: 0;
    top: 0;
}

.wcb-position-top-right .wcb-sale-badge {
    right: 0;
    top: 0;
}

/* Default Badge (Rectangle) */
.wcb-sale-badge-default {
    /* Styles applied inline from settings */
}

/* Special Badge Shapes */

/* Star Shape */
.wcb-shape-star {
    width: 90px !important;
    height: 90px !important;
    position: relative;
    clip-path: polygon(50% 0%,
            61% 35%,
            98% 35%,
            68% 57%,
            79% 91%,
            50% 70%,
            21% 91%,
            32% 57%,
            2% 35%,
            39% 35%) !important;
}

.wcb-shape-star .wcb-badge-text {
    font-size: 10px;
    font-weight: 700;
    padding: 20px 10px;
    text-align: center;
    z-index: 10;
    position: relative;
    line-height: 1.2;
    word-break: break-word;
    max-width: 50px;
}

/* Burst/Explosion Shape - CENTRO MAIOR */
.wcb-shape-burst {
    width: 100px !important;
    height: 100px !important;
    position: relative;
    background: transparent !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wcb-shape-burst::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: currentColor;
    /* Clip-path modificado para centro maior */
    clip-path: polygon(50% 0%,
            58% 30%,
            95% 30%,
            70% 50%,
            80% 88%,
            50% 70%,
            20% 88%,
            30% 50%,
            5% 30%,
            42% 30%);
    z-index: 0;
}

.wcb-shape-burst::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: currentColor;
    /* Clip-path modificado para centro maior */
    clip-path: polygon(50% 0%,
            58% 30%,
            95% 30%,
            70% 50%,
            80% 88%,
            50% 70%,
            20% 88%,
            30% 50%,
            5% 30%,
            42% 30%);
    transform: rotate(22.5deg);
    opacity: 0.8;
    z-index: 0;
}

.wcb-shape-burst .wcb-badge-text {
    font-size: 10px;
    font-weight: 700;
    padding: 5px;
    text-align: center;
    position: relative;
    z-index: 10;
    line-height: 1.3;
    word-break: break-word;
    max-width: 55px;
    /* Permitir quebra de linha */
    white-space: normal !important;
}

/* Hexagon Shape */
.wcb-shape-hexagon {
    width: 90px !important;
    height: 80px !important;
    position: relative;
    clip-path: polygon(30% 0%,
            70% 0%,
            100% 50%,
            70% 100%,
            30% 100%,
            0% 50%) !important;
}

.wcb-shape-hexagon .wcb-badge-text {
    font-size: 12px;
    padding: 5px;
    text-align: center;
    z-index: 10;
    position: relative;
}

/* Circle Shape */
.wcb-shape-circle {
    width: 80px !important;
    height: 80px !important;
    border-radius: 50% !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wcb-shape-circle .wcb-badge-text {
    font-size: 11px;
    text-align: center;
    padding: 10px;
    line-height: 1.2;
    z-index: 10;
    position: relative;
    /* Permitir quebra de linha */
    white-space: normal !important;
}

/* Ribbon Shape */
.wcb-shape-ribbon {
    position: relative;
    padding: 12px 25px;
    min-width: 90px;
    text-align: center;
    overflow: visible;
    border-radius: 0 !important;
}

.wcb-shape-ribbon::before,
.wcb-shape-ribbon::after {
    content: '';
    position: absolute;
    top: 100%;
    width: 0;
    height: 0;
    border-style: solid;
}

.wcb-shape-ribbon::before {
    left: 0;
    border-width: 12px 12px 0 0;
    border-color: inherit;
    border-right-color: transparent;
    border-bottom-color: transparent;
    filter: brightness(0.7);
}

.wcb-shape-ribbon::after {
    right: 0;
    border-width: 12px 0 0 12px;
    border-color: inherit;
    border-left-color: transparent;
    border-bottom-color: transparent;
    filter: brightness(0.7);
}

.wcb-shape-ribbon .wcb-badge-text {
    font-size: 11px;
    font-weight: 700;
    line-height: 1.3;
    /* Permitir quebra de linha */
    white-space: normal !important;
}

/* Permitir quebra de linha em TODOS os badges especiais */
.wcb-special-badge .wcb-badge-text {
    white-space: normal !important;
}

/* Star também permite quebra de linha */
.wcb-shape-star .wcb-badge-text {
    white-space: normal !important;
}

/* Hexagon também permite quebra de linha */
.wcb-shape-hexagon .wcb-badge-text {
    white-space: normal !important;
}

/* WooCommerce Blocks Integration */
.wp-block-woocommerce-product-image {
    position: relative;
}

.wc-block-grid__product {
    position: relative;
}

/* Hide original WooCommerce sale badge when our plugin is active */
.wc-block-components-product-sale-badge {
    display: none !important;
}

/* WooCommerce Traditional Templates */
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
    position: relative;
}

.woocommerce div.product div.images,
.woocommerce-page div.product div.images {
    position: relative;
}

.woocommerce div.product .woocommerce-product-gallery {
    position: relative;
}

/* Ensure badge is above product image */
.wcb-sale-badge-wrapper {
    z-index: 10 !important;
    pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {

    .wcb-shape-star,
    .wcb-shape-burst,
    .wcb-shape-hexagon,
    .wcb-shape-circle {
        width: 60px;
        height: 60px;
    }

    .wcb-shape-star .wcb-badge-text,
    .wcb-shape-burst .wcb-badge-text,
    .wcb-shape-hexagon .wcb-badge-text,
    .wcb-shape-circle .wcb-badge-text {
        font-size: 9px;
    }

    .wcb-shape-ribbon {
        min-width: 80px;
        padding: 8px 15px;
    }

    .wcb-shape-ribbon .wcb-badge-text {
        font-size: 10px;
    }
}

/* Hover effect for special badges */
.wcb-special-badge {
    transition: transform 0.2s ease;
}

.wcb-sale-badge-wrapper:hover .wcb-special-badge {
    transform: scale(1.05);
}