/* ======================
   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;
}

/* ======================
   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);
}

.producto img {
  width: 100%;
  height: 140px;
  object-fit: contain;
  margin-bottom: 8px;
}

.producto-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.producto-info h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.producto-info .precio {
  font-size: 14px;
  font-weight: bold;
  margin-top: auto;
}

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

.add-to-cart {
  margin-top: 10px;
  background: #25D366;
  border: none;
  color: white;
  padding: 10px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
}

.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
   (TIPO APP)
====================== */

#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;
}

/* ======================
   MENSAJE "PEDIDO ENVIADO"
====================== */

.pedido-enviado {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #25D366;
  color: white;
  padding: 12px 20px;
  border-radius: 30px;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  z-index: 2000;
}

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

@media (max-width: 600px) {

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

  .producto img {
    height: 120px;
  }

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

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

/* ======================
   MODAL CARRITO (AJUSTADO)
====================== */

#carrito {
  position: fixed;
  right: 20px;
  bottom: 80px; /* Separado del botón flotante */
  width: 350px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  padding: 20px;
  z-index: 9999;
  
  /* Se oculta por defecto */
  display: none; 
}

/* Clase que agregaremos con JS para mostrarlo */
#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; /* Para que no crezca infinito si hay muchos productos */
  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;
}

#carrito-items button {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

#carrito-items button:hover {
  background: #e0e0e0;
}

#carrito-items .item-subtotal {
  font-weight: 600;
  min-width: 50px;
  text-align: right;
}