/**
 * Product Card (Custom)
 * Design moderno para cards de produto
 */

.product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #e5e5e5;
    height: 100%;
}

.product-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-4px);
    border-color: #d0d0d0;
}

/* ========================================
   BADGES
======================================== */

.product-card__badges {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
    line-height: 1.2;
    letter-spacing: 0.5px;
}

.badge:after{
    display: none!important;
}

.badge--sale {
    background: #ff4757;
    color: #fff;
}

.badge--new {
    background: #2ed573;
    color: #fff;
}

.badge--featured {
    background: #ffa502;
    color: #fff;
}

/* ========================================
   IMAGEM
======================================== */

.product-card__image {
    position: relative;
    overflow: hidden;
    background: #f8f8f8;
    aspect-ratio: 1 / 1;
}

.product-card__image-link {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

.product-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.product-card__img--hover {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
}

.product-card:hover .product-card__img--hover {
    opacity: 1;
}

.product-card__img--placeholder {
    opacity: 0.5;
}

/* ========================================
   BOTÃO ADICIONAR AO CARRINHO
======================================== */

.product-card__add-to-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 50px;
    background: var(--bs-primary, #007bff);
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    text-align: center;
    margin-top: 12px;
}

.product-card__add-to-cart:hover {
    background: var(--bs-primary-dark, #333);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    text-decoration: none;
}

.product-card__add-to-cart:active {
    transform: translateY(0);
}

.product-card__add-to-cart i {
    font-size: 1rem;
}

.product-card__out-of-stock {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 50px;
    background: #f5f5f5;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #999;
    cursor: not-allowed;
    margin-top: 12px;
}

/* ========================================
   INFORMAÇÕES
======================================== */

.product-card__info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.product-card__title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.4;
    min-height: 1.5em;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card__title a {
    color: #333;
    text-decoration: none!important;
    transition: color 0.2s ease;
}

.product-card__title a:hover {
    color: #000;
}

/* ========================================
   RATING
======================================== */

.product-card__rating {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
}

.product-card__rating .star-rating {
    font-size: 0.875rem;
}

.product-card__rating-count {
    color: #666;
}

.star-rating {
    position: relative;
    display: inline-block;
    font-size: 0.875em;
    line-height: 1;
    font-family: 'star', sans-serif;
    color: #ffd700;
}

.star-rating::before {
    content: '\2605\2605\2605\2605\2605';
    color: #ddd;
    letter-spacing: 2px;
}

.star-rating span {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    white-space: nowrap;
    color: #ffd700;
}

.star-rating span::before {
    content: '\2605\2605\2605\2605\2605';
    letter-spacing: 2px;
}

/* ========================================
   PREÇO
======================================== */

.product-card__price {
    font-size: 1.125rem;
    font-weight: 700;
    margin-top: auto;
}

.product-card__price del {
    font-size: 0.875rem;
    font-weight: 400;
    color: #999;
    margin-right: 6px;
}

.product-card__price ins .amount{
    text-decoration: none!important;
    font-weight: 700;
}

/* WooCommerce price classes */
.product-card__price .woocommerce-Price-amount {
    font-weight: 700;
}

.product-card__price .woocommerce-Price-currencySymbol {
    font-size: 0.875em;
}

/* ========================================
   PARCELAMENTO
======================================== */

.product-card__installments {
    font-size: 0.8125rem;
    color: #3f3f3f;
    font-weight: 500;
    margin-top: 4px;
    line-height: 1.3;
}

.product-card__installments .woocommerce-Price-amount {
    font-weight: 700;
    color: #000;
}

/* ========================================
   LOADING STATE (AJAX)
======================================== */

.product-card.loading {
    pointer-events: none;
    opacity: 0.6;
}

.product-card__add-to-cart.loading {
    position: relative;
    pointer-events: none;
}

.product-card__add-to-cart.loading::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -10px;
    margin-top: -10px;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.product-card__add-to-cart.loading i,
.product-card__add-to-cart.loading span {
    opacity: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

@media (max-width: 768px) {
    .product-card__title {
        font-size: 0.875rem;
        min-height: 2.6em;
    }

    .product-card__price {
        font-size: 1rem;
    }

    .product-card__add-to-cart {
        height: 46px;
        font-size: 0.875rem;
    }

    .product-card__out-of-stock {
        height: 46px;
        font-size: 0.875rem;
    }

    .badge {
        font-size: 0.6875rem;
        padding: 3px 8px;
    }
}

@media (max-width: 480px) {
    .product-card__info {
        padding: 12px;
    }

    .product-card__badges {
        top: 8px;
        left: 8px;
    }
}

/* ========================================
   ACESSIBILIDADE
======================================== */

.product-card:focus-within {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

.product-card__add-to-cart:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* Melhor contraste para screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
