/**
 * Arcade Machine Configurator -- single-page scrolling builder styles.
 *
 * Rendered inline in normal page flow (see templates/add-to-cart-button.php +
 * configurator.js), not inside a modal/Shadow DOM, so everything is scoped
 * under .amc-builder-root / .amc-sticky-bar / .amc-review-overlay to keep the
 * active theme's global element styles from leaking in.
 */

#amc-builder-root,
#amc-builder-root *,
#amc-builder-root *::before,
#amc-builder-root *::after,
.amc-sticky-bar,
.amc-sticky-bar *,
.amc-review-overlay,
.amc-review-overlay * {
	box-sizing: border-box;
}

.amc-builder-anchor {
	scroll-margin-top: 90px;
}

#amc-builder-root {
	display: block;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 16px;
	line-height: 1.5;
	color: #17162a;
	-webkit-font-smoothing: antialiased;
	margin: 1.6em 0 6em;
}

#amc-builder-root button {
	font-family: inherit;
	background: none;
	border: none;
	color: inherit;
	cursor: pointer;
	text-align: left;
}
#amc-builder-root svg {
	display: block;
}

/* -- Notices ------------------------------------------------------------ */

.amc-notice-area {
	margin: 0 0 1.2em;
	display: flex;
	flex-direction: column;
	gap: 0.6em;
}
.amc-notice {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1em;
	background: #fff7ed;
	border: 1px solid #fed7aa;
	color: #9a3412;
	padding: 0.8em 1em;
	border-radius: 12px;
	font-size: 0.92em;
	font-weight: 600;
	animation: amc-step-in 0.2s ease both;
}
.amc-notice-close {
	flex-shrink: 0;
	padding: 0.2em;
	line-height: 0;
	color: inherit;
	opacity: 0.7;
}
.amc-notice-close:hover {
	opacity: 1;
}
.amc-notice-close svg {
	width: 14px;
	height: 14px;
}

/* -- Size section --------------------------------------------------------- */

.amc-size-section {
	margin: 0 0 2.2em;
}
.amc-size-heading {
	font-size: 1.5em;
	font-weight: 800;
	letter-spacing: -0.01em;
	margin: 0 0 0.9em;
	line-height: 1.3;
}
.amc-size-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 1em;
}
/*
 * Prefixed with #amc-builder-root so these beat the ID-scoped
 * `#amc-builder-root button { border: none; }` reset above -- a bare class
 * selector like `.amc-size-card` has lower specificity than that ID selector
 * and would silently lose its border, which is exactly why the selected game
 * size card wasn't showing the same bold border as selected option rows.
 */
#amc-builder-root .amc-size-card {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.6em;
	border: 2px solid #eeecf5;
	border-radius: 16px;
	background: #fff;
	padding: 1.3em 1.3em 1.4em;
	font-size: 1em;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
#amc-builder-root .amc-size-card:hover {
	border-color: #d6249f;
	transform: translateY(-2px);
	box-shadow: 0 10px 20px -12px rgba(214, 36, 159, 0.4);
}
#amc-builder-root .amc-size-card.is-selected {
	border-color: transparent;
	background: linear-gradient(#fff, #fff) padding-box,
		linear-gradient(135deg, #7c3aed, #d6249f, #f97316) border-box;
	box-shadow: 0 10px 24px -12px rgba(124, 58, 237, 0.45);
}
.amc-size-check {
	position: absolute;
	top: 0.7em;
	right: 0.7em;
	width: 1.5em;
	height: 1.5em;
	border-radius: 50%;
	background: linear-gradient(135deg, #7c3aed, #d6249f);
	color: #fff;
	display: none;
	align-items: center;
	justify-content: center;
}
.amc-size-check svg {
	width: 13px;
	height: 13px;
}
.amc-size-card.is-selected .amc-size-check {
	display: flex;
}
.amc-size-label {
	font-weight: 700;
	padding-right: 1.6em;
	line-height: 1.35;
}
.amc-size-price {
	font-size: 1.05em;
	font-weight: 800;
	color: #d6249f;
}

.amc-select-size-hint {
	margin: 0;
	padding: 1.4em 1.5em;
	background: #f8f7fc;
	border-radius: 14px;
	color: #56546b;
	font-weight: 600;
	text-align: center;
}

/* -- Option groups / rows ------------------------------------------------- */

.amc-options-section {
	min-height: 1px;
}

.amc-group {
	margin: 0 0 2.2em;
	animation: amc-step-in 0.25s ease both;
}
.amc-group-heading {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.6em;
	margin: 0 0 0.9em;
}
.amc-group-heading h3 {
	font-size: 1.2em;
	font-weight: 800;
	letter-spacing: -0.01em;
	margin: 0;
	line-height: 1.3;
}
.amc-choose-note {
	margin-left: auto;
	font-size: 0.78em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #a6a4b8;
	background: #f1effa;
	padding: 0.3em 0.7em;
	border-radius: 999px;
}

.amc-rows-list {
	display: flex;
	flex-direction: column;
	gap: 0.7em;
}

/*
 * Each option choice is a full-width row, one per line. `.amc-row-wrap` is the
 * unit: the clickable row itself (`.amc-row-line` holds it plus its optional
 * "i" icon side by side) and, directly below that, the info panel it expands
 * -- so opening it pushes the rows underneath down instead of overlaying them.
 * Multiple rows from the same multi-choice option (e.g. Standard / RGB Gold
 * Leaf buttons) each get their own wrap, so they always stack full width
 * instead of being squeezed onto one line.
 */
.amc-row-wrap + .amc-row-wrap {
	margin-top: 0.7em;
}
.amc-row-line {
	display: flex;
	align-items: stretch;
	gap: 0.6em;
}
.amc-row-line .amc-row {
	flex: 1 1 auto;
	min-width: 0;
}
.amc-row-line .amc-info-wrap {
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

#amc-builder-root .amc-row {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1em;
	width: 100%;
	border: 2px solid #eeecf5;
	border-radius: 14px;
	background: #fff;
	padding: 0.95em 1.2em;
	font-size: 0.98em;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}
#amc-builder-root .amc-row:hover:not(:disabled) {
	border-color: #d6249f;
}
#amc-builder-root .amc-row:disabled,
#amc-builder-root .amc-row.is-disabled {
	cursor: not-allowed;
	opacity: 0.45;
}
#amc-builder-root .amc-row.is-disabled:hover {
	border-color: #eeecf5;
}
#amc-builder-root .amc-row.is-selected {
	border-color: transparent;
	background: linear-gradient(#faf6ff, #faf6ff) padding-box,
		linear-gradient(135deg, #7c3aed, #d6249f, #f97316) border-box;
}
.amc-row-label {
	font-weight: 700;
	line-height: 1.35;
}
.amc-row-right {
	display: flex;
	align-items: center;
	gap: 0.9em;
	flex-shrink: 0;
}
.amc-row-price {
	font-size: 0.9em;
	font-weight: 800;
	color: #d6249f;
	white-space: nowrap;
}
.amc-row-indicator {
	width: 1.5em;
	height: 1.5em;
	border-radius: 50%;
	border: 2px solid #d6d3e6;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	color: #fff;
}
.amc-row.is-selected .amc-row-indicator {
	border-color: transparent;
	background: linear-gradient(135deg, #7c3aed, #d6249f);
}
.amc-row-indicator svg {
	width: 12px;
	height: 12px;
}
.amc-row-flash {
	animation: amc-flash 1.4s ease;
}
@keyframes amc-flash {
	0%, 100% { box-shadow: none; }
	25% { box-shadow: 0 0 0 4px rgba(214, 36, 159, 0.35); }
}

/* -- Info: inline expand-below-row panel ------------------------------------
 * Deliberately the same on every screen size (not a desktop-hover popover):
 * an absolutely-positioned popover was running off the edge of the screen on
 * phones, so the panel is now a normal block in the document flow that opens
 * directly beneath its row/heading and pushes the following content down.
 * ---------------------------------------------------------------------- */

.amc-info-wrap {
	display: inline-flex;
}
.amc-info-btn {
	flex-shrink: 0;
	color: #a6a4b8;
	padding: 0.3em;
	line-height: 0;
	border-radius: 50%;
	transition: color 0.15s ease, background 0.15s ease;
}
.amc-info-btn:hover,
.amc-info-btn[aria-expanded="true"] {
	color: #7c3aed;
	background: #f1effa;
}
.amc-info-btn svg {
	width: 19px;
	height: 19px;
}
.amc-info-panel {
	width: 100%;
	margin-top: 0.6em;
	background: #f8f7fc;
	border: 1px solid #eeecf5;
	border-radius: 14px;
	padding: 1em 1.1em;
	animation: amc-step-in 0.18s ease both;
}
.amc-info-panel[hidden] {
	display: none;
}
.amc-info-text {
	margin: 0 0 0.7em;
	font-size: 0.88em;
	line-height: 1.55;
	color: #56546b;
}
.amc-info-text:last-child {
	margin-bottom: 0;
}
.amc-info-placeholder {
	margin: 0;
	font-size: 0.85em;
	font-style: italic;
	color: #a6a4b8;
}
.amc-info-video {
	position: relative;
	width: 100%;
	max-width: 480px;
	aspect-ratio: 16 / 9;
	border-radius: 10px;
	overflow: hidden;
	background: #17162a;
}
.amc-info-video iframe,
.amc-info-video video {
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

/* -- Sticky total bar -------------------------------------------------- */

.amc-sticky-bar {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 500;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1em;
	padding: 0.8em 1.4em;
	background: rgba(253, 253, 255, 0.96);
	backdrop-filter: blur(8px);
	border-bottom: 1px solid #eeecf5;
	box-shadow: 0 8px 24px -16px rgba(20, 10, 40, 0.3);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: #17162a;
}
.amc-sticky-totals {
	display: flex;
	align-items: center;
	gap: 0.7em;
	flex-wrap: wrap;
	font-size: 0.9em;
}
.amc-sticky-item {
	display: flex;
	flex-direction: column;
	line-height: 1.2;
}
.amc-sticky-key {
	font-size: 0.68em;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	font-weight: 700;
	color: #a6a4b8;
}
.amc-sticky-val {
	font-weight: 800;
}
.amc-sticky-op {
	color: #a6a4b8;
	font-weight: 700;
}
.amc-sticky-total .amc-sticky-val {
	font-size: 1.25em;
	background: linear-gradient(135deg, #7c3aed, #d6249f);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

@media (max-width: 680px) {
	.amc-sticky-bar {
		top: auto;
		bottom: 0;
		border-bottom: none;
		border-top: 1px solid #eeecf5;
		flex-direction: column;
		align-items: stretch;
		gap: 0.6em;
		padding: 0.7em 1em calc(0.7em + env(safe-area-inset-bottom, 0px));
	}
	.amc-sticky-totals {
		justify-content: center;
	}
	.amc-review-btn {
		width: 100%;
	}
	#amc-builder-root {
		margin-bottom: 8.5em;
	}
}

/* -- Buttons --------------------------------------------------------------- */

.amc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5em;
	padding: 0.85em 1.5em;
	border-radius: 999px;
	font-weight: 700;
	font-size: 0.95em;
	transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
	white-space: nowrap;
}
.amc-btn svg {
	width: 16px;
	height: 16px;
}
.amc-btn-primary {
	color: #fff;
	background: linear-gradient(135deg, #7c3aed, #d6249f);
	box-shadow: 0 8px 20px -8px rgba(124, 58, 237, 0.6);
}
.amc-btn-primary:hover:not(:disabled) {
	transform: translateY(-1px);
	box-shadow: 0 12px 24px -8px rgba(214, 36, 159, 0.55);
}
.amc-btn-primary:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none;
}
.amc-btn-secondary {
	color: #17162a;
	background: #f1effa;
}
.amc-btn-secondary:hover {
	background: #e4e1f2;
}

/* -- Review overlay ------------------------------------------------------ */

.amc-review-overlay {
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 4vh 1em;
	overflow-y: auto;
	background: radial-gradient(circle at 30% 20%, rgba(124, 58, 237, 0.25), rgba(10, 8, 20, 0.75) 60%);
	backdrop-filter: blur(6px);
	animation: amc-fade-in 0.2s ease both;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: #17162a;
}
.amc-review-overlay[hidden] {
	display: none;
}
.amc-review-panel {
	width: min(92vw, 640px);
	background: #fdfdff;
	border-radius: 22px;
	padding: 1.8em 1.9em 2em;
	box-shadow: 0 30px 80px -20px rgba(20, 10, 40, 0.5);
	animation: amc-rise-in 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.amc-review-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1em;
	margin: 0 0 1em;
}
.amc-review-header h2 {
	font-size: 1.35em;
	font-weight: 800;
	margin: 0;
}
.amc-review-close {
	flex-shrink: 0;
	color: #8b8a99;
	padding: 0.5em;
	border-radius: 999px;
	line-height: 0;
}
.amc-review-close:hover {
	background: #f1effa;
	color: #17162a;
}
.amc-review-close svg {
	width: 18px;
	height: 18px;
}

.amc-review-list {
	margin: 0 0 1em;
	border-top: 1px solid #eeecf5;
}
.amc-review-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1em;
	padding: 0.85em 0;
	border-bottom: 1px solid #eeecf5;
}
.amc-review-row dt {
	display: flex;
	align-items: center;
	gap: 0.6em;
	color: #56546b;
	font-size: 0.92em;
	font-weight: 600;
}
.amc-review-edit {
	font-size: 0.82em;
	font-weight: 700;
	color: #7c3aed;
	text-decoration: underline;
	padding: 0.1em 0;
}
.amc-review-edit:hover {
	color: #d6249f;
}
.amc-review-row dd {
	display: flex;
	align-items: center;
	gap: 0.9em;
	font-weight: 700;
	text-align: right;
}
.amc-review-price {
	color: #d6249f;
	min-width: 4.6em;
	text-align: right;
}
.amc-review-total {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 1.15em;
	font-weight: 800;
	padding: 0.4em 0 1em;
}

.amc-qty-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: #f8f7fc;
	border-radius: 14px;
	padding: 1em 1.2em;
	margin: 0 0 1.2em;
	font-weight: 700;
}
.amc-qty-control {
	display: flex;
	align-items: center;
	gap: 0.7em;
}
.amc-qty-btn {
	width: 2.2em;
	height: 2.2em;
	border-radius: 50%;
	border: 1px solid #e4e1f2;
	background: #fff;
	font-size: 1.1em;
	line-height: 1;
	font-weight: 700;
	transition: background 0.15s ease, border-color 0.15s ease;
}
.amc-qty-btn:hover {
	border-color: #d6249f;
	color: #d6249f;
}
#amc-qty-input {
	width: 3.2em;
	text-align: center;
	border: 1px solid #e4e1f2;
	border-radius: 8px;
	padding: 0.5em;
	font-weight: 700;
	font-size: 1em;
	font-family: inherit;
	color: inherit;
	background: #fff;
}

.amc-review-actions {
	display: flex;
	gap: 0.7em;
	flex-wrap: wrap;
}
.amc-review-actions .amc-btn {
	flex: 1 1 auto;
}

.amc-review-panel .amc-error-msg {
	background: #fef2f2;
	color: #b91c1c;
	padding: 0.9em 1.1em;
	border-radius: 12px;
	margin: 1em 0 0;
	font-size: 0.9em;
	font-weight: 600;
}

/* -- Success screen -------------------------------------------------------- */

.amc-success {
	text-align: center;
	padding: 1.5em 0.5em;
}
.amc-success-icon {
	display: inline-flex;
	width: 4em;
	height: 4em;
	border-radius: 50%;
	background: linear-gradient(135deg, #22c55e, #16a34a);
	color: #fff;
	align-items: center;
	justify-content: center;
	margin-bottom: 1em;
	box-shadow: 0 12px 28px -8px rgba(22, 163, 74, 0.5);
	animation: amc-pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.amc-success-icon svg {
	width: 30px;
	height: 30px;
}
.amc-success h2 {
	font-size: 1.5em;
	font-weight: 800;
	margin: 0 0 1.4em;
}
.amc-success-actions {
	display: flex;
	gap: 0.8em;
	justify-content: center;
	flex-wrap: wrap;
}

/* -- Shared animations ------------------------------------------------------ */

@keyframes amc-step-in {
	from { opacity: 0; transform: translateY(10px); }
	to { opacity: 1; transform: translateY(0); }
}
@keyframes amc-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}
@keyframes amc-rise-in {
	from { opacity: 0; transform: translateY(24px) scale(0.98); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes amc-pop-in {
	from { opacity: 0; transform: scale(0.5); }
	to { opacity: 1; transform: scale(1); }
}

/* -- Accessibility ----------------------------------------------------------- */

#amc-builder-root button:focus-visible,
#amc-builder-root input:focus-visible,
.amc-sticky-bar button:focus-visible,
.amc-review-overlay button:focus-visible,
.amc-review-overlay input:focus-visible,
.amc-review-overlay a:focus-visible {
	outline: 3px solid #2563eb;
	outline-offset: 2px;
}

@media (max-width: 640px) {
	.amc-size-grid {
		grid-template-columns: 1fr 1fr;
		gap: 0.7em;
	}
	.amc-group-heading {
		gap: 0.5em;
	}
	.amc-choose-note {
		margin-left: 0;
	}
}

@media (max-width: 420px) {
	.amc-size-grid {
		grid-template-columns: 1fr;
	}
}

@media (prefers-reduced-motion: reduce) {
	.amc-group,
	.amc-notice,
	.amc-info-panel,
	.amc-review-overlay,
	.amc-review-panel,
	.amc-success-icon {
		animation: none !important;
	}
}
