/*
 * Cellpept conversion - product pages (plan 1.10 / 2.4). Loaded on single product pages by
 * mu-plugins/cellpept-conv-product.php. Selectors start with body.single-product so they win over
 * the layout CSS (post-797.css) that Elementor prints later in the page.
 */

/* ---------- 1. Size buttons (the real <select> stays in the form, visually hidden) ---------- */
body.single-product select.cp-sizes-native {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	margin: -1px !important;
	padding: 0 !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
	opacity: 0 !important;
	pointer-events: none !important;
}

body.single-product .cp-sizes {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 8px;
	max-width: 100%;
	vertical-align: middle;
}

body.single-product .cp-sizes button.cp-size {
	display: inline-flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	gap: 2px;
	min-width: 88px;
	min-height: 48px;
	margin: 0;
	padding: 6px 14px;
	border: 1px solid var(--wd-form-brd-color, rgba(0, 0, 0, 0.15));
	border-radius: 8px;
	background: var(--bgcolor-white, #fff);
	box-shadow: none;
	color: var(--color-gray-900, #242424);
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 0;
	text-align: start;
	text-transform: none;
	cursor: pointer;
	transition: border-color .15s ease, box-shadow .15s ease;
}

body.single-product .cp-sizes button.cp-size:hover {
	background: var(--bgcolor-white, #fff);
	border-color: var(--wd-primary-color, #309bb4);
	color: var(--color-gray-900, #242424);
}

body.single-product .cp-sizes button.cp-size:focus-visible {
	outline: 2px solid var(--wd-primary-color, #309bb4);
	outline-offset: 2px;
}

body.single-product .cp-sizes .cp-size-price {
	color: var(--color-gray-500, #767676);
	font-size: 13px;
	font-weight: 400;
	white-space: nowrap;
}

body.single-product .cp-sizes button.cp-size.is-selected {
	border-color: var(--wd-primary-color, #309bb4);
	box-shadow: inset 0 0 0 1px var(--wd-primary-color, #309bb4);
}

body.single-product .cp-sizes button.cp-size.is-selected .cp-size-price {
	color: var(--wd-primary-color, #309bb4);
}

body.single-product .cp-sizes button.cp-size.is-out-of-stock .cp-size-price {
	color: var(--color-gray-400, #a5a5a5);
}

body.single-product .cp-sizes button.cp-size.is-unavailable {
	opacity: .45;
	cursor: not-allowed;
}

/* ---------- 2. Static info block under Add to cart ---------- */
body.single-product .cp-pp-info {
	margin: 14px 0 0;
	padding: 12px 14px;
	border: 1px solid var(--brdcolor-gray-300, rgba(0, 0, 0, 0.105));
	border-radius: 8px;
	background: var(--bgcolor-gray-100, #f7f7f7);
	color: var(--color-gray-700, #4b4b4b);
	font-size: 14px;
	line-height: 1.45;
	text-align: start;
}

body.single-product .cp-pp-info .cp-pp-line {
	margin: 0 0 6px;
}

body.single-product .cp-pp-info .cp-pp-line:last-child {
	margin-bottom: 0;
}

body.single-product .cp-pp-info .cp-pp-min strong {
	color: var(--color-gray-900, #242424);
	font-weight: 700;
	white-space: nowrap;
}

body.single-product .cp-pp-info .cp-pp-ship-item {
	white-space: nowrap;
}

body.single-product .cp-pp-info .cp-pp-ship-item:last-child {
	white-space: normal;
}

body.single-product .cp-pp-info .cp-pp-usps {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 16px;
	margin: 8px 0 0;
	padding: 0;
	list-style: none;
}

body.single-product .cp-pp-info .cp-pp-usps li {
	position: relative;
	margin: 0;
	padding: 0 0 0 18px;
	color: var(--color-gray-900, #242424);
	font-weight: 600;
	list-style: none;
}

body.single-product .cp-pp-info .cp-pp-usps li::before {
	content: "";
	position: absolute;
	top: .3em;
	left: 3px;
	width: 5px;
	height: 10px;
	border: solid var(--wd-primary-color, #309bb4);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

/* ---------- 3. Lab report link under Add to cart instead of above it (secondary style) ---------- */
/* Simple products: the COA snippet prints the link before the form. Reorder with CSS (no layout jump). */
body.single-product .wd-single-add-cart > .elementor-widget-container:has(> a.lab-report-btn) {
	display: flex;
	flex-direction: column;
}

body.single-product .wd-single-add-cart > .elementor-widget-container:has(> a.lab-report-btn) > form.cart {
	order: 1;
}

body.single-product .wd-single-add-cart > .elementor-widget-container:has(> a.lab-report-btn) > .cp-pp-info {
	order: 2;
}

body.single-product .wd-single-add-cart > .elementor-widget-container:has(> a.lab-report-btn) > a.lab-report-btn {
	order: 3;
	align-self: flex-start;
}

/* Variable products: product.js moves #variation-lab-report under the info block. */
body.single-product #variation-lab-report.cp-lab-moved {
	margin: 0 !important;
}

body.single-product .wd-single-add-cart a.lab-report-btn {
	margin: 12px 0 0 !important;
	padding: 8px 16px;
	border: 1px solid currentColor;
	border-radius: 8px;
	background: transparent;
	color: var(--wd-primary-color, #309bb4) !important;
	font-size: 14px;
	line-height: 1.3;
}

body.single-product .wd-single-add-cart a.lab-report-btn:hover {
	background: var(--wd-primary-color, #309bb4);
	color: #fff !important;
}

/* ---------- 4. Phones: title, price and Add to cart on the first screen (plan 2.4) ---------- */
@media (max-width: 768px) {
	/* Gallery: no extra space above it; no thumbnail strip (the main image keeps its arrows and swipe). */
	body.single-product .single-product-page .wd-single-gallery > .elementor-widget-container {
		margin-top: 0;
	}

	body.single-product .single-product-page .wd-single-gallery .wd-gallery-thumb {
		display: none;
	}

	/* Less space between gallery and product details, and between the details. */
	body.single-product .single-product-page .e-con:has(> .e-con-inner > .e-con > .wd-single-gallery),
	body.single-product .single-product-page .e-con:has(> .e-con > .wd-single-gallery) {
		--gap: 10px 10px;
		--row-gap: 10px;
	}

	body.single-product .single-product-page .e-con:has(> .wd-single-add-cart) {
		--margin-top: 0px;
		--gap: 8px 8px;
		--row-gap: 8px;
	}

	/* Size row: "Size:" next to the choice, tighter spacing. Server-side selectors (not set by JS),
	   so nothing moves when the buttons replace the dropdown. */
	body.single-product .wd-single-add-cart form.variations_form {
		--wd-var-table-mb: 12px;
	}

	body.single-product .wd-single-add-cart form.variations_form table.variations .cell {
		display: table-cell;
		vertical-align: middle;
	}

	body.single-product .wd-single-add-cart form.variations_form table.variations .label {
		margin: 0;
		padding-right: 12px;
	}

	body.single-product .wd-single-add-cart form.variations_form .woocommerce-variation > div {
		margin-bottom: 6px;
	}

	/* The small "Clear" link would sit on the tighter spacing; on phones a size is changed by tapping another one. */
	body.single-product .wd-single-add-cart form.variations_form .wd-reset-var {
		display: none;
	}

	body.single-product .cp-sizes button.cp-size {
		min-height: 44px;
		padding: 5px 12px;
	}

	body.single-product .cp-pp-info {
		margin-top: 12px;
		font-size: 13.5px;
	}
}
