/**
 * filtros-dinamicos.css
 * Estilos para el sistema de filtros dinámicos
 */

/* ═══════════════════════════════════════ */
/* CONTENEDOR PRINCIPAL DE FILTROS        */
/* ═══════════════════════════════════════ */

.filtros-panel {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 30px;
  border: 1px solid #e0e0e0;
}

/* Titulo de filtros */
.filtros-panel h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: #333;
}

/* ═══════════════════════════════════════ */
/* SELECTOR DE GÉNERO                     */
/* ═══════════════════════════════════════ */

.genero-selector-wrapper {
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid #e0e0e0;
}

.genero-selector-wrapper label {
  display: block;
  font-weight: 600;
  margin-bottom: 10px;
  color: #333;
  font-size: 0.95rem;
}

[data-genero-selector] {
  width: 100%;
  padding: 10px 15px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

[data-genero-selector]:hover {
  border-color: #007bff;
}

[data-genero-selector]:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* ═══════════════════════════════════════ */
/* CATEGORÍAS (Grid de botones)           */
/* ═══════════════════════════════════════ */

.categorias-section {
  margin-bottom: 25px;
}

.categorias-section h3 {
  font-weight: 600;
  margin-bottom: 12px;
  color: #333;
  font-size: 0.95rem;
}

.categorias-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}

.categoria-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 10px;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  text-decoration: none;
  color: #333;
  font-size: 0.85rem;
  font-weight: 500;
}

.categoria-btn img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 8px;
}

.categoria-btn:hover {
  border-color: #007bff;
  background: #f0f7ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

.categoria-btn.active {
  border-color: #007bff;
  background: #0056b3;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.categoria-btn.active span {
  color: white;
}

/* ═══════════════════════════════════════ */
/* SUBCATEGORÍAS (Checkboxes agrupados)   */
/* ═══════════════════════════════════════ */

.subcategorias-section {
  margin-bottom: 25px;
}

.subcategorias-section h3 {
  font-weight: 600;
  margin-bottom: 12px;
  color: #333;
  font-size: 0.95rem;
}

.subcategorias-section.hidden {
  display: none;
}

.subcategorias-grupo {
  margin-bottom: 18px;
  background: white;
  padding: 12px;
  border-radius: 8px;
  border-left: 4px solid #007bff;
}

.subcategorias-grupo h4 {
  font-weight: 600;
  margin-bottom: 10px;
  color: #007bff;
  font-size: 0.9rem;
}

.subcategorias-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  padding: 6px;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.checkbox-item:hover {
  background: #f0f7ff;
}

.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 10px;
  cursor: pointer;
  accent-color: #007bff;
}

.checkbox-item span {
  font-size: 0.95rem;
  color: #555;
}

/* ═══════════════════════════════════════ */
/* PILLS DE FILTROS ACTIVOS               */
/* ═══════════════════════════════════════ */

.filtros-activos {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 2px solid #e0e0e0;
}

.filtros-activos h3 {
  font-weight: 600;
  margin-bottom: 10px;
  color: #333;
  font-size: 0.95rem;
}

[data-filtros-pill] {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-pill {
  display: inline-block;
  background: #007bff;
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}

.filter-pill:empty {
  display: none;
}

/* ═══════════════════════════════════════ */
/* CONTENEDOR DE PRODUCTOS                */
/* ═══════════════════════════════════════ */

[data-productos-container] {
  margin-top: 30px;
}

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

.producto-card {
  display: block;
  text-decoration: none;
  color: #333;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e0e0e0;
  transition: all 0.3s ease;
  background: white;
}

.producto-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  transform: translateY(-4px);
  border-color: #007bff;
}

.producto-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.producto-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 12px 6px;
  margin: 0;
  line-height: 1.3;
}

.producto-card .precio {
  padding: 0 12px 8px;
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #007bff;
}

.producto-card .oferta-badge {
  display: block;
  background: #dc3545;
  color: white;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  margin: 6px 12px 0;
  border-radius: 4px;
}

/* ═══════════════════════════════════════ */
/* MENSAJES DE ESTADO                     */
/* ═══════════════════════════════════════ */

.empty,
.info,
.error {
  text-align: center;
  padding: 30px 20px;
  border-radius: 8px;
  font-size: 0.95rem;
}

.empty {
  background: #f0f0f0;
  color: #666;
}

.info {
  background: #e7f3ff;
  color: #004085;
  border: 1px solid #b3d9ff;
}

.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* ═══════════════════════════════════════ */
/* RESPONSIVE                             */
/* ═══════════════════════════════════════ */

@media (max-width: 768px) {
  .filtros-panel {
    padding: 15px;
  }

  .categorias-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
  }

  .categoria-btn img {
    width: 50px;
    height: 50px;
  }

  .categoria-btn {
    padding: 10px;
    font-size: 0.8rem;
  }

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

  .producto-card img {
    height: 160px;
  }

  [data-filtros-pill] {
    gap: 6px;
  }

  .filter-pill {
    padding: 4px 10px;
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .filtros-panel {
    padding: 12px;
    margin-bottom: 20px;
  }

  .filtros-panel h2 {
    font-size: 1.1rem;
  }

  .categorias-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  }

  .productos-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .subcategorias-grupo {
    padding: 10px;
  }
}
