/* Producto.css - Estilos responsivos para la página de productos */

/* Submenú de categorías */
.submenu-categorias {
  background: #333;
  color: white;
  padding: 1rem;
  position: sticky;
  top: var(--header-height, 80px); /* Altura dinámica del header */
  width: 100%;
  z-index: 900;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s ease;
}

.submenu-categorias ul {
  list-style: none;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 1200px;
}

.submenu-categorias li {
  display: flex;
  align-items: center;
}

.submenu-categorias a {
  text-decoration: none;
  color: #ffffff;
  font-weight: bold;
  padding: 8px 12px;
  border-radius: 5px;
  transition: 0.3s;
  font-size: 0.9rem;
  white-space: nowrap;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.submenu-categorias a:hover {
  background: #f4a261;
  color: white;
}

/* Ocultar el submenú en dispositivos móviles */
@media (max-width: 768px) {
  .submenu-categorias {
    top: var(--header-height-mobile, 60px); /* Altura para móviles */
    padding: 0.6rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .submenu-categorias ul {
    flex-wrap: nowrap;
    justify-content: flex-start;
    padding: 0 1rem;
  }

  .submenu-categorias li {
    flex: 0 0 auto;
  }

  .submenu-categorias a {
    font-size: 0.8rem;
    padding: 6px 10px;
    white-space: nowrap;
  }
}

/* Media Queries */
@media (max-width: 1024px) {
  .submenu-categorias {
    top: var(--header-height-tablet, 70px); /* Altura para tablets */
    padding: 0.8rem;
  }

  .submenu-categorias ul {
    gap: 0.8rem;
  }
}

@media (max-width: 480px) {
  .submenu-categorias {
    top: var(--header-height-mobile, 50px);
    padding: 0.4rem;
  }

  .submenu-categorias a {
    font-size: 0.75rem;
    padding: 4px 8px;
  }
}

/* Estilos para la sección de productos */
#productos {
  padding: 4rem 1rem;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

/* Ajustar el scroll-margin-top para las secciones de categorías */
#Bebidas_Frías,
#Bebidas_Calientes,
#Salsas,
#Sal_chile,
#Chapulines {
  scroll-margin-top: 200px;
}

/* Grid de productos responsivo */
.productos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
  padding: 1rem 0;
}

/* Producto individual - Estilo responsivo */
.producto {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
  height: 100%;
}

.producto:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Contenedor de imagen con tamaño fijo */
.producto-imagen-container {
  width: 100%;
  height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f8f8f8;
  border-radius: 6px;
  margin-bottom: 1rem;
  overflow: hidden;
}

/* Imagen del producto - Responsive y consistente */
.producto img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  padding: 0.5rem;
}

.detalles-producto {
  width: 100%;
  padding: 0.5rem;
  text-align: center;
  margin-top: auto;
}

.detalles-producto h3 {
  font-size: 1.1rem;
  margin: 0.5rem 0;
  color: #333;
  font-weight: 600;
}

.precio {
  font-size: 1.2rem;
  font-weight: bold;
  color: #e76f51;
  margin: 0.5rem 0;
}

.acciones {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  width: 100%;
  text-align: center;
}

.producto:hover .acciones {
  opacity: 1;
}

.vista-rapida {
  background: rgba(51, 51, 51, 0.9);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  font-weight: 500;
  text-decoration: none;
  display: inline-block;
}

.vista-rapida:hover {
  background: #333;
}

.link-detalles {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Media Queries para diferentes tamaños de pantalla */
@media (max-width: 1024px) {
  .productos-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.2rem;
  }

  .producto-imagen-container {
    height: 180px;
  }
}

@media (max-width: 768px) {
  #productos {
    margin-top: 1rem;
  }

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

  .producto-imagen-container {
    height: 150px;
  }

  .detalles-producto h3 {
    font-size: 1rem;
  }

  .precio {
    font-size: 1.1rem;
  }

  .vista-rapida {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .productos-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.8rem;
  }

  .producto {
    padding: 0.8rem;
  }

  .producto-imagen-container {
    height: 130px;
  }

  .detalles-producto h3 {
    font-size: 0.9rem;
  }

  .precio {
    font-size: 1rem;
  }

  #Bebidas_Frías,
  #Bebidas_Calientes,
  #Salsas,
  #Sal_chile,
  #Chapulines {
    scroll-margin-top: 90px;
  }
}

/*Mensaje en caso de no encontrar */
.no-results {
  text-align: center;
  padding: 40px 20px;
  margin: 30px auto;
  max-width: 500px;
  background-color: #f8f8f8;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.no-results p {
  margin: 10px 0;
  color: #555;
  font-size: 1.1rem;
}

.no-results p:first-child {
  font-weight: bold;
  color: #333;
  font-size: 1.3rem;
}

:root {
  --header-height: 115px;
  --header-height-tablet: 70px;
  --header-height-mobile: 60px;
}

@media (max-width: 480px) {
  :root {
    --header-height-mobile: 50px;
  }
}

/* Estilos del carrito */
.header__cart-container {
  position: relative;
  margin-left: 15px;
  display: flex;
  align-items: center;
}

.header__cart-button {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  padding: 8px;
  transition: all 0.3s ease;
}

.header__cart-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.cart-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff6b6b;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

/* Modal del carrito */
.cart-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.cart-content {
  background-color: white;
  margin: 5% auto;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  animation: slideIn 0.3s;
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.close-cart {
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  color: #aaa;
  transition: color 0.3s;
}

.close-cart:hover {
  color: #333;
}

.cart-items {
  margin: 20px 0;
}

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

.cart-item-info {
  flex-grow: 1;
  margin-right: 15px;
}

.cart-item-info h4 {
  margin: 0 0 5px 0;
  font-size: 1rem;
}

.cart-item-info p {
  margin: 0;
  color: #666;
  font-size: 0.9rem;
}

.cart-item-actions {
  display: flex;
  align-items: center;
}

.cart-item-actions button {
  background: #f0f0f0;
  border: none;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  cursor: pointer;
  margin: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}

.cart-item-actions button:hover {
  background: #ddd;
}

.cart-item-actions span {
  width: 30px;
  text-align: center;
}

.cart-total {
  text-align: right;
  font-size: 1.2rem;
  font-weight: bold;
  margin: 20px 0;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

.checkout-btn {
  background: #25d366;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  width: 100%;
  transition: background 0.3s;
  margin-top: 10px;
}

.checkout-btn:hover {
  background: #128c7e;
}

.añadir-carrito {
  background: #4caf50;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 8px;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  display: inline-block;
  width: 100%;
  text-align: center;
}

.añadir-carrito:hover {
  background: #45a049;
}

/* Mensaje cuando el carrito está vacío */
.cart-empty-message {
  text-align: center;
  padding: 20px;
  color: #666;
}

/* Notificación de producto añadido */
.cart-notification {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #4caf50;
  color: white;
  padding: 12px 24px;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 1100;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.cart-notification.show {
  opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
  .cart-content {
    width: 95%;
    margin: 10% auto;
  }

  .cart-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .cart-item-actions {
    margin-top: 10px;
    align-self: flex-end;
  }
}
