/* ===== Tiered Discount Block ("Compre mais e pague menos") ===== */
.tiered-discount {
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #ececec;
    border-radius: 10px;
    background: #fff;
    font-family: inherit;
}

.tiered-discount__header {
    margin-bottom: 18px;
}

.tiered-discount__title {
    margin: 0 0 4px;
    color: #3b0a52;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
}

.tiered-discount__subtitle {
    margin: 0;
    color: #2b2b2b;
    font-size: 15px;
    line-height: 1.3;
}

.tiered-discount__progress {
    position: relative;
    margin: 22px 0 24px;
    padding: 0 12px;
}

.tiered-discount__bar {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    height: 6px;
    background: #d9d9d9;
    border-radius: 4px;
    overflow: hidden;
}

.tiered-discount__bar-fill {
    height: 100%;
    background: #16a34a;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.tiered-discount__steps {
    position: relative;
    height: 60px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.tiered-discount__step {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.tiered-discount__step.is-completed .tiered-discount__step-marker {
    background: #16a34a;
}

.tiered-discount__step-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #d9d9d9;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

.tiered-discount__step-label {
    margin-top: 8px;
    color: #2b2b2b;
    font-size: 16px;
    font-weight: 600;
}

.tiered-discount__levels {
    display: flex;
    align-items: stretch;
    gap: 12px;
    flex-wrap: wrap;
}

.tiered-discount__level {
    position: relative;
    flex: 1 1 240px;
    min-width: 240px;
    padding: 16px 16px 14px;
    border-radius: 10px;
    border: 1.5px solid transparent;
}

.tiered-discount__level--current {
    background: #e9f8ee;
    border-color: #bfe7cb;
}

.tiered-discount__level--next {
    background: #fdeaf3;
    border-color: #f5b9d4;
}

.tiered-discount__badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    background: #cfeed7;
    color: #166534;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.tiered-discount__badge--next {
    background: #ec4899;
    color: #fff;
}

.tiered-discount__level-body {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tiered-discount__level-qty {
    color: #2b2b2b;
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
}

.tiered-discount__level-prices {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: auto;
    line-height: 1.1;
}

.tiered-discount__level-old {
    color: #6b6b6b;
    text-decoration: line-through;
    font-size: 13px;
    font-weight: 600;
}

.tiered-discount__level-new {
    color: #16a34a;
    font-size: 20px;
    font-weight: 700;
}

.tiered-discount__arrow {
    align-self: center;
    color: #b5b5b5;
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
}

.tiered-discount__lock {
    color: #2b2b2b;
    font-size: 18px;
}

.tiered-discount__level-text {
    margin: 0;
    color: #2b2b2b;
    font-size: 14px;
    line-height: 1.3;
}

.tiered-discount__level-new-price {
    color: #ec4899;
    font-weight: 700;
}

.tiered-discount__status {
    margin-top: 16px;
    padding: 8px 12px;
    background: #fff3cd;
    border: 1px dashed #f0ad4e;
    border-radius: 6px;
    color: #8a6d3b;
    font-family: monospace;
    font-size: 13px;
    text-align: center;
}

@media (max-width: 600px) {
    .tiered-discount {
        padding: 16px;
    }

    .tiered-discount__title {
        font-size: 18px;
    }

    .tiered-discount__subtitle {
        font-size: 13px;
    }

    .tiered-discount__step-label {
        font-size: 14px;
    }

    .tiered-discount__arrow {
        transform: rotate(90deg);
        align-self: center;
    }

    .tiered-discount__level {
        min-width: 100%;
    }

    .tiered-discount__level-prices {
        align-items: flex-end;
    }
}

/* ==============================================================
   Badge compacto pra cards de listagem (produto/lista*)
   ============================================================== */
.tiered-discount-badge {
    position: relative;
    background: #fff;
    border: 1px solid #c8e6c9;
    border-radius: 8px;
    padding: 8px 12px;
    margin-top: 8px;
    font-size: 13px;
    color: #1b8f4a;
    text-align: left;
    line-height: 1.35;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
}

/* No pé da imagem: absolute pra não empurrar o layout do card. */
/* Estado compacto (padrão) — mesma proporção do selo: só o headline. */
.image-box .tiered-discount-badge {
    position: absolute;
    top: 0;
    left: 0;
    width: 120px;
    max-width: calc(100% - 12px);
    padding: 6px 10px;
    margin: 0;
    z-index: 100;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    max-height: 100px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-box .tiered-discount-badge .tiered-discount-badge__head {
    flex-direction: column;
    align-items: center;
}

.image-box .tiered-discount-badge .tiered-discount-badge__bar,
.image-box .tiered-discount-badge .tiered-discount-badge__achievements {
    display: none;
}

/* Headline em 3 linhas no compacto (formato selo). Cada span numa linha, sem quebra. */
.image-box .tiered-discount-badge .tiered-discount-badge__headline > span {
    display: block;
    white-space: nowrap;
}

.image-box .tiered-discount-badge .tiered-discount-badge__headline-price {
    font-size: 16px;
    font-weight: 700;
}

/* Estado expandido: hover só em desktop (hover: hover) OU classe .is-open (mobile tap). */
@media (hover: hover) {
    .product-inner:hover .image-box .tiered-discount-badge {
        width: 100%;
        max-height: 500px;
    }

    .product-inner:hover .image-box .tiered-discount-badge .tiered-discount-badge__headline {
        display: flex;
        align-items: baseline;
        gap: 5px;
    }

    .product-inner:hover .image-box .tiered-discount-badge .tiered-discount-badge__bar {
        display: flex;
    }

    .product-inner:hover .image-box .tiered-discount-badge .tiered-discount-badge__achievements {
        display: flex;
    }

    .product-inner:hover .image-box .tiered-discount-badge .tiered-discount-badge__head {
        flex-direction: row;
        align-items: flex-start;
    }
}

.image-box .tiered-discount-badge.is-open {
    width: 100%;
    max-height: 500px;
}

.image-box .tiered-discount-badge.is-open .tiered-discount-badge__headline {
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.image-box .tiered-discount-badge.is-open .tiered-discount-badge__achievements {
    display: flex;
}

.image-box .tiered-discount-badge.is-open .tiered-discount-badge__head {
    flex-direction: row;
    align-items: flex-start;
}

/* Mobile: badge menor no top-left, tap abre — mas SEM barra de progressão. */
@media (max-width: 767px) {
    .image-box .tiered-discount-badge {
        max-width: 90px;
        padding: 4px 6px;
        pointer-events: auto;
        cursor: pointer;
    }

    .image-box .tiered-discount-badge .tiered-discount-badge__head {
        gap: 3px;
    }

    .image-box .tiered-discount-badge .tiered-discount-badge__headline {
        font-size: 8px;
        line-height: 1.15;
    }

    .image-box .tiered-discount-badge .tiered-discount-badge__headline-price {
        font-size: 10px;
    }

    .image-box .tiered-discount-badge .tiered-discount-badge__counter {
        font-size: 9px;
        min-width: 26px;
        height: 14px;
        padding: 0 4px;
    }

    /* Expandido no mobile via tap: max-width volta pra 100%, padding padrão. */
    .image-box .tiered-discount-badge.is-open {
        max-width: none;
        padding: 6px 10px;
    }

    .image-box .tiered-discount-badge.is-open .tiered-discount-badge__headline {
        font-size: 11px;
    }

    .image-box .tiered-discount-badge.is-open .tiered-discount-badge__headline-price {
        font-size: 13px;
    }

    /* Barra de progressão nunca aparece no mobile, mesmo com .is-open. */
    .image-box .tiered-discount-badge .tiered-discount-badge__bar,
    .image-box .tiered-discount-badge.is-open .tiered-discount-badge__bar {
        display: none;
    }
}

.tiered-discount-badge__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.tiered-discount-badge__text {
    flex: 1;
    min-width: 0;
}

.tiered-discount-badge__headline {
    display: block;
    color: #1b8f4a;
    font-weight: 500;
}

.tiered-discount-badge__headline strong {
    font-weight: 700;
}

.tiered-discount-badge__counter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 22px;
    padding: 0 8px;
    background: #8a1e3d;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    border-radius: 4px;
    flex-shrink: 0;
}

.tiered-discount-badge__bar {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tiered-discount-badge__achievements {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 8px;
}

.tiered-discount-badge__achievements:empty {
    display: none;
}

.tiered-discount-badge__achievement {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #e8f5ec;
    color: #1b8f4a;
    font-weight: 600;
    font-size: 11px;
    line-height: 1.4;
}

.tiered-discount-badge__achievement::before {
    content: "\2713";
    font-weight: 700;
}

.tiered-discount-badge__bar-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #1b8f4a;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.tiered-discount-badge__bar-marker--end {
    background: #9e9e9e;
    color: #fff;
}

.tiered-discount-badge__bar-track {
    flex: 1;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    position: relative;
}

.tiered-discount-badge__bar-fill {
    display: block;
    height: 100%;
    background: #1b8f4a;
    border-radius: 3px;
    transition: width .2s ease;
}

.tiered-discount-badge__bar-checkpoints {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.tiered-discount-badge__bar-checkpoint {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #8a1e3d;
    box-shadow: 0 0 0 2px #fff;
    z-index: 1;
}

.tiered-discount-badge__bar-checkpoint--achieved {
    background: #8a1e3d;
}

.tiered-discount-badge__bar-fill[data-progress-controlled] {
    width: var(--tiered-badge-progress-width, 0%) !important;
}

/* Estado "promoção completa" (todos os tiers atingidos) */
.tiered-discount-badge.is-completed {
    background: #1b8f4a;
    border-color: #1b8f4a;
}

.tiered-discount-badge.is-completed .tiered-discount-badge__headline {
    color: #fff;
}

.tiered-discount-badge.is-completed .tiered-discount-badge__counter {
    background: #fff;
    color: #1b8f4a;
}

.tiered-discount-badge.is-completed .tiered-discount-badge__bar-marker {
    background: #fff;
    color: #1b8f4a;
}

.tiered-discount-badge.is-completed .tiered-discount-badge__bar-track {
    background: rgba(255, 255, 255, 0.35);
}

.tiered-discount-badge.is-completed .tiered-discount-badge__bar-fill {
    background: #fff;
}

.tiered-discount-badge.is-completed .tiered-discount-badge__bar,
.tiered-discount-badge.is-completed .tiered-discount-badge__achievements {
    display: none;
}
