/* Conteúdo Final Ajustado: static/pedidos_farma_rocha_core/css/product_card_v2.css */

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700;900&display=swap');

.product-card {
    font-family: 'Roboto', sans-serif;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07);
    overflow: hidden;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.2s ease;
}

.product-card:hover {
    transform: translateY(-3px);
}

.product-card.out-of-stock {
    filter: grayscale(90%);
    opacity: 0.8;
}

.product-card.out-of-stock::after {
    content: 'Produto Esgotado';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.9);
    color: #333;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 8px;
    z-index: 10;
    text-align: center;
    font-size: 1.1rem;
}

/* ---------------- IMAGEM ---------------- */
.product-image-container {
    position: relative;
    padding: 10px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    background-color: #fafafa;
    overflow: hidden; /* Garante que selos não escapem */
}

.product-image-container img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
}

/* ---------------- SELOS ---------------- */
.badge {
    position: absolute;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    z-index: 5;
}

/* Selo desconto (X%) - canto superior esquerdo */
.badge-discount {
    top: 6px;
    left: 6px;
    background-color: #f39c12;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    font-weight: 800;
}

/* Container dos selos superiores direitos */
.top-right-badges {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 4px;
    z-index: 6;
}

/* Selo G */
.badge-generic {
    background-color: #FFEB3B;
    color: #212529;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4rem;
    font-weight: 900;
    border: 2px solid rgba(0, 0, 0, 0.15);
}

/* Selo Oferta */
.badge-offer {
    background-color: #e74c3c;
    animation: blink-animation 1.5s infinite;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 12px;
}

/* Selo Economize */
.badge-savings {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #3498db;
    font-size: 11px;
    white-space: nowrap;
    padding: 3px 8px;
    border-radius: 12px;
}

@keyframes blink-animation {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.75; transform: scale(1.08); }
}

/* ---------------- INFORMAÇÕES ---------------- */
.product-info {
    padding: 0 12px 12px 12px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-title {
    font-size: 11px;
    font-weight: 500;
    color: #2c3e50;
    margin: 0;
    height: 28px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-lab {
    font-size: 9.5px;
    color: #7f8c8d;
    font-weight: 400;
    margin: 3px 0 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 5px;
}

.product-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 6px;
}

.product-price {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.product-price--current {
    color: #00529e;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}

.product-price--old {
    text-decoration: line-through;
    color: #95a5a6;
    font-size: 10px;
    margin-top: 2px;
}

/* ---------------- BOTÕES ---------------- */
.product-action {
    position: relative;
    width: 70px;
    height: 28px;
}

.buy-button,
.quantity-control {
    position: absolute;
    right: 0;
    top: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.buy-button {
    background-color: #007d43;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.buy-button svg {
    width: 14px;
    height: 14px;
    fill: white;
}

.quantity-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #e0e0e0;
    border-radius: 14px;
    padding: 2px;
    width: 70px;
    background-color: #fff;
    opacity: 0;
    transform: translateY(7px);
    pointer-events: none;
}

.quantity-control button {
    background-color: #f4f4f4;
    color: #00529e;
    font-size: 11px;
    font-weight: 700;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    width: 18px;
    height: 18px;
    line-height: 1;
}

.quantity-value {
    font-size: 11px;
    font-weight: 700;
    color: #333;
}

.product-action.quantity-mode-active .buy-button {
    opacity: 0;
    transform: translateY(7px);
    pointer-events: none;
}

.product-action.quantity-mode-active .quantity-control {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ---------------- DESKTOP ---------------- */
@media (min-width: 768px) {
    .product-info { padding: 0 16px 16px 16px; }
    .product-title { font-size: 15px; height: 38px; }
    .product-lab { font-size: 13px; margin-top: 4px; }
    .product-rating { gap: 6px; margin-top: 8px; }
    .product-price--current { font-size: 26px; }
    .product-price--old { font-size: 14px; }

    .product-action { width: 125px; height: 50px; }
    .buy-button { width: 50px; height: 50px; }
    .buy-button svg { width: 24px; height: 24px; }

    .quantity-control {
        border-width: 2px;
        border-radius: 25px;
        padding: 5px;
        width: 125px;
    }
    .quantity-control button { font-size: 18px; width: 32px; height: 32px; }
    .quantity-value { font-size: 18px; }
}

/* ---------------- SELos - Ajuste para Mobile ---------------- */
.badge-discount,
.badge-generic,
.badge-offer,
.badge-savings {
    transform: scale(0.82);
    transform-origin: top right;
}

/* Ajustes individuais no mobile */
.badge-discount {
    font-size: 9px;
    width: 28px;
    height: 28px;
}
.badge-generic {
    font-size: 1.1rem;
    width: 28px;
    height: 28px;
}
.badge-offer {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 10px;
}
.badge-savings {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Redefinições para desktop */
@media (min-width: 768px) {
    .badge-discount {
        font-size: 12px;
        width: 34px;
        height: 34px;
    }
    .badge-generic {
        font-size: 1.4rem;
        width: 34px;
        height: 34px;
    }
    .badge-offer {
        font-size: 11px;
        padding: 4px 10px;
    }
    .badge-savings {
        font-size: 11px;
        padding: 3px 8px;
    }
}
