/**
 * KPS xWootools – Estilos frontend para swatches de variaciones.
 *
 * Notas:
 * - Cada atributo se envuelve en .kps-xwt-attribute-wrapper.
 * - Dentro hay un <select> nativo (oculto) y .kps-xwt-swatches con los botones.
 */

.kps-xwt-attribute-wrapper {
  margin-bottom: 0.75em;
  --kps-xwt-swatch-size: 32px;
}

/* Ocultamos el <select> nativo pero lo mantenemos en el DOM
   para que WooCommerce gestione las variaciones como siempre. */
.kps-xwt-attribute-wrapper select {
  position: absolute;
  left: -9999px;
}

/* Contenedor de swatches */
.kps-xwt-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Botón base de swatch */
.kps-xwt-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  width: var(--kps-xwt-swatch-size);
  height: var(--kps-xwt-swatch-size);
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.kps-xwt-swatch-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center center;
  padding: 0 6px;
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
}

/* Estilos según vista global (ajustes) */

.kps-xwt-view-rounded .kps-xwt-swatch {
  border-radius: 50%;
}

.kps-xwt-view-pill .kps-xwt-swatch {
  border-radius: 999px;
  min-width: calc(var(--kps-xwt-swatch-size) * 2);
}

.kps-xwt-view-square .kps-xwt-swatch {
  border-radius: 2px;
}

/* Estados */

.kps-xwt-swatch:hover:not(.is-disabled) {
  border-color: #555;
}

.kps-xwt-swatch.is-selected {
  border-color: #000;
  box-shadow: 0 0 0 1px #000;
}

.kps-xwt-swatch.is-disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Swatches basados en texto (label, button, radio, select):
   no necesitan background-image/color por defecto. */
.kps-xwt-swatch.kps-xwt-swatch-type-label .kps-xwt-swatch-inner,
.kps-xwt-swatch.kps-xwt-swatch-type-button .kps-xwt-swatch-inner,
.kps-xwt-swatch.kps-xwt-swatch-type-radio .kps-xwt-swatch-inner,
.kps-xwt-swatch.kps-xwt-swatch-type-select .kps-xwt-swatch-inner {
  background-image: none;
  background-color: transparent;
}

/* Ajuste responsive */
@media (max-width: 480px) {
  .kps-xwt-swatches {
    gap: 4px;
  }
}
