/**
 * Klixie Mix & Match — frontend styling.
 * Gebruikt ACSS-variabelen waar mogelijk, met nette fallbacks.
 */

.kmm-configurator {
	--kmm-accent: var(--accent, #e67405);
	--kmm-primary: var(--primary, #2364a9);
	--kmm-secondary: var(--secondary, #f1b708);
	--kmm-line: rgba(0, 0, 0, 0.1);
	display: flex;
	flex-direction: column;
	gap: 0.9rem;
	max-width: 640px;
	margin: 0.5rem 0 1.75rem;
}

.kmm-configurator[hidden],
.kmm-panel[hidden] {
	display: none !important;
}

/* Mix & Match-knop (optioneel openklappen) */
.kmm-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	align-self: flex-start;
	background: transparent;
	border: 2px solid var(--kmm-accent);
	color: var(--kmm-accent);
	font-family: inherit;
	font-weight: 700;
	font-size: var(--text-s, 0.875rem);
	padding: 0.55rem 1rem;
	border-radius: 0.5rem;
	cursor: pointer;
	transition: background-color 0.1s ease, color 0.1s ease;
}

.kmm-toggle:hover,
.kmm-toggle.is-open {
	background: var(--kmm-accent);
	color: #fff;
}

.kmm-toggle-icon {
	font-size: 1.15em;
	line-height: 1;
	transition: transform 0.15s ease;
}

.kmm-toggle.is-open .kmm-toggle-icon {
	transform: rotate(45deg);
}

.kmm-panel {
	display: flex;
	flex-direction: column;
	gap: 0.9rem;
}

.kmm-need-variation {
	margin: 0;
	padding: 0.75rem 0;
	font-size: var(--text-s, 0.875rem);
	opacity: 0.7;
	text-align: center;
}

.kmm-configurator *,
.kmm-configurator *::before,
.kmm-configurator *::after {
	box-sizing: border-box;
}

.kmm-step {
	padding-bottom: var(--space-m, 1.1rem);
	border-bottom: 1px solid var(--kmm-line);
}

.kmm-step:last-child {
	padding-bottom: 0;
	border-bottom: 0;
}

.kmm-label {
	font-family: "Luckiest Guy", var(--heading-font-family, inherit), sans-serif;
	font-weight: 400;
	font-size: clamp(1.1rem, 2.6vw, 1.3rem);
	letter-spacing: 0.02em;
	color: var(--kmm-primary);
	margin: 0 0 var(--space-s, 0.7rem);
	line-height: 1.3;
}

.kmm-hint {
	font-weight: 400;
	opacity: 0.55;
	font-size: 0.8em;
}

.kmm-help {
	margin: -0.2rem 0 0.85rem;
	font-size: 0.9em;
	opacity: 0.7;
	line-height: 1.5;
}

/* --- Swatches --- */
.kmm-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 0.55rem;
}

.kmm-swatch {
	width: 28px;
	height: 28px;
	border-radius: 0.4rem;
	background: var(--kmm-c, #ccc);
	border: 2px solid rgba(0, 0, 0, 0.1);
	cursor: pointer;
	padding: 0;
	position: relative;
	transition: box-shadow 0.08s ease;
	appearance: none;
	-webkit-appearance: none;
	flex: 0 0 auto;
}

.kmm-configurator .kmm-swatch.is-selected {
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--kmm-accent) !important;
	border-color: var(--kmm-accent) !important;
}

.kmm-configurator .kmm-swatch:focus {
	outline: none;
}

.kmm-configurator .kmm-swatch:focus-visible {
	outline: 2px solid var(--kmm-accent);
	outline-offset: 3px;
}

/* --- Aantal letters --- */
.kmm-counts {
	display: flex;
	flex-wrap: wrap;
	gap: 0.45rem;
}

.kmm-count {
	min-width: 2.6rem;
	height: 2.6rem;
	padding: 0 0.6rem;
	border: 2px solid rgba(0, 0, 0, 0.14);
	background: #fff;
	border-radius: 0.45rem;
	cursor: pointer;
	font-weight: 700;
	font-size: 1rem;
	line-height: 1;
	color: inherit;
	transition: border-color 0.08s ease, background-color 0.08s ease;
}

.kmm-count:hover {
	border-color: var(--kmm-accent);
}

.kmm-count.is-selected {
	border-color: var(--kmm-accent);
	background: var(--kmm-accent);
	color: #fff;
}

/* --- Tekstveld --- */
.kmm-configurator .kmm-text-input {
	width: 100%;
	height: 3.4rem;
	padding: 0 1rem;
	font-size: 1.3rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	border: 2px solid rgba(0, 0, 0, 0.18);
	border-radius: 0.6rem;
	background: #fff;
	color: inherit;
}

.kmm-configurator .kmm-text-input:focus {
	outline: none;
	border-color: var(--kmm-accent);
	box-shadow: 0 0 0 3px rgba(232, 116, 26, 0.18);
}

.kmm-palette {
	margin-bottom: 1rem;
}

/* --- Voorbeeld --- */
.kmm-preview {
	display: flex;
	justify-content: center;
	padding: 1.1rem 0.5rem;
	background: var(--base-light, #f3f4f6);
	border-radius: 0.9rem;
}

.kmm-preview-inner {
	display: inline-flex;
	align-items: center;
	gap: 0.1rem;
	max-width: 100%;
}

.kmm-ring {
	flex: 0 0 auto;
	width: 2rem;
	height: 2rem;
	border-radius: 50%;
	border: 0.34rem solid #c7ccd1;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.6);
	margin-right: -0.4rem;
	z-index: 2;
}

.kmm-board {
	display: inline-flex;
	flex-wrap: nowrap;
	gap: 0.3rem;
	padding: 0.45rem;
	border-radius: 0.75rem;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.12);
	max-width: 100%;
	overflow-x: auto;
	align-items: center;
}

.kmm-well {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.18rem;
	border-radius: 0.42rem;
	box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.45);
}

.kmm-pkey {
	width: 3.1rem;
	height: 3.1rem;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 0.36rem;
	font-family: inherit;
	font-weight: 800;
	font-size: 1.45rem;
	cursor: pointer;
	background-color: #ddd;
	background-image: linear-gradient(
		to bottom,
		rgba(255, 255, 255, 0.4),
		rgba(255, 255, 255, 0) 42%,
		rgba(0, 0, 0, 0.14)
	);
	box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.45), inset 0 -2px 3px rgba(0, 0, 0, 0.12);
	text-transform: uppercase;
	text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
	user-select: none;
	transition: transform 0.08s ease;
}

.kmm-pkey:hover {
	transform: translateY(-2px);
}

.kmm-pkey:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -4px;
}

/* Lege positie (spatie): duidelijk zichtbaar zodat de gekozen grootte meteen telt */
.kmm-pkey--space {
	background-color: rgba(255, 255, 255, 0.16);
	background-image: none;
	box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.45), inset 0 2px 4px rgba(0, 0, 0, 0.35);
}

/* --- Prijs & koop --- */
.kmm-price {
	font-size: 1.6rem;
	font-weight: 800;
	color: inherit;
	margin-bottom: 0.6rem;
}

.kmm-price-label {
	font-weight: 500;
	opacity: 0.6;
	font-size: 0.62em;
	margin-right: 0.4rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.kmm-price-value {
	color: var(--kmm-accent);
}

.kmm-buy-row {
	display: flex;
	gap: 0.6rem;
	align-items: stretch;
	flex-wrap: wrap;
}

.kmm-qty {
	display: flex;
	align-items: stretch;
	border: 2px solid rgba(0, 0, 0, 0.14);
	border-radius: 0.5rem;
	overflow: hidden;
	flex: 0 0 auto;
}

.kmm-qty-btn {
	width: 2.8rem;
	border: 0;
	background: #f2f2f2;
	cursor: pointer;
	font-size: 1.2rem;
	line-height: 1;
	color: inherit;
}

.kmm-qty-input {
	width: 3rem;
	text-align: center;
	border: 0;
	background: #fff;
	color: inherit;
	-moz-appearance: textfield;
}

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

.kmm-add {
	flex: 1 1 12rem;
	min-height: 3.2rem;
	cursor: pointer;
}

.kmm-add.is-loading {
	opacity: 0.6;
	pointer-events: none;
}

.kmm-error {
	color: #c0392b;
	margin: 0.6rem 0 0;
	font-size: 0.9em;
}

.kmm-success {
	color: #1d7a4d;
	margin: 0.6rem 0 0;
	font-size: 0.95em;
	font-weight: 600;
}

.kmm-success a {
	margin-left: 0.3rem;
	text-decoration: underline;
}

/* --- Winkelwagen / checkout weergave --- */
.kmm-summary {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 0.8rem;
	align-items: center;
}

.kmm-chip {
	display: inline-block;
	width: 1em;
	height: 1em;
	border-radius: 50%;
	vertical-align: middle;
	border: 1px solid rgba(0, 0, 0, 0.2);
}

.kmm-sum-keys {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 0.25rem;
}

.kmm-key {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.8em;
	height: 1.8em;
	border-radius: 0.25em;
	font-weight: 700;
	font-size: 0.8em;
	line-height: 1;
	color: #fff;
	text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
}

.kmm-key--space {
	background: repeating-linear-gradient(45deg, #eee, #eee 3px, #ddd 3px, #ddd 6px);
}
