/* --- 1. O CONTÊINER DOS PRODUTOS (A GRADE) --- */
#product-card-container {
    display: grid;
    /* Cria colunas que se ajustam automaticamente:
       - Elas vão tentar ter 240px.
       - Vão crescer para preencher o espaço (1fr).
       - O navegador decide quantas colunas cabem.
    */
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem; /* Espaçamento entre os cards */
    margin-top: 1rem;
    width: 100%;
}

/* --- 2. O CARD INDIVIDUAL DO PRODUTO --- */
.product-card {
    background-color: white;
    border-radius: 8px;
    overflow: hidden; /* Garante que badges e imagens fiquem dentro das bordas */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    text-decoration: none;
    color: inherit;
    display: flex; /* Organiza o conteúdo interno em coluna */
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

/* --- 3. IMAGEM E BADGES --- */
.card-image-container {
    position: relative;
    width: 100%;
    /* Truque para criar um container quadrado (aspect-ratio: 1/1) */
    padding-top: 100%; 
}

.card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Garante que a imagem preencha o espaço sem distorcer */
}

.discount-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: #ee4d2d; /* Laranja/Vermelho Shopee */
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 2;
}

.origin-flag {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    border-radius: 4px;
    padding: 5px;
    height: 30px; /* Altura fixa para a flag */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 2;
}

.origin-flag img {
    height: 20px;
    width: auto;
}

/* --- 4. CONTEÚDO DE TEXTO DO CARD --- */
.card-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Faz esta área crescer para empurrar o preço para baixo */
}

.card-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.4;
    /* Limita o título a duas linhas */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;  
    overflow: hidden;
    text-overflow: ellipsis;
    height: 2.8em; /* 2 linhas * 1.4 de line-height */
}

.card-rating {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 1rem;
    margin-top: auto; /* Empurra o rating para baixo, alinhando os preços */
}
    
.card-rating .star-icon {
    color: #ffce3d;
    margin-right: 4px;
    width: 16px;
    height: 16px;
}
    
.card-rating .sales-count {
    margin-left: 8px;
    padding-left: 8px;
    border-left: 1px solid #eee;
}

.card-price-container {
    display: flex;
    align-items: baseline; /* Alinha os preços pela base */
    gap: 8px;
}

.current-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ee4d2d;
}

.original-price {
    font-size: 0.9rem;
    color: #999;
    text-decoration: line-through;
}