/**
 * Purchase options (one-time vs subscription plans).
 *
 * Card-style selector rendered by
 * woocommerce/single-product/product-subscription-options.php.
 * Colours are placeholders until the design tokens land — see the Figma file.
 */

/*
 * On variable products APFS renders the plan options inside
 * .woocommerce-variation-price, which a legacy site-wide snippet hides outright
 * (`.woocommerce-variation-price { display: none }`) so the variation price does
 * not duplicate the price shown above. That would hide the purchase options too,
 * so the container is restored here and only the duplicated price is suppressed.
 * Higher specificity than the legacy rule, so no !important is needed.
 *
 * When the legacy snippet is retired with the Elementor build, this block and
 * its counterpart can go.
 */
.has-subscription-plans .woocommerce-variation-price {
	display: block;
}

.has-subscription-plans .woocommerce-variation-price > .price {
	display: none;
}

/*
 * Quantity is not part of this purchase flow: a plan is bought one at a time.
 * Hidden rather than removed so the input still submits its default of 1.
 *
 * !important is required here, not lazy: WooCommerce's variation script sets an
 * inline `display: block` on this element when a variation is chosen, and an
 * inline style beats any selector.
 */
.has-subscription-plans .woocommerce-variation-add-to-cart .quantity,
.has-subscription-plans form.cart > .quantity {
	display: none !important;
}

.pv-purchase-options {
	--pv-po-accent: #4f2fe8;
	--pv-po-border: #d8d8e0;
	--pv-po-surface: #f7f6f2;
	--pv-po-text-muted: #5c5c66;
	--pv-po-radius: 12px;

	margin: 1.5rem 0;
}

.pv-purchase-options__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

/* --- Card ---------------------------------------------------------------- */

.pv-purchase-option {
	position: relative;
	border: 2px solid var(--pv-po-border);
	border-radius: var(--pv-po-radius);
	background: #fff;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.pv-purchase-option.is-selected {
	border-color: var(--pv-po-accent);
	background: var(--pv-po-surface);
}

/* Keyboard focus has to remain visible: the real radio is only visually hidden. */
.pv-purchase-option:focus-within {
	outline: 2px solid var(--pv-po-accent);
	outline-offset: 2px;
}

.pv-purchase-option__badge {
	position: absolute;
	top: 0;
	right: 1rem;
	transform: translateY(-50%);
	background: var(--pv-po-accent);
	color: #fff;
	font-size: 0.8125rem;
	font-weight: 600;
	line-height: 1;
	padding: 0.4em 0.9em;
	border-radius: 999px;
}

.pv-purchase-option__label {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	padding: 1.15rem 1.25rem;
	margin: 0;
	cursor: pointer;
}

/* --- Radio --------------------------------------------------------------- */

.pv-purchase-option__input {
	appearance: none;
	-webkit-appearance: none;
	flex: 0 0 auto;
	width: 1.25rem;
	height: 1.25rem;
	margin: 0.15rem 0 0;
	border: 2px solid var(--pv-po-border);
	border-radius: 50%;
	background: #fff;
	cursor: pointer;
}

.pv-purchase-option__input:checked {
	border-color: var(--pv-po-accent);
	/* Inner dot without an extra element. */
	box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 1rem var(--pv-po-accent);
}

/* --- Body ---------------------------------------------------------------- */

.pv-purchase-option__body {
	flex: 1 1 auto;
	min-width: 0;
}

.pv-purchase-option__heading {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem;
}

.pv-purchase-option__title {
	font-weight: 600;
}

.pv-purchase-option--subscription .pv-purchase-option__title {
	color: var(--pv-po-accent);
}

.pv-purchase-option__price {
	text-align: right;
	white-space: nowrap;
}

/* WooCommerce renders the pre-discount price in <del>. */
.pv-purchase-option__price del {
	display: block;
	font-size: 0.875em;
	opacity: 0.7;
}

.pv-purchase-option__price ins {
	text-decoration: none;
	font-weight: 600;
}

/* --- Benefits ------------------------------------------------------------ */

.pv-purchase-option__benefits {
	display: block;
	margin-top: 0.5rem;
	color: var(--pv-po-text-muted);
	font-size: 0.9375rem;
}

.pv-purchase-option__benefit {
	display: block;
	padding-left: 1rem;
	position: relative;
}

.pv-purchase-option__benefit::before {
	content: "";
	position: absolute;
	left: 0.25rem;
	top: 0.65em;
	width: 4px;
	height: 4px;
	border-radius: 50%;
	background: currentColor;
}

/* --- Small screens ------------------------------------------------------- */

@media (max-width: 480px) {
	.pv-purchase-option__heading {
		flex-direction: column;
		gap: 0.15rem;
	}

	.pv-purchase-option__price {
		text-align: left;
	}
}
