/* assets/css/estilos.css */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}
/* --- 1. RESET Y BASE (MOBILE) --- */
:root {
    --color-primario: #2e7d32; /* Verde Dietética */
    --color-secundario: #345138;
    --color-fondo: #f8f9fa;
    --color-texto: #333;
    --borde-radio: 12px;
    --rosa: #fed5e3;
}
html, body {
    height: 100%; 
    margin: 0;
    padding: 0;
}
body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--color-fondo);
    color: var(--color-texto);
    overflow-x: hidden;
    min-height: 100vh;  
}

a { text-decoration: none; color: inherit; }
a, button {
    -webkit-tap-highlight-color: transparent;
}

/* --- HEADER: ESTRUCTURA GRID (La Clave) --- */

.cabecera_principal {
    background: white;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 10px 10px 7px;
    display: grid;
    grid-template-columns: 1fr auto; /* Col 1: Logo (flexible), Col 2: Carrito */
    gap: 11px;
    align-items: center;
}

/* POSICIONES EN MÓVIL */
.logo {
    grid-column: 1 / 2; /* Fila 1, Izquierda */
    grid-row: 1;   
    max-height: 45px;
}
.imagen_logo{
    max-height: 45px;
}

.icono_carrito {
    grid-column: 2 / 3; /* Fila 1, Derecha */
    grid-row: 1;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0px 15px;
}





/* --- 4. LAYOUT PRINCIPAL --- */
.contenedor_principal {
    padding: 10px;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: start;
    min-height: 60vh;       
}
.titulo{
    margin: 8px 0px;
    text-align: center;
    font-size: 1.5rem;
}

.banner{
    width: 100%;
}
.banner img{
    width: 100%;
    aspect-ratio: 3/1;
    object-fit: cover;
}

.grilla_productos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); 
    gap: 15px;
}

/* --- 5. TARJETA PRODUCTO --- */
.tarjeta_producto {
    position: relative; 
    background: white; 
    border-radius: 8px; 
    overflow: hidden; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.1); 
    display: flex; 
    flex-direction: column;
}
.link_invisible::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; 
    cursor: pointer;
}
.btn_agregar {
    position: relative; 
    z-index: 2;  
    width: 100%;
    padding: 0px;
    background: var(--color-primario);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.7rem;    
    min-height: 35px;
    max-width: 170px;
    align-self: center;   
    display: flex;
    align-items: center;     
    justify-content: center; 
    text-align: center;
    line-height: 1;       
}

/* Opcional: Un efecto hover para toda la tarjeta */
.tarjeta_producto:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.tarjeta_producto img {
    width: 100%;
    aspect-ratio: 1/1; /* Siempre cuadrada */
    object-fit: cover;
}

.info_producto {
    padding: 0px 10px 5px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.titulo_producto {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0px;
}

.desc_corta {
    font-size: 0.8rem;
    color: #777;
    margin-bottom: 5px;
    flex-grow: 1;
}

.precio_box {
    margin: 5px 0px;
    display: flex;           /* Activamos Flexbox */
    flex-direction: column;  /* Forzamos orden vertical (uno abajo del otro) */
    align-items: flex-start; /* Alineamos a la izquierda */
    gap: 2px;                /* Un pequeño espacio entre el precio real y el tachado */
}

.precio {
    font-weight: bold;
    color: var(--color-secundario);
    font-size: 1.1rem;
    line-height: 1.1; /* Ajustamos para que no quede muy separado del de abajo */
}

.precio_tachado {
    font-size: 0.8rem;
    text-decoration: line-through;
    color: #aaa;
    margin-left: 0;   /* IMPORTANTE: Sacamos el margen izquierdo que tenía antes */
    font-weight: normal;
}

.btn_agregar:active { transform: scale(0.98); }

/* --- 6. FOOTER --- */
.pie_pagina {
    text-align: center;
    padding: 15px;
    background: #fff;
    margin-top: 5px;
    color: #666;
    border-top: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.pie_pagina p {
    font-size: 0.9rem;
    color: #999;
    margin: 0;
}
/* --- NUEVA BARRA DE BÚSQUEDA --- */
.fila_busqueda {
    padding: 5px 10px 10px; /* Un poco de aire abajo */
    border-bottom: 1px solid #eee;
}

.form_busqueda {
    grid-column: 1 / -1; 
    grid-row: 2;         
    display: flex;
    background: #f1f1f1;
    border-radius: 8px;
    gap: 5px; /* Reducimos un poco el gap de 7 a 5 para ganar espacio */
    padding: 3px;    
    max-width: 100%; /* NUEVO: Blindaje anti-desborde */
    box-sizing: border-box; /* Asegura que el padding no sume ancho */
}
/* --- ESTILOS BUSCADOR CON "X" --- */

/* 1. Nuevo envoltorio para el input y la X */
.contenedor_input_relativo {
    position: relative;
    flex-grow: 1; /* Ocupa todo el espacio disponible */
    display: flex;
    align-items: center;
    min-width: 0; /* Evita desbordes en flexbox */
}

/* 2. Ajuste al Input para dejar espacio a la X */
.input_buscar {
    width: 100%;
    padding-right: 30px; /* Espacio a la derecha para que el texto no se monte sobre la X */
    /* El resto de tus estilos se mantienen... */
}

/* 3. La "X" (Botón de limpiar) */
.btn_limpiar_search {
    position: absolute;
    right: 8px; /* Pegado a la derecha */
    top: 50%;
    transform: translateY(-50%); /* Centrado vertical perfecto */    
    font-size: 1.8rem;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
    display: none; /* Oculto por defecto (se activa con JS) */
    padding: 1px;  /* Aumenta el área de toque para el dedo */
    z-index: 10;
}

.btn_limpiar_search:hover {
    color: #e74c3c; /* Rojo al pasar el mouse */
}

.navegacion_categorias {
    grid-column: 1 / -1; /* Ocupa todo el ancho */
    grid-row: 3;         /* Baja a la tercera fila */
    overflow-x: auto;
    white-space: nowrap;
    padding-top: 5px;
    scrollbar-width: none; 
}
.input_buscar {
    border: none;
    background: transparent;
    padding: 3px;
    flex-grow: 1; 
    font-family: inherit;
    outline: none;
    min-width: 0; 
    height: 35px;
    font-size: 0.9rem;
}

.select_categoria {
    height: 35px;
    border: 1px solid #ccc; /* Borde gris suave */
    background-color: white;
    border-radius: 6px;
    padding: 3px 6px;
    font-size: 0.9rem;
    color: #555;    
    width: auto;          
    max-width: 30%;       
    flex-shrink: 0;       
    cursor: pointer;
    font-family: inherit;
    text-overflow: ellipsis; 
    white-space: nowrap;
    overflow: hidden;
    outline: none; /*
    -moz-appearance: none;
    appearance: none;*/    
}
.btn_lupa {
    border: none;
    background: var(--color-primario);
    color: white;
    border-radius: 6px;
    width: 35px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.contador_carrito { position: absolute; top: -5px; right: 4px; background: var(--rosa); color: white; font-size: 0.7rem; width: 18px; height: 18px; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-weight: bold; }






/* Botón deshabilitado (Sin Stock) */
.btn_sin_stock {
    background-color: #e0e0e0 !important; /* Gris claro */
    color: #999 !important; /* Texto gris oscuro */
    cursor: not-allowed; /* Muestra el icono de prohibido 🚫 */
    pointer-events: none; /* Asegura que no sea clickeable */
    box-shadow: none;
    border: 1px solid #ccc;
}

/* Ajuste para que mantenga la posición en la tarjeta (z-index) */
.tarjeta_producto .btn_sin_stock {
    position: relative;
    z-index: 2;
}
.badge_destacado {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ffc107; /* Amarillo */
   
    font-size: 0.75rem;
    font-weight: bold;
    padding: 2px 4px;
    border-radius: 4px;
    z-index: 10; /* Que flote sobre la foto */
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    text-shadow: 0 0 0 white; 
    color: transparent;
}



.barra_info {
    display: flex;
    justify-content: space-around; /* Los separa equitativamente */
    align-items: center;
    gap: 5px;    
    background-color: #e8f5e9; /* Verde muy clarito (tipo medicina/salud) */
    border-top: 1px solid #c8e6c9;
    border-bottom: 1px solid #c8e6c9;
    padding: 6px;
    margin: 0; 
}

.info_item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 150px; /* Para que no se aprieten demasiado */
}

.info_icono {  
    width: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    
}
.info_icono img {
    width: 26px;
    height: 26px;
}
.info_texto {
    display: flex;
    flex-direction: column;
}

.info_texto strong {
    font-size: 0.7rem;
    color: var(--color-secundario);
}

.info_texto span {
    font-size: 0.65rem;
    color: #666;
}
.logo a:active, .icono_carrito:active {
    transform: scale(0.95);
    transition: transform 0.1s;
}

/* ... Tu CSS general queda igual ... */

/* CAMBIO: Comportamiento Carrusel en Móvil */
@media (max-width: 480px) {
    .barra_info {
        min-height: 40px; 
        justify-content: center; /* Centramos el mensaje activo */
        padding: 0px 10px;
    }

    .info_item {
        display: none; 
        width: 100%;
        justify-content: center; 
        border: none; 
        padding-bottom: 0;
        opacity: 0;
        transition: opacity 0.5s ease-in-out;
    }

    /* 4. Clase mágica que pone el JS */
    .info_item.activo {
        display: flex; /* Este sí se muestra */
        opacity: 1;    /* Se hace visible */
        animation: fadeEntrada 0.5s; /* Efecto extra de entrada */
    }
    .info_icono { width: 27px; height: 27px; }
    .info_icono img { width: 26px; height: 26px; }
}

/* Animación suave para que entre deslizando un poquito */
@keyframes fadeEntrada {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}













/* --- 7. VERSIÓN ESCRITORIO (Media Queries) --- */
@media (min-width: 860px) {
    
    .contenedor_principal {
    padding: 10px;
    width: 85%;
    justify-self: center;
    }
    .cabecera_principal {
        /* TRUCO DE CENTRADO: */
        /* Col 1 (1fr): Espacio flexible a la izquierda */
        /* Col 2 (auto): El buscador (ancho fijo o max-width) */
        /* Col 3 (1fr): Espacio flexible a la derecha (idéntico a la col 1) */
        grid-template-columns: 1fr auto 1fr;         
        padding: 5px 40px;
        gap: 20px;
    }

    .logo { 
        grid-column: 1; 
        grid-row: 1; 
        justify-self: start; /* Forzamos a que se pegue a la izquierda */
        max-height: 50px;
    }
    .imagen_logo{
    max-height: 50px;
    }
    

    .form_busqueda { 
        grid-column: 2; /* Se queda estricto en el centro */
        grid-row: 1;    
        width: 100%;
        /* Le damos un ancho fijo considerable para que luzca bien */
        width: 500px; 
        margin: 0; 
    }

    .icono_carrito { 
        grid-column: 3; 
        grid-row: 1; 
        justify-self: end; /* Forzamos a que se pegue a la derecha */
    }

    /* La navegación sigue igual */
    .navegacion_categorias {
        grid-column: 1 / -1;
        grid-row: 2;
        display: flex;
        justify-content: center;
        border-top: 1px solid #eee;
        margin-top: 10px;
        padding-top: 15px;
    }    
    .grilla_productos {
        gap: 30px;
    }
    .btn_checkout{
    min-width: 250px;
    justify-self: end;
    margin-top: 25px;
    }
}