/* begin license *
 *
 * Copyright (C) 2026 BBPak https://bbpak.nl
 *
 * This file is part of "De slimmedoos - Configurator"
 *
 * end license */

/*
 * The configurator (/configurator), in the web shop's house style.
 *
 * huisstijl/css/slimme-doos-huisstijl.css (from the web designer) gives the fonts, the
 * colours (--eno-*), buttons (.eno-button), fields (.eno-input, .eno-select, labels)
 * and the quantity stepper (.eno-qty). This file only adds the layout and the parts
 * the house style has no class for. Prefix: sd- (slimme doos).
 *
 * The page is shown in an iframe inside the order page's white card
 * (.eno-order__embed, with its own padding), so it has no background or padding of
 * its own.
 */

/* Page -------------------------------------------------------------------- */

html,
body.sd-page {
	margin: 0;
	padding: 0;
	background: transparent;
}

body.sd-page {
	/* SWL's dialogs (errors) in the house colours */
	--swl-accent: var(--eno-color-orange);
	--swl-accent-fg: var(--eno-color-white);
	--swl-radius: var(--eno-radius);
	--swl-danger: #b3261e;
	--swl-fg: var(--eno-color-text);
	--swl-muted: var(--eno-color-text-muted);
	--swl-border: var(--eno-color-surface-dim);
}

.sd-configurator {
	box-sizing: border-box;
}

.sd-configurator *,
.sd-configurator *::before,
.sd-configurator *::after {
	box-sizing: inherit;
}

/* Layout: the form, with the summary beside it (below it on narrow frames) */

.sd-layout {
	display: grid;
	gap: 2rem;
	align-items: start;
}

@media (min-width: 860px) {
	.sd-layout {
		grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem);
		gap: 2.5rem;
	}

	.sd-summary {
		position: sticky;
		top: 1rem;
	}
}

.sd-section + .sd-section {
	margin-top: 2rem;
	padding-top: 2rem;
	border-top: 1px solid var(--eno-color-surface);
}

.sd-heading {
	margin: 0 0 1.25rem;
	font-family: var(--eno-font-heading);
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: -0.01em;
}

.sd-grid {
	display: grid;
	gap: 1rem 1.25rem;
}

@media (min-width: 560px) {
	.sd-grid--2 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.sd-grid--3 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.sd-field {
	min-width: 0;
}

.sd-section .eno-field-hint {
	margin: 0.75rem 0 0;
}

/* Fields ------------------------------------------------------------------ */

/* A number with its unit ("mm") inside the field, on the right */
.sd-unit {
	position: relative;
}

.sd-unit .eno-input {
	padding-right: 3rem;
	appearance: textfield;
	-moz-appearance: textfield;
}

.sd-unit .eno-input::-webkit-inner-spin-button,
.sd-unit .eno-input::-webkit-outer-spin-button {
	margin: 0;
	appearance: none;
	-webkit-appearance: none;
}

.sd-unit__label {
	position: absolute;
	top: 50%;
	right: 0.875rem;
	transform: translateY(-50%);
	color: var(--eno-color-outline);
	font-size: var(--eno-text-label);
	pointer-events: none;
}

/* A flat product (FEFCO below 200) has no height: dsd.js disables the field */
.eno-input:disabled,
.eno-select:disabled {
	border-color: var(--eno-color-surface-high);
	background-color: var(--eno-color-surface-low);
	color: var(--eno-color-outline);
	cursor: not-allowed;
}

.eno-input:disabled:hover,
.eno-select:disabled:hover {
	border-color: var(--eno-color-surface-high);
}

.eno-select {
	cursor: pointer;
}

/* The quantity stepper: as high as the other fields, room for 5 digits */
.sd-qty {
	display: flex;
	width: 100%;
	max-width: 14rem;
	height: 3rem;
	border-color: var(--eno-color-surface-dim);
}

.sd-qty .eno-qty__button,
.sd-qty .eno-qty__button:focus {
	width: 3rem;
	height: auto;
}

.sd-qty .eno-qty__input,
.sd-qty .eno-qty__input:focus {
	flex: 1;
	width: auto;
	height: auto;
}

/* Messages about the sizes */
.sd-messages {
	margin: 1rem 0 0;
	padding: 0.75rem 1rem;
	border-left: 3px solid #b3261e;
	border-radius: 0 var(--eno-radius) var(--eno-radius) 0;
	background-color: rgb(179 38 30 / 6%);
	list-style: none;
}

.sd-messages .eno-field-error {
	margin: 0;
}

.sd-messages .eno-field-error + .eno-field-error {
	margin-top: 0.25rem;
}

/* Summary ----------------------------------------------------------------- */

.sd-summary {
	padding: 1.5rem;
	border: 1px solid var(--eno-color-surface-high);
	border-radius: var(--eno-radius-lg);
	background-color: var(--eno-color-surface-low);
}

.sd-summary:empty {
	display: none;
}

.sd-summary__stage {
	display: flex;
	justify-content: center;
	margin-bottom: 1.25rem;
	padding: 1rem;
	border-radius: var(--eno-radius);
	background-color: var(--eno-color-white);
}

.sd-summary__stage canvas {
	display: block;
	max-width: 100%;
	height: auto;
}

.sd-summary__title {
	margin: 0 0 0.5rem;
	font-family: var(--eno-font-heading);
	font-size: var(--eno-text-headline-md);
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: -0.02em;
}

.sd-summary__specs {
	margin: 0;
	padding: 0;
	color: var(--eno-color-text-muted);
	font-size: var(--eno-text-label);
	list-style: none;
}

.sd-summary__specs li + li {
	margin-top: 0.125rem;
}

.sd-summary__hint {
	margin: 1.25rem 0 0;
	color: var(--eno-color-text-muted);
	font-size: var(--eno-text-label);
}

.sd-prices {
	margin: 1.25rem 0 0;
	padding-top: 1.25rem;
	border-top: 1px solid var(--eno-color-surface-high);
}

.sd-prices__row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem;
}

.sd-prices__row + .sd-prices__row {
	margin-top: 0.5rem;
}

.sd-prices dt,
.sd-prices dd {
	margin: 0;
}

.sd-prices dt {
	color: var(--eno-color-text-muted);
}

.sd-prices dd {
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.sd-prices__row--total dt {
	color: var(--eno-color-text);
	font-weight: 600;
}

.sd-prices__row--total dd {
	font-family: var(--eno-font-heading);
	font-size: var(--eno-text-headline-md);
	font-weight: 800;
	letter-spacing: -0.02em;
}

.sd-prices__note {
	color: var(--eno-color-text-muted);
	font-size: var(--eno-text-small);
	font-weight: 400;
}

.sd-summary__order {
	margin: 1.5rem 0 0;
}

.sd-summary__button {
	width: 100%;
}

/* Configurator switched off in the admin */
.sd-notice {
	padding: 2rem 1.5rem;
	border: 1px dashed var(--eno-color-outline);
	border-radius: var(--eno-radius-lg);
	background-color: var(--eno-color-surface-low);
	color: var(--eno-color-text-muted);
	text-align: center;
}

.sd-notice p {
	margin: 0;
}

/* Selects: a chevron instead of the browser's arrow, as on the web shop */
.sd-configurator .eno-select {
	padding-right: 2.75rem;
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%231c1b1b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-position: right 0.875rem center;
	background-repeat: no-repeat;
	background-size: 1.125rem;
}

.sd-configurator .eno-select:disabled {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%238c7264' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
