/**
 * Productable — Swatches de variación.
 *
 * Botones tipo píldora para atributos de texto (como Tallas). El `<select>`
 * nativo se mantiene oculto (clase `productable-raw-select`) para que el JS de
 * WooCommerce siga sincronizando las variaciones.
 */

/* Select nativo oculto (la clase la agrega swatches.js). */
.productable-raw-select {
	display: none !important;
}

/* Contenedor de botones. */
.productable-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 12px;
	padding: 0;
	list-style: none;
}

.productable-swatches .productable-swatch-item {
	margin: 0;
	padding: 0;
}

/* Botón base (0,2,0: gana al [type=button] del tema). */
.productable-swatches .productable-swatch {
	min-width: var(--productable-swatch-width, 40px);
	height: var(--productable-swatch-height, 40px);
	font-size: var(--productable-swatch-font, 14px);
	padding: 0 14px;
	border: 1px solid #cfcfcf;
	background: #ffffff;
	color: #1a1a1a;
	cursor: pointer;
	line-height: 1;
	transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

/* Forma: píldora (por defecto). */
.productable-swatches--rounded .productable-swatch {
	border-radius: 999px;
}

/* Forma: cuadrado. */
.productable-swatches--squared .productable-swatch {
	border-radius: 8px;
}

/* Hover negro (0,3,0). */
.productable-swatches .productable-swatch:hover {
	background: var(--productable-swatch-selected-bg, #1a1a1a);
	color: var(--productable-swatch-selected-text, #ffffff);
	border-color: var(--productable-swatch-selected-bg, #1a1a1a);
}

/* Seleccionado (0,3,0 y 0,4,0 en hover/focus). */
.productable-swatches .productable-swatch.is-selected,
.productable-swatches .productable-swatch.is-selected:hover,
.productable-swatches .productable-swatch.is-selected:focus {
	background: var(--productable-swatch-selected-bg, #1a1a1a);
	color: var(--productable-swatch-selected-text, #ffffff);
	border-color: var(--productable-swatch-selected-bg, #1a1a1a);
}

/* Sin stock: apagado y sin clic (0,3,0). */
.productable-swatches .productable-swatch.is-disabled,
.productable-swatches .productable-swatch:disabled,
.productable-swatches .productable-swatch.is-disabled:hover,
.productable-swatches .productable-swatch:disabled:hover {
	background: #ececec;
	color: #9a9a9a;
	border-color: #d4d4d4;
	opacity: 0.6;
	cursor: not-allowed;
	text-decoration: none;
	pointer-events: none;
}

/* Foco accesible. */
.productable-swatch:focus-visible {
	outline: 2px solid #1a1a1a;
	outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
 * Presentación en la tabla de variaciones (solo ficha de producto).
 *
 * WooCommerce renderiza cada atributo como table.variations > tr > td.label
 * (etiqueta "Tallas") + td.value (select + nuestras píldoras). El tema pinta
 * button:hover de rojo y da 15px de padding + fondo gris a la sección de
 * atributos; estas reglas lo neutralizan SOLO aquí, sin tocar tablas
 * globales ni el carrito.
 * ------------------------------------------------------------------------- */

/* Píldoras apiladas DEBAJO de la etiqueta. */
.woocommerce form.cart table.variations tr {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
}

.woocommerce form.cart table.variations td.value {
	width: 100%;
}

/* Sección de atributos limpia: sin fondo gris, sin bordes de rejilla y sin el padding de 15px del tema. */
.woocommerce form.cart table.variations,
.woocommerce form.cart table.variations tbody,
.woocommerce form.cart table.variations tr,
.woocommerce form.cart table.variations td,
.woocommerce form.cart table.variations th {
	background: transparent;
	border: 0;
}

.woocommerce form.cart table.variations td.label,
.woocommerce form.cart table.variations th.label {
	padding: 0 0 8px;
}

/* La etiqueta "Tallas" y la etiqueta "Cantidad" comparten tamaño de texto.
   Se usa rem (no em) para que no dependa del contexto de cada contenedor. */
body.woocommerce form.cart table.variations td.label,
body.woocommerce form.cart table.variations td.label label,
body.woocommerce form.cart table.variations th.label,
body.woocommerce form.cart table.variations th.label label {
	font-size: 0.9rem;
	font-weight: 700;
}

.woocommerce form.cart table.variations td.value {
	padding: 0 0 16px;
}

/* Número de la talla elegida, junto a la etiqueta "Tallas". */
.productable-selected-num {
	font-weight: 600;
	color: #1a1a1a;
	margin-left: 6px;
}

/* Ocultar extras de variación ("Limpiar" y disponibilidad) cuando el ajuste está activo. */
body.productable-hide-extras form.cart .reset_variations,
body.productable-hide-extras form.cart .woocommerce-variation-availability {
	display: none !important;
}

/* Compactar el hueco entre las tallas y el botón de compra (solo ficha con extras ocultos). */
body.productable-hide-extras form.cart table.variations {
	margin-bottom: 6px !important;
}
body.productable-hide-extras form.cart table.variations td.value {
	padding-bottom: 8px !important;
}
body.productable-hide-extras form.cart .single_variation {
	margin: 0 !important;
	padding: 0 !important;
}
body.productable-hide-extras form.cart .woocommerce-variation-add-to-cart {
	margin-top: 0 !important;
}
