/* RESET Y GLOBAL */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Nunito', sans-serif;
  background: #fff;
  color: #333;
  font-size: 16px;
  line-height: 1.4;
  overflow-x: hidden;
}

h2 {
    cursor: default;
}

.hidden {
    display: none !important;
}


/* HEADER */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  background-color: white;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  margin-bottom: 2rem;
  position: sticky;
  top: 0;
  z-index: 300;
}

.menu-btn {
  width: 2rem;
  background: none;
  border: none;
  cursor: pointer;
  margin: 0.5rem;
}

.menu-btn img {
  width: 100%;
  height: auto;
}

.logo {
  height: 3.5rem;
  width: auto;
}
.carrito {
    width: 2rem;
  background: none;
  border: none;
  cursor: pointer;
  margin: 0.5rem;
}
.carrito img {
  width: 100%;
  height: auto;
}

/* MENÚ LATERAL */
.menu-lateral {
  position: fixed;
  top: 0;
  left: 0;
  width: 85vw;
  max-width: 320px;
  min-width: 250px;
  height: 100%;
  background: linear-gradient(180deg, #4A8CCA 0%, #3D78B6 100%);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 1000;
  padding: 0;
  box-shadow: 4px 0 15px rgba(0, 0, 0, 0.2);
}

.menu-lateral.visible {
  transform: translateX(0);
}

.menu-header {
  display: flex;
  justify-content: flex-end; /* Pushes the close button to the right */
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  position: relative; /* Establishes a positioning context for the title */
}

.menu-titulo {
  color: white;
  font-size: 1.8rem;
  font-weight: 700;
  /* Center the title perfectly within the header */
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.close-menu-btn {
  background: none;
  border: none;
  color: white;
  font-size: 2.5rem;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s ease, color 0.2s ease;
}

.close-menu-btn:hover {
  transform: rotate(90deg);
  color: #FEF3DC;
}

.menu-opciones {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 1rem;
}

.menu-opciones a {
  color: white;
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.menu-opciones a:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateX(5px);
}

.menu-opciones img {
  width: 1.8rem;
  height: 1.8rem;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.overlay.activa {
  opacity: 1;
  pointer-events: auto;
}

/* SEARCH WRAPPER */
.search-wrapper {
  position: relative;
  z-index: 200; /* High z-index for the whole search component */
}

/* BUSCADOR */
.buscador {
  padding: 10px; /* Padding remains on the inner element */
  background-color: white;
  display: flex;
  justify-content: center;
}

.buscador input {
  width: 100%;
  padding: 0.8rem 1rem 0.8rem 3rem;
  border-radius: 25px;
  background-color: #FEF3DC;
  border: 1px solid #FEF3DC;
  font-size: 1rem;
  outline: none;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.2rem;
  height: 1.2rem;
  pointer-events: none;
}

.search-icon img {
  width: 100%;
  height: auto;
}

/* ENVIO */
.entrega {
  padding: 10px;
  background-color: #ffffff;
  margin-left: 1rem;
}

.entrega-select {
  position: relative;
  width: 100%;
}

.entrega-select select {
  width: 100%;
  padding: 12px;
  padding-right: 2rem;
  border-radius: 5px;
  border: 1px solid #ccc;
  font-size: 16px;
  appearance: none;
  background-color: white;
  color: #817979;
}

.dropdown-arrow {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 16px;
  color: #5a5a5a;
}

/* CATEGORÍAS */
.grid-categorias {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
  padding: 1rem;
}

.categoria {
  background: white;
  border: 3px solid #ccc;
  border-radius: 15px;
  text-decoration: none;
  padding: 1rem;
  width: 90%;
  height: auto;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  cursor: pointer;
  /* --- Initial state for scroll animation --- */
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
  will-change: opacity, transform;
}

.categoria.visible {
  opacity: 1;
  transform: translateY(0);
}

.categoria:hover {
  transform: scale(1.05);
}

.categoria img {
  width: 100%;
  height: auto;
  max-height: 100px;
  object-fit: contain;
}

.categoria p {
  margin: 1rem 0;
  font-size: 1.8em;
  color: #444;
  font-weight: 500;
}

.categoria-frutas { border-color: #3182CE; }
.categoria-verduras { border-color: #38A169; }
.categoria-granos { border-color: #D69E2E; }

/* PROMOCIONES */
.promociones .carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  border-radius: 5%;
}

.carousel-item {
  min-width: 80%;
  height: 100px;
  background: #eee;
  margin: 10px;
  padding: 2%;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  /* Responsive font size: min 1rem, preferred 5vw, max 2.5rem */
  font-size: clamp(1rem, 5vw, 2.5rem);
  /* Remove text-wrap: ; (invalid) */
}

/* MÁS COMPRADOS */
.mas-comprados {
  padding: 25px 15px;
  background: #ffffff;
  position: relative;
}


.productos-container {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 15px;
  padding-bottom: 10px;
  scrollbar-width: none;
}

.productos-slider {
  display: flex;
  flex-direction: row;
  gap: 15px;
  padding: 5px 5px 15px;
}

.producto {
  width: 12rem;
  scroll-snap-align: start;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  flex-shrink: 0;
  transition: transform 0.3s ease;
  border: 2px solid #a8a8a8;
}
.producto:hover {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

.producto-icon img {
  width: 100px;
  height: 100px;
  object-fit: cover;
}

.producto-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 10px;
}

.producto-precio {
  font-weight: bold;
  font-size: 1rem;
  color: #333;
  margin-bottom: 5px;
}

.producto-nombre {
  font-size: 0.9rem;
  color: #666;
}

.agregar-btn {
  background: #4a7db3;
  border: none;
  border-radius: 18px;
  padding: 8px 20px;
  font-weight: bold;
  color: white;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
  width: 100%;
  max-width: 120px;
}

.agregar-btn:hover {
  background: #3e65b3;
}

/* SEARCH RESULTS / SUGGESTIONS DROPDOWN */
.resultados-busqueda {
    position: absolute;
    top: 100%; /* Position it right below the .buscador container */
    left: 10px; /* Align with the padding of .buscador */
    right: 10px; 
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 5px 10px rgba(0,0,0,0.1);
    max-height: 300px;
    overflow-y: auto;
    /* --- Animation Properties --- */
    opacity: 0;
    transform: translateY(-10px);
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.resultados-busqueda.show {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
}

/* Override slider styles for the vertical suggestion list */
#searchResultsContainer.productos-slider {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 0;
}

/* Style for each individual suggestion item */
.suggestion-item {
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Title for recent searches */
.suggestion-title {
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: bold;
    color: #888;
    background-color: #f9f9f9;
    border-bottom: 1px solid #eee;
    cursor: default;
}

.suggestion-item:hover,
.suggestion-item.active {
    background-color: #f0f0f0;
}

/* buscado recientemente */
.recent-item .recent-text {
    flex-grow: 1;
}

.remove-recent-btn {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #aaa;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}
.remove-recent-btn:hover {
    color: #333;
}

/* FOOTER */
.footer {
  background: #4a7db3;
  color: white;
  padding: 2rem 1rem;
  font-size: 14px;
}

.contenido {
  padding-left: 1rem;
}

.footer-logo {
  height: 6rem;
  width: auto;
  margin-bottom: 1rem;
  display: block;
}

.footer-subtitle {
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.footer-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.info-section p {
  margin: 0;
  line-height: 1.5;
}

/* MEDIA QUERIES PARA TABLETS O DESKTOPS */
@media (min-width: 768px) {
  .categoria {
    width: 28%;
  }
  .section-title {
    font-size: 2.5rem;
  }

  .grid-categorias {
    gap: 4rem;
  }

  .productos-slider {
    gap: 2rem;
  }

  .menu-lateral {
    width: 50vw;
  }

  .header {
    padding: 15px 10px;
  }

  .logo {
    height: 5rem;
  }

  .menu-titulo {
    font-size: 3rem;
  }

  .menu-opciones a {
    font-size: 2rem;
  }

  
}
.categorias,
.promociones {
    padding: 25px 15px;
    background: #fff; 
}
