/**
 * Estilos actualizados para el Componente de Catálogo con Filtros Jerárquicos
 */

/* Contenedor principal */
.anchico-catalogo-container {
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  padding: 20px;
  color: #333;
}

/* Estilos generales para filas de filtros */
.anchico-catalogo-filters-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  margin-bottom: 0 !important;
  padding: 10px;
  border-radius: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  justify-content: flex-start; /* Asegura que los primeros elementos sean visibles */
}

.anchico-catalogo-filters-row::before,
.anchico-catalogo-filters-row::after {
  content: "";
  flex: 1; /* Toma el espacio disponible de manera igual */
}

/* Estilizar la barra de scroll */
.anchico-catalogo-filters-row::-webkit-scrollbar {
  height: 6px;
}

.anchico-catalogo-filters-row::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.anchico-catalogo-filters-row::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.anchico-catalogo-filters-row::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

/* Contenedor de filtros primarios (géneros) */
.anchico-catalogo-primary-filters {
  margin-bottom: 0 !important;
}

/* Contenedor de filtros secundarios (consolas) */
.anchico-catalogo-secondary-filters {
  margin-bottom: 0 !important;
}

/* Contenedor de filtros de plataforma */
.anchico-catalogo-platform-filters {
  margin-bottom: 0 !important;
}

/* Estilo básico para todos los filtros */
.anchico-catalogo-filter {
  padding: 10px 20px;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  background-color: transparent; /* Fondo transparente por defecto */
  color: #333; /* Texto negro por defecto */
  border: 1px solid #ccc; /* Borde gris */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  text-align: center;
  min-width: max-content; /* Asegura que el contenido no se corte */
  white-space: nowrap; /* Evita que el texto se envuelva */
}

.anchico-catalogo-filter:hover {
  background-color: rgba(0, 0, 0, 0.05);
  border-color: #aaa;
  transform: translateY(-1px);
}

/* Estado activo para todos los filtros */
.anchico-catalogo-filter.anchico-catalogo-filter-active {
  background-color: var(--background-secondary, #4a4a4a);
  color: black;
  border-color: var(--background-secondary, #4a4a4a);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Contador de productos */
.anchico-catalogo-filter-count {
  font-size: 0.85em;
  opacity: 0.8;
  margin-left: 3px;
}

/* Contenedor de productos */
.anchico-catalogo-products-wrapper {
  position: relative;
  margin-top: 30px;
}

/* Grid de productos */
.anchico-catalogo-container .products {
  display: grid !important;
  grid-gap: 20px;
  grid-template-columns: repeat(var(--columns-desktop, 4), 1fr) !important;
  padding: 0;
  margin: 0;
  list-style: none;
}

/* Ajustes de estilo para productos de WooCommerce */
.anchico-catalogo-container .products > li.product {
  width: 100% !important;
  float: none !important;
  margin: 0 !important;
  padding: 15px !important;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  transition: all 0.3s ease;
}

.anchico-catalogo-container .products > li.product:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  background-color: rgba(255, 255, 255, 0.1);
}

/* Responsive */
@media (max-width: 64rem) {
  .anchico-catalogo-filter {
    padding: 8px 15px;
    font-size: 0.9em;
  }
}

@media (max-width: 37.5rem) {
  .anchico-catalogo-container .products {
    grid-template-columns: repeat(var(--columns-mobile, 1), 1fr) !important;
  }

  .anchico-catalogo-filter {
    padding: 6px 12px;
    font-size: 0.85em;
  }

  .anchico-catalogo-filters-row {
    padding: 5px;
    gap: 6px;
  }
}

/* Estado de carga */
.anchico-catalogo-products-wrapper.loading {
  min-height: 200px;
}

.anchico-catalogo-products-wrapper.loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.7);
  z-index: 1;
  border-radius: 8px;
}

.anchico-catalogo-products-wrapper.loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-top: 4px solid var(--background-secondary, #4a4a4a);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 2;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Mensaje sin productos */
.anchico-catalogo-no-products {
  padding: 40px;
  text-align: center;
  background-color: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
  color: #666;
  font-size: 1.1em;
}

/* Paginación */
.anchico-catalogo-pagination {
  margin-top: 30px;
  text-align: center;
}

.anchico-catalogo-pagination .page-numbers {
  display: inline-block;
  padding: 8px 12px;
  margin: 0 3px;
  border: 1px solid #ddd;
  border-radius: 3px;
  text-decoration: none;
  color: #333;
  background-color: transparent;
  transition: all 0.3s ease;
}

.anchico-catalogo-pagination .page-numbers.current {
  background-color: var(--background-secondary, #4a4a4a);
  color: white;
  border-color: var(--background-secondary, #4a4a4a);
}

.anchico-catalogo-pagination .page-numbers:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Animaciones para cambios de filtro */
.anchico-catalogo-filter {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Estilo para los grupos de plataformas */
.platform-group {
  width: 100%;
  animation: slideDown 0.3s ease-in-out;
  display: flex;
  gap: var(--spacing-sm);
  justify-content: center;
}

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

/* Estilo para la transición entre productos */
.anchico-catalogo-products ul.products {
  transition: opacity 0.3s ease;
}

.anchico-catalogo-products-wrapper.loading .products {
  opacity: 0.5;
}
