/*
 * Woodzco Variation Swatches – front end.
 * Class names match "Variation Swatches for WooCommerce" for theme compatibility.
 */

/* Tooltips ---------------------------------------------------------------- */

.woo-variation-swatches [data-wvstooltip],
.woo-variation-swatches .wvs-has-image-tooltip {
	--arrow-width: 5px;
	--arrow-distance: 10px;
	--tip-height: 30px;
	--tip-min-width: 100px;
	--tip-min-height: 100px;
	--horizontal-position: 0px;
	position: relative;
	outline: none;
}

.woo-variation-swatches [data-wvstooltip]::before,
.woo-variation-swatches [data-wvstooltip]::after {
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
	box-sizing: border-box;
	position: absolute;
	z-index: 999;
	transition: opacity 0.3s ease-in-out;
	display: flex;
	justify-content: center;
	align-items: center;
}

.woo-variation-swatches [data-wvstooltip]::before {
	content: attr(data-wvstooltip) " " attr(data-wvstooltip-out-of-stock);
	box-shadow: 0 0 5px 1px rgba(0, 0, 0, 0.3);
	border-radius: 3px;
	background-color: var(--wvs-tooltip-background-color, #333);
	color: var(--wvs-tooltip-text-color, #fff);
	height: var(--tip-height);
	line-height: var(--tip-height);
	width: max-content;
	min-width: var(--tip-min-width);
	max-width: 260px;
	padding-inline: 10px;
	font-size: 14px;
	font-weight: normal;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	bottom: calc(100% + var(--arrow-distance));
	left: 50%;
	transform: translateX(calc(-50% + var(--horizontal-position)));
}

.woo-variation-swatches .wvs-has-image-tooltip[data-wvstooltip]::before {
	content: attr(data-wvstooltip);
	background-image: var(--tooltip-background);
	background-repeat: no-repeat;
	background-size: contain;
	background-position: center top;
	min-width: clamp(var(--tip-min-width), 53vw, var(--tooltip-width, 100px));
	height: calc(clamp(var(--tip-min-height), 53vw, var(--tooltip-height, 100px)) + var(--tip-height));
	flex-direction: column;
	justify-content: flex-end;
	line-height: var(--tip-height);
}

.woo-variation-swatches [data-wvstooltip]::after {
	content: " ";
	width: 0;
	border: var(--arrow-width) solid transparent;
	border-top-color: var(--wvs-tooltip-background-color, #333);
	bottom: calc(100% + var(--arrow-distance) - 2 * var(--arrow-width));
	left: 50%;
	transform: translateX(-50%);
}

.woo-variation-swatches [data-wvstooltip]:hover::before,
.woo-variation-swatches [data-wvstooltip]:hover::after,
.woo-variation-swatches [data-wvstooltip]:focus-visible::before,
.woo-variation-swatches [data-wvstooltip]:focus-visible::after {
	visibility: visible;
	opacity: 1;
}

.woo-variation-swatches .wvs-tooltip-position-bottom[data-wvstooltip]::before {
	bottom: auto;
	top: calc(100% + var(--arrow-distance));
}

.woo-variation-swatches .wvs-tooltip-position-bottom[data-wvstooltip]::after {
	bottom: auto;
	top: calc(100% + var(--arrow-distance) - 2 * var(--arrow-width));
	border-top-color: transparent;
	border-bottom-color: var(--wvs-tooltip-background-color, #333);
}

.woo-variation-swatches .variable-item.disabled[data-wvstooltip]:not(:hover)::before {
	visibility: hidden;
}

/* Layout ------------------------------------------------------------------ */

.woo-variation-swatches .variations td.value,
.woo-variation-swatches .variations .woo-variation-items-wrapper {
	overflow: visible;
}

.woo-variation-swatches .variable-items-wrapper {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	margin: 0;
	padding: 0;
	list-style: none;
	justify-content: flex-start;
}

.woo-variation-swatches .variable-items-wrapper .variable-item {
	margin: 0;
	padding: 0;
	list-style: none;
	transition: all 0.2s ease;
	user-select: none;
	outline: none;
}

.woo-variation-swatches .variable-items-wrapper .variable-item .variable-item-contents {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	position: relative;
	width: 100%;
	height: 100%;
}

.woo-variation-swatches .variable-items-wrapper .variable-item img {
	margin: 0;
	padding: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
}

.woo-variation-swatches .variable-items-wrapper .variable-item > span {
	pointer-events: none;
}

/* Swatch box */
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item) {
	box-sizing: border-box;
	cursor: pointer;
	display: flex;
	position: relative;
	justify-content: center;
	align-items: center;
	background-color: var(--wvs-item-background-color, #fff);
	color: var(--wvs-item-text-color, #000);
	box-shadow: var(--wvs-item-box-shadow, 0 0 0 1px #a8a8a8);
	padding: 2px;
	margin: 4px;
	width: var(--wvs-single-product-item-width, 30px);
	height: var(--wvs-single-product-item-height, 30px);
}

.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item):hover,
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item):focus-visible {
	box-shadow: var(--wvs-hover-item-box-shadow, 0 0 0 3px #ddd);
	background-color: var(--wvs-hover-item-background-color, #fff);
	color: var(--wvs-hover-item-text-color, #000);
}

.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).selected,
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).selected:hover {
	box-shadow: var(--wvs-selected-item-box-shadow, 0 0 0 2px #000);
	color: var(--wvs-selected-item-text-color, #000);
}

/* Color */
.woo-variation-swatches .variable-items-wrapper .variable-item-span-color {
	display: block;
	width: 100%;
	height: 100%;
}

/* Tick on selected color / image */
.woo-variation-swatches .variable-items-wrapper .variable-item.color-variable-item.selected:not(.no-stock) .variable-item-contents::before,
.woo-variation-swatches .variable-items-wrapper .variable-item.image-variable-item.selected:not(.no-stock) .variable-item-contents::before {
	position: absolute;
	content: " ";
	display: block;
	background-image: var(--wvs-tick);
	background-repeat: no-repeat;
	background-position: center center;
	background-size: 60%;
	height: 100%;
	width: 100%;
}

/* Button */
.woo-variation-swatches .variable-items-wrapper .variable-item.button-variable-item {
	text-align: center;
	font-size: var(--wvs-single-product-item-font-size, 16px);
	line-height: 1.2;
}

/* Product page buttons: extra top/bottom room (height grows with the padding). */
.woo-variation-swatches .single-product-variable-items .variable-item.button-variable-item {
	height: auto;
	min-height: var(--wvs-single-product-item-height, 30px);
	padding-top: 8px;
	padding-bottom: 8px;
}

.woo-variation-swatches .single-product-variable-items.enabled-large-size .variable-item.button-variable-item {
	min-height: var(--wvs-single-product-large-item-height, 40px);
}

.woo-variation-swatches .variable-items-wrapper .variable-item.button-variable-item.selected:not(.no-stock) {
	background-color: var(--wvs-selected-item-background-color, #fff);
	color: var(--wvs-selected-item-text-color, #000);
}

/* Unavailable / out of stock */
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled,
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled:hover {
	cursor: not-allowed;
	box-shadow: var(--wvs-item-box-shadow, 0 0 0 1px #a8a8a8);
}

/* Grayed out, but clicking it switches to a combination where it is available. */
.woo-variation-swatches .variable-items-wrapper .variable-item.disabled.wvs-can-reset,
.woo-variation-swatches .variable-items-wrapper .variable-item.disabled.wvs-can-reset label {
	cursor: pointer;
}

.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled.wvs-can-reset:hover {
	box-shadow: var(--wvs-hover-item-box-shadow, 0 0 0 3px #ddd);
}

.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled .variable-item-contents,
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).no-stock .variable-item-contents {
	opacity: 0.6;
}

.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled .variable-item-contents::before,
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).no-stock .variable-item-contents::before {
	position: absolute;
	content: " ";
	display: block;
	background-image: var(--wvs-cross);
	background-repeat: no-repeat;
	background-position: center center;
	background-size: 100% 100%;
	height: 100%;
	width: 100%;
}

.woo-variation-swatches.wvs-behavior-blur-no-cross .variable-items-wrapper .variable-item.disabled .variable-item-contents::before,
.woo-variation-swatches.wvs-behavior-blur-no-cross .variable-items-wrapper .variable-item.no-stock .variable-item-contents::before,
.woo-variation-swatches.wvs-behavior-hide .variable-items-wrapper .variable-item.no-stock .variable-item-contents::before {
	background-image: none;
}

.woo-variation-swatches.wvs-behavior-hide .variable-items-wrapper .variable-item.disabled {
	display: none !important;
}

/* Low stock badge */
.woo-variation-swatches .variable-items-wrapper .variable-item.wvs-show-stock-left-info:not(.disabled) .wvs-stock-left-info::after {
	content: attr(data-wvs-stock-info);
	position: absolute;
	left: 50%;
	top: calc(100% + 4px);
	transform: translateX(-50%);
	min-width: 36px;
	text-align: center;
	line-height: 1;
	font-size: 10px;
	font-style: italic;
	white-space: nowrap;
	background: #de8604;
	color: #fff;
	padding: 2px 3px;
	border-radius: 2px;
	z-index: 2;
}

/* Shapes */
.woo-variation-swatches .wvs-style-rounded.variable-items-wrapper .variable-item:not(.radio-variable-item),
.woo-variation-swatches .wvs-style-rounded.variable-items-wrapper .variable-item:not(.radio-variable-item) .variable-item-span,
.woo-variation-swatches .wvs-style-rounded.variable-items-wrapper .variable-item:not(.radio-variable-item) img {
	border-radius: 100%;
	overflow: hidden;
}

.woo-variation-swatches .wvs-style-rounded.variable-items-wrapper .variable-item.button-variable-item {
	overflow: visible;
}

.woo-variation-swatches .wvs-style-squared.variable-items-wrapper .variable-item:not(.radio-variable-item) {
	border-radius: 2px;
}

.woo-variation-swatches .wvs-style-squared.variable-items-wrapper .variable-item.button-variable-item {
	width: auto;
	min-width: var(--wvs-single-product-item-width, 30px);
}

.woo-variation-swatches .wvs-style-squared.variable-items-wrapper .variable-item.button-variable-item .variable-item-span {
	padding: 0 5px;
}

/* Radio */
.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper {
	display: block;
}

.woo-variation-swatches .variable-items-wrapper .radio-variable-item {
	display: block;
	margin: 0 0 6px;
}

.woo-variation-swatches .variable-items-wrapper .radio-variable-item .variable-item-contents {
	align-items: flex-start;
}

.woo-variation-swatches .variable-items-wrapper .radio-variable-item label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 2px 0;
	cursor: pointer;
}

.woo-variation-swatches .variable-items-wrapper .radio-variable-item input {
	margin: 0;
	width: 18px;
	height: 18px;
}

.woo-variation-swatches .variable-items-wrapper .radio-variable-item .variable-item-radio-value-wrapper img {
	width: 40px;
	height: 40px;
	display: inline-block;
	vertical-align: middle;
}

.woo-variation-swatches .variable-items-wrapper .radio-variable-item .variable-item-radio-value-wrapper .stock {
	display: inline;
	margin: 0;
}

.woo-variation-swatches .variable-items-wrapper .radio-variable-item.disabled label {
	cursor: not-allowed;
	opacity: 0.5;
	text-decoration: line-through;
}

.woo-variation-swatches .variable-items-wrapper .radio-variable-item.no-stock .variable-item-radio-value {
	text-decoration: line-through;
	opacity: 0.6;
}

.woo-variation-swatches.wvs-behavior-hide .variable-items-wrapper .radio-variable-item.disabled {
	display: none !important;
}

/* "+N more" */
.woo-variation-swatches .woo-variation-swatches-variable-item-more {
	list-style: none;
	margin: 4px;
	font-size: small;
	align-self: center;
}

/* Large swatches */
.woo-variation-swatches .enabled-large-size.variable-items-wrapper .variable-item:not(.radio-variable-item) {
	width: var(--wvs-single-product-large-item-width, 40px);
	height: var(--wvs-single-product-large-item-height, 40px);
}

.woo-variation-swatches .enabled-large-size.variable-items-wrapper .variable-item.button-variable-item {
	font-size: var(--wvs-single-product-large-item-font-size, 16px);
}

.woo-variation-swatches .wvs-style-squared.enabled-large-size.variable-items-wrapper .variable-item.button-variable-item {
	width: auto;
	min-width: var(--wvs-single-product-large-item-width, 40px);
}

/* Groups */
.woo-variation-swatches .grouped-variable-items {
	display: flex;
	flex-wrap: wrap;
	list-style: none;
}

.woo-variation-swatches .grouped-variable-items-display-vertical {
	flex-direction: column;
	align-items: flex-start;
}

.woo-variation-swatches .grouped-variable-items-display-horizontal {
	align-items: flex-end;
}

.woo-variation-swatches .grouped-variable-items .group-variable-items-wrapper {
	list-style: none;
	margin: 10px 20px 0 0;
}

.woo-variation-swatches .grouped-variable-items .group-variable-items-wrapper:last-child {
	margin-right: 0;
}

.woo-variation-swatches .grouped-variable-items .group-variable-item-wrapper {
	display: flex;
	flex-wrap: wrap;
	margin: 0;
	padding: 0;
	list-style: none;
}

.woo-variation-swatches .grouped-variable-items .group-variable-items-name {
	font-style: italic;
	font-size: 0.9em;
}

/* Selected value label */
.woo-variation-swatches.wvs-show-label .variations th,
.woo-variation-swatches.wvs-show-label .variations td {
	display: block;
	width: auto !important;
	text-align: start;
}

.woo-variation-swatches.wvs-show-label .variations th label {
	display: inline-block;
	margin: 0 2px 0 0;
}

.woo-variation-swatches .woo-selected-variation-item-name {
	font-weight: 600;
	margin-inline-start: 2px;
}

/* Shop pages -------------------------------------------------------------- */

.woo-variation-swatches .wvs-archive-variations-wrapper {
	margin: 8px 0;
	position: relative;
}

.woo-variation-swatches .wvs-archive-variations-wrapper .variations {
	display: flex;
	flex-direction: column;
	align-items: var(--wvs-position, flex-start);
	list-style: none;
	margin: 0;
	padding: 0;
}

.woo-variation-swatches .wvs-archive-variations-wrapper .variations > li {
	list-style: none;
	margin: 0;
	padding: 0;
}

.woo-variation-swatches .wvs-archive-variations-wrapper .woo-variation-item-label {
	margin-top: 4px;
	font-size: 0.9em;
}

.woo-variation-swatches .wvs-archive-variations-wrapper .variable-items-wrapper {
	justify-content: var(--wvs-position, flex-start);
}

.woo-variation-swatches .wvs-archive-variations-wrapper .variable-item:not(.radio-variable-item) {
	width: var(--wvs-archive-product-item-width, 30px);
	height: var(--wvs-archive-product-item-height, 30px);
}

.woo-variation-swatches .wvs-archive-variations-wrapper .variable-item.button-variable-item {
	font-size: var(--wvs-archive-product-item-font-size, 16px);
}

.woo-variation-swatches .wvs-archive-variations-wrapper .wvs-style-squared .variable-item.button-variable-item {
	width: auto;
	min-width: var(--wvs-archive-product-item-width, 30px);
}

.woo-variation-swatches .wvs-archive-variations-wrapper .wvs_archive_reset_variations {
	font-size: small;
}

.woo-variation-swatches .wvs-archive-variations-wrapper .wvs-archive-information:empty {
	display: none;
}

.woo-variation-swatches .wvs-archive-variations-wrapper .wvs-archive-information p {
	margin: 4px 0 0;
	font-size: small;
}

.wp-block-wzvs-variation-swatches.swatches-align-left {
	--wvs-position: flex-start;
}

.wp-block-wzvs-variation-swatches.swatches-align-center {
	--wvs-position: center;
}

.wp-block-wzvs-variation-swatches.swatches-align-right {
	--wvs-position: flex-end;
}

/* Filter widget ----------------------------------------------------------- */

.wvs-widget-layered-nav-list .wvs-widget-item-wrapper {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.wvs-widget-layered-nav-list .item {
	display: inline-block;
	width: 20px;
	height: 20px;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
	object-fit: cover;
}

.wvs-widget-layered-nav-list .item.style-rounded {
	border-radius: 50%;
}

.wvs-widget-layered-nav-list .chosen .item {
	box-shadow: 0 0 0 2px currentColor;
}

/* Theme fixes ------------------------------------------------------------- */

.wvs-theme-storefront.single-product div.product {
	overflow: visible;
}

.wvs-theme-flatsome .variations .reset_variations {
	position: relative;
	bottom: 0;
	left: 0;
}

.wvs-theme-woodmart .woo-variation-items-wrapper > .swatches-select,
.wvs-theme-woodmart .wd-attr-selected,
.wvs-theme-kalium .woo-variation-items-wrapper .select-option-ui,
.wvs-theme-savoy .woo-variation-items-wrapper .sod_select,
.wvs-theme-woodstock .woo-variation-items-wrapper .variation-select,
.wvs-theme-oxygen .woo-variation-items-wrapper .select-wrapper,
.wvs-theme-thegem .woo-variation-items-wrapper .combobox-wrapper {
	display: none !important;
}

.woo-variation-swatches.woocommerce .product.elementor table.variations td.value::before {
	display: none !important;
}

.woo-variation-swatches.rtl .variable-items-wrapper .variable-item:not(.radio-variable-item) {
	margin: 4px 0 4px 8px;
}

@media (prefers-reduced-motion: reduce) {
	.woo-variation-swatches .variable-items-wrapper .variable-item,
	.woo-variation-swatches [data-wvstooltip]::before,
	.woo-variation-swatches [data-wvstooltip]::after {
		transition: none;
	}
}
