/* BioPeps brand palette — matches the site's teal → blue → purple gradient
 * (same gradient used in the "Research Use Only" header banner) and Inter
 * type. Adjust the two accent stops here if the brand palette shifts. */
.pfl-bundle-tiers-wrap {
	--pfl-accent-from: #16b3a3;   /* teal */
	--pfl-accent: #5b6ee1;        /* blue-purple, primary accent */
	--pfl-accent-text: #5b6ee1;
	--pfl-accent-to: #7b5cf0;     /* purple */
	--pfl-card-bg: transparent;
	--pfl-card-border: rgba(91, 110, 225, 0.35);
	--pfl-card-active-bg: rgba(91, 110, 225, 0.10);
	--pfl-card-active-border: #5b6ee1;
	--pfl-text: inherit;
	--pfl-muted: rgba(120, 120, 120, 0.9);

	font-family: Inter, ui-sans-serif, system-ui, sans-serif;
	margin: 6px 0 20px;
}

.pfl-bundle-tiers {
	display: flex;
	flex-wrap: nowrap;
	gap: 10px;
	overflow-x: auto;
	/*
	 * Setting overflow-x: auto here also forces the browser to clip the
	 * y-axis (per spec, "auto" on one axis makes "visible" on the other
	 * compute to "auto" too), which was cutting off the top of the
	 * absolutely-positioned "Save X%" badge (it sits at top: -9px on
	 * .pfl-tier-card__badge, poking above the card). This top padding
	 * gives the scroll container's padding-box enough room so the badge
	 * is no longer outside the clip area. The 10px added here is offset
	 * by reducing the wrap's margin-top above (16px -> 6px), so overall
	 * spacing above the row is unchanged.
	 */
	padding: 10px 0 6px;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	scrollbar-color: var(--pfl-card-active-border) transparent;
}

.pfl-bundle-tiers::-webkit-scrollbar {
	height: 6px;
}

.pfl-bundle-tiers::-webkit-scrollbar-thumb {
	background: var(--pfl-card-border);
	border-radius: 3px;
}

.pfl-bundle-tiers--empty {
	font-size: 0.9em;
	color: var(--pfl-muted);
	font-style: italic;
	padding: 10px 0;
}

.pfl-tier-card {
	position: relative;
	display: flex;
	flex: 0 0 120px;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	background: var(--pfl-card-bg);
	border: 1.5px solid var(--pfl-card-border);
	border-radius: 6px;
	padding: 10px 8px 12px;
	cursor: pointer;
	text-align: center;
	transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
	color: var(--pfl-text);
	font-family: inherit;
}

.pfl-tier-card:hover {
	border-color: var(--pfl-card-active-border);
	transform: translateY(-1px);
}

.pfl-tier-card--active {
	background: var(--pfl-card-active-bg);
	border-color: var(--pfl-card-active-border);
	box-shadow: 0 0 0 1px var(--pfl-card-active-border);
}

.pfl-tier-card__label {
	font-size: 0.78em;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	opacity: 0.85;
	line-height: 1.3;
}

.pfl-tier-card__price {
	font-size: 1.05em;
	font-weight: 700;
	color: var(--pfl-accent-text);
	margin-top: 2px;
}

.pfl-tier-card__unit {
	font-size: 0.72em;
	color: var(--pfl-muted);
}

.pfl-tier-card__badge {
	position: absolute;
	top: -9px;
	right: -6px;
	background: linear-gradient(90deg, var(--pfl-accent-from), var(--pfl-accent-to));
	color: #ffffff;
	font-size: 0.65em;
	font-weight: 700;
	padding: 2px 6px;
	border-radius: 10px;
	white-space: nowrap;
}

@media (max-width: 480px) {
	.pfl-tier-card {
		flex-basis: 105px;
	}
}

/*
 * Desktop fix: the same "Overflow: Hidden" ancestor issue described in the
 * mobile block below also clips the Add to Cart button on wider viewports
 * (it was previously only re-opened inside the max-width:767px query).
 * This scopes the overflow re-open to desktop widths and lets the
 * qty/button row wrap ONLY if it genuinely runs out of horizontal space,
 * instead of being clipped. It does not touch the mobile stacking rules
 * below, and it does not force stacking on desktop the way the mobile
 * rules do — it's a min-width query so it never overlaps the mobile one.
 */
@media (min-width: 768px) {
	.elementor-widget-container:has(.pfl-bundle-tiers-wrap),
	.e-con:has(.pfl-bundle-tiers-wrap),
	.elementor-column:has(.pfl-bundle-tiers-wrap),
	body.single-product .elementor-element:has(form.cart) {
		overflow: visible !important;
	}

	body.single-product form.cart {
		flex-wrap: wrap;
		overflow: visible;
		max-width: 100%;
	}

	body.single-product form.cart .single_add_to_cart_button {
		box-sizing: border-box;
		max-width: 100%;
		flex-shrink: 1;
	}
}

/*
 * Mobile fix: on some Elementor single-product layouts, a parent
 * section/column has "Overflow: Hidden" set (Advanced > Layout), which
 * clips this row instead of letting it scroll, and can also clip the
 * quantity box + Add to Cart button that sit right below it if that
 * row isn't allowed to wrap on small screens.
 *
 * This re-opens overflow on ancestors of the tier wrap specifically
 * (not site-wide), and forces the qty/button row to wrap so nothing
 * gets pushed off-screen. Scoped to single-product pages only.
 */
@media (max-width: 767px) {
	/*
	 * These three rules (wrap / tier row / card) are widget-specific
	 * selectors, so it's safe to apply them on any page, not only when
	 * body.single-product is present -- some page builders/templates
	 * render the product without that body class, which was silently
	 * skipping the 2-column grid below and leaving the row as a plain
	 * horizontal scroll on mobile.
	 */
	.pfl-bundle-tiers-wrap {
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
		overflow: visible;
	}

	.elementor-widget-container:has(.pfl-bundle-tiers-wrap),
	.e-con:has(.pfl-bundle-tiers-wrap),
	.elementor-column:has(.pfl-bundle-tiers-wrap),
	body.single-product .elementor-element:has(form.cart) {
		overflow: visible !important;
	}

	.pfl-bundle-tiers {
		display: grid !important;
		grid-template-columns: repeat(2, 1fr) !important;
		gap: 10px !important;
		overflow: visible !important;
		overflow-x: visible !important;
		flex-wrap: unset !important;
		padding-bottom: 0 !important;
	}

	.pfl-tier-card {
		flex: unset !important;
		width: 100% !important;
		box-sizing: border-box !important;
	}

	/* form.cart is a shared WooCommerce class (also used on cart/checkout),
	 * so these stay scoped to single-product pages only. */
	body.single-product form.cart {
		flex-wrap: wrap !important;
		overflow: visible !important;
		width: 100% !important;
		max-width: 100% !important;
	}

	body.single-product form.cart .quantity,
	body.single-product form.cart .single_add_to_cart_button {
		flex: 1 1 100%;
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
		margin-left: 0 !important;
		margin-right: 0 !important;
	}

	body.single-product form.cart .quantity {
		margin-bottom: 8px;
	}
}
