/**
 * Catalogue Mode — single product page.
 *
 * Enqueued only when catalogue mode applies to the product being viewed,
 * so every rule here can assume that context.
 *
 * THIRD-PARTY SELECTORS IN THIS FILE
 * ----------------------------------
 * .single_add_to_cart_button, .quantity.buttons_added, .price  → WooCommerce
 * .fusion-button-wrapper                                       → Avada
 * .wcrp-rental-products-rental-totals                          → Kestrel
 *
 * None of these are a public API. If catalogue mode ever stops hiding the
 * Add to Cart button or the price after a WooCommerce or Avada update, one
 * of these class names has changed and this is the file to check. Phase 4
 * moves the full list into a compatibility layer so a health check can
 * verify them automatically.
 */

/*
 * Hide the native Add to Cart button and quantity stepper. Covers both
 * standard WooCommerce markup and Avada's own button wrapper.
 */
.single-product .single_add_to_cart_button,
.single-product .quantity.buttons_added,
.fusion-button-wrapper .single_add_to_cart_button,
.fusion-button-wrapper .quantity.buttons_added {
	display: none !important;
}

/*
 * Hide the price.
 *
 * Scoped to .single-product, and this stylesheet only loads when catalogue
 * mode applies to the current product, so it can only ever affect the
 * product being viewed — global and per-product mode need no distinction.
 */
.single-product .price,
.single-product p.price,
.single-product span.price {
	display: none !important;
}

/*
 * Kestrel's calculated rental total (R19).
 *
 * On a rental product in catalogue mode no price shows until dates are
 * picked — then a total appears, because Kestrel renders it into its own
 * rental-form markup rather than WooCommerce's .price. The .price rule above
 * never reaches it, and the value is computed in JavaScript after date
 * selection, so no PHP filter sees it either.
 *
 * WHY THIS IS NOT `display: none`
 * ------------------------------
 * Because it cannot be. Kestrel shows the block with
 *
 *     $( '#wcrp-rental-products-rental-totals-N' )
 *         .attr( 'style', 'display: block !important;' );
 *
 * (class-wcrp-rental-products-product-rental-form.php:1203, and its own
 * comment says "Not .show() as !important required"). An !important
 * declaration in a style attribute outranks !important in any stylesheet —
 * that is the cascade, not a specificity contest, so no selector we could
 * write would win. A first attempt at this rule used `display: none
 * !important` and had precisely no effect.
 *
 * What Kestrel does *not* own is every other property: it sets the style
 * attribute wholesale, and that attribute only ever contains `display`. So
 * the block is collapsed on the properties still available to us. It stays
 * in the DOM and stays `display: block`, but occupies no space and is hidden
 * from assistive technology.
 *
 * The alternative was stripping the inline style in JavaScript, which means
 * re-doing it every time Kestrel recalculates — a fight on every date
 * change, with a visible flash each time it loses.
 *
 * Gated the opposite way round to the cart's rental exception, on purpose:
 * the rule simply does not apply when the setting is on, so Kestrel's layout
 * is left exactly as it was rather than restored to an approximation of it.
 * PHP adds jr-wca-show-rental-price to <body> when "Show Rental Price in
 * Enquiry List" is on.
 */
body.single-product:not( .jr-wca-show-rental-price ) .wcrp-rental-products-rental-totals {
	visibility: hidden !important;
	height: 0 !important;
	min-height: 0 !important;
	max-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	overflow: hidden !important;
}

/* Enquiry notice — matches WooCommerce's own message layout. */
.jr-wca-notice {
	display: flex !important;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
}

.jr-wca-notice__text {
	flex: 1;
}

.jr-wca-notice__btn {
	white-space: nowrap;
	flex-shrink: 0;
}

/*
 * Enquire button while the rental form is incomplete.
 *
 * The server rejects a rental enquiry with no dates — that check is the
 * authority and cannot be bypassed. This is the visual counterpart, so the
 * button reads as unavailable rather than accepting a click and then
 * declining it, matching how Kestrel's own button behaves.
 */
.jr-wca-enquire-btn[disabled],
.jr-wca-enquire-btn.jr-wca-is-blocked {
	opacity: 0.5;
	cursor: not-allowed;
}

.jr-wca-enquire-hint {
	display: block;
	margin-top: 6px;
	font-size: 0.9em;
	opacity: 0.8;
}
