/* Bookzilla Attribute Product Fields — frontend */

.bapf-fields {
	margin: 1.25em 0;
}

.bapf-field {
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 6px;
	padding: 0.9em 1em;
	margin-bottom: 1em;
}

.bapf-field__head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 0.75em;
	flex-wrap: wrap;
}

.bapf-field__label {
	font-weight: 600;
}

.bapf-field__price {
	font-size: 0.9em;
	opacity: 0.85;
	white-space: nowrap;
}

.bapf-field__desc {
	margin: 0.35em 0 0;
	font-size: 0.88em;
	opacity: 0.75;
}

.bapf-field__qty {
	display: flex;
	align-items: center;
	gap: 0.75em;
	margin-top: 0.75em;
}

.bapf-field__qty > label {
	font-size: 0.9em;
	margin: 0;
}

.bapf-stepper {
	display: inline-flex;
	align-items: stretch;
	border: 1px solid rgba(0, 0, 0, 0.2);
	border-radius: 4px;
	overflow: hidden;
}

.bapf-stepper__btn {
	width: 2.2em;
	border: 0;
	background: rgba(0, 0, 0, 0.05);
	cursor: pointer;
	font-size: 1em;
	line-height: 1;
	padding: 0;
}

.bapf-stepper__btn:hover {
	background: rgba(0, 0, 0, 0.1);
}

.bapf-stepper__btn:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: -2px;
}

.bapf-stepper__input {
	width: 3.2em;
	text-align: center;
	border: 0;
	border-left: 1px solid rgba(0, 0, 0, 0.12);
	border-right: 1px solid rgba(0, 0, 0, 0.12);
	-moz-appearance: textfield;
	appearance: textfield;
}

.bapf-stepper__input::-webkit-outer-spin-button,
.bapf-stepper__input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.bapf-match-qty {
	border: 0;
	background: none;
	padding: 0;
	font-size: 0.85em;
	text-decoration: underline;
	cursor: pointer;
	opacity: 0.8;
}

.bapf-match-qty:hover {
	opacity: 1;
}

.bapf-field__units {
	margin-top: 0.5em;
}

.bapf-unit {
	display: flex;
	align-items: flex-start;
	gap: 0.75em;
	margin-top: 0.6em;
	flex-wrap: wrap;
}

.bapf-unit__label {
	min-width: 4.5em;
	font-size: 0.88em;
	opacity: 0.8;
	padding-top: 0.4em;
}

.bapf-unit > select {
	flex: 1;
	max-width: 260px;
}

/* Options: circular radio button, colour dot, then the term name */

.bapf-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em 1.4em;
	flex: 1;
}

.bapf-swatch {
	display: inline-flex;
	align-items: center;
	gap: 0.45em;
	cursor: pointer;
	font-size: 0.92em;
	line-height: 1.3;
	user-select: none;
}

/* Native circular radio, kept visible */
.bapf-swatch input[type="radio"] {
	appearance: auto;
	-webkit-appearance: radio;
	position: static;
	opacity: 1;
	pointer-events: auto;
	width: 1.05em;
	height: 1.05em;
	margin: 0;
	flex: none;
	accent-color: #1e1e1e;
	cursor: pointer;
}

.bapf-swatch__chip {
	width: 1em;
	height: 1em;
	border-radius: 50%;
	border: 1px solid rgba(0, 0, 0, 0.25);
	flex: none;
}

/* "Clear" wrapping paper: transparent look */
.bapf-swatch__chip--clear {
	background:
		linear-gradient(45deg, rgba(0, 0, 0, 0.12) 25%, transparent 25%, transparent 75%, rgba(0, 0, 0, 0.12) 75%),
		linear-gradient(45deg, rgba(0, 0, 0, 0.12) 25%, #fff 25%, #fff 75%, rgba(0, 0, 0, 0.12) 75%);
	background-size: 8px 8px;
	background-position: 0 0, 4px 4px;
}

/* Term with no resolvable colour: radio + text only */
.bapf-swatch__chip--none {
	display: none;
}

.bapf-swatch:has(input:checked) .bapf-swatch__name {
	font-weight: 600;
}

.bapf-totals {
	border-top: 2px solid rgba(0, 0, 0, 0.15);
	margin-top: 1em;
	padding-top: 0.75em;
	max-width: 340px;
}

.bapf-totals__row {
	display: flex;
	justify-content: space-between;
	gap: 1em;
	font-size: 0.95em;
	padding: 0.15em 0;
}

.bapf-totals__row--grand {
	font-weight: 700;
	font-size: 1.05em;
	border-top: 1px dashed rgba(0, 0, 0, 0.2);
	margin-top: 0.35em;
	padding-top: 0.45em;
}
