/* ============================================
   CWK Swatches – Frontend Styles
   ============================================ */

/* --- Container --- */
.cwk-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 6px 0 12px;
}

/* --- Base swatch --- */
.cwk-swatch {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	border: 2px solid transparent;
	transition: border-color 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
	box-sizing: border-box;
	position: relative;
}

/* --- Color swatch --- */
.cwk-swatch-color {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: 2px solid #e0e0e0;
}

.cwk-swatch-color:hover {
	border-color: #888;
}

.cwk-swatch-color.cwk-swatch-active {
	border-color: #222;
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px #222;
}

/* --- Image swatch --- */
.cwk-swatch-image {
	width: 50px;
	height: 50px;
	border-radius: 4px;
	overflow: hidden;
	border: 2px solid #e0e0e0;
	padding: 0;
}

.cwk-swatch-image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.cwk-swatch-image:hover {
	border-color: #888;
}

.cwk-swatch-image.cwk-swatch-active {
	border-color: #222;
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px #222;
}

/* --- Disabled / out of stock --- */
.cwk-swatch.cwk-swatch-disabled {
	opacity: 0.3;
	cursor: not-allowed;
	pointer-events: none;
	position: relative;
}

.cwk-swatch-color.cwk-swatch-disabled::after {
	content: '';
	position: absolute;
	top: 50%;
	left: -2px;
	right: -2px;
	height: 1.5px;
	background: #999;
	transform: rotate(-45deg);
}

/* --- Tooltip --- */
.cwk-swatch[title] {
	position: relative;
}

.cwk-swatch::before {
	content: attr(title);
	position: absolute;
	bottom: calc(100% + 6px);
	left: 50%;
	transform: translateX(-50%);
	background: #333;
	color: #fff;
	font-size: 11px;
	line-height: 1.3;
	padding: 4px 8px;
	border-radius: 3px;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.15s ease;
	z-index: 10;
}

.cwk-swatch:hover::before {
	opacity: 1;
}

.cwk-swatch.cwk-swatch-disabled::before {
	display: none;
}

/* --- Hide the label "Elegir una opción" row when swatches are present --- */
.variations .cwk-swatches ~ .reset_variations {
	display: inline-block;
	margin-left: 4px;
}

/* --- Variations table: stack label above values --- */
.cwk-product-layout .variations,
.cwk-product-layout .variations tbody,
.cwk-product-layout .variations tr {
	display: block;
	width: 100%;
}

.cwk-product-layout .variations tr {
	margin-bottom: 16px;
}

.cwk-product-layout .variations .label,
.cwk-product-layout .variations .value {
	display: block;
	width: 100%;
	padding: 0;
}

.cwk-product-layout .variations .label {
	margin-bottom: 8px;
}

.cwk-product-layout .variations .label label {
	font-weight: 600;
	font-size: 14px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	margin: 0;
}

/* --- Responsive --- */
@media (max-width: 768px) {
	.cwk-swatch-color {
		width: 34px;
		height: 34px;
	}

	.cwk-swatch-image {
		width: 44px;
		height: 44px;
	}

	.cwk-swatches {
		gap: 6px;
	}

	.cwk-swatch::before {
		display: none; /* No tooltips on mobile */
	}
}

