/* Bulk Tier Discounts – product page table. Scoped under .btd so theme styles can't leak in. */
.btd {
	--btd-accent: #1ec28b;
	--btd-on-accent: #fff;
	--btd-badge: #ff7c8c;
	--btd-on-badge: #fff;
	--btd-text: #4a4f55;
	--btd-muted: #8a9096;
	--btd-line: #e3e7ea;
	--btd-hover: #f6f8f9;
	--btd-radius: 6px;
	--btd-accent-text: color-mix(in srgb, var(--btd-accent) 85%, #000);
	box-sizing: border-box;
	width: 100%;
	flex: 1 0 100%;
	max-width: 100%;
	margin: 0 0 1.25em;
	color: var(--btd-text);
	font-size: 15px;
	line-height: 1.35;
	text-align: left;
}
.btd *, .btd *::before, .btd *::after { box-sizing: border-box; }

.btd .btd__fieldset {
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
	border-radius: var(--btd-radius);
	overflow: hidden;
	border-bottom: 1px solid var(--btd-line);
}

.btd .btd__head,
.btd .btd__row {
	display: grid;
	grid-template-columns: 2.25em minmax(0, 1.05fr) minmax(0, 1fr) minmax(0, 1fr);
	align-items: center;
	column-gap: .25em;
}

.btd .btd__head {
	background: var(--btd-accent);
	color: var(--btd-on-accent);
	font-weight: 700;
	font-size: .95em;
	letter-spacing: .01em;
}
.btd .btd__head .btd__cell {
	padding: .85em .5em;
	text-align: center;
}
.btd .btd__head .btd__cell--qty { grid-column: 1 / 3; }
.btd .btd__head .btd__cell + .btd__cell { border-left: 1px solid rgba(255, 255, 255, .35);
	border-left-color: color-mix(in srgb, var(--btd-on-accent) 35%, transparent); }

.btd .btd__row {
	position: relative;
	margin: 0;
	padding: .7em .25em .7em .5em;
	min-height: 3.6em; /* ≥ 48px touch target */
	border-top: 1px solid var(--btd-line);
	font-size: 1em;
	font-weight: 400;
	color: var(--btd-text);
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	transition: background-color .15s ease;
	-webkit-tap-highlight-color: transparent;
}
.btd .btd__head + .btd__row { border-top: 0; }
.btd .btd__row:hover { background: var(--btd-hover); }
.btd .btd__row.is-selected {
	background: #eefaf5;
	background: color-mix(in srgb, var(--btd-accent) 9%, #fff);
	box-shadow: inset 3px 0 0 var(--btd-accent);
}
.btd .btd__row.is-disabled {
	cursor: not-allowed;
	background: #fafbfb;
}
.btd .btd__row.is-disabled .btd__cell { opacity: .5; }
.btd .btd__row.is-disabled:hover { background: #fafbfb; }

/* Custom radio, still a real focusable input. */
.btd .btd__radio {
	-webkit-appearance: none;
	appearance: none;
	display: inline-block;
	position: static;
	width: 1.35em;
	height: 1.35em;
	margin: 0;
	padding: 0;
	border: 2px solid #c8ced3;
	border-radius: 50%;
	background: #fff;
	box-shadow: none;
	vertical-align: middle;
	cursor: inherit;
	transition: border-color .15s ease, box-shadow .15s ease;
	font-size: inherit;
	opacity: 1;
}
.btd .btd__radio:checked {
	border-color: var(--btd-accent);
	box-shadow: inset 0 0 0 .22em #fff, inset 0 0 0 1em var(--btd-accent);
}
.btd .btd__radio:disabled { background: #eef0f2; }
.btd .btd__radio:focus { outline: none; }
.btd .btd__radio:focus-visible { outline: 2px solid var(--btd-accent); outline-offset: 2px; }
.btd .btd__row:has(.btd__radio:focus-visible) { outline: 2px solid var(--btd-accent); outline-offset: -2px; }

.btd .btd__cell { min-width: 0; }
.btd .btd__row .btd__cell--qty {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .2em .5em;
}
.btd .btd__row .btd__cell--unit,
.btd .btd__row .btd__cell--total {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	line-height: 1.25;
}

.btd .btd__qty { font-weight: 600; color: #2f3439; white-space: nowrap; }
.btd .btd__row .woocommerce-Price-amount { font-weight: inherit; color: inherit; white-space: nowrap; }
.btd .btd__row del {
	color: var(--btd-muted);
	font-size: .85em;
	font-weight: 600;
	text-decoration: line-through;
	opacity: 1;
}
.btd .btd__row del .woocommerce-Price-amount { color: inherit; }
.btd .btd__total,
.btd .btd__unit { color: #2f3439; font-weight: 700; }
.btd .btd__row.is-selected .btd__total,
.btd .btd__row.is-selected .btd__unit { color: var(--btd-accent); color: var(--btd-accent-text); }
.btd .btd__row-saving {
	margin-top: .1em;
	font-size: .72em;
	font-weight: 700;
	color: var(--btd-accent);
	color: var(--btd-accent-text);
	white-space: nowrap;
}
.btd .btd__row.is-disabled .btd__row-saving { color: var(--btd-muted); }
.btd .btd__free {
	display: inline-flex;
	align-items: center;
	gap: .25em;
	font-size: .72em;
	font-weight: 700;
	color: var(--btd-accent);
	color: var(--btd-accent-text);
	white-space: nowrap;
}
.btd .btd__truck { flex: none; width: 1.25em; height: 1.25em; vertical-align: -.2em; }

.btd .btd__badge {
	display: inline-block;
	padding: .2em .6em;
	border-radius: 999px;
	background: var(--btd-badge);
	color: var(--btd-on-badge);
	font-size: .72em;
	font-weight: 700;
	line-height: 1.3;
	white-space: nowrap;
	letter-spacing: .01em;
}
.btd .btd__note {
	flex-basis: 100%;
	font-size: .75em;
	color: var(--btd-muted);
}

.btd .btd__summary {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: .15em;
	padding: 1em .5em 0;
	text-align: center;
}
.btd .btd__normal { color: var(--btd-accent); color: var(--btd-accent-text); font-size: .9em; font-weight: 600; }
.btd .btd__normal del { color: inherit; text-decoration: line-through; }
.btd .btd__ours { color: var(--btd-accent); color: var(--btd-accent-text); font-size: 1.45em; line-height: 1.2; }
.btd .btd__ours strong { font-weight: 600; color: inherit; }
.btd .btd__ours .woocommerce-Price-amount { color: inherit; }
.btd .btd__saving {
	margin-top: .25em;
	padding: .15em .7em;
	border-radius: 999px;
	background: #eefaf5;
	background: color-mix(in srgb, var(--btd-accent) 12%, #fff);
	color: #22714f;
	color: color-mix(in srgb, var(--btd-accent) 55%, #000);
	font-size: .82em;
	font-weight: 600;
}
/* +/- counter */
.btd .btd__counter-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .75em;
	padding: 1em 0 0;
}
.btd .btd__counter-label {
	display: inline;
	margin: 0;
	font-size: .95em;
	font-weight: 600;
	color: #2f3439;
	text-transform: none;
	letter-spacing: normal;
}
.btd .btd__counter {
	display: inline-flex;
	align-items: stretch;
	height: 46px; /* ≥ 44px touch target inside the border */
	box-sizing: border-box;
	border: 1px solid var(--btd-line);
	border-radius: 999px;
	overflow: hidden;
	background: #fff;
}
.btd .btd__step {
	-webkit-appearance: none;
	appearance: none;
	width: 46px;
	min-width: 0;
	min-height: 0;
	height: auto;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: #f4f6f7;
	color: #2f3439;
	font-size: 1.25em;
	font-weight: 600;
	line-height: 1;
	box-shadow: none;
	text-shadow: none;
	cursor: pointer;
	transition: background-color .15s ease;
}
.btd .btd__step:hover:not(:disabled) { background: #e8ecee; }
.btd .btd__step:disabled { color: #c3c9cd; cursor: not-allowed; }
.btd .btd__step:focus { outline: none; }
.btd .btd__step:focus-visible { outline: 2px solid var(--btd-accent); outline-offset: -2px; }
.btd .btd__qty-input {
	-moz-appearance: textfield;
	appearance: textfield;
	width: 3.75em;
	height: auto;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-left: 1px solid var(--btd-line);
	border-right: 1px solid var(--btd-line);
	border-radius: 0;
	background: #fff;
	box-shadow: none;
	color: #2f3439;
	font-size: 1.05em;
	font-weight: 700;
	text-align: center;
}
.btd .btd__qty-input::-webkit-outer-spin-button,
.btd .btd__qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.btd .btd__qty-input:focus { outline: 2px solid var(--btd-accent); outline-offset: -2px; }
.btd .btd__qty-input[readonly] { cursor: default; }

/* Free shipping line in the summary */
.btd .btd__shipping {
	display: inline-flex;
	align-items: center;
	gap: .35em;
	margin-top: .3em;
	font-size: .85em;
	color: var(--btd-text);
}
.btd .btd__shipping.is-free { color: var(--btd-accent); color: var(--btd-accent-text); font-weight: 700; }

.btd [hidden] { display: none !important; }

.btd-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Add to cart button directly under the table. */
form.cart:has(.btd--full-button) .single_add_to_cart_button,
form.cart.btd-full-button .single_add_to_cart_button {
	display: block;
	width: 100%;
	margin-left: 0;
	margin-right: 0;
}
form.cart:has(.btd) { flex-wrap: wrap; }

/* The table has its own +/- counter. If a theme prints its own quantity box anyway
   (not via the WooCommerce template), hide it – the server uses btd_qty. */
form.cart:has(.btd) .quantity:not(.btd-cart-qty-wrap),
form.cart.btd-form .quantity:not(.btd-cart-qty-wrap) { display: none; }

/* Sticky add-to-cart bars (e.g. Flatsome's): keep just the button there. Harmless elsewhere. */
.sticky-add-to-cart--active .btd { display: none; }

/* Cart page dropdown. */
.btd-cart-qty-wrap select.btd-cart-qty { min-width: 6.5em; width: auto; margin: 0; }

/* Small phones. */
@media (max-width: 380px) {
	.btd { font-size: 14px; }
	.btd .btd__head .btd__cell { padding: .75em .25em; }
	.btd .btd__head,
	.btd .btd__row { grid-template-columns: 2em minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); }
	.btd .btd__row { padding-left: .4em; }
}

@media (prefers-reduced-motion: reduce) {
	.btd .btd__row, .btd .btd__radio { transition: none; }
}
