/* ==========================================================================
   1. ESTILOS BASE Y RESET
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html {
    scroll-behavior: smooth;
}

/* Compensa el header "sticky" para que las secciones no queden tapadas al saltar con el menú */
#promociones,
#catalogo,
#contacto {
    scroll-margin-top: 110px;
}

body {
    background-color: #f8f9fa; /* Fondo gris muy claro */
    color: #333;
}

/* ==========================================================================
   2. CABECERA PRINCIPAL (HEADER)
   ========================================================================== */
.header-principal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 50px;
    background-color: #ffffff;
}

.logo img {
    height: 50px; /* Ajusta esto según el tamaño real de tu logo */
    object-fit: contain;
}

.buscador {
    display: flex;
    align-items: center;
    border: 1px solid #0b3b60;
    border-radius: 20px;
    padding: 5px 15px;
    width: 40%;
}

.buscador input {
    border: none;
    outline: none;
    width: 100%;
    padding: 5px;
}

.btn-buscar {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
}

.iconos-usuario {
    display: flex;
    gap: 20px;
    align-items: center;
    font-size: 1.5em;
    cursor: pointer;
}

.icono-carrito {
    position: relative;
    color: #79a342;
}

.badge-carrito {
    position: absolute;
    top: -5px;
    right: -10px;
    background-color: #e74c3c;
    color: white;
    font-size: 0.5em;
    padding: 2px 6px;
    border-radius: 50%;
    font-weight: bold;
}

/* ==========================================================================
   3. BARRA DE NAVEGACIÓN (AZUL)
   ========================================================================== */
.nav-azul {
    background-color: #0b3b60; /* Azul institucional */
    padding: 12px 0;
}

.nav-azul ul {
    display: flex;
    justify-content: center;
    list-style: none;
    gap: 30px;
}

.nav-azul a {
    color: #ffffff;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
}

.nav-azul a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   4. SECCIÓN PROMOCIONES (HERO)
   ========================================================================== */
.seccion-promociones {
    background-color: #e9ecef;
    margin: 20px 50px;
    padding: 40px;
    border-radius: 10px;
    text-align: center;
}

.promo-contenido h1 {
    font-size: 2em;
    margin-bottom: 20px;
    color: #333;
}

.btn-verde-claro {
    background-color: #8fa652;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
}

/* ==========================================================================
   5. CATÁLOGO DE PRODUCTOS
   ========================================================================== */
.contenedor-catalogo {
    padding: 0 50px 40px 50px;
}

.titulo-seccion {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5em;
}

.subcategorias {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
    font-weight: bold;
    border-bottom: 1px solid #ccc;
    padding-bottom: 10px;
}

/* Píldoras de filtro de categoría (nivel 1) */
.filtro-pill {
    background: #ffffff;
    border: 1.5px solid #dbe2d8;
    color: #555;
    padding: 7px 18px;
    border-radius: 999px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filtro-pill:hover {
    border-color: #79a342;
    color: #4f6b37;
}

.filtro-pill.activo {
    background: #0b3b60;
    border-color: #0b3b60;
    color: #ffffff;
}

/* Píldora especial de "En promoción": color diferenciado incluso sin estar activa */
.filtro-pill-promo {
    border-color: #e0a800;
    color: #8a6400;
}

.filtro-pill-promo.activo {
    background: #e0a800;
    border-color: #e0a800;
    color: #ffffff;
}

/* Píldoras de subcategoría (nivel 2, dependen de la categoría activa) */
.filtro-pill-sub {
    background: #f1f4ee;
    border: 1px solid #e1e7db;
    color: #666;
    padding: 5px 15px;
    border-radius: 999px;
    font-size: 0.78em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filtro-pill-sub:hover {
    border-color: #79a342;
    color: #4f6b37;
}

.filtro-pill-sub.activo {
    background: #79a342;
    border-color: #79a342;
    color: #ffffff;
}

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

.card {
    background: #ffffff;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.card img {
    height: 140px;
    object-fit: contain;
    margin-bottom: 15px;
}

.card h3 {
    font-size: 0.9em;
    margin-bottom: 10px;
    color: #333;
    height: 35px; /* Mantiene aliniación aunque el texto sea largo */
    overflow: hidden;
}

.precio-card {
    font-weight: bold;
    font-size: 1.2em;
    margin-bottom: 5px;
}

.precio-anterior-card {
    font-size: 0.8em;
    color: #888;
    text-decoration: line-through;
    margin-bottom: 15px;
    display: block;
}

/* Botones de las tarjetas */
.btn-anadir {
    background-color: #79a342; /* Verde oliva */
    color: white;
    border: none;
    width: 100%;
    padding: 8px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 10px;
}

.btn-whatsapp {
    background-color: #0b3b60; /* Azul oscuro */
    color: white;
    border: none;
    width: 100%;
    padding: 8px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: bold;
    cursor: pointer;
}

/* ==========================================================================
   6. PANEL DE CANASTA (LATERAL)
   ========================================================================== */
.panel-canasta {
    position: fixed;
    top: 0;
    right: -100%; /* Escondido por defecto */
    width: 350px;
    max-width: 100vw; /* Evita que sea más ancho que un celular */
    height: 100%; /* Fallback para navegadores antiguos */
    height: 100dvh; /* Altura dinámica (¡Esto soluciona el botón escondido!) */
    background-color: #ffffff;
    box-shadow: -4px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s ease-in-out;
    z-index: 1050; /* Lo pone por encima de todo el menú */
    display: flex;
    flex-direction: column;
}

/* Cuando JavaScript le añade la clase 'activo' */
.panel-canasta.activo {
    right: 0;
}

/* Ajuste específico para pantallas de celular */
@media (max-width: 576px) {
    .panel-canasta {
        width: 100%; /* En celular, que el carrito ocupe toda la pantalla */
    }
}

/* Esta clase se añadirá con JavaScript para mostrar el panel */
.panel-canasta.activo {
    right: 0;
}

.cabecera-canasta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eaeaea;
}

.cabecera-canasta button {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
}

.lista-items-canasta {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
}

.item-carrito {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 10px;
    font-size: 0.9em;
}

.resumen-canasta {
    padding: 20px;
    background-color: #f9f9f9;
    border-top: 1px solid #eaeaea;
}

.subtotal {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    font-size: 1.2em;
    margin-bottom: 15px;
}

.btn-completar-whatsapp {
    background-color: #25D366; /* Verde oficial de WhatsApp */
    color: white;
    border: none;
    width: 100%;
    padding: 15px;
    border-radius: 30px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1em;
}

/* ==========================================================================
   7. FOOTER Y CONTACTO
   ========================================================================== */
.contacto-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 0 50px 40px 50px;
}

.placeholder-mapa {
    background: #e9ecef;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ccc;
}

.datos-contacto p {
    margin-bottom: 10px;
}

.footer-azul {
    background-color: #0b3b60;
    color: white;
    text-align: center;
    padding: 20px;
}

.enlaces-legales {
    margin-bottom: 10px;
}

.enlaces-legales a {
    color: white;
    text-decoration: none;
    margin: 0 10px;
    font-size: 0.9em;
}

/* Selector de cantidad (tarjetas del catálogo y modal de detalle) */
.selector-cantidad {
    user-select: none;
}

.btn-cantidad {
    background: #f1f4ee;
    border: 1px solid #dbe2d8;
    color: #0b3b60;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 1em;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-cantidad:hover {
    background: #dbe2d8;
}

.cantidad-valor {
    min-width: 22px;
    text-align: center;
    font-weight: 700;
    color: #333;
}

/* Etiqueta de subcategoría en las tarjetas del catálogo */
.etiqueta-subcategoria {
    display: inline-block;
    background: #f1f4ee;
    color: #4f6b37;
    font-size: 0.7em;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    margin-bottom: 8px;
}