/* Ensure consistent box sizing across components */
* { 
    box-sizing: border-box; 
}

/* Grid layout for product lists */
.product-grid-home,
.sugest-prod {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    padding: 20px 0;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Product card structural rules */
.product-card {
    display: flex;
    flex-direction: column;
    background: #ffffff !important;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    height: 100%;
    min-height: 380px;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 22px rgba(0,0,0,0.08);
}

.product-media-wrap {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    flex-shrink: 0;
}

/* ==========================================================
   CARROSSEL HERO (HOME) - CORREÇÃO DE TAMANHO E ENQUADRAMENTO
   ========================================================== */

.hero-carousel-panel {
    width: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    border: 2px solid var(--border-color);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
    background: var(--bg-surface);
}

.hero-carousel-container {
    width: 100%;
    height: 380px;
    max-height: 450px;
    min-height: 250px;
    position: relative;
    background: #000000;
}

.hero-carousel-container .carousel-slide {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: none; /* Controlado via JS */
}

.hero-carousel-container .carousel-slide.active {
    display: block;
}

/* Garante que o link ocupe toda a área do slide */
.hero-carousel-container .carousel-slide a {
    display: block;
    width: 100%;
    height: 100%;
}

/* Força a imagem a preencher a tela mantendo a proporção correta */
.hero-carousel-container .carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.hero-carousel-fallback {
    width: 100%;
    min-height: 360px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-radius: 12px;
}

/* Legendas sobrepostas à imagem */
.hero-carousel-container .carousel-caption {
    position: absolute;
    left: 24px;
    bottom: 24px;
    right: 24px;
    max-width: calc(100% - 48px);
    color: #ffffff;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    padding: 12px 18px;
    border-radius: 8px;
    z-index: 2;
}

.hero-carousel-container .carousel-caption h3 {
    margin: 0 0 4px 0;
    font-size: 1.3rem;
}

.hero-carousel-container .carousel-caption p {
    margin: 0;
    font-size: 0.95rem;
}

/* Botões Anterior / Próximo */
.hero-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: #ffffff;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.hero-carousel-btn:hover {
    background: rgba(0, 0, 0, 0.85);
    transform: translateY(-50%) scale(1.05);
}

.hero-carousel-btn.prev { left: 16px; }
.hero-carousel-btn.next { right: 16px; }

/* Responsividade do Carrossel */
@media (max-width: 900px) {
    .hero-carousel-container {
        height: 300px;
    }
}

@media (max-width: 640px) {
    .hero-carousel-container {
        height: 220px;
    }

    .hero-carousel-container .carousel-caption {
        left: 16px;
        right: 16px;
        bottom: 16px;
        padding: 8px 12px;
    }

    .hero-carousel-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

/* Outros elementos */
.product-card-link {
    background: #ffffff !important;
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
    text-decoration: none;
    color: inherit;
}

.preco-prod {
    color: #27ae60 !important;
    font-weight: 700;
    font-size: 1.2rem;
}

.preco-antigo {
    text-decoration: line-through;
    color: #999;
}

.estoque-badge, .selo-promocao { 
    position: absolute; 
    top: 8px; 
    left: 8px; 
    z-index: 6; 
}

.produto-thumb.selected-thumb {
    outline: 3px solid #d68910;
    box-shadow: 0 0 6px rgba(0,0,0,0.2);
}

.product-media {
    display: none;
}
.product-media.active {
    display: block;
}

/* ==========================================================
   IMAGEM ÚNICA DOS PRODUTOS (SEM CARROSSEL)
   ========================================================== */

.product-media-wrap {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f8f8f8;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Exibe a imagem do produto diretamente, sem precisar de classes ativas ou scripts */
.product-media {
    display: block !important;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Mantém a peça inteira visível sem cortar */
    transition: transform 0.3s ease;
}

/* Efeito de zoom elegante ao passar o mouse por cima do card */
.product-card:hover .product-media {
    transform: scale(1.06);
}

/* Utilitários visuais de suporte */
.produto-thumb.selected-thumb {
    outline: 3px solid #d68910;
    box-shadow: 0 0 6px rgba(0,0,0,0.2);
}