/* Estructura general */
.wike-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  /* CAMBIADO: Usar altura fija más grande para debug */
  max-height: 80vh; /* Simplificado para debug */
  background: #fff;
  border: 1px solid #ccc;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: row;
  z-index: 9999;
  /* CAMBIADO: Forzar scroll */
  overflow: auto;
  overflow-x: hidden;
  overflow-y: scroll;
  box-sizing: border-box;
  padding-top: 40px;
  /* AÑADIDO: Padding bottom para asegurar espacio */
  padding-bottom: 20px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  flex-wrap: nowrap;
  height: auto;
  align-items: flex-start;
}

.wike-search-right::after {
  content: "";
  display: block;
  height: 40px; /* CAMBIADO: Aumentado para dar más espacio al final */
}

/* Botón de cierre */
.wike-search-close {
  position: absolute;
  top: 5px;
  right: 10px;
  font-size: 18px;
  cursor: pointer;
  color: #333;
  background: none;
  border: none;
}

/* Parte izquierda: filtros */
.wike-search-left {
  width: 30%;
  padding: 15px;
  border-right: 1px solid #ddd;
  background-color: #f3f3f3;
}

/* Parte derecha: productos */
.wike-search-right {
  width: 70%;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-sizing: border-box;
  flex: 1 1 auto; /* permite crecer y contraerse */
  /* CAMBIADO: Permitir que crezca con su contenido */
  min-height: auto;  /* CAMBIADO: de 0 a auto para que pueda crecer */
  height: auto;      /* AÑADIDO: asegurar altura automática */
  /* AÑADIDO: Asegurar que el contenedor se ajuste al contenido */
  align-items: stretch;
}

/* Elementos individuales del producto (sin imagen por ahora) */
.wike-product-item {
  border-bottom: 1px solid #eee;
  padding: 8px 0;
  font-size: 0.95rem;
}

.wike-filters {
  padding-left: 20px;
  padding-right: 10px;
}

.wike-filter-section {
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e0e0e0;
  text-align: center;
}

.wike-filter-section h4 {
  font-size: 1.1rem;
  margin-bottom: 10px;
  font-weight: bold;
}

.wike-search-bar {
  display: flex;
  align-items: center;
  border: 1px solid #ccc;
  border-radius: 30px;
  overflow: hidden;
  background-color: #fff;
  /*max-width: 400px;*/
  width: 560px;
  margin: 0 auto;
}

.wike-search-bar input[type="text"] {
  border: none;
  padding: 10px 15px;
  flex: 1;
  font-size: 1rem;
  outline: none;
}

.wike-search-bar button {
  background: none;
  border: none;
  padding: 0 15px;
  cursor: pointer;
  color: #333;
  display: flex;
  align-items: center;
}

.wike-search-bar svg {
  width: 18px;
  height: 18px;
}

.wike-suggestions {
  padding: 10px;
  margin-bottom: 10px;
  background: #f7f7f7;
  border-radius: 5px;
}
.wike-suggestions ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.wike-suggestions li {
  cursor: pointer;
  padding: 5px;
  transition: background 0.2s;
}
.wike-suggestions li:hover {
  background: #e0e0e0;
}

/* Categorías */
.block-categories {
  margin-bottom: 25px;
}

.block-categories h4 {
  font-size: 1.1rem;
  margin-bottom: 10px;
}

.block-categories ul {
  padding-left: 0;
  list-style: none;
}

.block-categories ul li {
  padding: 6px 0;
  border-bottom: 1px solid #eee;
}

.block-categories a {
  color: #333;
  text-decoration: none;
  display: flex;
  justify-content: space-between;
}

.block-categories a:hover {
  color: #007bff;
}

/* Ocultar */
.hidden {
  display: none !important;
}

/* Responsivo */
@media (max-width: 768px) {
  .wike-search-results {
    flex-direction: column;
    max-height: 90vh;
  }

  .wike-search-left,
  .wike-search-right {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #ddd;
  }
}

#wike-products {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
  /* CAMBIADO: Eliminar flex-grow y flex-shrink problemáticos */
  /* flex-grow: 1;
  flex-shrink: 1; */
  /* CAMBIADO: Permitir crecimiento natural */
  min-height: auto;
  height: auto;
  /* AÑADIDO: Asegurar que el contenedor se ajuste a su contenido */
  align-content: flex-start;
  width: 100%; /* Asegurar que ocupe todo el ancho disponible */
  /* AÑADIDO: Margen inferior para el scroll */
  margin-bottom: 40px;
}

.product-card {
  width: 220px;              /* Fijo, no max-width */
  /* CORREGIDO: Eliminar margin duplicado y conflictivo */
  /* margin: 10px; */         /* margen externo - ELIMINADO */
  display: flex;             /* ya no inline-block */
  flex-direction: column;    /* estructura vertical */
  border: 1px solid #eee;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  box-sizing: border-box;
  margin: 0; /* Solo este margin */
  /* AÑADIDO: Asegurar altura mínima */
  min-height: fit-content;
  flex-shrink: 0; /* Evitar que se compriman */
}

.product-image-wrapper {
  position: relative;
}

.discount-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background-color: #e60023;
  color: white;
  padding: 4px 6px;
  font-size: 12px;
  font-weight: bold;
  border-radius: 4px;
}

.product-image {
  width: 100%;
  height: auto;
}

.product-info {
  padding: 10px;
}

.product-title {
  font-weight: 600;
  color: #333;
  text-decoration: none;
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

.product-price-search {
  font-size: 15px;
  display: flex;
  justify-content: center;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.price-discounted {
  color: #e60023;
  font-weight: bold;
}

.price-original {
  color: #999;
  text-decoration: line-through;
  font-size: 14px;
}

.price-normal {
  color: #333;
  font-weight: bold;
}

/* Responsive */
/*@media (min-width: 600px) {
  .product-card {
    width: calc(100% / 3 - 20px);
  }
}

@media (min-width: 900px) {
  .product-card {
    width: calc(100% / 4 - 20px);
  }
}

@media (min-width: 1200px) {
  .product-card {
    width: calc(100% / 5 - 20px);
  }
}*/

.no-scroll {
  overflow: hidden;
  height: 100vh;
}

.search-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.search-filter-bar select {
  padding: 6px 12px;
  font-size: 14px;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 600px) {
  .search-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-filter-bar select {
    width: 100%;
  }
}