/* ============================================================
   PRODUCT CARDS — XPLUSS storefront
   - Anti-flash: skeleton overlay until images + JS layout settle
   - Subtle image zoom on hover (4%, 500ms ease-out)
   - Subtle brightness lift on image hover (B)
   - Wishlist button highlights on card hover (C)
   - Adaptive name typography (clamp + JS line-wrap detection)
   - Pill-shaped CTA + Amazon-style cart quantity widget
   ============================================================ */

.product-card {
    position: relative;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1.75rem;
}

.product-card .product-card-content {
    visibility: hidden;
    opacity: 0;
}
.product-card.ready .product-card-content {
    visibility: visible;
    opacity: 1;
    transition: opacity 350ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Skeleton (anti-flash) */
.product-card-skeleton {
    position: absolute;
    inset: 0;
    background: #fff;
    z-index: 1;
    padding: 0 0.6rem 1rem;
    opacity: 1;
    pointer-events: none;
    transition: opacity 250ms ease-out;
}
.product-card.ready .product-card-skeleton {
    opacity: 0;
}
.product-card-skeleton-img {
    aspect-ratio: 4 / 5;
    width: 100%;
    border-radius: 6px 6px 0 0;
    margin-bottom: 0.85rem;
    background: linear-gradient(90deg, #eef0f3 0%, #f6f7f9 50%, #eef0f3 100%);
    background-size: 200% 100%;
    animation: pc-shimmer 1.4s infinite;
}
.product-card-skeleton-text,
.product-card-skeleton-btn {
    height: 14px;
    margin: 0 auto 0.6rem;
    border-radius: 4px;
    background: linear-gradient(90deg, #eef0f3 0%, #f6f7f9 50%, #eef0f3 100%);
    background-size: 200% 100%;
    animation: pc-shimmer 1.4s infinite;
}
.product-card-skeleton-text { width: 80%; }
.product-card-skeleton-text-sm { width: 50%; height: 10px; }
.product-card-skeleton-btn {
    height: 32px;
    margin-top: 0.85rem;
    width: 100%;
    border-radius: 999px;
}

@keyframes pc-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Media area */
.product-card-media {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 5;
    background: #f6f7f9;
    border-radius: 6px 6px 0 0;
}
.product-card-media-link {
    display: block;
    width: 100%;
    height: 100%;
}
.product-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                filter 500ms ease-out;
    transform-origin: center;
    will-change: transform;
}
/* Hover: zoom 4% + leve brilho (B) */
.product-card:hover .product-card-image {
    transform: scale(1.04);
    filter: brightness(1.04);
}
.product-card-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aab1ba;
    font-size: 0.85rem;
    background: #f6f7f9;
}

/* Wishlist (heart) */
.product-card-wishlist {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 2;
    transform: scale(1);
    transition: transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 250ms ease-out;
}
/* Hover do card destaca o coração (C) */
.product-card:hover .product-card-wishlist {
    transform: scale(1.12);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Body */
.product-card-body {
    padding: 1rem 0.6rem 0;
    text-align: center;
}
.product-card-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #1d1d1d;
    text-decoration: none;
    font-weight: 600;
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    line-height: 1.25;
    min-height: 2.5em;
    word-break: break-word;
    transition: color 200ms ease;
}
.product-card-name:hover {
    color: #444;
    text-decoration: none;
}
.product-card-name.product-card-name--two-lines {
    font-size: clamp(0.78rem, 1.3vw, 0.9rem);
    line-height: 1.15;
}
.product-card-price {
    margin-top: 0.4rem;
    color: #6c757d;
    font-weight: 600;
    font-size: 0.95rem;
}

/* CTA slot — fixed height to avoid layout shift between button and widget */
.product-card-cta-slot {
    margin-top: 0.85rem;
    min-height: 38px;
    display: flex;
    align-items: stretch;
}

/* Pill-shaped CTAs (no icons, rounded, hover color) */
.product-card-cta {
    border-radius: 999px;
    padding: 0 1rem;
    height: 38px;
    width: 100%;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    text-transform: none;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background-color 200ms ease, color 200ms ease,
                border-color 200ms ease;
    border: 1.5px solid transparent;
}

/* Add to cart (default state — solid dark, hover lifts to highlight) */
.product-card-cta--add {
    background: #1d1d1d;
    color: #fff;
    border-color: #1d1d1d;
}
.product-card-cta--add:hover:not(:disabled) {
    background: #d97706;
    color: #fff;
    border-color: #d97706;
}
.product-card-cta--add:disabled {
    background: #c5c8cc;
    color: #fff;
    border-color: #c5c8cc;
    cursor: not-allowed;
}

/* Ver opções (outline variant) */
.product-card-cta--options {
    background: transparent;
    color: #1d1d1d;
    border-color: #1d1d1d;
}
.product-card-cta--options:hover {
    background: #1d1d1d;
    color: #fff;
    border-color: #1d1d1d;
    text-decoration: none;
}

/* ===== Cart quantity widget (Amazon-style: − N no carrinho +) ===== */
.product-card-cart-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 38px;
    border: 1.5px solid #1d1d1d;
    border-radius: 999px;
    background: #fff;
    overflow: hidden;
    transition: border-color 200ms ease;
}
.product-card-cart-control:hover {
    border-color: #d97706;
}
.product-card-cart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 100%;
    background: transparent;
    color: #1d1d1d;
    border: none;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 150ms ease, color 150ms ease;
}
.product-card-cart-btn:hover:not(:disabled) {
    background: #d97706;
    color: #fff;
}
.product-card-cart-btn:disabled {
    color: #c5c8cc;
    cursor: not-allowed;
}
.product-card-cart-btn--minus { border-right: 1px solid #ececec; }
.product-card-cart-btn--plus { border-left: 1px solid #ececec; }
.product-card-cart-btn .fe { font-size: 0.9rem; }
.product-card-cart-count {
    flex: 1;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 600;
    color: #1d1d1d;
    user-select: none;
}

/* HTMX swap feedback — gentle pulse during request */
.product-card-cart-control.htmx-request,
.product-card-cta--add.htmx-request {
    opacity: 0.65;
    pointer-events: none;
}
