/* WD Bundle Variations
 * Colors are resolved in this order:
 *   1. --wdva-c-*   (set by the plugin from Woodmart / Elementor / custom settings)
 *   2. Woodmart's live CSS variables
 *   3. Elementor's global color variables
 *   4. a neutral fallback
 */
.wdva {
	--wdva-accent: var(--wdva-c-accent, var(--btn-accented-bgcolor, var(--wd-primary-color, var(--e-global-color-primary, #7a5555))));
	--wdva-text: var(--wdva-c-text, var(--wd-text-color, var(--e-global-color-text, #333)));
	--wdva-title: var(--wdva-c-title, var(--wd-title-color, var(--e-global-color-primary, #111)));
	--wdva-save: var(--wdva-c-save, var(--wd-primary-color, #d33a3a));
	--wdva-r: var(--wd-brd-radius, 8px);
	--wdva-idle: #efefef;
	--wdva-line: #dcdcdc;
	--wdva-tint: #f1e8e8;
	--wdva-extra: #ece3e3;
	--wdva-extra-idle: #e3dada;

	position: relative;
	margin: 0 0 18px;
	font-family: inherit;
	color: var(--wdva-text);
	line-height: 1.35;
}

@supports (color: color-mix(in srgb, red 10%, white)) {
	.wdva {
		--wdva-idle: color-mix(in srgb, var(--wdva-text) 7%, #fff);
		--wdva-line: color-mix(in srgb, var(--wdva-text) 22%, #fff);
		--wdva-tint: color-mix(in srgb, var(--wdva-accent) 14%, #fff);
		--wdva-extra: color-mix(in srgb, var(--wdva-accent) 16%, #fff);
		--wdva-extra-idle: color-mix(in srgb, var(--wdva-accent) 24%, #fff);
	}
}

.wdva *, .wdva *::before, .wdva *::after { box-sizing: border-box; }

/* Hide the theme's own variation UI while the widget is on. */
form.cart.wdva-on table.variations,
form.cart.wdva-on .reset_variations,
form.cart.wdva-on .woocommerce-variation-description,
form.cart.wdva-on .woocommerce-variation-price,
form.cart.wdva-on .woocommerce-variation-availability,
form.cart.wdva-on .quantity,
form.cart.wdva-on .wd-swatches-product { display: none !important; }

.wdva-list { display: flex; flex-direction: column; gap: 12px; }

/* ----------------------------------------------------------- tier card */
.wdva-tier {
	position: relative;
	background: var(--wdva-idle);
	border: 1px solid var(--wdva-line);
	border-radius: var(--wdva-r);
	transition: background .2s, border-color .2s, box-shadow .2s;
}
.wdva-tier.is-sel {
	background: var(--wd-form-bg, #fff);
	border: 2px solid var(--wdva-accent);
	box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
}
.wdva-tier.has-open { z-index: 6; }

.wdva-head {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 0;
	padding: 16px 18px;
	cursor: pointer;
	user-select: none;
}
.wdva-r { position: absolute; opacity: 0; pointer-events: none; }

.wdva-dot {
	flex: 0 0 24px;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	border: 2px solid var(--wdva-line);
	background: #fff;
	position: relative;
	transition: border-color .2s;
}
.wdva-tier.is-sel .wdva-dot { border-color: var(--wdva-accent); }
.wdva-tier.is-sel .wdva-dot::after {
	content: "";
	position: absolute;
	inset: 4px;
	border-radius: 50%;
	background: var(--wdva-accent);
}
.wdva-r:focus-visible + .wdva-dot { outline: 2px solid var(--wdva-accent); outline-offset: 2px; }

.wdva-ttl { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wdva-ttl b { font-size: 1.18em; font-weight: 700; color: var(--wdva-title); }
.wdva-save { color: var(--wdva-save); font-size: .88em; font-weight: 500; }

.wdva-prc { display: flex; flex-direction: column; align-items: flex-end; text-align: end; line-height: 1.2; white-space: nowrap; }
.wdva-prc b { font-size: 1.2em; font-weight: 700; color: var(--wdva-title); }
.wdva-prc del { font-size: .82em; opacity: .6; }

/* Badge with a notched corner */
.wdva-badge {
	position: absolute;
	top: -10px;
	inset-inline-end: 14px;
	z-index: 2;
	padding: 3px 12px 3px 16px;
	background: var(--wdva-title);
	color: #fff;
	font-size: .78em;
	font-weight: 700;
	line-height: 1.4;
	clip-path: polygon(9px 0, 100% 0, 100% 100%, 0 100%, 0 9px);
}
[dir="rtl"] .wdva-badge { clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 0 100%); padding: 3px 16px 3px 12px; }

/* ------------------------------------------------------------ pickers */
.wdva-body { padding: 0 18px 16px; animation: wdvaIn .22s ease; }
.wdva-lbl { margin: 0 0 8px; font-size: .86em; color: var(--wdva-save); }
.wdva-unit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 8px; }
.wdva-unit:last-child { margin-bottom: 0; }
.wdva-n { min-width: 22px; font-size: .86em; opacity: .75; }

.wdva-dd { position: relative; }
.wdva-dd-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	margin: 0;
	padding: 5px 10px;
	background: var(--wd-form-bg, #fff);
	color: var(--wdva-text);
	border: 1px solid var(--wdva-line);
	border-radius: var(--wd-form-brd-radius, 6px);
	font: inherit;
	font-size: .94em;
	line-height: 1.2;
	text-transform: none;
	box-shadow: none;
	cursor: pointer;
}
.wdva-dd-btn:hover, .wdva-dd.is-open .wdva-dd-btn { border-color: var(--wdva-accent); background: var(--wd-form-bg, #fff); color: var(--wdva-text); }
.wdva-dd-btn:focus-visible { outline: 2px solid var(--wdva-accent); outline-offset: 1px; }

.wdva-caret {
	width: 0; height: 0;
	margin-inline-start: 2px;
	border-inline: 4px solid transparent;
	border-top: 5px solid currentColor;
}
.wdva-th { width: 30px; height: 30px; object-fit: cover; border-radius: 4px; background: #eee; flex: 0 0 30px; }

.wdva-dd-list {
	display: none;
	position: absolute;
	inset-inline-start: 0;
	top: calc(100% + 4px);
	z-index: 20;
	min-width: 100%;
	max-height: 260px;
	overflow-y: auto;
	margin: 0;
	padding: 0;
	list-style: none;
	background: #fff;
	border: 1px solid var(--wdva-line);
	border-radius: var(--wd-form-brd-radius, 6px);
	box-shadow: 0 8px 22px rgba(0, 0, 0, .16);
}
.wdva-dd.is-open .wdva-dd-list { display: block; animation: wdvaIn .15s ease; }
.wdva-dd-list li {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 8px 12px;
	white-space: nowrap;
	cursor: pointer;
	font-size: .94em;
	border-bottom: 1px solid #f0f0f0;
}
.wdva-dd-list li:last-child { border-bottom: 0; }
.wdva-dd-list li:hover, .wdva-dd-list li.is-act { background: var(--wdva-tint); }
.wdva-dd-list li.is-sel { font-weight: 600; background: var(--wdva-tint); }
.wdva-dd-list li.is-dis { opacity: .4; cursor: not-allowed; text-decoration: line-through; }

/* ---------------------------------------------------- add-on / gift row */
.wdva-extra {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0;
	padding: 10px 18px;
	background: var(--wdva-extra-idle);
	border-radius: 0 0 calc(var(--wdva-r) - 1px) calc(var(--wdva-r) - 1px);
	font-size: .94em;
}
.wdva-tier.is-sel .wdva-extra { background: var(--wdva-extra); }
.wdva-addon { cursor: pointer; }
.wdva-addon-cb {
	flex: 0 0 18px;
	width: 18px; height: 18px;
	margin: 0;
	accent-color: var(--wdva-accent);
}
.wdva-xth { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; flex: 0 0 36px; }
.wdva-x-t { flex: 1 1 auto; min-width: 0; font-weight: 700; color: var(--wdva-title); }
.wdva-extra .wdva-prc b { font-size: 1em; }

/* ------------------------------------------------------------- message */
.wdva-msg { margin-top: 10px; font-size: .92em; }
.wdva-msg:empty { display: none; }
.wdva-msg.is-ok { color: #2e7d32; }
.wdva-msg.is-err { color: #c62828; }
.wdva-msg a { color: inherit; text-decoration: underline; }

.wdva-free { font-weight: 700; color: var(--wdva-save, #2e7d32); }

@keyframes wdvaIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

@media (max-width: 480px) {
	.wdva-head { padding: 14px; gap: 10px; }
	.wdva-body { padding: 0 14px 14px; }
	.wdva-extra { padding: 10px 14px; }
	.wdva-prc b { font-size: 1.1em; }
	.wdva-unit { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
	.wdva-body, .wdva-dd.is-open .wdva-dd-list { animation: none; }
	.wdva-tier { transition: none; }
}

/* Variation mode: keep the normal quantity box; grey out unavailable variations. */
form.cart.wdva-on.wdva-vm .quantity { display: revert !important; }
.wdva-tier.is-out { opacity: .5; }
.wdva-tier.is-out .wdva-head { cursor: not-allowed; }
.wdva-vsel { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; }
.wdva-vsel .wdva-lbl { min-width: 70px; }
.wdva-vsel select.wdva-vs { flex: 1 1 auto; min-width: 0; }

/* Variation mode: list is capped at 3 cards and scrolls inside itself. */
.wdva-list.is-scroll { overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 2px 4px 2px 2px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }

.wdva-note { display: block; font-size: .82em; font-weight: 400; line-height: 1.35; opacity: .75; white-space: normal; }
