/* ======================
   ESTILOS GENERALES
====================== */

body {
  font-family: system-ui, Arial, sans-serif;
  background: #f5f5f5;
  margin: 0;
  padding: 0;
}

/* ======================
   CONTENEDOR GENERAL
====================== */

#tienda,
#carrito-pagina {
  padding: 15px;
  max-width: 1200px;
  margin: auto;
}

/* ======================
   TIENDA – CATEGORÍAS
====================== */

#categorias {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

#categorias button {
  padding: 6px 12px;
  border: none;
  background: #eee;
  cursor: pointer;
  border-radius: 20px;
  font-size: 13px;
}

#categorias button:hover {
  background: #ddd;
}

/* ======================
   BUSCADOR
====================== */

#buscador {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

/* ======================
   GRILLA DE PRODUCTOS
====================== */

#productos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 15px;
  align-items: stretch; /* Asegura que todas las cards de una fila midan lo mismo */
}

/* ======================
   CARD DE PRODUCTO
====================== */

.producto {
  background: #ffffff;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
  height: 100%; /* Importante para la alineación */
}

/* Contenedor de imagen: ALTURA LIMITADA */
.producto img {
  width: 100%;
  height: 160px; /* Altura máxima fija en PC */
  object-fit: contain;
  margin-bottom: 8px;
  background: #fff;
}

.producto-info {
  flex: 1; /* Empuja el contenido para ocupar el espacio */
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* Mantiene el precio/botón abajo */
}

.producto-info h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  min-height: 40px; /* Espacio fijo para 2 renglones de texto */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.producto-info .precio {
  font-size: 16px;
  font-weight: bold;
  margin: 10px 0;
  color: #222;
}

/* ======================
   BOTÓN AGREGAR
====================== */

.add-to-cart {
  margin-top: auto; /* Siempre al fondo de la card */
  background: #25D366;
  border: none;
  color: white;
  padding: 10px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
}

.add-to-cart:hover {
  background: #1ebe5d;
}

.add-to-cart[disabled] {
  background: #aaa;
  cursor: not-allowed;
}

/* ======================
   CARRITO (PÁGINA)
====================== */

#carrito-items {
  list-style: none;
  padding: 0;
  margin: 0;
}

#carrito-items li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 14px;
}

#carrito-items button {
  border: none;
  background: #eee;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 4px;
}

#carrito-total {
  font-weight: bold;
  margin-top: 12px;
}

#enviar-whatsapp {
  width: 100%;
  background: #25D366;
  color: white;
  border: none;
  padding: 12px;
  margin-top: 12px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 15px;
}

/* ======================
   BOTÓN FLOTANTE DE CARRITO
====================== */

#carrito-flotante {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: #25D366;
  color: white;
  border: none;
  padding: 14px 16px;
  border-radius: 50px;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,.25);
  z-index: 1000;
  display: none;
}

#carrito-flotante span {
  font-weight: bold;
  margin-left: 6px;
}

/* ======================
   AVISO HORARIO
====================== */

.aviso-horario {
  background: #fff3cd;
  color: #856404;
  padding: 12px;
  margin-bottom: 15px;
  text-align: center;
  font-weight: bold;
  border-radius: 8px;
}

/* ======================
   RESPONSIVE – MOBILE
====================== */

@media (max-width: 600px) {

  #productos {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }

  .producto {
    padding: 8px;
  }

  .producto img {
    height: 120px; /* Altura más chica para celulares */
  }

  .producto-info h3 {
    font-size: 13px;
    min-height: 34px;
  }

  #carrito-flotante {
    right: 12px;
    bottom: 12px;
  }

  #carrito {
    width: 90% !important;
    right: 5% !important;
    left: 5% !important;
    bottom: 85px !important;
  }
}

/* ======================
   MODAL CARRITO
====================== */

#carrito {
  position: fixed;
  right: 20px;
  bottom: 80px;
  width: 350px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  padding: 20px;
  z-index: 9999;
  display: none; 
}

#carrito.activo {
  display: block;
}

#carrito h2 {
  margin-top: 0;
  font-size: 18px;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

#carrito ul {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 300px;
  overflow-y: auto;
}

#carrito-items li {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
}
