/**
 * Bundle chips.
 *
 * No !important anywhere that a widget control can also target. Elementor
 * drops !important from any rule whose value is a global color — it emits
 * `background-color: var( --e-global-color-primary );` with no flag — so an
 * !important here silently beats every global the merchant picks. Specificity
 * does the same job safely: these selectors sit at (0,3,1), above the theme's
 * `.woocommerce button.button` (0,2,1) and below Elementor's generated widget
 * rules (0,4,0), which is exactly where a default belongs.
 */

.jc-bundle-save {
	margin: 24px 0 20px;
}

.jc-bundle-save.is-hidden {
	display: none !important;
}

.jc-bundle-save .jc-bundle-save__title {
	margin: 0 0 20px;
	font-size: 22px;
	line-height: 1.2;
	font-weight: 700;
}

.jc-bundle-save .jc-bundle-save__options {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 16px;
}

.jc-bundle-save .jc-bundle-save__options button.jc-bundle-option {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 132px;
	width: 100%;
	margin: 0;
	padding: 18px 12px;
	background: #fff;
	border: 2px solid #e1e4e8;
	border-radius: 15px;
	cursor: pointer;
	text-align: center;
	transition: border-color .2s, background-color .2s, box-shadow .2s, transform .2s;
}

/* Images beside the text rather than above it. */
.jc-bundle-save .jc-bundle-save__options button.jc-bundle-option.is-horizontal {
	flex-direction: row;
}

.jc-bundle-save .jc-bundle-save__options button.jc-bundle-option:hover {
	border-color: #399b91;
}

.jc-bundle-save .jc-bundle-save__options button.jc-bundle-option.is-active {
	border-color: #399b91;
	background: #f2fbf9;
	box-shadow: 0 0 0 1px #399b91;
}

.jc-bundle-save .jc-bundle-save__options button.jc-bundle-option:focus-visible {
	outline: 3px solid rgba(57, 155, 145, .25);
	outline-offset: 2px;
}

.jc-bundle-save .jc-bundle-option__images {
	position: relative;
	align-items: center;
	justify-content: center;
	min-width: 0;
}

.jc-bundle-save .jc-bundle-option__images img {
	position: relative;
	display: block;
	width: 54px;
	height: 76px;
	max-width: none;
	margin: 0;
	object-fit: contain;
}

/* Inline: one row, overlapping by default so a bundle reads as a bundle. */
.jc-bundle-save .jc-bundle-option__images.is-inline {
	display: flex;
	flex-wrap: nowrap;
}

.jc-bundle-save .jc-bundle-option__images.is-inline img + img {
	margin-left: var(--jc-bundle-image-overlap, -18px);
}

.jc-bundle-save .jc-bundle-option__images.is-inline img:nth-child(2) {
	z-index: 2;
}

.jc-bundle-save .jc-bundle-option__images.is-inline img:nth-child(3) {
	z-index: 3;
}

.jc-bundle-save .jc-bundle-option__images.is-inline img:nth-child(4) {
	z-index: 4;
}

.jc-bundle-save .jc-bundle-option__images.is-inline img:nth-child(5) {
	z-index: 5;
}

/* Grid: every image gets its own cell, nothing overlaps. */
.jc-bundle-save .jc-bundle-option__images.is-grid {
	display: grid;
	grid-template-columns: repeat(var(--jc-bundle-image-columns, 3), auto);
	gap: var(--jc-bundle-image-gap, 4px);
	justify-items: center;
}

.jc-bundle-save .jc-bundle-option__content {
	min-width: 0;
}

.jc-bundle-save .jc-bundle-option__quantity {
	display: block;
	font-size: 20px;
	line-height: 1.15;
	font-weight: 700;
}

.jc-bundle-save .jc-bundle-option__price {
	display: block;
	margin-top: 6px;
	font-size: 16px;
	line-height: 1.2;
	font-weight: 600;
}

.jc-bundle-save .jc-bundle-option__price .woocommerce-Price-amount {
	font-size: inherit;
	font-weight: inherit;
}

/*
 * The word "off" is lowercase in the string and uppercased here, rather than
 * being written "OFF" in the string itself. That way the casing is a style, and
 * the widget's Discount typography > Text Transform control can change it to
 * title case or leave it alone. Baked into the string, no control could.
 */
.jc-bundle-save .jc-bundle-option__discount {
	display: block;
	margin-top: 5px;
	text-transform: uppercase;
	font-size: 16px;
	line-height: 1.2;
	font-weight: 700;
	color: #399b91;
}

.jc-bundle-save .jc-bundle-option__badge {
	position: absolute;
	top: -14px;
	left: 50%;
	transform: translateX(-50%);
	padding: 6px 12px;
	border-radius: 7px;
	background: #399b91;
	color: #fff;
	font-size: 12px;
	line-height: 1.1;
	font-weight: 700;
	white-space: nowrap;
}

.jc-bundle-save .jc-bundle-option__badge--best {
	background: #eea536;
}

.jc-bundle-save .jc-bundle-option__badge--bulk {
	background: #171717;
}

/* Switched on from the panel. The chips already state the unit price, so
   WooCommerce's variation price line is a second answer to the same question.

   The price line, and only the price line. WooCommerce Subscriptions renders
   its whole one-time / subscribe block inside this same container, so hiding
   the container took the purchase options with it and there was no way to have
   both — the switch had to be off, which put the duplicate price back. The
   child selector hides the duplicate and leaves everything else in there. */
form.cart.jc-bundle-hide-variation-price .woocommerce-variation-price > .price {
	display: none;
}

/* B2BKing prints its own tier table on the product page. The chips replace it. */
.single-product .b2bking_tier_table {
	display: none;
}

/* A bundle is selected, so subscribing is off the table. Dimmed rather than
   hidden: a block that disappears as the shopper clicks between chips reads as
   a fault, and anyone who came looking for the subscribe option is left
   wondering where it went. */
.wcsatt-options-wrapper.jc-bundle-subs-blocked {
	opacity: .55;
}

.wcsatt-options-wrapper.jc-bundle-subs-blocked input {
	cursor: not-allowed;
}

.jc-bundle-subs-note {
	margin: 8px 0 0;
	font-size: 13px;
	line-height: 1.4;
	opacity: .85;
}

/* Shown only inside the Elementor editor, where a blank canvas is confusing. */
.jc-bundle-save__empty {
	padding: 14px 16px;
	border: 1px dashed #b9c0c7;
	border-radius: 8px;
	color: #5c6670;
	font-size: 14px;
	line-height: 1.4;
}

@media (max-width: 1024px) {
	.jc-bundle-save .jc-bundle-save__options {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 600px) {
	.jc-bundle-save .jc-bundle-save__options {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
	}

	.jc-bundle-save .jc-bundle-save__options button.jc-bundle-option {
		min-height: 115px;
		padding: 12px 8px;
		gap: 6px;
	}

	.jc-bundle-save .jc-bundle-option__images img {
		width: 42px;
		height: 62px;
	}

	.jc-bundle-save .jc-bundle-option__quantity {
		font-size: 16px;
	}

	.jc-bundle-save .jc-bundle-option__price,
	.jc-bundle-save .jc-bundle-option__discount {
		font-size: 14px;
	}

	.jc-bundle-save .jc-bundle-option__badge {
		padding: 5px 8px;
		font-size: 10px;
	}
}
