/* =========================================================
   PRODUCT CARD — Loja da Barba
   Card reutilizável para vitrines (Destaques, módulos, etc.)
   Para reverter: remova product-card.css e product-card.js do header.twig
   ========================================================= */

:root {
    --ldb-price-regular: var(--ldb-ink);
    --ldb-price-striked: #9CA3A0;
    --ldb-price-promo-label: var(--ldb-ink);
    --ldb-price-promo-value: var(--ldb-gold-hover);
    --ldb-price-tax: #9CA3A0;
    --ldb-title: #5C6670;
    --ldb-title-hover: var(--ldb-ink);
    /* Selo de desconto — troque estes valores para testar outros tons de verde */
    --ldb-discount-bg: #E6F0EA;
    --ldb-discount-text: #2F5E48;
    --ldb-discount-border: #C5D9CE;
}

/* --- Showcase wrapper --- */
.ldb-product-showcase {
    margin-bottom: 28px;
}

.ldb-product-listing {
    margin-bottom: 24px;
}

.ldb-product-showcase__heading {
    margin: 0 0 18px;
    font-family: "Lexend", sans-serif;
    font-size: 22px;
    font-weight: 600;
    color: var(--ldb-green, var(--ldb-ink));
    text-align: center;
}

.ldb-product-showcase__grid.productrow {
    display: flex;
    flex-wrap: wrap;
    margin-left: -10px;
    margin-right: -10px;
}

.ldb-product-showcase__grid .product-layout {
    margin-bottom: 20px;
    padding-left: 10px;
    padding-right: 10px;
}

/* --- Card base (neutraliza .product-thumb legado do CiMart) --- */
.ldb-product-showcase .ldb-product-card.product-thumb,
.ldb-product-carousel .ldb-product-card.product-thumb {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
    margin: 0;
    padding: 0 !important;
    border: 1px solid var(--ldb-border);
    border-radius: 12px;
    background: #fff !important;
    box-shadow: 0 2px 8px rgba(30, 57, 42, 0.06);
    cursor: pointer;
    transition: box-shadow 0.22s cubic-bezier(0.25, 1, 0.5, 1),
                transform 0.22s cubic-bezier(0.25, 1, 0.5, 1);
}

.ldb-product-showcase .ldb-product-card.product-thumb:hover .button-group,
.ldb-product-carousel .ldb-product-card.product-thumb:hover .button-group {
    display: none !important;
    opacity: 0 !important;
    bottom: auto !important;
}

.ldb-product-showcase .ldb-product-card:hover,
.ldb-product-showcase .ldb-product-card:focus-within,
.ldb-product-carousel .ldb-product-card:hover,
.ldb-product-carousel .ldb-product-card:focus-within {
    box-shadow: 0 8px 24px rgba(30, 57, 42, 0.12);
    transform: translateY(-2px);
}

/* Link invisível cobre o card inteiro (exceto favoritos) */
.ldb-product-card__stretched-link {
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: 12px;
    text-decoration: none;
}

.ldb-product-card__stretched-link:focus-visible {
    outline: 2px solid var(--ldb-gold);
    outline-offset: 2px;
}

/* Neutraliza regras legadas do CiMart para cards da vitrine */
.ldb-product-showcase .ldb-product-card .button-group,
.ldb-product-carousel .ldb-product-card .button-group {
    display: none !important;
}

.ldb-product-showcase .ldb-product-card .caption,
.ldb-product-carousel .ldb-product-card .caption {
    display: none;
}

/* --- Imagem: fundo branco unificado (premium, sem “caixa” cinza) --- */
.ldb-product-card__media {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    width: 100%;
    padding: 8px 8px 0;
    background: #fff;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
}

.ldb-product-card__media > picture {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    max-width: 100%;
    margin: 0;
}

.ldb-product-card__image {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    margin: 0 auto;
    object-fit: contain;
    transition: transform 0.28s cubic-bezier(0.25, 1, 0.5, 1);
}

.ldb-product-card:hover .ldb-product-card__image,
.ldb-product-card:focus-within .ldb-product-card__image {
    transform: scale(1.04);
}

/* --- Badge % OFF na imagem --- */
.ldb-product-card__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 8px;
    border-radius: 4px;
    background: var(--ldb-cta, #2e7d32);
    color: #fff;
    border: 0;
    font-family: "Lexend", sans-serif;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* --- Favoritos --- */
.ldb-product-card__wishlist {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 4;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.94);
    color: var(--ldb-ink);
    box-shadow: 0 2px 8px rgba(30, 57, 42, 0.1);
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.ldb-product-card__wishlist:hover,
.ldb-product-card__wishlist:focus {
    background: #fff;
    color: var(--ldb-gold);
    transform: scale(1.08);
    outline: none;
}

.ldb-product-card__wishlist:focus-visible {
    outline: 2px solid var(--ldb-gold);
    outline-offset: 2px;
}

.ldb-product-card__wishlist.is-active,
.ldb-product-card__wishlist.is-active:hover {
    color: var(--ldb-gold);
}

/* --- Corpo do card --- */
.ldb-product-card__body {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    padding: 2px 12px 14px;
    text-align: left;
    pointer-events: none;
}

.ldb-product-card__title {
    margin: 0 0 6px;
    font-family: "Lexend", sans-serif;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.35;
    min-height: 35px;
    color: #3d3d3d;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.ldb-product-showcase .ldb-product-card:hover .ldb-product-card__title,
.ldb-product-carousel .ldb-product-card:hover .ldb-product-card__title {
    color: var(--ldb-title-hover);
}

/* --- Avaliações (média + estrelas + quantidade) --- */
.ldb-product-card__rating {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 5px;
    margin: 0 0 10px;
    min-height: 16px;
    font-family: "Lexend", sans-serif;
    line-height: 1;
}

/* Reserva altura no carrossel/grade quando não há avaliações */
.ldb-product-card__rating--empty {
    visibility: hidden;
}

.ldb-product-card__rating-value {
    color: #1a1a1a;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.ldb-product-card__rating-stars {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    height: 12px;
    line-height: 1;
}

.ldb-product-card__rating-stars .fa {
    display: block;
    font-size: 11px;
    line-height: 1;
    width: 11px;
    color: #fc0 !important;
}

.ldb-product-card__rating-stars .fa-star-o {
    opacity: 0.35;
}

.ldb-product-card__rating-count {
    color: #8a8a8a;
    font-size: 12px;
    font-weight: 400;
    line-height: 1;
}

/* --- Oferta / preço (hierarquia estilo Magalu: PIX em destaque) --- */
.ldb-product-card__offer {
    margin-top: auto;
    width: 100%;
    text-align: left;
}

.ldb-product-card__offer-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}

.ldb-price--old {
    color: var(--ldb-price-striked);
    font-size: 13px;
    font-weight: 400;
    text-decoration: line-through;
    line-height: 1.2;
    flex-shrink: 0;
    white-space: nowrap;
}

.ldb-price__discount {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--ldb-discount-bg);
    color: var(--ldb-discount-text);
    border: 1px solid var(--ldb-discount-border);
    font-family: "Lexend", sans-serif;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
}

.ldb-product-card__hero-price {
    margin: 0;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px 8px;
    line-height: 1.15;
    max-width: 100%;
    overflow: hidden;
}

.ldb-product-card__hero-amount {
    color: #1a1a1a;
    font-family: "Lexend", sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    flex-shrink: 0;
    white-space: nowrap;
}

.ldb-product-card__hero-price--promo .ldb-product-card__hero-amount {
    color: var(--ldb-price-promo-value, var(--ldb-gold-hover));
}

.ldb-product-card__hero-label {
    color: #6b6b6b;
    font-size: 13px;
    font-weight: 500;
}

.ldb-product-card__installment {
    display: block;
    margin: 6px 0 0;
    color: #6b6b6b;
    font-family: "Lexend", sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.ldb-product-card__pix {
    display: block;
    margin: 5px 0 0;
    color: var(--ldb-cta, #2e7d32);
    font-family: "Lexend", sans-serif;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.ldb-price--tax {
    display: block;
    margin-top: 4px;
    color: var(--ldb-price-tax);
    font-size: 11px;
    font-weight: 400;
}

/* Compat: regras antigas de preço usadas na PDP / outros blocos */
.ldb-product-card__price {
    margin: 0;
    margin-top: auto;
    padding-top: 4px;
    width: 100%;
    line-height: 1.35;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    text-align: left;
}

.ldb-price {
    display: block;
}

.ldb-price--reserved {
    display: none;
}

.ldb-price--regular {
    color: var(--ldb-price-regular);
    font-size: 19px;
    font-weight: 700;
}

.ldb-price--promo {
    display: block;
    width: 100%;
    line-height: 1.15;
}

.ldb-price__amount {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 5px;
    max-width: 100%;
}

.ldb-price__value {
    display: inline;
    color: var(--ldb-price-promo-value);
    font-size: 21px;
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
}

/*
  Alternativas de tom (substitua as variáveis em :root):

  Escuro premium:
    --ldb-discount-bg: var(--ldb-ink);
    --ldb-discount-text: var(--ldb-gold);
    --ldb-discount-border: var(--ldb-ink);

  Menta suave:
    --ldb-discount-bg: #DFF1E7;
    --ldb-discount-text: #1B4332;
    --ldb-discount-border: #B7DEC7;
*/

/* --- Mobile --- */
@media (max-width: 767px) {
    .ldb-product-showcase {
        margin-bottom: 20px;
    }

    .ldb-product-showcase__heading {
        margin-bottom: 14px;
        font-size: 18px;
    }

    .ldb-product-showcase__grid.productrow {
        margin-left: -6px;
        margin-right: -6px;
    }

    .ldb-product-showcase__grid .product-layout {
        margin-bottom: 12px;
        padding-left: 6px;
        padding-right: 6px;
    }

    .ldb-product-card__media {
        padding: 6px 6px 0;
    }

    .ldb-product-card__body {
        padding: 2px 10px 12px;
    }

    .ldb-product-card__title {
        font-size: 12px;
        font-weight: 400;
        min-height: 32px;
        margin-bottom: 4px;
    }

    .ldb-product-card__hero-price {
        gap: 4px 5px;
    }

    .ldb-product-card__hero-amount {
        font-size: 16px;
    }

    .ldb-product-card__hero-price--promo .ldb-price--old {
        font-size: 11px;
    }

    .ldb-product-card__badge {
        top: 8px;
        left: 8px;
        padding: 3px 6px;
        font-size: 10px;
    }

    .ldb-product-card__hero-label {
        font-size: 12px;
    }

    .ldb-product-card__installment {
        margin-top: 5px;
        font-size: 12px;
    }

    .ldb-product-card__pix {
        margin-top: 4px;
        font-size: 14px;
    }

    .ldb-price__value {
        font-size: clamp(14px, 4.2vw, 17px);
    }

    .ldb-price__discount {
        font-size: 10px;
        padding: 2px 6px;
    }

    .ldb-product-card__wishlist {
        width: 32px;
        height: 32px;
        top: 8px;
        right: 8px;
        font-size: 13px;
    }
}

@media (max-width: 991px) {
    .ldb-product-showcase__grid .product-layout {
        width: 50%;
    }
}

/* --- Fase 7: animação do coração --- */
@keyframes ldb-heart-pop {
    0% { transform: scale(1); }
    35% { transform: scale(1.22); }
    70% { transform: scale(0.94); }
    100% { transform: scale(1); }
}

.ldb-product-card__wishlist.is-animating {
    animation: ldb-heart-pop 0.42s cubic-bezier(0.25, 1, 0.5, 1);
}

.ldb-product-card__wishlist.is-loading {
    opacity: 0.65;
    cursor: wait;
    pointer-events: none;
}

.ldb-product-card__wishlist.is-loading i {
    opacity: 0.5;
}

/* --- Fase 7: toasts --- */
:root {
    --ldb-toast-gap: 10px;
    --ldb-toast-offset-top: calc(var(--ldb-top-advantage-height, 40px) + 76px);
}

@media (max-width: 767px) {
    :root {
        --ldb-toast-offset-top: var(
            --ldb-mobile-sticky-top,
            calc(var(--ldb-top-advantage-height, 34px) + var(--ldb-mobile-header-height, 56px))
        );
    }

    body.ldb-header-scrolled {
        --ldb-toast-offset-top: calc(var(--ldb-mobile-header-height, 56px) + 2px);
    }
}

#alert.ldb-product-toast-host {
    z-index: 1000040;
    top: calc(var(--ldb-toast-offset-top) + var(--ldb-toast-gap) + env(safe-area-inset-top, 0px)) !important;
    right: 16px !important;
    left: auto !important;
    width: auto !important;
    max-width: min(380px, calc(100vw - 32px));
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none;
}

#alert.ldb-product-toast-host .alert {
    pointer-events: auto;
    margin-bottom: 10px;
    box-shadow: 0 8px 24px rgba(184, 146, 58, 0.18);
}

.ldb-product-toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, #FFF8E7 0%, #F5EDD6 100%);
    color: var(--ldb-ink);
    border: 1px solid rgba(184, 146, 58, 0.35);
    box-shadow: 0 8px 24px rgba(184, 146, 58, 0.18);
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.28s ease, transform 0.28s ease;
    pointer-events: auto;
}

.ldb-product-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.ldb-product-toast.is-hiding {
    opacity: 0;
    transform: translateY(-8px);
}

.ldb-product-toast--error {
    background: linear-gradient(135deg, #FFF0F0 0%, #FBE4E4 100%);
    color: #7a2e2e;
    border-color: rgba(122, 46, 46, 0.25);
}

.ldb-product-toast--info {
    background: linear-gradient(135deg, #F3F8F5 0%, #E6F0EA 100%);
    color: var(--ldb-ink);
    border-color: rgba(30, 57, 42, 0.18);
}

.ldb-product-toast__message a {
    color: var(--ldb-gold-hover);
    font-weight: 600;
    text-decoration: underline;
}

.ldb-product-toast__message a:hover,
.ldb-product-toast__message a:focus {
    color: var(--ldb-ink);
}

.ldb-product-toast .fa {
    margin-top: 2px;
    font-size: 16px;
    color: var(--ldb-gold-hover);
    flex-shrink: 0;
}

.ldb-product-toast__message {
    flex: 1 1 auto;
    font-size: 14px;
    line-height: 1.4;
}

.ldb-product-toast__close {
    flex-shrink: 0;
    border: 0;
    background: transparent;
    color: #5C6670;
    font-size: 20px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
}

.ldb-product-toast__close:hover,
.ldb-product-toast__close:focus {
    color: var(--ldb-ink);
    outline: none;
}

.ldb-product-toast__close:focus-visible {
    outline: 2px solid var(--ldb-gold);
    outline-offset: 2px;
    border-radius: 4px;
}

/* --- Fase 7: acessibilidade --- */
@media (prefers-reduced-motion: reduce) {
    .ldb-product-showcase .ldb-product-card.product-thumb,
    .ldb-product-carousel .ldb-product-card.product-thumb,
    .ldb-product-card__image,
    .ldb-product-card__wishlist,
    .ldb-product-toast {
        transition: none !important;
        animation: none !important;
    }

    .ldb-product-showcase .ldb-product-card:hover,
    .ldb-product-showcase .ldb-product-card:focus-within,
    .ldb-product-carousel .ldb-product-card:hover,
    .ldb-product-carousel .ldb-product-card:focus-within {
        transform: none;
    }

    .ldb-product-card:hover .ldb-product-card__image,
    .ldb-product-card:focus-within .ldb-product-card__image {
        transform: none;
    }
}
