/* ==========================================================================
   Product Swatches — Frontend
   ========================================================================== */

/* Hide original select when swatches are active */
select.kw-swatch-select-hidden {
	display: none !important;
}

/* Swatch container */
.kw-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 6px;
}

/* ── Base swatch ── */
.kw-swatch {
	position: relative;
	cursor: pointer;
	transition: transform 0.15s, box-shadow 0.15s;
}

.kw-swatch:hover {
	transform: translateY(-1px);
}

.kw-swatch.is-active {
	box-shadow: 0 0 0 2px var(--wp--preset--color--accent, #0f3460);
}

.kw-swatch.is-disabled {
	opacity: 0.35;
	pointer-events: none;
	position: relative;
}

.kw-swatch.is-disabled::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(135deg, transparent 45%, rgba(0,0,0,.3) 45%, rgba(0,0,0,.3) 55%, transparent 55%);
	border-radius: inherit;
}

/* ── Tooltip ── */
.kw-swatch__tooltip {
	position: absolute;
	bottom: calc(100% + 6px);
	left: 50%;
	transform: translateX(-50%);
	padding: 3px 8px;
	background: var(--wp--preset--color--text, #1a1a2e);
	color: #fff;
	font-size: 11px;
	font-weight: 500;
	white-space: nowrap;
	border-radius: 4px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.15s;
}

.kw-swatch:hover .kw-swatch__tooltip {
	opacity: 1;
}

/* ── Color swatch ── */
.kw-swatch--color {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: 2px solid transparent;
	padding: 3px;
}

.kw-swatch--color.is-active {
	border-color: var(--wp--preset--color--accent, #0f3460);
	box-shadow: none;
}

.kw-swatch__color {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	border: 1px solid rgba(0, 0, 0, 0.1);
}

/* ── Image swatch ── */
.kw-swatch--image {
	width: 48px;
	height: 48px;
	border-radius: var(--kw-radius-sm, 6px);
	overflow: hidden;
	border: 2px solid var(--wp--preset--color--border, #dee2e6);
}

.kw-swatch--image.is-active {
	border-color: var(--wp--preset--color--accent, #0f3460);
	box-shadow: none;
}

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

.kw-swatch__placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	background: var(--wp--preset--color--surface-alt, #f8f9fa);
	font-size: 12px;
	font-weight: 600;
	color: var(--wp--preset--color--text-light, #6c757d);
	text-transform: uppercase;
}

/* ── Label swatch ── */
.kw-swatch--label {
	padding: 6px 14px;
	border: 1px solid var(--wp--preset--color--border, #dee2e6);
	border-radius: var(--kw-radius-sm, 6px);
	background: var(--wp--preset--color--surface, #fff);
	transition: border-color 0.15s, background-color 0.15s, transform 0.15s;
}

.kw-swatch--label:hover {
	border-color: var(--wp--preset--color--accent, #0f3460);
	background: var(--wp--preset--color--surface-alt, #f8f9fa);
}

.kw-swatch--label.is-active {
	border-color: var(--wp--preset--color--accent, #0f3460);
	background: var(--wp--preset--color--accent, #0f3460);
	color: #fff;
	box-shadow: none;
}

.kw-swatch--label.is-active .kw-swatch__text {
	color: inherit;
}

.kw-swatch__text {
	font-size: 0.8125rem;
	font-weight: 500;
	color: var(--wp--preset--color--text, #1a1a2e);
	line-height: 1.4;
}
