/*
 * WooCommerce Hierarchical Variation Selector - frontend styles.
 * All rules are namespaced under .whvs-* to avoid clashing with Flatsome / UX Builder.
 */

.whvs-selector {
	--whvs-accent: #f2701c;
	--whvs-accent-soft: #fdecdf;
	--whvs-border: #e3ddd0;
	--whvs-border-dark: #cfc8b8;
	--whvs-ink: #1c1c1e;
	--whvs-muted: #8a8a8e;
	--whvs-icon: #33415c;
	--whvs-card-bg: #fffdf9;

	margin: 0 0 24px;
	max-width: 100%;
}

.whvs-group {
	margin: 0 0 24px;
}

.whvs-group:last-child {
	margin-bottom: 0;
}

.whvs-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 8px 16px;
	margin: 0 0 10px;
}

.whvs-label {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	color: var( --whvs-ink );
}

.whvs-label__sep {
	font-weight: 600;
	opacity: 0.5;
}

.whvs-label__value--muted {
	font-weight: 600;
	color: var( --whvs-muted );
}

.whvs-label__value--accent {
	font-weight: 700;
	color: var( --whvs-accent );
}

.whvs-size-guide {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	border: 0;
	background: none;
	padding: 0;
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	color: var( --whvs-ink );
	opacity: 0.75;
	white-space: nowrap;
	cursor: pointer;
}

.whvs-size-guide:hover {
	opacity: 1;
}

.whvs-size-guide[hidden] {
	display: none;
}

.whvs-size-guide svg {
	width: 14px;
	height: 14px;
	flex: 0 0 auto;
}

.whvs-options {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}

.whvs-options--card {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 112px, 1fr ) );
	gap: 12px;
}

/* Base option (all kinds reset from this). */
.whvs-option {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	box-sizing: border-box;
	border: 1.5px solid var( --whvs-border );
	background: #ffffff;
	color: var( --whvs-ink );
	font: inherit;
	line-height: 1.2;
	cursor: pointer;
	transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
	-webkit-tap-highlight-color: transparent;
	white-space: nowrap;
}

.whvs-option:hover:not( .is-active ) {
	border-color: var( --whvs-border-dark );
}

.whvs-option:focus-visible {
	outline: 2px solid var( --whvs-accent );
	outline-offset: 2px;
}

/* Check-pill kind (Fit Type). */
.whvs-option--check {
	border-radius: 999px;
	min-height: 44px;
	padding: 11px 20px;
	font-size: 14px;
	font-weight: 600;
}

.whvs-option--check.is-active {
	border-color: var( --whvs-accent );
	background: var( --whvs-accent-soft );
	color: var( --whvs-accent );
}

.whvs-check-badge {
	display: inline-flex;
	flex: 0 0 auto;
	color: var( --whvs-accent );
}

.whvs-check-badge svg {
	display: block;
}

/* Radio-pill kind (Print on the). */
.whvs-option--radio {
	border-radius: 999px;
	min-height: 44px;
	padding: 11px 20px;
	font-size: 14px;
	font-weight: 600;
}

.whvs-option--radio.is-active {
	border-color: var( --whvs-accent );
	background: var( --whvs-accent-soft );
	color: var( --whvs-accent );
}

.whvs-radio-dot {
	position: relative;
	width: 16px;
	height: 16px;
	flex: 0 0 auto;
	border-radius: 50%;
	border: 2px solid var( --whvs-border-dark );
}

.whvs-option--radio.is-active .whvs-radio-dot {
	border-color: var( --whvs-accent );
}

.whvs-option--radio.is-active .whvs-radio-dot::after {
	content: '';
	position: absolute;
	inset: 3px;
	border-radius: 50%;
	background: var( --whvs-accent );
}

/* Plain kind (Size). */
.whvs-option--plain {
	border-radius: 8px;
	min-width: 52px;
	min-height: 52px;
	padding: 8px 14px;
	font-size: 14px;
	font-weight: 600;
}

.whvs-option--plain.is-active {
	border-color: var( --whvs-accent );
	background: var( --whvs-accent-soft );
	color: var( --whvs-accent );
}

/* Color swatch kind. */
.whvs-option--swatch {
	overflow: visible;
	border: none;
	border-radius: 8px;
	min-height: 40px;
	padding: 0 16px;
	font-size: 13px;
	font-weight: 700;
	background-color: var( --whvs-swatch-color, #cccccc );
	color: var( --whvs-swatch-text-color, #ffffff );
}

.whvs-option--swatch.is-active {
	outline: 2px solid var( --whvs-accent );
	outline-offset: 3px;
}

.whvs-check-badge--corner {
	position: absolute;
	top: -7px;
	right: -7px;
	width: 18px;
	height: 18px;
}

.whvs-check-badge--corner svg {
	width: 100%;
	height: 100%;
}

/* Style card kind. */
.whvs-option--card {
	flex-direction: column;
	border-radius: 12px;
	min-height: 110px;
	padding: 8px 12px 8px;
	gap: 5px;
	background: var( --whvs-card-bg );
	text-align: center;
	white-space: normal;
}

.whvs-option--card.is-active {
	border-color: var( --whvs-accent );
	background: var( --whvs-accent-soft );
}

.whvs-style-card__media {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 50px;
	width: 50px;
	color: var( --whvs-icon );
}

.whvs-style-card__image {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	display: block;
}

.whvs-style-card__icon svg {
	width: 40px;
	height: 40px;
	display: block;
}

.whvs-style-card__label {
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
}

.whvs-unavailable-message {
	margin-top: 10px;
	padding: 10px 12px;
	border-radius: 8px;
	background: #fdecea;
	border: 1px solid #f3b4ac;
	color: #7a2018;
	font-size: 13px;
}

.whvs-unavailable-message[hidden] {
	display: none;
}

/* Keep the native WooCommerce dropdowns functional but visually hidden once the
   custom UI has taken over, instead of removing them from the DOM. */
.whvs-native-hidden {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect( 0, 0, 0, 0 ) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

@media ( max-width: 767px ) {
	.whvs-options--card {
		grid-template-columns: repeat( auto-fill, minmax( 84px, 1fr ) );
		gap: 8px;
	}

	.whvs-option--card {
		min-height: 88px;
		padding: 6px;
		gap: 4px;
	}

	.whvs-style-card__media {
		height: 36px;
		width: 36px;
	}

	.whvs-style-card__icon svg {
		width: 28px;
		height: 28px;
	}

	.whvs-style-card__label {
		font-size: 11.5px;
		line-height: 1.25;
	}

	.whvs-option--check,
	.whvs-option--radio {
		padding: 10px 16px;
		font-size: 14px;
	}

	.whvs-option--plain {
		min-width: 46px;
		min-height: 46px;
		padding: 6px 10px;
	}

	.whvs-option--swatch {
		min-height: 38px;
		padding: 0 13px;
		font-size: 12.5px;
	}

	.whvs-header {
		row-gap: 6px;
	}
}

/* Size Guide popup. */
html.whvs-modal-open {
	overflow: hidden;
}

.whvs-modal-overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba( 20, 18, 14, 0.55 );
}

.whvs-modal {
	position: relative;
	width: 100%;
	max-width: 560px;
	max-height: calc( 100vh - 40px );
	overflow-y: auto;
	background: #ffffff;
	border-radius: 12px;
	padding: 28px 24px 24px;
	box-sizing: border-box;
	box-shadow: 0 20px 60px rgba( 0, 0, 0, 0.25 );
}

.whvs-modal__close {
	position: absolute;
	top: 14px;
	right: 14px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 50%;
	background: none;
	color: #1c1c1e;
	cursor: pointer;
}

.whvs-modal__close:hover {
	background: #f2ede4;
}

.whvs-modal__title {
	margin: 0 28px 14px 0;
	font-size: 18px;
	font-weight: 800;
	letter-spacing: 0.01em;
	text-transform: uppercase;
	color: #1c1c1e;
}

.whvs-modal__instructions {
	margin: 0 0 16px;
	padding: 12px 16px 12px 32px;
	background: #fdf6e3;
	border-radius: 8px;
	font-size: 13px;
	line-height: 1.6;
	color: #3a3326;
}

.whvs-modal__unit-toggle {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin: 0 0 12px;
	padding: 3px;
	border-radius: 999px;
	background: #f2ede4;
}

.whvs-modal__unit-toggle button {
	border: 0;
	background: none;
	border-radius: 999px;
	padding: 6px 16px;
	font-size: 12.5px;
	font-weight: 700;
	letter-spacing: 0.02em;
	color: #55524a;
	cursor: pointer;
}

.whvs-modal__unit-toggle button.is-active {
	background: #1c1c1e;
	color: #ffffff;
}

.whvs-modal__body {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
	align-items: flex-start;
}

.whvs-modal__diagram {
	max-width: 160px;
	width: 100%;
	height: auto;
	flex: 0 0 auto;
}

.whvs-modal__table-col {
	flex: 1 1 220px;
	min-width: 0;
}

.whvs-modal__table-wrap {
	overflow-x: auto;
}

.whvs-modal__table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
	white-space: nowrap;
}

.whvs-modal__table th {
	text-align: left;
	padding: 8px 12px;
	text-transform: uppercase;
	font-size: 11.5px;
	letter-spacing: 0.02em;
	color: #1c1c1e;
	border-bottom: 2px solid #1c1c1e;
}

.whvs-modal__table td {
	padding: 8px 12px;
	border-bottom: 1px solid #e3ddd0;
	color: #1c1c1e;
}

.whvs-modal__notice {
	margin: 18px 0 0;
	font-size: 12px;
	line-height: 1.5;
	color: #ef4444;
}

/* Gating states (Fit Type/Style not fully selected, or no guide configured
   for the current pair) - same modal chrome, no table/toggle/image. */
.whvs-modal__message {
	margin: 8px 28px 4px 0;
	font-size: 14px;
	line-height: 1.5;
	color: #1c1c1e;
}

@media ( max-width: 480px ) {
	.whvs-modal {
		padding: 22px 16px 18px;
	}

	.whvs-modal__diagram {
		max-width: 120px;
		margin: 0 auto;
	}

	.whvs-modal__body {
		justify-content: center;
	}
}
.woocommerce-variation-add-to-cart .added_to_cart.wc-forward {
	display: none !important;
}
