/**
 * OX Product Extras - front end.
 * Colours follow --oxpe-accent, set from the plugin settings.
 */

.oxpe-extras {
	--oxpe-accent: #8bc34a;
	--oxpe-border: rgba(0, 0, 0, 0.1);
	clear: both;
	width: 100%;
	margin: 0 0 20px;
	border-radius: 6px;
	overflow: hidden;
	box-sizing: border-box;
	text-align: left;
}

.oxpe-extras * {
	box-sizing: border-box;
}

.oxpe-extras__header {
	background: var(--oxpe-accent);
	color: #fff;
	font-weight: 700;
	font-size: 16px;
	line-height: 1.35;
	padding: 12px 16px;
	margin: 0;
}

.oxpe-extras__body {
	background: #fff;
	border: 1px solid var(--oxpe-border);
	border-top: 0;
	border-radius: 0 0 6px 6px;
	padding: 0 16px;
}

.oxpe-extra {
	position: relative;
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	padding: 12px 0;
	border-bottom: 1px solid var(--oxpe-border);
}

.oxpe-extra:last-child {
	border-bottom: 0;
}

.oxpe-extra__label {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 1 1 auto;
	min-width: 0;
	margin: 0 !important;
	padding: 0;
	cursor: pointer;
	font-weight: 600;
	line-height: 1.4;
	color: inherit;
}

.oxpe-extras input.oxpe-extra__checkbox {
	width: 20px !important;
	height: 20px !important;
	min-width: 20px;
	min-height: 20px;
	margin: 0 !important;
	padding: 0;
	flex: 0 0 auto;
	cursor: pointer;
	accent-color: var(--oxpe-accent);
	opacity: 1;
	position: static;
	pointer-events: auto;
}

.oxpe-extra__name {
	min-width: 0;
	word-break: break-word;
}

.oxpe-extra__price {
	font-weight: 400;
	opacity: 0.75;
	white-space: nowrap;
}

.oxpe-extras select.oxpe-extra__variation {
	flex: 0 1 auto;
	width: auto !important;
	max-width: 100%;
	min-width: 150px;
	height: auto !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 7px 28px 7px 10px !important;
	font-size: 14px !important;
	line-height: 1.3 !important;
	font-weight: 400;
	color: inherit;
	background-color: #fff;
	border: 1px solid var(--oxpe-border);
	border-radius: 4px;
	cursor: pointer;
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%23555' d='M1.4 0 6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 10px 7px;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
}

.oxpe-extras select.oxpe-extra__variation:focus,
.oxpe-extras input.oxpe-extra__checkbox:focus-visible {
	outline: 2px solid var(--oxpe-accent);
	outline-offset: 2px;
}

/* Accent bar on the ticked row. Absolute so nothing shifts on toggle. */
.oxpe-extra.is-selected::before {
	content: "";
	position: absolute;
	left: -16px;
	top: 0;
	bottom: 0;
	width: 3px;
	background: var(--oxpe-accent);
}

.oxpe-extra--unavailable {
	opacity: 0.55;
}

.oxpe-extra--unavailable .oxpe-extra__label {
	cursor: not-allowed;
}

.oxpe-extra__stock {
	font-weight: 400;
	font-size: 0.9em;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	opacity: 0.7;
	white-space: nowrap;
}

@media (max-width: 575px) {
	.oxpe-extra {
		flex-direction: column;
		align-items: flex-start;
	}

	.oxpe-extras select.oxpe-extra__variation {
		width: 100% !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.oxpe-extras * {
		transition: none !important;
	}
}
