/* ---------------------------------------------------
   PRODUTOS – CARD COM ALTURA FIXA
--------------------------------------------------- */

.produto-card {
    width: 300px;
    height: 380px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    overflow: hidden;
    padding: 0;
    display: block; /* 👈 NÃO É FLEX */
    position: relative;
    transition: transform .25s ease;
}

.produto-card:hover {
    transform: translateY(-4px);
}

/* ---------------------------
   IMAGEM
---------------------------- */
.produto-card img {
    width: 100%;
    height: 150px;   /* Altura fixa para todos */
    object-fit: contain;
    display: block;
    padding-top: 10px;
    background: #fff;
}

/* ---------------------------
   ÁREA DE INFORMAÇÃO
---------------------------- */
.produto-info {
    padding: 10px 14px;
    height: 180px;   /* 👈 Altura fixa */
    display: block;
    text-align: center;
}

/* Título com reticências em 2 linhas */
.produto-info h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #333;

    display: -webkit-box;
    -webkit-line-clamp: 2;   /* 2 linhas */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 62px;  /* fixa para padronizar */
    margin-bottom: 8px;
}

/* Preço */
.produto-preco-promocao {
    font-size: 1rem;
    font-weight: 700;
    color: #d98a00;
    margin-top: 5px;
    margin-bottom: 12px;
}

/* Preço atual na grid */
.product-grid-5x3 .preco-atual {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
    margin-bottom: 10px;
}

.product-grid-5x3 .preco-atual.promocao {
    color: var(--accent-color);
}

/* ---------------------------
   BOTÃO – SEMPRE NO FUNDO
---------------------------- */
.btn-add-carrinho {
    
    bottom: 10px;
    left: 10px;
    right: 10px;
    
    border: none;
    color: #fff;

    padding: 10px;
    border-radius: 8px;

    cursor: pointer;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.btn-add-carrinho:hover {
    opacity: .9;
}


/* ---------------------------------------------------
   SEÇÃO PROMOÇÕES — CARROSSEL
--------------------------------------------------- */

#promocoes-track {
    display: flex;
    gap: 20px;
    overflow-x: hidden;
    padding: 20px 0;
    animation: slide-left 55s linear infinite;
}

#promocoes-track.paused {
    animation-play-state: paused;
}

.promo-item {
    flex: 0 0 auto;
}

/* animação suave para direita → esquerda */
@keyframes slide-left {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}

       /* Estilos para botão Adicionar ao Carrinho */
.btn-add-carrinho {
    width: 100%;
    padding: 10px 15px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.btn-add-carrinho:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-add-carrinho i {
    font-size: 1rem;
}

/* Preço com promoção */
.produto-preco-original {
    color: var(--text-light);
    font-size: 0.9rem;
    margin: 5px 0;
}

.produto-preco-promocao {
    color: var(--accent-color);
    font-size: 1.3rem;
    font-weight: bold;
    margin: 5px 0;
}

/* Animação para feedback do carrinho */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Ícone do carrinho no header */
.btn-carrinho {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-light);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.btn-carrinho:hover {
    background: var(--primary-color);
    color: white;
}

.cart-counter {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* ===================================================
   LISTA DE PRODUTOS (produtos.html)
   Estrutura da Sidebar, Grid e Paginação
   =================================================== */

/* Container principal da página de lista */
.page-container {
    max-width: 1200px; /* Largura máxima do conteúdo */
    margin: 30px auto;
    padding: 0 15px;
}

/* Wrapper para alinhar a sidebar e a área de produtos lado a lado */
.content-wrapper {
    display: flex;
    gap: 30px; /* Espaço entre a sidebar e a área de produtos */
}


/* --------------------------
   SIDEBAR DE CATEGORIAS
---------------------------- */

.sidebar {
    flex: 0 0 250px; /* Largura fixa para a sidebar */
    padding: 15px;
    background-color: #f8f8f8;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    height: fit-content; /* Ajusta a altura ao conteúdo */
}

.sidebar h3 {
    border-bottom: 2px solid var(--primary-color, #333);
    padding-bottom: 10px;
    margin-bottom: 15px;
    font-size: 1.2em;
}

#lista-categorias {
    list-style: none;
    padding: 0;
    margin: 0;
}

#lista-categorias li {
    padding: 10px 5px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: 4px;
    margin-bottom: 5px;
}

#lista-categorias li:hover {
    background-color: #eee;
}

#lista-categorias li.active {
    background-color: var(--primary-color, #007bff);
    color: white;
    font-weight: bold;
}


/* --------------------------
   ÁREA DE PRODUTOS E GRID 3x4
---------------------------- */

.products-area {
    flex-grow: 1; /* Ocupa o restante do espaço */
}

.product-grid-5x3 {
    display: grid;
    /* Define 3 colunas de tamanho igual para grid 3x4 */
    grid-template-columns: repeat(3, 1fr); 
    gap: 25px; /* Espaço entre os cards */
    margin-bottom: 30px;
}

/* Ajuste nos cards existentes para caberem na grid */
.product-grid-5x3 .produto-card {
    width: 100%; /* Ocupa toda a largura da célula da grid */
    height: 450px; /* Altura fixa para todos os cards */
    display: flex; /* Usa flexbox para organizar o conteúdo */
    flex-direction: column; /* Empilha verticalmente */
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    overflow: hidden;
    padding: 0;
    position: relative;
    transition: transform .25s ease;
}

.product-grid-5x3 .produto-card:hover {
    transform: translateY(-4px);
}

/* Container da imagem */
.product-grid-5x3 .produto-img-container {
    flex-shrink: 0; /* Não encolhe */
    width: 100%;
    height: 180px; /* Altura fixa para a imagem */
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 10px;
}

/* Garante que o container da imagem e info se ajustem */
.product-grid-5x3 .produto-card img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Mantém proporção sem cortar */
    display: block;
}

/* Área de informação com flexbox */
.product-grid-5x3 .produto-info {
    flex: 1; /* Ocupa o espaço restante */
    display: flex;
    flex-direction: column;
    padding: 15px;
    justify-content: space-between; /* Distribui o espaço */
    min-height: 0; /* Permite que o flex funcione corretamente */
}

/* Nome do produto */
.product-grid-5x3 .produto-nome {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 10px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Máximo 2 linhas */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    flex-shrink: 0;
}

/* Container de preços */
.product-grid-5x3 .produto-precos {
    flex-shrink: 0;
    margin-bottom: 10px;
}

/* Botão sempre no rodapé */
.product-grid-5x3 .btn-add-carrinho {
    width: 100%;
    margin-top: auto; /* Empurra o botão para o final */
    flex-shrink: 0;
    padding: 12px 15px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.product-grid-5x3 .btn-add-carrinho:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* --------------------------
   PAGINAÇÃO
---------------------------- */

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.pagination-controls button {
    background-color: var(--primary-color, #007bff);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.pagination-controls button:hover:not(:disabled) {
    background-color: var(--dark-primary-color, #0056b3);
}

.pagination-controls button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* ===================================================
   BARRA DE PESQUISA
   =================================================== */

.search-bar-container {
    margin-bottom: 25px;
    padding: 0;
}

.search-bar-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
}

.search-icon {
    position: absolute;
    left: 15px;
    color: var(--text-light, #6b7280);
    font-size: 1.1rem;
    z-index: 1;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 14px 50px 14px 45px;
    border: 2px solid var(--border-color, #e5e7eb);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color, #0004ff);
    box-shadow: 0 0 0 3px rgba(0, 4, 255, 0.1);
}

.search-input::placeholder {
    color: var(--text-light, #9ca3af);
}

.clear-search-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-light, #6b7280);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1;
}

.clear-search-btn:hover {
    background-color: var(--bg-light, #f3f4f6);
    color: var(--text-color, #1f2937);
}

.clear-search-btn i {
    font-size: 0.9rem;
}

/* Mensagem quando não há resultados */
.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light, #6b7280);
    font-size: 1.1rem;
}

.no-products::before {
    content: '🔍';
    display: block;
    font-size: 3rem;
    margin-bottom: 15px;
}

/* ===================================================
   RESPONSIVIDADE - GRID DE PRODUTOS
   =================================================== */

@media (max-width: 1024px) {
    .product-grid-5x3 {
        grid-template-columns: repeat(2, 1fr); /* 2 colunas em tablets */
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .content-wrapper {
        flex-direction: column; /* Sidebar acima dos produtos */
        gap: 20px;
    }
    
    .sidebar {
        flex: 1 1 100%; /* Ocupa toda a largura */
        width: 100%;
    }
    
    .search-bar-wrapper {
        max-width: 100%;
    }
    
    .search-input {
        padding: 12px 45px 12px 40px;
        font-size: 0.95rem;
    }
    
    .search-icon {
        left: 12px;
        font-size: 1rem;
    }
    
    .product-grid-5x3 {
        grid-template-columns: repeat(2, 1fr); /* 2 colunas em mobile */
        gap: 15px;
    }
    
    .product-grid-5x3 .produto-card {
        height: 420px; /* Altura um pouco menor em mobile */
    }
    
    .product-grid-5x3 .produto-img-container {
        height: 150px;
    }
}

@media (max-width: 480px) {
    .search-input {
        padding: 10px 40px 10px 35px;
        font-size: 0.9rem;
    }
    
    .search-icon {
        left: 10px;
        font-size: 0.9rem;
    }
    
    .product-grid-5x3 {
        grid-template-columns: 1fr; /* 1 coluna em telas muito pequenas */
        gap: 15px;
    }
    
    .product-grid-5x3 .produto-card {
        height: 400px;
    }
}