/* Enhanced WooCommerce: variation swatches.
 * Colors are CSS variables. In "auto" mode only fallbacks are used, so the
 * swatches inherit the theme font and text color. */

.ewc-has-swatches table.variations,
.ewc-has-swatches table.variations tbody,
.ewc-has-swatches table.variations tr,
.ewc-has-swatches table.variations th,
.ewc-has-swatches table.variations td {
	display: block !important;
	width: 100% !important;
	padding: 0 !important;
	border: 0 !important;
	background: none !important;
	text-align: left !important;
}
.ewc-has-swatches table.variations { margin: 0 0 20px !important; }
.ewc-has-swatches table.variations tr + tr { margin-top: 16px !important; }
.ewc-has-swatches table.variations th.label { margin-bottom: 10px !important; line-height: 1.3; }
.ewc-has-swatches table.variations th.label label { font-weight: 600; }
.ewc-current { font-weight: 400; opacity: .65; }
.ewc-has-swatches .reset_variations { display: none !important; }

.ewc-swatches__select {
	position: absolute !important;
	width: 1px; height: 1px; overflow: hidden;
	clip: rect(0 0 0 0); white-space: nowrap;
}
.ewc-swatches-wrap { position: relative; width: 100%; }
.ewc-swatches {
	display: grid !important;
	grid-template-columns: repeat(var(--ewc-sw-cols, 2), minmax(0, 1fr)) !important;
	gap: 12px !important;
	width: 100% !important;
}

/* Card: neutralise theme / Elementor button styles. */
body .ewc-swatches button.ewc-swatch,
body .ewc-swatches button.ewc-swatch:hover,
body .ewc-swatches button.ewc-swatch:focus,
body .ewc-swatches button.ewc-swatch:active {
	box-sizing: border-box !important;
	display: flex !important;
	align-items: center !important;
	justify-content: flex-start !important;
	gap: 12px !important;
	width: 100% !important;
	min-width: 0 !important; min-height: 0 !important; height: auto !important;
	margin: 0 !important;
	padding: 8px 14px 8px 8px !important;
	background: var(--ewc-sw-bg, transparent) !important;
	background-image: none !important;
	color: var(--ewc-sw-text, currentColor) !important;
	border: 1.5px solid var(--ewc-sw-border, rgba(127, 127, 127, .3)) !important;
	border-radius: var(--ewc-sw-radius, 14px) !important;
	box-shadow: none !important;
	text-align: left !important; text-transform: none !important;
	letter-spacing: normal !important; text-decoration: none !important;
	font-family: inherit !important; font-size: 15px !important; font-weight: 400 !important;
	line-height: 1.25 !important;
	cursor: pointer;
	transition: border-color .2s, background-color .2s, box-shadow .2s !important;
}
body .ewc-swatches button.ewc-swatch:hover { border-color: var(--ewc-sw-active, currentColor) !important; }
body .ewc-swatches button.ewc-swatch:focus-visible { outline: 2px solid var(--ewc-sw-active, currentColor) !important; outline-offset: 2px !important; }

body .ewc-swatches button.ewc-swatch.is-selected,
body .ewc-swatches button.ewc-swatch.is-selected:hover {
	background: var(--ewc-sw-bg-active, rgba(127, 127, 127, .08)) !important;
	border: 2px solid var(--ewc-sw-active, currentColor) !important;
	padding: 7.5px 13.5px 7.5px 7.5px !important;
	box-shadow: 0 0 0 4px rgba(127, 127, 127, .12) !important;
}
body .ewc-swatches button.ewc-swatch.is-disabled { opacity: .4 !important; cursor: not-allowed; }
body .ewc-swatches button.ewc-swatch.is-disabled .ewc-swatch__name { text-decoration: line-through; }
body .ewc-swatches button.ewc-swatch.is-hidden { display: none !important; }

.ewc-swatch__img {
	width: var(--ewc-sw-img, 52px); height: var(--ewc-sw-img, 52px);
	border-radius: 10px; overflow: hidden; flex-shrink: 0;
	background: rgba(127, 127, 127, .1);
}
.ewc-swatch__img img {
	width: 100% !important; height: 100% !important; max-width: none !important;
	object-fit: cover; display: block; margin: 0 !important;
	border-radius: 0 !important; box-shadow: none !important;
}
.ewc-swatch__color {
	width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}
.ewc-swatch__txt { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.ewc-swatch__name { font-weight: 600 !important; font-size: 15px; }
.ewc-swatch__desc {
	font-weight: 400 !important; font-size: 12px; margin-top: 2px;
	color: var(--ewc-sw-muted, currentColor);
	opacity: var(--ewc-sw-muted-opacity, .65);
}

/* Label-only type: compact centered buttons. */
.ewc-swatches--label { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)) !important; }
body .ewc-swatches--label button.ewc-swatch,
body .ewc-swatches--label button.ewc-swatch:hover { justify-content: center !important; padding: 10px 12px !important; }
body .ewc-swatches--label button.ewc-swatch.is-selected { padding: 9.5px 11.5px !important; }
.ewc-swatches--label .ewc-swatch__txt { flex: none; align-items: center; text-align: center; }
.ewc-swatches--label .ewc-swatch__check,
.ewc-swatches--label .ewc-swatch__desc { display: none; }

/* Radio indicator. */
.ewc-swatch__check {
	width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; position: relative;
	border: 1.5px solid var(--ewc-sw-border, rgba(127, 127, 127, .45));
	background: transparent; transition: .2s;
}
.ewc-swatch.is-selected .ewc-swatch__check {
	background: var(--ewc-sw-active, currentColor);
	border-color: var(--ewc-sw-active, currentColor);
}
.ewc-swatch.is-selected .ewc-swatch__check::after {
	content: ""; position: absolute; left: 7px; top: 3.5px; width: 5px; height: 10px;
	border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

@media (max-width: 480px) {
	.ewc-swatches:not(.ewc-swatches--label) { grid-template-columns: repeat(min(var(--ewc-sw-cols, 2), 2), minmax(0, 1fr)) !important; }
	body .ewc-swatches button.ewc-swatch { padding: 6px 10px 6px 6px !important; gap: 10px !important; }
	body .ewc-swatches button.ewc-swatch.is-selected { padding: 5.5px 9.5px 5.5px 5.5px !important; }
	.ewc-swatches { --ewc-sw-img: min(var(--ewc-sw-img, 52px), 44px); }
	.ewc-swatch__name { font-size: 14px; }
	.ewc-swatch__check { width: 18px; height: 18px; }
	.ewc-swatch.is-selected .ewc-swatch__check::after { left: 5.5px; top: 2.5px; width: 4px; height: 8px; }
}
