/**
 * Build-a-box / mix & match (Pro) — styling.
 *
 * A full-width grid of product cards with quantity steppers, a "N of M added"
 * meter and a progress bar that turns complete-green when the box is full.
 * Reads the configurator's --bb-* tokens so it brands with everything else.
 */

.bb-box {
	margin-top: 4px;
	/* Clearance so the last grid row can sit above the docked sticky summary
	   bar (~80px tall) instead of tucking behind it. The compact grid rows
	   otherwise have too little room below them, unlike the tall list items. */
	padding-bottom: 72px;
}

/* Keyboard / anchored scrolling parks a card above the pinned bar, matching
   .bundle-item's clearance. */
.bb-box-card {
	scroll-margin-bottom: 96px;
}

/* Head: the "Choose 6" instruction + the live "3 / 6" meter. */
.bb-box-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 8px;
}

.bb-box-instruction {
	font-weight: 600;
	color: var(--bb-ink);
}

.bb-box-meter {
	font-variant-numeric: tabular-nums;
	font-weight: 600;
	color: var(--bb-muted);
	white-space: nowrap;
}

.bb-box-ok .bb-box-meter {
	color: var(--bb-success);
}

.bb-box-over .bb-box-meter {
	color: #b91c1c;
}

/* Quantity-break note: "10% off" / "add 2 more for 15% off", under the head row. */
.bb-box-break-note {
	flex-basis: 100%;
	margin-top: 2px;
	font-size: 0.85em;
	font-weight: 600;
	color: var(--bb-success);
}

.bb-box-break-note:empty {
	display: none;
}

/* Progress bar. */
.bb-box-bar {
	height: 6px;
	background: var(--bb-surface-alt);
	border-radius: 3px;
	overflow: hidden;
	margin-bottom: 14px;
}

.bb-box-bar-fill {
	display: block;
	height: 100%;
	width: 0;
	background: var(--bb-accent);
	border-radius: 3px;
	transition: width 0.25s ease;
}

.bb-box-ok .bb-box-bar-fill {
	background: var(--bb-success-bright);
}

.bb-box-over .bb-box-bar-fill {
	background: #dc2626;
}

/* Card grid: auto-fills as many columns as fit, no sideways scroll. */
.bb-box-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 12px;
}

.bb-box-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 6px;
	padding: 12px 10px 10px;
	background: var(--bb-surface);
	border: 1px solid var(--bb-border);
	border-radius: 10px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.bb-box-card-chosen {
	border-color: var(--bb-accent);
	box-shadow: inset 0 0 0 1px var(--bb-accent);
}

.bb-box-card-img {
	width: 72px;
	height: 72px;
	object-fit: cover;
	border-radius: 8px;
	background: var(--bb-surface-faint);
}

.bb-box-card-name {
	font-size: 13px;
	font-weight: 600;
	color: var(--bb-ink-soft);
	line-height: 1.3;
}

.bb-box-card-price {
	font-size: 13px;
	color: var(--bb-muted);
}

.bb-box-card-price del {
	color: var(--bb-muted-light);
	margin-right: 4px;
}

/* Variation chooser on a variable card: a compact select above the stepper. */
.bb-box-var {
	width: 100%;
	max-width: 152px;
	margin-top: 2px;
	padding: 5px 8px;
	font-size: 12.5px;
	border: 1px solid var(--bb-border-strong);
	border-radius: 8px;
	background: var(--bb-surface);
	color: var(--bb-ink);
}

/* A nudge shown only when a quantity is set but no option has been chosen. */
.bb-box-card-hint {
	display: none;
	font-size: 11.5px;
	font-weight: 600;
	color: #b91c1c;
}

.bb-box-card-pending .bb-box-card-hint {
	display: block;
}

/* A pending card flags the missing choice in red, overriding the chosen accent. */
.bb-box-card-pending,
.bb-box-card-pending.bb-box-card-chosen {
	border-color: #f0b4b4;
	box-shadow: inset 0 0 0 1px #f0b4b4;
}

/* Stepper: − [n] + */
.bb-box-stepper {
	display: inline-flex;
	align-items: center;
	margin-top: 2px;
	border: 1px solid var(--bb-border-strong);
	border-radius: 999px;
	overflow: hidden;
	background: var(--bb-surface);
}

.bb-box-dec,
.bb-box-inc {
	border: 0;
	background: var(--bb-surface-faint);
	color: var(--bb-ink);
	width: 30px;
	height: 30px;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}

.bb-box-dec:hover,
.bb-box-inc:hover {
	background: var(--bb-accent-bg);
	color: var(--bb-accent-deep);
}

.bb-box-full .bb-box-inc {
	opacity: 0.4;
	cursor: not-allowed;
}

/* Variety cap: dim the cards you have not chosen once the cap of different
   products is reached, so it is clear why their plus is disabled. */
.bb-box-card-locked {
	opacity: 0.55;
}

.bb-box-card-locked .bb-box-inc,
.bb-box-inc:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.bb-box-variety {
	font-size: 12px;
	color: var(--bb-ink-soft, #6b6b6b);
}

.bb-box-qty {
	width: 38px;
	height: 30px;
	border: 0;
	border-left: 1px solid var(--bb-border);
	border-right: 1px solid var(--bb-border);
	text-align: center;
	font-size: 14px;
	font-variant-numeric: tabular-nums;
	-moz-appearance: textfield;
	appearance: textfield;
	background: var(--bb-surface);
	color: var(--bb-ink);
}

.bb-box-qty::-webkit-outer-spin-button,
.bb-box-qty::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* Sold-out card: muted, no stepper. */
.bb-box-card-oos {
	opacity: 0.55;
}

.bb-box-oos {
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--bb-muted-light);
}

@media (max-width: 480px) {
	.bb-box-grid {
		grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
		gap: 10px;
	}

	.bb-box-card-img {
		width: 60px;
		height: 60px;
	}
}
