/**
 * PeptideLab — product buy box (swatches, quantity tiers, stepper, live total).
 *
 * Loaded only on single product pages, after woocommerce.css.
 *
 * Colour note: the reference design uses a blue accent. This theme already has
 * an established palette (navy + assay teal), so the selected states reuse
 * --pl-accent / --pl-accent-soft instead of introducing a second accent colour.
 * Swap those two variables below if you want the blue from the mockup.
 */

/* ==========================================================================
   1. Variation swatches (pills)
   ========================================================================== */

/* The native <select> stays in the DOM for WooCommerce's own JS but is not shown. */
.pl-native-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.pl-swatches-swatched .variations th.label {
	display: none;
}

.pl-swatches-swatched .variations td.value {
	display: block;
	width: 100%;
	padding: 0;
}

.pl-swatches-swatched .variations {
	margin-bottom: var(--pl-s4);
}

.pl-swatches__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--pl-s3);
	margin-bottom: var(--pl-s3);
}

.pl-swatches__label {
	display: block;
	color: var(--pl-navy-900);
	font-size: 1rem;
	font-weight: 700;
}

/* WooCommerce's "Clear" link, moved up next to the attribute label. */
.pl-swatches__head .reset_variations {
	font-size: 0.78rem;
}

/* When a quantity ladder is on screen the cards carry the price. */
.pl-has-tiers .woocommerce-variation-price {
	display: none;
}

.pl-swatches__options {
	display: flex;
	flex-wrap: wrap;
	gap: var(--pl-s3);
}

.pl-swatch {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-width: 104px;
	padding: 13px 18px;
	border: 1px solid var(--pl-line-strong);
	border-radius: 14px;
	background: #fff;
	color: var(--pl-navy-900);
	font: inherit;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.pl-swatch:hover:not(.is-disabled) {
	border-color: var(--pl-accent);
}

.pl-swatch.is-selected {
	border-color: var(--pl-accent);
	background: var(--pl-accent-soft);
}

.pl-swatch.is-disabled {
	border-color: var(--pl-line);
	background: #fff;
	color: var(--pl-slate-400);
	cursor: not-allowed;
}

.pl-swatch:focus-visible {
	outline: 2px solid var(--pl-focus);
	outline-offset: 2px;
}

.pl-swatch__note {
	display: block;
	margin-top: 3px;
	color: var(--pl-slate-400);
	font-size: 0.72rem;
	font-weight: 500;
}

/* ==========================================================================
   2. Quantity tier cards
   ========================================================================== */

.pl-tiers {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--pl-s3);
	width: 100%;
	/* Only meaningful when the buy box itself is a flex row (simple products). */
	flex: 1 1 100%;
	margin-bottom: var(--pl-s4);
}

.pl-tiers[hidden] {
	display: none;
}

.pl-tier {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: var(--pl-s4) var(--pl-s3);
	border: 1px solid var(--pl-line);
	border-radius: 14px;
	background: #fff;
	color: var(--pl-navy-900);
	font: inherit;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.pl-tier:hover {
	border-color: var(--pl-accent-line);
}

.pl-tier.is-selected {
	border-color: var(--pl-accent);
	background: var(--pl-accent-soft);
}

.pl-tier:focus-visible {
	outline: 2px solid var(--pl-focus);
	outline-offset: 2px;
}

.pl-tier__label {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 8px;
	font-size: 0.92rem;
	font-weight: 600;
}

.pl-tier__badge {
	display: inline-block;
	padding: 2px 9px;
	border-radius: var(--pl-r-pill);
	background: var(--pl-accent-soft);
	color: var(--pl-accent-strong);
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.02em;
}

.pl-tier.is-selected .pl-tier__badge {
	background: #fff;
}

.pl-tier__price {
	display: flex;
	align-items: baseline;
	justify-content: center;
	flex-wrap: wrap;
	gap: 8px;
	/* 价格用正文字体，和单品页价格保持一致 */
	font-family: var(--pl-font-sans);
	font-size: 1.12rem;
	font-weight: 700;
	letter-spacing: -0.01em;
}

.pl-tier__was {
	color: var(--pl-slate-400);
	font-size: 0.95rem;
	font-weight: 500;
}

/* ==========================================================================
   3. Quantity stepper
   ========================================================================== */

.woocommerce .quantity.pl-qty {
	padding: 0;
	min-width: 104px;
}

.pl-qty__select {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	min-width: 104px;
	padding: 15px 34px 15px 20px;
	border: 0;
	background-color: transparent;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%230f172a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	background-size: 12px 8px;
	color: var(--pl-navy-900);
	font: inherit;
	font-family: var(--pl-font-sans);
	font-size: 1.05rem;
	font-weight: 700;
	cursor: pointer;
}

.pl-qty__select:focus-visible {
	outline: 2px solid var(--pl-focus);
	outline-offset: 2px;
}

/* ==========================================================================
   4. Add-to-cart live total
   ========================================================================== */

.pl-add-to-cart__total {
	margin-left: 8px;
	font-weight: 600;
	opacity: 0.92;
}

.pl-add-to-cart__total:empty {
	display: none;
}

/* ==========================================================================
   5. Small screens
   ========================================================================== */

@media (max-width: 560px) {
	.pl-tiers {
		grid-template-columns: minmax(0, 1fr);
	}

	.pl-swatch {
		min-width: 84px;
		padding: 11px 14px;
		font-size: 0.95rem;
	}
}
