/*
 * Nord System - Devis : front-end styles.
 *
 * Everything is scoped under `.nsd` so it can sit inside a Woodmart product
 * page or a builder page without leaking into, or inheriting from, the theme.
 * Design tokens mirror the reference site (nordsystemdistribution.fr) so the
 * WooCommerce catalogue and the marketing site feel like one brand.
 */

.nsd {
	--nsd-bg: #f7f6f4;
	--nsd-fg: #1a1c1e;
	--nsd-primary: #85be14;
	--nsd-primary-dark: #72a810;
	--nsd-accent: #ff8200;
	--nsd-secondary: #383e42;
	--nsd-muted: #eceae6;
	--nsd-muted-fg: #5a5e62;
	--nsd-card: #ffffff;
	--nsd-border: #e0ddd8;
	--nsd-radius: 2px;
	--nsd-sans: "DM Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
	--nsd-serif: "Fraunces", "Iowan Old Style", "Times New Roman", serif;
	--nsd-shadow: 0 8px 24px rgba(26, 28, 30, 0.08);
	--nsd-shadow-gold: 0 8px 24px rgba(133, 190, 20, 0.35);

	box-sizing: border-box;
	color: var(--nsd-fg);
	font-family: var(--nsd-sans);
	font-weight: 400;
	line-height: 1.55;
}

.nsd *,
.nsd *::before,
.nsd *::after {
	box-sizing: border-box;
}

/* -------------------------------------------------------------- Primitives */

.nsd-label {
	margin: 0 0 0.75rem;
	font-family: var(--nsd-sans);
	font-size: 0.6rem;
	font-weight: 700;
	letter-spacing: 0.4em;
	text-transform: uppercase;
	color: var(--nsd-primary);
}

.nsd-label__value {
	color: var(--nsd-muted-fg);
	font-weight: 400;
	letter-spacing: normal;
	text-transform: none;
}

.nsd-icon {
	flex: 0 0 auto;
}

.nsd-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	min-height: 52px;
	padding: 1rem 2.25rem;
	border: 1.5px solid transparent;
	border-radius: var(--nsd-radius);
	font-family: var(--nsd-sans);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease,
		box-shadow 0.3s ease, border-color 0.3s ease;
}

.nsd-btn--block {
	width: 100%;
}

.nsd-btn--gold {
	background-color: var(--nsd-primary);
	color: #fff;
}

.nsd-btn--gold:hover:not(:disabled) {
	background-color: var(--nsd-primary-dark);
	transform: translateY(-2px);
	box-shadow: var(--nsd-shadow-gold);
	color: #fff;
}

.nsd-btn--outline {
	border-color: var(--nsd-fg);
	color: var(--nsd-fg);
	font-weight: 600;
	background: transparent;
}

.nsd-btn--outline:hover {
	background-color: var(--nsd-fg);
	color: var(--nsd-bg);
}

.nsd-btn--ghost {
	border-color: var(--nsd-border);
	color: var(--nsd-muted-fg);
	background: transparent;
	font-weight: 600;
}

.nsd-btn--ghost:hover {
	border-color: var(--nsd-primary);
	color: var(--nsd-fg);
}

.nsd-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.nsd-btn.is-busy {
	position: relative;
	color: transparent !important;
}

.nsd-btn.is-busy::after {
	content: "";
	position: absolute;
	inset: 0;
	margin: auto;
	width: 18px;
	height: 18px;
	border: 2px solid rgba(255, 255, 255, 0.5);
	border-top-color: #fff;
	border-radius: 50%;
	animation: nsd-spin 0.7s linear infinite;
}

@keyframes nsd-spin {
	to {
		transform: rotate(360deg);
	}
}

/* ----------------------------------------------------------- Configurator */

.nsd-configurator {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
	padding: 1.75rem;
	background: var(--nsd-card);
	border: 1px solid var(--nsd-border);
	border-radius: var(--nsd-radius);
}

.nsd-config__title {
	margin: 0;
	font-family: var(--nsd-serif);
	font-size: 1.35rem;
	font-weight: 600;
	line-height: 1.2;
	color: var(--nsd-fg);
}

.nsd-config__delay {
	margin: 0;
	text-align: center;
	font-size: 0.72rem;
	color: var(--nsd-muted-fg);
	letter-spacing: 0.04em;
}

.nsd-field {
	margin: 0;
}

.nsd-options {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.nsd-option {
	min-height: 40px;
	padding: 0.5rem 0.875rem;
	border: 1px solid var(--nsd-border);
	border-radius: var(--nsd-radius);
	background: var(--nsd-card);
	color: var(--nsd-fg);
	font-family: var(--nsd-sans);
	font-size: 0.8rem;
	font-weight: 500;
	cursor: pointer;
	transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

.nsd-option:hover {
	border-color: var(--nsd-primary);
}

.nsd-option.is-selected {
	border-color: var(--nsd-primary);
	background: var(--nsd-primary);
	color: #fff;
}

/* Custom dimension inputs */

.nsd-custom-dims {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 0.75rem;
	margin-top: 0.875rem;
	padding: 1rem;
	background: color-mix(in srgb, var(--nsd-muted) 55%, transparent);
	border: 1px solid var(--nsd-border);
	border-radius: var(--nsd-radius);
}

.nsd-custom-dims[hidden] {
	display: none;
}

.nsd-custom-dims__field {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
	flex: 1 1 120px;
}

.nsd-custom-dims__field span {
	font-size: 0.7rem;
	color: var(--nsd-muted-fg);
	letter-spacing: 0.02em;
}

.nsd-custom-dims__field input {
	width: 100%;
	padding: 0.55rem 0.75rem;
	border: 1px solid var(--nsd-border);
	border-radius: var(--nsd-radius);
	background: var(--nsd-card);
	color: var(--nsd-fg);
	font-family: var(--nsd-sans);
	font-size: 0.85rem;
}

.nsd-custom-dims__field input:focus {
	outline: none;
	border-color: var(--nsd-primary);
}

.nsd-custom-dims__x {
	padding-bottom: 0.6rem;
	color: var(--nsd-muted-fg);
	font-size: 1rem;
}

.nsd-custom-dims__unit {
	padding-bottom: 0.6rem;
	font-size: 0.75rem;
	color: var(--nsd-muted-fg);
}

/* Colour swatches */

.nsd-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

/*
 * The button is only a hit area : the colour is painted by the inner chip.
 * Themes (Woodmart among them) repaint every `button` background, which would
 * otherwise turn every swatch into the same grey circle.
 */
.nsd .nsd-swatch {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: none !important;
	box-shadow: none;
	cursor: pointer;
	transition: transform 0.14s ease;
}

.nsd .nsd-swatch__chip {
	display: block;
	width: 2.25rem;
	height: 2.25rem;
	border-radius: 50%;
	border: 1px solid rgba(26, 28, 30, 0.16);
	box-shadow: inset 0 -2px 6px rgba(26, 28, 30, 0.12);
	transition: box-shadow 0.14s ease;
}

.nsd .nsd-swatch:hover {
	transform: scale(1.06);
}

.nsd .nsd-swatch.is-selected {
	transform: scale(1.04);
}

.nsd .nsd-swatch.is-selected .nsd-swatch__chip {
	box-shadow: 0 0 0 2px var(--nsd-card), 0 0 0 4px var(--nsd-primary),
		inset 0 -2px 6px rgba(26, 28, 30, 0.12);
}

/* Extras grid */

.nsd-extras {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.5rem;
}

@media (min-width: 480px) {
	.nsd-extras {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.nsd-extra {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	min-height: 72px;
	padding: 0.75rem;
	border: 1px solid var(--nsd-border);
	border-radius: var(--nsd-radius);
	background: var(--nsd-card);
	color: var(--nsd-muted-fg);
	font-family: var(--nsd-sans);
	font-size: 0.72rem;
	font-weight: 500;
	line-height: 1.25;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.2s, color 0.2s, background-color 0.2s;
}

.nsd-extra:hover {
	border-color: color-mix(in srgb, var(--nsd-primary) 45%, transparent);
	color: var(--nsd-fg);
}

.nsd-extra.is-selected {
	border-color: var(--nsd-primary);
	color: var(--nsd-fg);
	background: color-mix(in srgb, var(--nsd-primary) 10%, transparent);
}

.nsd-extra.is-selected .nsd-icon {
	color: var(--nsd-primary);
}

.nsd-extra__label {
	display: block;
}

/* Quantity */

.nsd-qty {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.nsd-qty__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	border: 1px solid var(--nsd-border);
	border-radius: var(--nsd-radius);
	background: var(--nsd-card);
	color: var(--nsd-fg);
	font-size: 1.1rem;
	cursor: pointer;
	transition: border-color 0.2s;
}

.nsd-qty__btn .nsd-icon {
	display: none;
}

.nsd-qty__btn:hover {
	border-color: var(--nsd-primary);
}

.nsd-qty__value {
	min-width: 2rem;
	text-align: center;
	font-weight: 600;
	font-size: 1.1rem;
}

/* Notes */

.nsd-textarea {
	width: 100%;
	padding: 0.75rem 1rem;
	border: 1px solid var(--nsd-border);
	border-radius: var(--nsd-radius);
	background: var(--nsd-bg);
	color: var(--nsd-fg);
	font-family: var(--nsd-sans);
	font-size: 0.85rem;
	font-weight: 300;
	resize: vertical;
	transition: border-color 0.2s;
}

.nsd-textarea:focus {
	outline: none;
	border-color: var(--nsd-primary);
}

/* Summary */

.nsd-summary {
	padding: 1rem;
	background: color-mix(in srgb, var(--nsd-muted) 50%, transparent);
	border: 1px solid color-mix(in srgb, var(--nsd-border) 60%, transparent);
	border-radius: var(--nsd-radius);
}

.nsd-summary__list {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.nsd-summary__row {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 0.75rem;
	padding-bottom: 0.4rem;
	border-bottom: 1px solid color-mix(in srgb, var(--nsd-border) 40%, transparent);
	font-size: 0.78rem;
}

.nsd-summary__row:last-child {
	padding-bottom: 0;
	border-bottom: 0;
}

.nsd-summary__row dt {
	margin: 0;
	flex: 0 0 auto;
	color: var(--nsd-muted-fg);
}

.nsd-summary__row dd {
	margin: 0;
	max-width: 60%;
	text-align: right;
	font-weight: 500;
	overflow-wrap: anywhere;
}

/* Toast */

.nsd-toast {
	position: fixed;
	left: 50%;
	bottom: 1.5rem;
	transform: translate(-50%, 1rem);
	z-index: 9999;
	max-width: min(90vw, 360px);
	padding: 0.875rem 1.25rem;
	background: var(--nsd-secondary);
	color: #fff;
	border-radius: var(--nsd-radius);
	box-shadow: var(--nsd-shadow);
	font-size: 0.85rem;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.nsd-toast[hidden] {
	display: none;
}

.nsd-toast.is-visible {
	opacity: 1;
	transform: translate(-50%, 0);
}

.nsd-toast.is-error {
	background: #b3261e;
}

