/**
 * TTC Live Price Product - minimal styling for the three-state control.
 * Everything is scoped under body.ttc-lpp-on (set by ttc-lpp.js on boot),
 * so a JS failure leaves the page 100% stock.
 */

/* State B: the add button stays visibly present but permanently inert.
   The JS additionally sets the native disabled attribute AND the same
   inline styles, so the greyed look survives even when this stylesheet
   is missing from a stale (mobile) RUCSS used-CSS variant - the rules
   here are the styling of record, the :disabled selector the backup. */
body.ttc-lpp-on form.cart .single_add_to_cart_button.ttc-lpp-in-cart,
body.ttc-lpp-on form.cart .single_add_to_cart_button:disabled {
	opacity: 0.45;
	filter: grayscale(60%);
	cursor: not-allowed;
	pointer-events: none;
}

/* Remove-from-cart link under the button */
body.ttc-lpp-on .ttc-lpp-extras {
	margin-top: 10px;
	flex-basis: 100%;
}

/* The [hidden] guard is load-bearing: any author `display` value would
   otherwise override the hidden attribute's UA display:none (found in
   live testing - the link showed in State A once this stylesheet started
   loading). */
body.ttc-lpp-on a.ttc-lpp-remove[hidden] {
	display: none !important;
}

body.ttc-lpp-on a.ttc-lpp-remove {
	display: inline-block;
	margin-top: 6px;
	font-size: 0.875em;
	color: #b00020;
	text-decoration: underline;
	cursor: pointer;
}

body.ttc-lpp-on a.ttc-lpp-remove:hover,
body.ttc-lpp-on a.ttc-lpp-remove:focus {
	color: #7f0017;
}

/* The live "Totaal" writes into Hestia's OWN .hestia-sar-total-val, so
   the theme's native total styling applies untouched. Styling below is
   ONLY for the .ttc-lpp-total-fallback row rendered on installs without
   Hestia's total (it reuses the same class names for the JS selector). */
body.ttc-lpp-on .ttc-lpp-total-fallback {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-top: 12px;
	padding-top: 10px;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
	font-size: 1rem;
}

body.ttc-lpp-on .ttc-lpp-total-fallback .hestia-sar-total-label {
	font-weight: 600;
	opacity: 0.75;
}

body.ttc-lpp-on .ttc-lpp-total-fallback .hestia-sar-total-val {
	font-weight: 700;
}

/* ONE price tag per page (user request): on variable products the summary
   p.price is the live, engine-priced display, so WooCommerce's duplicate
   per-variation price block inside the form stays hidden. Availability /
   stock text in .woocommerce-variation stays visible - only the price
   div is dropped. */
body.ttc-lpp-on form.cart.variations_form .woocommerce-variation-price {
	display: none !important;
}

/* State B shows ONLY the greyed-out button + remove link: no "View cart"
   (a.added_to_cart) link may ever appear next to the button. The JS
   already avoids triggering its injection (no $button arg on the
   added_to_cart event); this is the belt-and-braces for anything else
   that fires the event with a button (e.g. other plugins). */
body.ttc-lpp-on form.cart a.added_to_cart {
	display: none !important;
}

/* While an AJAX round-trip is in flight: dim the controls slightly.
   The inputs stay enabled - edits made meanwhile are queued client-side
   (last write wins), not lost. */
body.ttc-lpp-on form.cart.ttc-lpp-updating .quantity,
body.ttc-lpp-on form.cart.ttc-lpp-updating .single_add_to_cart_button,
body.ttc-lpp-on form.cart.ttc-lpp-updating .ttc-lpp-extras {
	opacity: 0.6;
	transition: opacity 0.15s ease;
}

/* Unit-price strikeout inside the summary price (server sends WooCommerce's
   own <del>/<ins> sale markup; keep <ins> from being underlined, matching
   WooCommerce core styles). */
body.ttc-lpp-on div.product p.price ins {
	text-decoration: none;
}
