/**
 * Q8 Kart — single product page:
 * - Full-width main area on desktop (body.q8kart-product-fullwidth).
 * - Summary: brand add-to-cart, qty controls, price / sale colors aligned with shop “q8kart” cards.
 */

/* Tabs + related + upsells band: full width of shop container (all breakpoints). */
body.q8kart-product-fullwidth.single-product .product-footer > .container {
	max-width: none !important;
	width: 100%;
	padding-left: clamp(12px, 2.5vw, 40px);
	padding-right: clamp(12px, 2.5vw, 40px);
	box-sizing: border-box;
}

/* Related / upsells titles: Flatsome uses .container-width on related heading (narrower than grid). */
body.single-product .related.related-products-wrapper .product-section-title.container-width {
	max-width: none !important;
	width: 100%;
	padding-left: 0;
	padding-right: 0;
}

/* Repeater row uses full inner width (grid or slider). */
body.single-product .related.related-products-wrapper .row,
body.single-product .upsells-wrapper .row {
	width: 100%;
	max-width: none;
}

@media screen and (min-width: 850px) {
	body.q8kart-product-fullwidth.single-product #main {
		max-width: none !important;
		width: 100%;
	}

	body.q8kart-product-fullwidth.single-product #main > .shop-container {
		max-width: none !important;
		width: 100%;
		padding-left: clamp(12px, 2.5vw, 40px);
		padding-right: clamp(12px, 2.5vw, 40px);
		box-sizing: border-box;
	}

	body.q8kart-product-fullwidth.single-product #main > .shop-container > .container {
		max-width: none !important;
		width: 100%;
		padding-left: 0;
		padding-right: 0;
	}

	body.q8kart-product-fullwidth.single-product .product-container {
		max-width: none;
		width: 100%;
	}

	body.q8kart-product-fullwidth.single-product .product-main .row.content-row {
		max-width: none;
	}
}

/**
 * Single product — summary: brand ATC, qty chrome, price (match shop “q8kart” cards).
 * Uses same tokens as product-box-q8kart.css when loaded; local fallbacks if not.
 */
body.single-product {
	--q8-pdp-brand: #2e1a6d;
	--q8-pdp-brand-hover: #4a338d;
	--q8-pdp-btn-fg: #ffffff;
	--q8-pdp-price: #000000;
	--q8-pdp-price-del: #d32f2f;
}

/* Price */
body.single-product .product-summary .price .woocommerce-Price-amount.amount,
body.single-product .entry-summary .price .woocommerce-Price-amount.amount {
	color: var(--q8kart-price-ink, var(--q8-pdp-price));
	font-weight: 700;
}

body.single-product .product-summary .price del,
body.single-product .product-summary .price del *,
body.single-product .product-summary .price s,
body.single-product .product-summary .price s *,
body.single-product .entry-summary .price del,
body.single-product .entry-summary .price del *,
body.single-product .entry-summary .price s,
body.single-product .entry-summary .price s * {
	color: var(--q8kart-price-del, var(--q8-pdp-price-del)) !important;
	-webkit-text-fill-color: var(--q8kart-price-del, var(--q8-pdp-price-del)) !important;
	font-weight: 600 !important;
}

body.single-product .product-summary .price ins .woocommerce-Price-amount.amount,
body.single-product .entry-summary .price ins .woocommerce-Price-amount.amount {
	color: var(--q8kart-price-ink, var(--q8-pdp-price)) !important;
}

/* Quantity +/- (Flatsome / WC) */
body.single-product form.cart .quantity .minus,
body.single-product form.cart .quantity .plus,
body.single-product form.cart .quantity input[type="button"] {
	background: #fff !important;
	border: 1px solid rgba(46, 26, 109, 0.35) !important;
	color: var(--q8-brand-solid, var(--q8-pdp-brand)) !important;
	box-shadow: none !important;
}

body.single-product form.cart .quantity .minus:hover,
body.single-product form.cart .quantity .plus:hover {
	border-color: var(--q8-brand-solid, var(--q8-pdp-brand)) !important;
	color: var(--q8-pdp-brand-hover) !important;
}

body.single-product form.cart .quantity .qty {
	border-color: rgba(46, 26, 109, 0.28) !important;
	color: var(--q8-pdp-price);
}

/* Primary ATC — simple, variable, external (submit), grouped row buttons */
body.single-product form.cart .single_add_to_cart_button,
body.single-product form.cart button.single_add_to_cart_button,
body.single-product form.cart button[type="submit"].single_add_to_cart_button,
body.single-product .woocommerce-variation-add-to-cart .single_add_to_cart_button,
body.single-product table.group_table .button {
	background-color: var(--q8-brand-solid, var(--q8-pdp-brand)) !important;
	background-image: none !important;
	color: var(--q8kart-btn-color, var(--q8-pdp-btn-fg)) !important;
	border: 1px solid var(--q8-brand-solid, var(--q8-pdp-brand)) !important;
	border-radius: 8px !important;
	font-weight: 600 !important;
	box-shadow: none !important;
}

body.single-product form.cart .single_add_to_cart_button:hover,
body.single-product form.cart button.single_add_to_cart_button:hover,
body.single-product .woocommerce-variation-add-to-cart .single_add_to_cart_button:hover,
body.single-product table.group_table .button:hover {
	filter: brightness(1.08);
	color: var(--q8kart-btn-color, var(--q8-pdp-btn-fg)) !important;
	border-color: var(--q8-pdp-brand-hover) !important;
}

body.single-product form.cart .single_add_to_cart_button:disabled,
body.single-product form.cart .single_add_to_cart_button.disabled {
	opacity: 0.55;
	filter: none;
}

/* “Clear” / reset variations — outline, not default grey */
body.single-product .reset_variations {
	color: var(--q8-brand-solid, var(--q8-pdp-brand)) !important;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
}

body.single-product .reset_variations:hover {
	color: var(--q8-pdp-brand-hover) !important;
}

/* Secondary text link in cart area (e.g. wishlist plugin) — tint to brand */
body.single-product .entry-summary form.cart a:not(.single_add_to_cart_button):not(.added_to_cart):not(.add_to_cart_button),
body.single-product .product-summary form.cart a:not(.single_add_to_cart_button):not(.added_to_cart):not(.add_to_cart_button) {
	color: var(--q8-brand-solid, var(--q8-pdp-brand));
}

body.single-product .entry-summary form.cart a:not(.single_add_to_cart_button):not(.added_to_cart):hover,
body.single-product .product-summary form.cart a:not(.single_add_to_cart_button):not(.added_to_cart):hover {
	color: var(--q8-pdp-brand-hover);
}

/**
 * Mobile / narrow: leave Flatsome sticky add-to-cart visible; pad page so content clears
 * stacked chrome (sticky ATC + optional #wide-nav bottom bar + safe area).
 */
@media screen and (max-width: 849px) {
	/* Sticky ATC + fixed app tab bar (#wide-nav); body.q8kart-mobile-tabbar sets --q8-mobile-tabbar-h in header CSS */
	body.single-product.q8kart-mobile-tabbar #main {
		padding-bottom: calc(128px + env(safe-area-inset-bottom, 0px));
	}

	body.single-product:not(.q8kart-mobile-tabbar) #main {
		padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
	}
}

/* Sticky add-to-cart bar — Q8 pill qty + solid brand button (matches shop / summary ATC) */
@media screen and (max-width: 849px) {
	body.single-product .sticky-add-to-cart {
		background: #fff !important;
		border-top: 1px solid rgba(46, 26, 109, 0.12);
		box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
	}

	body.single-product .sticky-add-to-cart .cart {
		display: flex;
		align-items: center;
		gap: 0.65rem;
		flex-wrap: nowrap;
		width: 100%;
		max-width: 100%;
		padding: 0.5rem 0.75rem;
		box-sizing: border-box;
	}

	body.single-product .sticky-add-to-cart .quantity {
		display: flex !important;
		align-items: stretch;
		margin: 0 !important;
		border: 1px solid rgba(46, 26, 109, 0.25);
		border-radius: 999px;
		overflow: hidden;
		background: #fff;
		flex: 0 0 auto;
	}

	body.single-product .sticky-add-to-cart .quantity .minus,
	body.single-product .sticky-add-to-cart .quantity .plus,
	body.single-product .sticky-add-to-cart .quantity input[type="button"] {
		background: #fff !important;
		border: none !important;
		color: var(--q8-brand-solid, #2e1a6d) !important;
		min-width: 2.25rem;
	}

	body.single-product .sticky-add-to-cart .quantity .qty {
		border: none !important;
		color: var(--q8-brand-solid, #2e1a6d) !important;
		font-weight: 600;
		max-width: 3rem;
	}

	body.single-product .sticky-add-to-cart .single_add_to_cart_button,
	body.single-product .sticky-add-to-cart button.single_add_to_cart_button {
		flex: 1 1 auto;
		border-radius: 999px !important;
		background-color: var(--q8-brand-solid, #2e1a6d) !important;
		background-image: none !important;
		color: #fff !important;
		border: 1px solid var(--q8-brand-solid, #2e1a6d) !important;
		font-weight: 700 !important;
		text-transform: uppercase;
		letter-spacing: 0.04em;
		padding: 0.65rem 1rem !important;
	}

	body.single-product .sticky-add-to-cart .sticky-add-to-cart-select-options-button {
		flex: 1 1 auto;
		border-radius: 999px !important;
	}
}
