/**
 * Custom Product Filters - Estilos
 */

/* Contenedor general */
.cpf-filters-container {
  padding: 20px 0;
}

/* ==================== FILTROS ACTIVOS (Superior) ==================== */

.cpf-active-filters {
  background: #f8f9fa;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 25px;
}

.cpf-active-filters-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #ddd;
}

.cpf-active-filters-title {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cpf-clear-all-link {
  font-size: 13px;
  color: #000;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
}

.cpf-clear-all-link:hover {
  color: #666;
  text-decoration: underline;
}

.cpf-active-filters-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 15px;
}

.cpf-active-filter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8f9fa;
  border-left: 3px solid #2271b1;
  border-radius: 4px;
  padding: 10px 12px;
  transition: all 0.3s ease;
}

.cpf-active-filter-item:hover {
  background: #f0f2f5;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cpf-active-filter-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.cpf-filter-icon {
  font-size: 18px;
}

.cpf-active-filter-text {
  font-size: 14px;
  color: #333;
}

.cpf-active-filter-text strong {
  color: #000;
  margin-right: 4px;
}

.cpf-remove-filter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  color: #000;
  border: none;
  border-radius: 50%;
  text-decoration: none;
  font-size: 20px;
  line-height: 1;
  transition: all 0.3s ease;
  cursor: pointer;
}

.cpf-remove-filter:hover {
  background: #000;
  color: #fff;
}

.cpf-clear-all-container {
  padding-top: 15px;
  border-top: 1px solid #e0e0e0;
  text-align: center;
}

.cpf-clear-all-button {
  display: inline-block;
  padding: 8px 20px;
  background: #fff;
  border: 2px solid #000;
  color: #000;
  text-decoration: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  transition: all 0.3s ease;
}

.cpf-clear-all-button:hover {
  background: #000;
  color: #fff;
}

.cpf-remove-filter:hover {
  background: #000;
  transform: scale(1.1);
}

.cpf-filter {
  margin-bottom: 30px;
  padding-bottom: 25px;
}

/* Sin margen inferior para filtros de colores y tallas */
.cpf-color-filter,
.cpf-size-filter {
  margin-bottom: 0;
  padding-bottom: 25px;
}

/* Sin margen superior en el primer filtro */
.cpf-filter:first-child {
  margin-top: 0;
}

.cpf-filter:last-child {
  border-bottom: none;
}

.cpf-filter-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin: 3em 0 15px 0;
  padding: 0 0 10px 0;
  border-bottom: 2px solid #e0e0e0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ==================== FILTRO DE COLORES ==================== */

/* Grid original (con nombre) */
.cpf-color-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

/* Grid de colores - columnas dinámicas desde admin */
.cpf-color-grid-4col {
  display: grid;
  /* grid-template-columns se define inline desde PHP */
  gap: 8px;
  width: 100%;
  max-width: 100%; /* No exceder el contenedor */
}

.cpf-color-item {
  display: flex;
  align-items: center;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
  background: #fff;
}

/* Color item circular (adaptativo) - SIN efecto hover */
.cpf-color-item-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: none;
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1; /* Mantiene cuadrado */
  text-decoration: none !important;
  animation: none !important;
  background-image: none !important;
}

.cpf-color-item-circle:hover {
  /* Sin efecto hover en colores */
  text-decoration: none !important;
  animation: none !important;
  background-image: none !important;
}

/* Override del tema Ohio para enlaces de colores */
.cpf-color-filter a,
.cpf-color-filter a:hover,
.cpf-color-filter a:focus,
.cpf-color-filter a:active {
  text-decoration: none !important;
  animation: none !important;
  background-image: none !important;
  border-bottom: none !important;
}

.cpf-color-item:hover {
  /* Sin efecto hover en contenedor de color */
}

.cpf-color-item.active {
  border-color: #000;
  background: #f5f5f5;
}

.cpf-color-swatch {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #ddd;
  margin-right: 12px;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Color swatch solo (sin texto) - Adaptativo SIN hover de background */
.cpf-color-swatch-only {
  width: 100%;
  max-width: 42px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 3px solid #ddd;
  display: block;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease; /* Solo border */
}

.cpf-color-swatch-only:hover {
  border-color: #999; /* Solo cambia borde, NO background */
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.cpf-color-item-circle.active .cpf-color-swatch-only {
  border-color: #000;
  border-width: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.cpf-color-name {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  flex-grow: 1;
}

.cpf-selected-check {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #000;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
}

/* Check para círculos */
.cpf-selected-check-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #000;
  font-size: clamp(14px, 3.5vw, 20px); /* Responsive */
  font-weight: bold;
  z-index: 3;
  text-shadow:
    -1px -1px 0 #fff,
    1px -1px 0 #fff,
    -1px 1px 0 #fff,
    1px 1px 0 #fff,
    0 0 3px #fff,
    0 0 5px #fff;
  pointer-events: none;
}

/* ==================== FILTRO DE TALLAS ==================== */

.cpf-size-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 8px;
}

/* Grid de tallas - columnas dinámicas desde admin */
.cpf-size-grid-4col {
  display: grid;
  /* grid-template-columns se define inline desde PHP */
  gap: 8px;
  width: 100%;
  max-width: 100%; /* No exceder el contenedor */
}

.cpf-size-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s ease;
  background: #fff;
  width: 100%;
  min-height: 50px; /* Mínimo */
  aspect-ratio: 1 / 1; /* Cuadrados perfectos que se adaptan */
  max-width: 100%; /* No exceder columna */
}

.cpf-size-item:hover {
  border-color: #000;
  background: #000;
  transform: none;
}

.cpf-size-item:hover .cpf-size-value,
.cpf-size-item:hover .cpf-size-count {
  color: #fff;
}

.cpf-size-item.active {
  border-color: #000;
  background: #000;
}

.cpf-size-item.active .cpf-size-value,
.cpf-size-item.active .cpf-size-count {
  color: #fff;
}

.cpf-size-value {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin-bottom: 0;
  display: block;
}

/* ==================== FILTRO DE CATEGORÍAS ==================== */

.cpf-category-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cpf-category-item {
  margin-bottom: 0; /* Sin margen entre items */
}

.cpf-category-item:not(:last-child) .cpf-category-link {
  border-bottom: none; /* Evitar doble borde */
}

.cpf-category-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 10px;
  text-decoration: none !important;
  animation: none !important;
  background-image: none !important;
  border-bottom: none !important;
  background: #fff;
}

.cpf-category-link:hover,
.cpf-category-link:focus,
.cpf-category-link:active {
  text-decoration: none !important;
  animation: none !important;
  background-image: none !important;
  border-bottom: none !important;
  background: #000;
  border-radius: 4px;
}

.cpf-category-link:hover .cpf-category-name {
  color: #fff;
}

.cpf-category-link:hover .cpf-category-count {
  color: #000;
  background: #fff;
}

.cpf-category-item.active .cpf-category-link {
  background: #000;
  border-color: #000;
}

.cpf-category-item.active .cpf-category-name,
.cpf-category-item.active .cpf-category-count {
  color: #fff;
}

.cpf-category-name {
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

.cpf-category-count {
  font-size: 12px;
  color: #999;
  background: #f5f5f5;
  padding: 2px 8px;
  border-radius: 10px;
}

/* Subcategorías */
.cpf-subcategory-list {
  list-style: none;
  margin: 8px 0 0 20px;
  padding: 0;
}

.cpf-subcategory-item {
  margin-bottom: 4px;
}

.cpf-subcategory-item a {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  font-size: 13px;
  color: #666;
  text-decoration: none !important;
  animation: none !important;
  background-image: none !important;
  border-bottom: none !important;
  border-left: 2px solid #e0e0e0;
  transition: all 0.3s ease;
}

.cpf-subcategory-item a:hover,
.cpf-subcategory-item a:focus,
.cpf-subcategory-item a:active {
  text-decoration: none !important;
  animation: none !important;
  background-image: none !important;
  border-bottom: none !important;
  color: #fff;
  background: #000;
  border-left-color: #000;
  padding-left: 15px;
}

.cpf-subcategory-item.active a {
  color: #000;
  font-weight: 600;
  border-left-color: #000;
}

.cpf-subcategory-item span {
  color: #999;
  font-size: 11px;
}

/* ==================== FILTRO DE MARCAS ==================== */

.cpf-brand-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cpf-brand-item {
  margin-bottom: 0; /* Sin margen entre items */
}

.cpf-brand-item:not(:last-child) .cpf-brand-link {
  border-bottom: none; /* Evitar doble borde */
}

.cpf-brand-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 10px;
  text-decoration: none !important;
  animation: none !important;
  background-image: none !important;
  border-bottom: none !important;
  background: #fff;
}

.cpf-brand-link:hover,
.cpf-brand-link:focus,
.cpf-brand-link:active {
  text-decoration: none !important;
  animation: none !important;
  background-image: none !important;
  border-bottom: none !important;
  background: #000;
  border-radius: 4px;
}

.cpf-brand-link:hover .cpf-brand-name {
  color: #fff;
}

.cpf-brand-link:hover .cpf-brand-count {
  color: #000;
  background: #fff;
}

.cpf-brand-item.active .cpf-brand-link {
  background: #000;
  border-color: #000;
}

.cpf-brand-item.active .cpf-brand-name,
.cpf-brand-item.active .cpf-brand-count {
  color: #fff;
}

.cpf-brand-name {
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

.cpf-brand-count {
  font-size: 12px;
  color: #999;
  background: #f5f5f5;
  padding: 2px 8px;
  border-radius: 10px;
}

/* Botón Ver más/menos de marcas */
.cpf-brand-toggle {
  width: 100%;
  padding: 10px;
  margin-top: 10px;
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  text-align: center;
  transition: all 0.2s ease;
}

.cpf-brand-toggle:hover {
  background: #000;
  border-color: #000;
  color: #fff;
}

.cpf-brand-hidden {
  display: none;
}

/* ==================== FILTRO DE ESTILOS ==================== */

.cpf-style-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cpf-style-item {
  margin-bottom: 0; /* Sin margen entre items */
}

.cpf-style-item:not(:last-child) .cpf-style-link {
  border-bottom: none; /* Evitar doble borde */
}

.cpf-style-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 10px;
  text-decoration: none !important;
  animation: none !important;
  background-image: none !important;
  border-bottom: none !important;
  background: #fff;
}

.cpf-style-link:hover,
.cpf-style-link:focus,
.cpf-style-link:active {
  text-decoration: none !important;
  animation: none !important;
  background-image: none !important;
  border-bottom: none !important;
  background: #000;
  border-radius: 4px;
}

.cpf-style-link:hover .cpf-style-name {
  color: #fff;
}

.cpf-style-link:hover .cpf-style-count {
  color: #000;
  background: #fff;
}

.cpf-style-item.active .cpf-style-link {
  background: #000;
  border-color: #000;
}

.cpf-style-item.active .cpf-style-name,
.cpf-style-item.active .cpf-style-count {
  color: #fff;
}

.cpf-style-name {
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

.cpf-style-count {
  font-size: 12px;
  color: #999;
  background: #f5f5f5;
  padding: 2px 8px;
  border-radius: 10px;
}

/* ==================== BOTONES DE LIMPIAR (dentro de cada filtro) ==================== */

.cpf-clear-filter {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 16px;
  font-size: 13px;
  color: #666;
  text-decoration: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  transition: all 0.3s ease;
  background: #fff;
}

.cpf-clear-filter:hover {
  background: #f5f5f5;
  border-color: #999;
  color: #333;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
  .cpf-size-grid,
  .cpf-size-grid-4col {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .cpf-size-item {
    height: 55px; /* Altura fija en tablet */
  }

  .cpf-size-value {
    font-size: 14px; /* Mismo tamaño que categorías */
  }

  .cpf-color-item {
    padding: 10px;
  }

  .cpf-color-swatch {
    width: 35px;
    height: 35px;
  }

  .cpf-color-grid-4col {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }

  .cpf-color-swatch-only {
    max-width: 45px;
  }
}

@media (max-width: 480px) {
  .cpf-size-grid,
  .cpf-size-grid-4col {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .cpf-size-item {
    height: 50px; /* Altura fija en móvil */
  }

  .cpf-color-grid {
    grid-template-columns: 1fr;
  }

  .cpf-color-grid-4col {
    gap: 12px;
    grid-template-columns: repeat(3, 1fr); /* 3 columnas en móvil */
  }

  .cpf-color-swatch-only {
    max-width: none; /* Sin límite en móvil */
  }

  .cpf-active-filters-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .cpf-active-filters-list {
    gap: 6px;
  }
}
