/**
 * Visual-set checkbox swatches for x-gf.
 *
 * Configure per visual-set in WP admin:
 * - Grid columns: 2–6 (default 3)
 * - Swatch height (optional px override, default 52)
 * - Grid columns mobile: 2–6 (default 2 when empty)
 * - Swatch height mobile (optional; falls back to desktop height)
 * - Image fit: cover | contain (default cover)
 * - Selection mode: checkbox | radio
 * - Maximum selections (checkbox mode, optional)
 */

/* Native select stays for value/submit only — never intercept taps (mobile OS picker bug). */
.xgform .jq-selectbox > select {
	pointer-events: none !important;
}

.xgform li.xgfield .xgfield_checkbox.xgf-has-visual-set {
	--xgf-cols: 3;
	--xgf-swatch-height: 52px;
	--xgf-bg-size: cover;
	--xgf-accent: #0ea743;

	display: grid;
	grid-template-columns: repeat(var(--xgf-cols), minmax(0, 1fr));
	gap: 8px 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.xgform li.xgfield .xgfield_checkbox.xgf-has-visual-set > .xgchoice {
	position: relative;
	float: none !important;
	width: auto !important;
	margin: 0;
	list-style: none;
}

.xgform li.xgfield .xgfield_checkbox.xgf-has-visual-set .xgf-choice-label {
	display: flex !important;
	flex-direction: column-reverse;
	align-items: center;
	justify-content: flex-end;
	gap: 6px;
	position: relative;
	width: 100%;
	min-height: calc(var(--xgf-swatch-height) + 28px);
	margin-top: 0;
	padding: 0;
	text-align: center;
	font-weight: 400;
	line-height: 1.25;
	background-image: none !important;
	background-repeat: no-repeat !important;
	cursor: pointer;
	box-sizing: border-box;
}

.xgform li.xgfield .xgfield_checkbox.xgf-has-visual-set .xgf-choice-text {
	display: block;
	width: 100%;
	font-size: 13px;
	background: none !important;
	background-image: none !important;
	background-size: unset !important;
	background-position: unset !important;
	background-repeat: no-repeat !important;
	position: static !important;
	top: auto !important;
	height: auto !important;
	min-height: 0 !important;
	opacity: 1 !important;
	border: none !important;
}

.xgform li.xgfield .xgfield_checkbox.xgf-has-visual-set .xgf-choice-visual {
	display: block !important;
	flex: 0 0 auto;
	width: 100%;
	height: var(--xgf-swatch-height);
	min-height: var(--xgf-swatch-height);
	background-size: var(--xgf-bg-size) !important;
	background-repeat: no-repeat !important;
	background-position: center center !important;
	border-radius: 3px;
	border: 3px solid transparent;
	box-sizing: border-box;
	position: static !important;
	top: auto !important;
	opacity: 1 !important;
}

.xgform li.xgfield .xgfield_checkbox.xgf-has-visual-set.xgf-fit-contain .xgf-choice-visual {
	background-position: bottom center !important;
}

.xgform li.xgfield .xgfield_checkbox.xgf-has-visual-set .xgfield-choice-input {
	position: absolute;
	top: 6px;
	left: 6px;
	width: 20px;
	height: 20px;
	margin: 0 !important;
	z-index: 2;
	accent-color: var(--xgf-accent);
	cursor: pointer;
}

.xgform li.xgfield .xgfield_checkbox.xgf-has-visual-set .xgchoice input:checked + .xgf-choice-label .xgf-choice-visual,
.xgform li.xgfield .xgfield_checkbox.xgf-has-visual-set .xgchoice input:hover + .xgf-choice-label .xgf-choice-visual {
	border-color: var(--xgf-accent);
}

.xgform li.xgfield .xgfield_checkbox.xgf-has-visual-set .xgchoice input:checked + .xgf-choice-label .xgf-choice-text {
	font-weight: 600;
}

@media (max-width: 767px) {
	.xgform li.xgfield .xgfield_checkbox.xgf-has-visual-set {
		grid-template-columns: repeat(var(--xgf-cols-mobile, 2), minmax(0, 1fr));
	}

	.xgform li.xgfield .xgfield_checkbox.xgf-has-visual-set .xgf-choice-label {
		min-height: calc(var(--xgf-swatch-height-mobile, var(--xgf-swatch-height)) + 28px);
	}

	.xgform li.xgfield .xgfield_checkbox.xgf-has-visual-set .xgf-choice-visual {
		height: var(--xgf-swatch-height-mobile, var(--xgf-swatch-height));
		min-height: var(--xgf-swatch-height-mobile, var(--xgf-swatch-height));
	}
}

.xgform li.xgfield .xgfield_checkbox .xgchoice.xgf-choice-disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.xgform li.xgfield .xgfield_checkbox .xgchoice.xgf-choice-disabled .xgf-choice-label {
	cursor: not-allowed;
}

.xgform li.xgfield .xgfield_checkbox.xgf-selection-radio .xgfield-choice-input {
	border-radius: 50%;
}
