/**
 * Kitty Fashion Color Gallery — Phase 2 storefront swatches.
 * Namespaced classes only; does not style gallery.
 */

/* Native Color/Size selects stay in the DOM for WooCommerce; visually hidden only. */
.kfcg-native-select {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.variations td.value {
	position: relative;
}

.kfcg-color-swatches,
.kfcg-size-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
}

.kfcg-color-swatches {
	gap: 10px;
}

/* Color swatch buttons — Flipkart-style image thumbnails */
.kfcg-color-swatch {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 72px;
	height: 72px;
	padding: 0;
	margin: 0;
	overflow: hidden;
	border: 1px solid #ddd;
	border-radius: 8px;
	background: #fff;
	cursor: pointer;
	box-sizing: border-box;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.kfcg-color-swatch:focus {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.kfcg-color-swatch:focus:not(:focus-visible) {
	outline: none;
}

.kfcg-color-swatch:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.kfcg-color-swatch.is-selected {
	border: 2px solid #222;
	box-shadow: none;
}

.kfcg-color-swatch.is-disabled,
.kfcg-color-swatch:disabled {
	opacity: 0.45;
	cursor: not-allowed;
	position: relative;
}

.kfcg-color-swatch.is-disabled::after,
.kfcg-color-swatch:disabled::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to top left,
		transparent calc(50% - 1px),
		#b32d2e calc(50% - 1px),
		#b32d2e calc(50% + 1px),
		transparent calc(50% + 1px)
	);
	pointer-events: none;
	border-radius: 8px;
}

.kfcg-color-swatch__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 7px;
}

.kfcg-color-swatch--text {
	width: auto;
	min-width: 72px;
	max-width: 120px;
	height: 72px;
	padding: 4px 10px;
}

.kfcg-color-swatch__label {
	display: block;
	font-size: 12px;
	line-height: 1.2;
	text-align: center;
	color: #1d2327;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 100px;
}

/* Size buttons */
.kfcg-size-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	height: 40px;
	padding: 6px 12px;
	margin: 0;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	background: #fff;
	color: #1d2327;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.2;
	cursor: pointer;
	box-sizing: border-box;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.kfcg-size-button:focus {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.kfcg-size-button:focus:not(:focus-visible) {
	outline: none;
}

.kfcg-size-button:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.kfcg-size-button.is-selected {
	border-color: #1d2327;
	background: #1d2327;
	color: #fff;
}

.kfcg-size-button.is-disabled,
.kfcg-size-button:disabled {
	opacity: 0.45;
	cursor: not-allowed;
	text-decoration: line-through;
}

.kfcg-size-button__label {
	pointer-events: none;
}

@media (max-width: 1024px) {
	.kfcg-color-swatch {
		width: 64px;
		height: 64px;
	}

	.kfcg-color-swatch--text {
		min-width: 64px;
		height: 64px;
	}
}

@media (max-width: 767px) {
	.kfcg-color-swatch {
		width: 58px;
		height: 58px;
	}

	.kfcg-color-swatch--text {
		min-width: 58px;
		height: 58px;
	}
}

@media (max-width: 480px) {
	.kfcg-size-button {
		min-width: 40px;
		height: 36px;
		padding: 4px 10px;
		font-size: 12px;
	}
}
