/* =========================================
   1. RESET Y CONFIGURACIÓN GLOBAL
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    overflow-x: hidden;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #ffffff;
    color: #333;
    line-height: 1.6;
}

/* 2. NAVBAR */
.navbar {
    width: 100%;
    height: 80px;
    background-color: #1a1a1a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid #b22222;
}

.nav-left { display: flex; align-items: center; gap: 12px; }
.logo { height: 50px; width: auto; }
.brand-name { color: white; font-weight: 800; font-size: 1.2rem; letter-spacing: 1px; }

.nav-center { display: flex; list-style: none; gap: 25px; }
.nav-center a {
    text-decoration: none;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    transition: 0.3s;
}
.nav-center a:hover { color: #b22222; }

.nav-right { display: flex; align-items: center; gap: 20px; }
/* =========================================
   3. HERO CARRUSEL
   ========================================= */
.hero-carousel {
    position: relative;
    width: 100%;
    /* En lugar de height fijo, usamos un mínimo y dejamos que fluya */
    min-height: 300px; 
    height: 70vh; 
    background-color: transparent; /* Cambiamos el negro por transparente */
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-carousel img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Llena el espacio sin deformar */
    object-position: center;
    z-index: 1; /* Detrás del texto */
}
.hero-overlay {
    position: relative; /* Cambiado de absolute para mejor control */
    z-index: 2;
    text-align: center;
    color: white;
    padding: 20px;
    width: 100%;
}

/* --- AJUSTE RESPONSIVO CRÍTICO --- */
@media (max-width: 768px) {
    .hero-carousel {
        /* Bajamos la altura en móvil para que la foto no se estire de más */
        height: 50vh; 
        min-height: 250px;
    }
    
    /* Si el fondo sigue viéndose negro, forzamos la imagen a mandar */
    .hero-carousel img {
        height: 100% !important;
        width: 100% !important;
    }
}

/* =========================================
   4. PRODUCTOS DESTACADOS (GRILLA FIJA)
   ========================================= */
.destacados { 
    padding: 60px 5%; 
    background: #fff;
    width: 100%;
}

.section-title { text-align: center; margin-bottom: 40px; }
.section-title h2 { font-size: 2.2rem; text-transform: uppercase; font-weight: 900; }
.section-title p { color: #b22222; font-weight: 500; letter-spacing: 1px; }

.destacados-grid {
    display: grid;
    /* Forzamos 3 columnas idénticas en pantallas grandes */
    grid-template-columns: repeat(3, 1fr); 
    gap: 30px;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

.product-card-destacada {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1; 
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    background: #000;
}

.product-card-destacada img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    display: block;
}

.product-card-destacada:hover img {
    transform: scale(1.1);
}

.info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    background: linear-gradient(transparent, rgba(0,0,0,0.9) 80%);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    pointer-events: none; /* Permite que el hover llegue a la imagen */
}

.info-overlay h3 { font-size: 1.1rem; margin-bottom: 5px; }
.precio-destacado { font-size: 1rem; font-weight: bold; margin-bottom: 10px; }

.badge-oferta {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #ffcc00;
    color: #000;
    padding: 4px 12px;
    font-weight: 800;
    border-radius: 50px;
    font-size: 0.75rem;
    z-index: 10;
}

/* Permitir clics específicamente en el botón dentro del overlay */
.info-overlay .add-cart {
    pointer-events: auto !important;
    position: relative; /* Asegura que esté por encima del degradado */
    z-index: 20;
}

/* =========================================
   5. SECCIÓN BENEFICIOS
   ========================================= */
.beneficios {
    display: flex; justify-content: space-around; padding: 40px 5%;
    background-color: #b22222; color: white; text-align: center;
}
.beneficio-item i { font-size: 2rem; margin-bottom: 10px; display: block; }

/* =========================================
   6. CATÁLOGO COMPLETO
   ========================================= */
.catalogo {
    display: flex; align-items: flex-start; padding: 60px 5%;
    gap: 40px; max-width: 1400px; margin: 0 auto;
}

.filtros {
    width: 280px; flex-shrink: 0; position: sticky; top: 100px;
    height: fit-content; background: #fff; padding: 10px;
}

.search-box { position: relative; margin-bottom: 25px; }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #888; }
.search-box input {
    width: 100%; padding: 10px 10px 10px 35px; border: 2px solid #eee;
    border-radius: 8px; outline: none;
}
.search-box input:focus { border-color: #b22222; }

.btn-filtro {
    display: block; width: 100%; text-align: left; padding: 10px;
    margin-bottom: 5px; background: white; border: 1px solid #f0f0f0;
    border-radius: 6px; cursor: pointer; transition: 0.3s;
}
.btn-filtro.active { background: #b22222; color: white; border-color: #b22222; }

.productos-grid {
    flex-grow: 1; display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.product-card {
    background: white; border-radius: 10px; overflow: hidden;
    display: flex; flex-direction: column; height: 100%;
    border: 1px solid #eee; transition: 0.3s;
}
.product-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.05); }
.product-card img { width: 100%; height: 180px; object-fit: cover; }
.product-card h4 {
    padding: 15px 10px 5px; text-align: center; min-height: 50px;
    display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.product-card .price { color: #b22222; font-weight: 800; font-size: 1.2rem; text-align: center; margin-bottom: 15px; }

.add-cart {
    display: block;          /* Lo convierte en bloque para poder usar margin auto */
    width: 90%;             /* Ocupa casi todo el ancho de la card */
    margin: 10px auto 20px; /* 10px arriba, AUTO a los lados (esto lo centra), 20px abajo */
    padding: 12px;
    background: #1a1a1a;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    text-align: center;      /* Centra el texto e icono dentro del botón */
    transition: 0.3s ease;
}

.add-cart:hover {
    background: #b22222;
    transform: translateY(-2px); /* Un pequeño efecto de elevación */
}

/* =========================================
   7. MARCAS Y FOOTER
   ========================================= */
.marcas {
    display: flex; justify-content: center; flex-wrap: wrap;
    gap: 40px; padding: 50px; background: #40507b; color: white;
}

.footer { background-color: #111;
    color: #fff;
    padding: 60px 5% 20px; }
.footer-content {
   display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}
.footer-section h3 { color: #b22222; margin-bottom: 15px; }
.footer-copy { text-align: center; margin-top: 50px; padding-top: 20px; border-top: 1px solid #222; font-size: 0.8rem; color: #555; }


/* =========================================
   8. RESPONSIVIDAD (AQUÍ ESTABA EL ERROR)
   ========================================= */
@media (max-width: 1024px) {
    .catalogo { flex-direction: column; }
    .filtros { width: 100%; position: static; }
    .destacados-grid { gap: 15px; } /* Mantenemos las 3 columnas hasta los 850px */
}

@media (max-width: 850px) {
    .destacados-grid { 
        /* Aquí recién pasamos a 1 columna para celular */
        grid-template-columns: 1fr; 
        max-width: 400px; 
    }
}

@media (max-width: 768px) {
    .productos-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .product-card img { height: 140px; }
    .beneficios { flex-direction: column; gap: 20px; }
}

/* Carrito Sidebar */
/* 6. CARRITO SIDEBAR */
.carrito-sidebar {
    position: fixed;
    right: -400px;
    top: 0;
    width: 350px;
    height: 100%;
    background: white;
    z-index: 2000;
    transition: 0.4s;
    box-shadow: -5px 0 15px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
}

.carrito-sidebar.active { right: 0; }

/* 7. RESPONSIVIDAD */
@media (max-width: 768px) {
    .nav-center { display: none; } /* En móvil usamos el botón hamburguesa */
    .hero-overlay h1 { font-size: 2.2rem; }
    .navbar { padding: 0 20px; }
}

.carrito-header {
    padding: 20px;
    background: #1a1a1a;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#items-carrito {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
}

.item-carrito {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.carrito-footer {
    padding: 20px;
    border-top: 2px solid #eee;
}

#enviar-whatsapp {
    width: 100%;
    padding: 15px;
    background: #25D366;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1.1rem;
}

/* Icono Flotante */
.cart-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #b22222;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

