/*
 * KratomSpot Subscription Purchase Box — frontend styles.
 *
 * Two switchable layouts (WooCommerce → Subscription Box → Design layout):
 *  - .ksui-layout-best-value : highlighted Subscribe & Save card with badge (V3)
 *  - .ksui-layout-compact    : joined rows with tinted selection + 2-column benefits (V2)
 *
 * Order: One-Time Purchase first, Subscribe & Save below it.
 * Also fixes the theme's ADD TO CART / BUY NOW buttons wrapping onto two lines on
 * desktop now that the button label carries the live price.
 */

/* ---------------------------------------------------------------- wrapper */

.ksui-purchase-box {
	margin: 12px 0 20px;
	width: 100%;
	max-width: 100%;
}

.ksui-purchase-box .wcsatt-options-product-prompt,
.ksui-purchase-box .ksui-prompt {
	margin: 0;
	padding: 0;
}

.ksui-purchase-box .ksui-heading {
	margin: 0 0 8px;
	font-size: 17px;
	line-height: 29px;
	font-weight: 700;
	color: #333333;
}

.ksui-purchase-box .ksui-fieldset {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}

ul.ksui-choices {
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: visible;
}

.ksui-choice {
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
}

/* ------------------------------------------------------- shared elements */

.ksui-choice .ksui-choice-label {
	display: flex;
	align-items: center;
	gap: 11px;
	width: 100%;
	margin: 0 !important;
	padding: 0;
	cursor: pointer;
	line-height: 1.3;
}

.ksui-choice--forced > .ksui-choice-label {
	cursor: default;
}

.ksui-choice .ksui-choice-title {
	flex: 1 1 auto;
	font-size: 15px;
	font-weight: 800;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	color: #1f1f1f;
}

.ksui-choice-price--subscribe {
	margin-left: auto;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	white-space: nowrap;
}

.ksui-choice .ksui-sub-amount {
	font-size: 20px;
	font-weight: 800;
	color: #4a6230;
	line-height: 1.15;
}

.ksui-choice del.ksui-sub-regular {
	font-size: 13.5px;
	font-weight: 600;
	color: #9d9d9d;
	text-decoration: line-through;
	margin: 0;
}

.ksui-choice-price--one-time {
	margin-left: auto;
	font-size: 17px;
	font-weight: 800;
	color: #4a6230;
	white-space: nowrap;
}

/* custom radio / checkbox */
.ksui-choice input.wcsatt-options-prompt-action-input {
	-webkit-appearance: none;
	appearance: none;
	flex: 0 0 20px;
	width: 20px;
	height: 20px;
	margin: 0 !important;
	padding: 0;
	border: 2px solid #b3b3b3;
	border-radius: 50%;
	background: #ffffff;
	cursor: pointer;
	position: relative;
	display: inline-block;
	vertical-align: middle;
	box-shadow: none;
}

.ksui-choice input.wcsatt-options-prompt-action-input[type="checkbox"] {
	border-radius: 5px;
}

.ksui-choice input.wcsatt-options-prompt-action-input:checked {
	border-color: #233a23;
}

.ksui-choice input.wcsatt-options-prompt-action-input:checked::after {
	content: '';
	position: absolute;
	top: 3px;
	left: 3px;
	right: 3px;
	bottom: 3px;
	border-radius: 50%;
	background: #233a23;
}

.ksui-choice input.wcsatt-options-prompt-action-input[type="checkbox"]:checked::after {
	border-radius: 2px;
}

.ksui-choice input.wcsatt-options-prompt-action-input:focus-visible {
	outline: 2px solid #233a23;
	outline-offset: 2px;
}

/* benefits */
.ksui-benefits {
	display: flex;
	flex-direction: column;
	gap: 7px;
	margin: 0 0 11px;
}

.ksui-benefit {
	display: flex;
	align-items: center;
	gap: 9px;
	font-size: 12.5px;
	font-weight: 700;
	letter-spacing: 0.4px;
	text-transform: uppercase;
	color: #1f1f1f;
	line-height: 1.4;
}

.ksui-check {
	flex: 0 0 17px;
	width: 17px;
	height: 17px;
	border-radius: 50%;
	background: #4a6230;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.ksui-check svg {
	width: 9px;
	height: 9px;
	display: block;
	stroke: #ffffff;
	stroke-width: 3;
	fill: none;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* Plan dropdown. display:block !important also defeats the APFS script's
   .hide() on single-plan products — the design always shows the Autoship select. */
.ksui-purchase-box select.wcsatt-options-product-dropdown.ksui-plan-select {
	display: block !important;
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding: 9px 14px;
	font-size: 14px;
	font-weight: 600;
	color: #1f1f1f;
	background-color: #ffffff;
	border: 1px solid #d8d6cd;
	border-radius: 9px;
	cursor: pointer;
	line-height: 1.4;
}

.ksui-purchase-box .ksui-plan-details {
	display: block;
}

.ksui-purchase-box .ksui-plan-details p {
	margin: 7px 0 0;
	font-size: 12.5px;
	color: #555555;
}

.ksui-purchase-box .ksui-plan-details:empty {
	display: none;
}

/* Real scheme radios: hidden state carriers when the dropdown drives the UI. */
.ksui-purchase-box ul.wcsatt-options-product.wcsatt-options-product--hidden {
	display: none !important;
}

.ksui-purchase-box ul.wcsatt-options-product {
	list-style: none;
	margin: 10px 0 0;
	padding: 0;
}

/* Forced-subscription panel (no one-time option). */
.ksui-choices--forced .ksui-choice--forced {
	display: block;
}

/* =========================================================================
   Layout: BEST VALUE (subscribe card with badge)
   ========================================================================= */

.ksui-layout-best-value .ksui-choice--one-time {
	background: #ffffff;
	border: 1px solid #d8d6cd;
	border-radius: 12px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ksui-layout-best-value .ksui-choice--one-time .ksui-choice-label {
	padding: 12px 16px;
}

.ksui-layout-best-value .ksui-choice--one-time .ksui-choice-title {
	font-size: 13.5px;
}

.ksui-layout-best-value .ksui-choice--one-time.ksui-selected {
	border-color: #1f1f1f;
	box-shadow: inset 0 0 0 1px #1f1f1f;
}

.ksui-layout-best-value .ksui-choice--subscribe {
	position: relative;
	margin: 15px 0 0 !important;
	background: #fdf6e7;
	border: 2px solid #233a23;
	border-radius: 14px;
	padding: 13px 16px 14px !important;
	cursor: pointer;
	transition: box-shadow 0.15s ease;
}

.ksui-layout-best-value .ksui-choice--subscribe.ksui-selected {
	box-shadow: 0 3px 10px rgba(35, 58, 35, 0.14);
}

.ksui-badge {
	position: absolute;
	top: -12px;
	right: 14px;
	background: #fab333;
	color: #241c00;
	font-size: 10.5px;
	font-weight: 800;
	letter-spacing: 0.6px;
	text-transform: uppercase;
	line-height: 1.5;
	padding: 3px 12px;
	border-radius: 20px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
	white-space: nowrap;
	z-index: 1;
}

.ksui-layout-best-value .wcsatt-options-product-wrapper.ksui-sub-panel {
	margin: 0;
	padding: 10px 0 0 31px;
}

/* =========================================================================
   Layout: COMPACT (joined rows, tinted selection, 2-column benefits)
   ========================================================================= */

.ksui-layout-compact ul.ksui-choices {
	background: #ffffff;
	border: 1px solid #e2e0d8;
	border-radius: 16px;
	overflow: hidden;
}

.ksui-layout-compact .ksui-choice + .ksui-choice {
	border-top: 1px solid #e2e0d8;
}

.ksui-layout-compact .ksui-choice .ksui-choice-label {
	padding: 12px 16px;
	transition: background-color 0.15s ease;
}

.ksui-layout-compact .ksui-choice.ksui-selected > .ksui-choice-label {
	background: #f1f5ea;
}

.ksui-layout-compact .ksui-choice-title {
	flex: 0 1 auto;
	font-size: 13px;
}

.ksui-chip {
	background: #4a6230;
	color: #ffffff;
	font-size: 10.5px;
	font-weight: 800;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	line-height: 1.5;
	padding: 2px 9px;
	border-radius: 20px;
	white-space: nowrap;
}

.ksui-layout-compact .ksui-choice-price--subscribe {
	flex-direction: row;
	align-items: center;
	gap: 6px;
}

.ksui-layout-compact .ksui-choice .ksui-sub-amount {
	font-size: 16px;
}

.ksui-layout-compact .ksui-choice-price--one-time {
	font-size: 15px;
}

.ksui-layout-compact .wcsatt-options-product-wrapper.ksui-sub-panel {
	margin: 0;
	padding: 2px 16px 14px 47px;
	background: #f1f5ea;
}

.ksui-layout-compact .ksui-benefits {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 7px 12px;
	margin: 0 0 10px;
}

.ksui-layout-compact .ksui-benefit {
	font-size: 10.5px;
	letter-spacing: 0.3px;
	gap: 7px;
}

.ksui-layout-compact .ksui-check {
	flex-basis: 15px;
	width: 15px;
	height: 15px;
}

.ksui-layout-compact select.wcsatt-options-product-dropdown.ksui-plan-select {
	border-radius: 21px;
	padding-left: 15px;
}

.ksui-layout-compact .ksui-choices--forced {
	background: #ffffff;
	border: 1px solid #e2e0d8;
	border-radius: 16px;
	overflow: hidden;
}

.ksui-layout-compact .ksui-choices--forced .ksui-choice-label {
	padding: 12px 16px;
}

/* ------------------------------------------- loyalty discount note (box) */

.ksui-purchase-box .ksui-deferred-note {
	margin: 0 0 10px;
	padding: 7px 11px;
	background: #ffffff;
	border: 1px dashed #b6c48f;
	border-radius: 8px;
	font-size: 11.5px;
	font-weight: 700;
	letter-spacing: 0.3px;
	text-transform: uppercase;
	color: #4a6230;
	line-height: 1.45;
}

/* =========================================================================
   "Subscribe & save" badge under prices (cards, quick view, product page)
   ========================================================================= */

.ksui-save-badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 20px;
	background: #f1f5ea;
	border: 1px solid #dfe7d1;
	color: #4a6230;
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.4px;
	line-height: 1.6;
	text-transform: uppercase;
	white-space: nowrap;
	vertical-align: middle;
}

/* Product cards: own line, centred under the price, never squashing the grid. */
.woocommerce ul.products li.product .price .ksui-save-badge,
.archive-product-content .product .price .ksui-save-badge,
.home_best_sell_products .product .price .ksui-save-badge,
.related.products .product .price .ksui-save-badge {
	display: block;
	width: -moz-fit-content;
	width: fit-content;
	margin: 7px auto 0;
}

/* Product page + quick view: sits next to the price. */
.woocommerce div.product p.price .ksui-save-badge,
.yith-quick-view-content .price .ksui-save-badge {
	margin-left: 8px;
}

/* The stock markup leaves empty <small> tags behind — collapse them. */
.price small.wcsatt-sub-options:empty,
.price small:empty {
	display: none;
}

/* =========================================================================
   Cart page — purchase-type switcher
   ========================================================================= */

.ksui-cart-plan-wrap {
	margin: 8px 0 2px;
}

select.ksui-cart-plan {
	width: 100%;
	max-width: 300px;
	padding: 8px 14px;
	background-color: #ffffff;
	border: 1px solid #d8d6cd;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.4;
	color: #1f1f1f;
	cursor: pointer;
}

select.ksui-cart-plan:focus-visible {
	outline: 2px solid #233a23;
	outline-offset: 2px;
}

/* One-time lines lead with the call to action; the select stays in the DOM so the
   cart form still posts the field, it is just not the thing being offered yet. */
.ksui-cart-plan-wrap--cta select.ksui-cart-plan {
	display: none;
}

button.ksui-cart-subscribe {
	display: inline-block;
	width: 100%;
	max-width: 300px;
	margin: 0;
	padding: 8px 18px;
	background: #233a23;
	border: 0;
	border-radius: 8px;
	color: #ffffff;
	font-size: 13px;
	font-weight: 400;
	letter-spacing: 0.4px;
	line-height: 1.4;
	text-transform: none;
	transition: background-color 0.15s ease, opacity 0.15s ease;
}

button.ksui-cart-subscribe:hover {
	background: #35492d;
	color: #ffffff;
}

button.ksui-cart-subscribe:focus-visible {
	outline: 2px solid #233a23;
	outline-offset: 2px;
}

button.ksui-cart-subscribe--busy {
	opacity: 0.6;
}

/* Fade the table while the cart re-posts so the change reads as "saving". */
form.ksui-cart-updating .woocommerce-cart-form__contents {
	opacity: 0.55;
	pointer-events: none;
	transition: opacity 0.15s ease;
}

/* =========================================================================
   Mini cart — plan controls injected into the theme's card layout
   ========================================================================= */

/*
 * Scoped ".woocommerce .widget_shopping_cart_content …" on purpose. Themes commonly
 * style every button and anchor inside the header cart area as an icon — KratomSpot's
 * sets them to 36px — and those selectors outweigh a single class. Three classes here
 * beat that without depending on any theme-specific class name.
 */
/* Frequency status line under a mini cart product name. */
.woocommerce .widget_shopping_cart_content .ksui-mc-freq {
	display: inline-block;
	font-size: 11.5px;
	font-weight: 700;
	line-height: 1.45;
	color: #4a6230;
}

.woocommerce .widget_shopping_cart_content .ksui-mc-freq--once {
	color: #6b7166;
	font-weight: 600;
}

.woocommerce .widget_shopping_cart_content .ks-mc select.ksui-mc-plan,
.woocommerce .widget_shopping_cart_content select.ksui-mc-plan {
	width: 100%;
	margin-top: 10px;
	padding: 8px 12px;
	background: #ffffff;
	border: 1px solid #d8d6cd;
	border-radius: 9px;
	font-family: inherit;
	font-size: 12.5px;
	font-weight: 700;
	line-height: 1.4;
	letter-spacing: normal;
	text-transform: none;
	color: #233a23;
	cursor: pointer;
	height: auto;
}

.woocommerce .widget_shopping_cart_content .ks-mc button.ksui-mc-subscribe,
.woocommerce .widget_shopping_cart_content button.ksui-mc-subscribe {
	display: block !important;
	width: 100%;
	min-width: 0;
	margin-top: 10px;
	padding: 10px;
	background: #233a23;
	border: 0;
	border-radius: 9px;
	color: #ffffff;
	font-family: inherit;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0.3px;
	line-height: 1.4;
	text-align: center;
	text-transform: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.woocommerce .widget_shopping_cart_content button.ksui-mc-subscribe:hover {
	background: #35492d;
	color: #ffffff;
}

.woocommerce .widget_shopping_cart_content select.ksui-mc-plan.is-busy,
.woocommerce .widget_shopping_cart_content button.ksui-mc-subscribe.is-busy {
	opacity: 0.55;
}

/* =========================================================================
   My Account — subscriber rewards progress
   ========================================================================= */

.ksui-rewards {
	margin: 0 0 34px;
}

.ksui-rewards .ksui-rewards-title {
	margin: 0 0 14px;
	font-size: 19px;
}

.ksui-reward {
	margin: 0 0 16px;
	padding: 14px 16px;
	background: #ffffff;
	border: 1px solid #e2e0d8;
	border-radius: 12px;
}

.ksui-reward--unlocked {
	background: #f1f5ea;
	border-color: #b6c48f;
}

.ksui-reward-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 9px;
	flex-wrap: wrap;
}

.ksui-reward-name {
	font-size: 13px;
	font-weight: 800;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	color: #1f1f1f;
}

.ksui-reward-meta {
	font-size: 12.5px;
	font-weight: 700;
	color: #4a6230;
	white-space: nowrap;
}

.ksui-reward-bar {
	height: 9px;
	border-radius: 6px;
	background: #ebeae4;
	overflow: hidden;
}

.ksui-reward-bar span {
	display: block;
	height: 100%;
	border-radius: 6px;
	background: #4a6230;
	transition: width 0.3s ease;
}

.ksui-reward--unlocked .ksui-reward-bar span {
	background: #fab333;
}

.ksui-reward-note {
	margin: 9px 0 0;
	font-size: 12.5px;
	line-height: 1.55;
	color: #555555;
}

/* =========================================================================
   Theme touch-ups
   ========================================================================= */

/* Only the layout fix belongs here. The label colour is the theme's call — it
   sets deep green on the amber fill, which white failed at (1.8:1 and 1.5:1).
   This selector carries .has-subscription-plans, so it out-specifies the theme's
   rule; re-declaring a colour here would silently win and undo that. */
.woocommerce div.product.has-subscription-plans form.cart button.single_add_to_cart_button {
	clear: both;
}

/* The buttons keep the theme's own sizing and wrapping. The flex layout that used to
   force them onto one row is gone: it only existed because the button label carried
   the live price, which the theme now opts out of via 'ksui_show_button_price'. */
@media (min-width: 768px) {

	.woocommerce div.product.has-subscription-plans form.cart .woocommerce-variation-add-to-cart,
	.woocommerce div.product.has-subscription-plans form.cart:not(.variations_form) {
		display: inline-block;
		width: 100%;
	}
}

/* The empty variation placeholder must never add stray spacing before a
   variation is selected. */
.wcsatt-options-wrapper--variation:empty {
	display: none;
}

@media (max-width: 480px) {

	.ksui-layout-best-value .ksui-choice--subscribe {
		padding: 12px 13px 13px !important;
	}

	.ksui-layout-best-value .wcsatt-options-product-wrapper.ksui-sub-panel {
		padding-left: 30px;
	}

	.ksui-layout-best-value .ksui-choice--one-time .ksui-choice-label {
		padding: 11px 13px;
	}

	.ksui-layout-compact .ksui-benefits {
		grid-template-columns: 1fr;
	}

	.ksui-layout-compact .wcsatt-options-product-wrapper.ksui-sub-panel {
		padding-left: 44px;
	}

	.ksui-choice .ksui-choice-title {
		font-size: 13px;
	}

	.ksui-choice .ksui-sub-amount {
		font-size: 17px;
	}
}
