/* Prapti Design: single product buy box (variable.php override + WooCommerce Subscriptions plan options). */

/* Real WooCommerce selects stay in the form but are visually hidden (not display:none, so JS/a11y tools still see them). */
.pd-visually-hidden {
	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;
}

/* The variation price is already shown in the top price; do not repeat it above the plan options. */
#custom-product-buy-container .woocommerce-variation-price > .price,
#custom-product-buy-container .woocommerce-variation-description:empty,
#custom-product-buy-container .woocommerce-variation-availability:empty {
	display: none;
}
/*
 * The site-wide WPCode CSS snippet ("6. HIDE DEFAULT CART / OPTIONS ELEMENTS") hides
 * `.single_variation` with !important. WooCommerce Subscriptions renders the plan options
 * (one-time / subscribe) INSIDE .single_variation (variation price_html), so they must stay
 * visible. The #id selector wins over that rule even though both are !important.
 */
#custom-product-buy-container .single_variation_wrap .single_variation {
	display: block !important;
	margin: 0;
}

/* Subscription plan options (WooCommerce Subscriptions / All Products for Subscriptions) */
#custom-product-buy-container .wcsatt-options-wrapper {
	margin: 22px 0 0; /* top space leaves room for the SAVE badge that overlaps the card */
	font-size: 13px;
	color: #2a2b2a;
}

/*
 * Consistent 16px between the last option card and BUY NOW.
 * Subscription products previously got this from .wcsatt-options-wrapper's 14px
 * bottom margin, so non-subscription products (license cards only) had no gap.
 * The gap now lives on the add-to-cart row; the APFS wrapper no longer adds
 * a bottom margin, so subscription products do not get a double gap.
 */
#custom-product-buy-container .woocommerce-variation-add-to-cart,
#custom-product-buy-container .variations_button {
	margin-top: 16px;
}

/* "Add to an existing subscription?" — APFS uses a 2em ::before spacer; tighten it. */
#custom-product-buy-container .wcsatt-add-to-subscription-wrapper {
	margin-top: 10px;
}
#custom-product-buy-container .wcsatt-add-to-subscription-wrapper::before {
	margin-top: 0;
}
#custom-product-buy-container .wcsatt-options-prompt-fieldset {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}
#custom-product-buy-container .wcsatt-options-prompt-radios,
#custom-product-buy-container .wcsatt-options-product {
	list-style: none;
	margin: 0;
	padding: 0;
}
#custom-product-buy-container .wcsatt-options-prompt-radios > li + li,
#custom-product-buy-container .wcsatt-options-product > li + li {
	margin-top: 8px;
}
#custom-product-buy-container .wcsatt-options-product label {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 12px 14px;
	border: 1.5px solid #d1d5db;
	border-radius: 0.75rem;
	cursor: pointer;
	font-weight: 600;
	line-height: 1.3;
}
#custom-product-buy-container .wcsatt-options-product label:has(input:checked) {
	border-color: #000;
}
#custom-product-buy-container .wcsatt-options-product input[type="radio"] {
	accent-color: #000;
	width: 16px;
	height: 16px;
	margin: 0;
	flex: 0 0 auto;
}
#custom-product-buy-container .wcsatt-options-wrapper .price {
	font-size: inherit;
	color: inherit;
}
#custom-product-buy-container .wcsatt-options-wrapper .subscription-details {
	color: #6b7280;
	font-weight: 500;
}
#custom-product-buy-container .wcsatt-options-product-wrapper {
	margin-top: 8px;
}
#custom-product-buy-container .wcsatt-options-product-dropdown-label {
	display: block;
	margin: 0 0 4px;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	color: #6b7280;
}
#custom-product-buy-container .wcsatt-options-product-dropdown {
	width: 100%;
	padding: 10px 12px;
	border: 1.5px solid #d1d5db;
	border-radius: 0.75rem;
	background: #fff;
	font-size: 13px;
}
#custom-product-buy-container .wcsatt-options-product-details {
	display: block;
	margin-top: 6px;
	font-size: 12px;
	color: #6b7280;
}
/* One-time/subscribe prompt already covers this duplicate list when a dropdown exists. */
#custom-product-buy-container .wcsatt-options-product--hidden { display: none; }

/* Add-to-cart state + errors */
#custom-product-buy-container .single_add_to_cart_button.loading { opacity: 0.7; cursor: progress; }
#custom-product-buy-container .pd-cart-notice {
	margin: 10px 0;
	padding: 10px 14px;
	border: 1.5px solid #f3c4c4;
	border-radius: 0.75rem;
	background: #fdf1f1;
	color: #a12626;
	font-size: 13px;
	font-weight: 600;
}
#custom-product-buy-container .pd-cart-notice p { margin: 0; }
#custom-product-buy-container .pd-cart-notice p + p { margin-top: 4px; }


/* ==========================================================================
   Purchase-type cards (One-time / Subscribe & save)
   Same look as the license cards: 1.5px border, rounded-xl, black radio, black selected border.
   Markup is the APFS prompt, enhanced by assets/js/pd-plan-options.js (adds .pd-plan-* parts).
   ========================================================================== */
#custom-product-buy-container .wcsatt-options-prompt-radios {
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 0 4px 4px 0; /* room for the selected card's offset shadow */
}
#custom-product-buy-container .wcsatt-options-prompt-radios > li { margin: 0; }

#custom-product-buy-container .wcsatt-options-prompt-label {
	position: relative;
	display: block;
	margin: 0;
	padding: 14px 15px 14px 35px;
	background: #fff;
	border: 1.5px solid #d1d5db;
	border-radius: 0.75rem;
	cursor: pointer;
	color: #111;
	font-family: inherit;
	line-height: 1.2;
	transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
/* Native radio stays in the DOM (name/value untouched) and covers the card: click + keyboard still work. */
#custom-product-buy-container .wcsatt-options-prompt-label .wcsatt-options-prompt-action-input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
	z-index: 1;
}
/* Radio circle (same as the license cards) */
#custom-product-buy-container .wcsatt-options-prompt-label::before {
	content: "";
	position: absolute;
	left: 10px;
	top: 50%;
	width: 16px;
	height: 16px;
	box-sizing: border-box;
	border: 1.5px solid #9ca3af;
	border-radius: 50%;
	background: #fff;
	transform: translateY(-50%);
	transition: background-color 0.15s, border-color 0.15s;
}
#custom-product-buy-container .wcsatt-options-prompt-label::after {
	content: "";
	position: absolute;
	left: 14px;
	top: 50%;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #fff;
	transform: translateY(-50%);
}
#custom-product-buy-container .wcsatt-options-prompt-label:has(input:checked) {
	border-color: #000;
	box-shadow: none;
}
#custom-product-buy-container .wcsatt-options-prompt-label:has(input:checked)::before {
	background: #000;
	border-color: #000;
}
#custom-product-buy-container .wcsatt-options-prompt-label:has(input:focus-visible) {
	outline: 2px solid #7a6ff8;
	outline-offset: 3px;
}
#custom-product-buy-container .wcsatt-options-prompt-label:hover { border-color: #6b7280; }
#custom-product-buy-container .wcsatt-options-prompt-label:has(input:checked):hover { border-color: #000; }

/* Original APFS label text is replaced by our parts (kept in the DOM, hidden). */
#custom-product-buy-container .pd-plan > .wcsatt-options-prompt-action { display: none; }

#custom-product-buy-container .pd-plan-body { display: block; }
#custom-product-buy-container .pd-plan-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}
#custom-product-buy-container .pd-plan-title {
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}
#custom-product-buy-container .pd-plan-price {
	display: inline-flex;
	align-items: baseline;
	gap: 5px;
	margin-left: auto;
	text-align: right;
	white-space: nowrap;
}
#custom-product-buy-container .pd-plan-was {
	color: #9ca3af;
	font-size: 14px;
	font-weight: 500;
	text-decoration: line-through;
}
#custom-product-buy-container .pd-plan-now {
	font-size: 14px;
	font-weight: 700;
	color: #111827;
}
#custom-product-buy-container .pd-plan-per {
	font-size: 11px;
	font-weight: 500;
	color: #6b7280;
}
#custom-product-buy-container .pd-plan-price .woocommerce-Price-amount,
#custom-product-buy-container .pd-plan-price bdi { font: inherit; color: inherit; text-decoration: inherit; }

/* SAVE x% pill (site purple) overlapping the top-right corner of the subscribe card */
#custom-product-buy-container .pd-plan-badge {
	position: absolute;
	top: -11px;
	right: 14px;
	z-index: 2;
	padding: 4px 10px;
	border-radius: 999px;
	background: linear-gradient(135deg, #7a6ff8, #6a5cf6); /* same purple as the BUY NOW button */
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.06em;
	line-height: 1.2;
	text-transform: uppercase;
	pointer-events: none;
}

@media (min-width: 991px) {
	#custom-product-buy-container .wcsatt-options-prompt-label { padding: 18px 20px 18px 45px; }
	#custom-product-buy-container .wcsatt-options-prompt-label::before { left: 15px; width: 20px; height: 20px; }
	#custom-product-buy-container .wcsatt-options-prompt-label::after { left: 20px; width: 10px; height: 10px; }
	#custom-product-buy-container .wcsatt-options-prompt-label:has(input:checked) { box-shadow: none; }
	#custom-product-buy-container .pd-plan-title { font-size: 16px; }
	#custom-product-buy-container .pd-plan-was,
	#custom-product-buy-container .pd-plan-now { font-size: 17px; }
	#custom-product-buy-container .pd-plan-per { font-size: 12px; }
	#custom-product-buy-container .pd-plan-badge { font-size: 11px; right: 18px; }
}

/* Before the JS runs (or if it fails) the plain APFS labels still look like cards. */
#custom-product-buy-container .wcsatt-options-prompt-label:not(.pd-plan) {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 600;
}
