/**
 * NPS product configurator shell (P2M5 buyer experience).
 *
 * Wraps the existing data-driven product form in an app-like experience: the
 * site chrome steps aside, a sticky bar keeps NPS branding plus a clickable
 * segmented step bar in view, and a live "Your Quote Request So Far" panel (a
 * sidebar on desktop, a bottom drawer on mobile) tracks the buyer's selections.
 * Presentation only; the form engine, fields, conditional logic, and submission
 * are untouched. Built to the UX spec Michael supplied in the 21 prototypes.
 */

/* --- chrome suppression --------------------------------------------------- */
body.nps-configurator #siteNav,
body.nps-configurator .footer,
body.nps-configurator .nav__overlay { display: none !important; }
body.nps-configurator main { padding-top: 0 !important; }
body.nps-configurator { background: #eef2f7; }

/* --- sticky context bar --------------------------------------------------- */
.nps-cfg-bar {
	position: sticky;
	top: 0;
	z-index: 60;
	background: rgba(255, 255, 255, .97);
	-webkit-backdrop-filter: saturate(180%) blur(8px);
	backdrop-filter: saturate(180%) blur(8px);
	border-bottom: 1px solid #e2e8f0;
	overflow-x: clip; /* a wide current-step label can't push the page sideways */
}
.nps-cfg-bar__inner {
	max-width: 1200px;
	margin: 0 auto;
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 9px 22px;
}
.nps-cfg-bar__logo { display: inline-flex; align-items: center; flex: none; }
.nps-cfg-bar__logo img { height: 34px; width: auto; display: block; }
.nps-cfg-bar__product {
	font-weight: 700;
	color: #0f1b2d;
	font-size: 15px;
	white-space: nowrap;
	flex: none;
	padding-right: 4px;
}

/* --- segmented progress bar: a rounded line per step + two labels ---------- */
/* The CURRENT step name (.nps-cfg-stepname) sits under its own segment, always
   visible and prominent. Hovering / focusing another segment fades in a SECOND,
   quieter label (.nps-cfg-hovername) under that segment, without hiding the
   current one. Both are absolutely positioned and clamped to the bar so a wide
   name near an edge can't clip past the viewport or overprint the logo. */
.nps-cfg-steps {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	position: relative; /* anchor for the absolutely-positioned step-name */
	flex: 1 1 auto;
	min-width: 0;
	margin-left: auto;
	max-width: 660px;
	padding-bottom: 18px; /* reserve one label line beneath the segment row */
}
/* "Step N of M" next to the section heading inside the form (not in the bar) */
.nps-cfg-stepbadge {
	display: inline-block;
	margin-left: 12px;
	font-size: 12px;
	font-weight: 600;
	color: #5b6675;
	white-space: nowrap;
	vertical-align: middle;
}
.nps-cfg-steps__row {
	display: flex;
	align-items: center;
	gap: 3px;
}
.nps-cfg-step {
	appearance: none;
	-webkit-appearance: none;
	border: 0;
	background: transparent;
	font: inherit;
	cursor: default;
	padding: 5px 0; /* vertical padding gives the 5px line a real click target */
	display: block;
	flex: 1 1 0;
	min-width: 30px;
}
.nps-cfg-step__line {
	display: block;
	height: 5px;
	width: 100%;
	border-radius: 999px;
	background: #dfe5ee;
	transition: background .15s ease;
}
.nps-cfg-stepname,
.nps-cfg-hovername {
	position: absolute;
	top: 16px; /* just under the segment row */
	left: 0; /* JS sets the real left so each label centres under its segment */
	transform: translateX(-50%);
	font-size: 11.5px;
	line-height: 1.2;
	text-align: center;
	/* The full name is shown on one line. When it is wider than its segment it
	   bleeds over the neighbouring (hidden) label space, and near an edge JS clamps
	   its position so it shifts inward instead of truncating or leaving the bar. */
	white-space: nowrap;
}
/* current step: prominent */
.nps-cfg-stepname { color: #0f1b2d; font-weight: 700; }
/* hovered/focused step: quieter, and it fades in and out */
.nps-cfg-hovername {
	color: #8892a1;
	font-weight: 500;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity .18s ease, visibility 0s linear .18s;
}
.nps-cfg-hovername.is-visible { opacity: 1; visibility: visible; transition: opacity .18s ease, visibility 0s; }
.nps-cfg-step.is-done .nps-cfg-step__line,
.nps-cfg-step.is-current .nps-cfg-step__line { background: #1f5fa8; }
.nps-cfg-step.is-clickable { cursor: pointer; }
/* hover response on non-current segments: a step toward the active colour */
.nps-cfg-step.is-done:hover .nps-cfg-step__line { background: #3f7bc0; }
.nps-cfg-step.is-upcoming:hover .nps-cfg-step__line { background: #b3c8e0; }

/* --- Previous / Next: equal width, right-aligned (desktop) ---------------- */
/* Both buttons share one min-width so they are identical despite their
   different padding, and they sit at the right. On the first step Previous is
   hidden, so Next keeps its width and position with empty space where Previous
   would appear. (Mobile overrides this to a full-width split below.) */
body.nps-configurator .nps-submit-row,
body.nps-configurator .nps-actions {
	display: flex;
	flex-direction: row;
	justify-content: flex-end;
	gap: 12px;
	align-items: stretch;
}
body.nps-configurator .nps-submit-row .nps-back,
body.nps-configurator .nps-submit-row .nps-submit {
	flex: 0 0 auto;
	min-width: 150px;
	width: auto;
	margin: 0;
	box-sizing: border-box;
	text-align: center;
}

/* --- content wrap + two-column layout ------------------------------------ */
.nps-cfg-wrap { max-width: 1200px; margin: 0 auto; padding: 26px 22px 72px; }
.nps-cfg-head { margin-bottom: 20px; }
.nps-cfg-eyebrow {
	display: block;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: #1f5fa8;
	margin-bottom: 4px;
}
.nps-cfg-h1 { margin: 0; font-size: 26px; line-height: 1.2; color: #0f1b2d; }
.nps-cfg-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 322px;
	gap: 30px;
	align-items: start;
}
.nps-cfg-main { min-width: 0; }
/* fill the column, and keep the first card flush with the tracker's top edge */
.nps-cfg-main .nps-product-form { max-width: none; margin: 0; padding-top: 0; }
/* Whatever card is first on a given step (the "I'm not sure" box on step 1, or
   the current section on later steps) must sit flush at the top so its top edge
   lines up with the tracker. Only one section shows at a time, so zeroing every
   section's top margin is safe. */
.nps-cfg-main .nps-product-form > *:first-child,
.nps-cfg-main .nps-notsure,
.nps-cfg-main .nps-contact,
.nps-cfg-main .nps-product-questions,
.nps-cfg-main .nps-product-section { margin-top: 0; }
/* the in-form progress bar is replaced by the sticky step bar */
body.nps-configurator .nps-product-form .nps-steps { display: none; }

/* --- live "Your Quote Request So Far" tracker (desktop sidebar) ----------- */
.nps-cfg-summary {
	position: sticky;
	top: 69px; /* bar height (~53px) + 16px, so the panel top lines up with the first form card */
	display: flex;
	flex-direction: column;
	max-height: calc(100vh - 100px); /* stay in view; the body scrolls inside */
	border: 1px solid var(--nps-line, #d7dce3);
	background: #fff;
	border-radius: 3px; /* match the form question cards */
	padding: 18px;
	box-shadow: 0 1px 2px rgba(15, 27, 45, .04);
}
.nps-cfg-summary__title,
.nps-cfg-drawer__title {
	font-weight: 700;
	color: #0f1b2d;
	font-size: 12px;
	letter-spacing: .06em;
	text-transform: uppercase;
	margin: 0 0 12px;
}
/* a dividing line under "Your Request" in the desktop box (it stays put while the
   list scrolls beneath it); the mobile drawer already has a divider on its header */
.nps-cfg-summary__title { flex: none; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid #e2e7ee; }
.nps-cfg-summary__body {
	font-size: 14px;
	overflow-y: auto;
	flex: 1 1 auto;
	min-height: 0;
	/* let the scrollbar sit near the box edge while the rows stay aligned with the
	   title above (negative margin pulls the scroll area out, padding pulls text in) */
	margin-right: -12px;
	padding-right: 12px;
}
/* Thin, subtle scrollbar: no track pill (that read as a decorative bar), just a
   light-grey thumb. Mobile scrollability is signalled by the drawer's edge fade. */
.nps-cfg-summary__body,
.nps-cfg-drawer__body { scrollbar-color: #cbd3dc transparent; scrollbar-width: thin; }
.nps-cfg-summary__body::-webkit-scrollbar,
.nps-cfg-drawer__body::-webkit-scrollbar { width: 8px; }
.nps-cfg-summary__body::-webkit-scrollbar-track,
.nps-cfg-drawer__body::-webkit-scrollbar-track { background: transparent; }
.nps-cfg-summary__body::-webkit-scrollbar-thumb,
.nps-cfg-drawer__body::-webkit-scrollbar-thumb { background: #cbd3dc; border-radius: 999px; }
.nps-cfg-summary__body::-webkit-scrollbar-thumb:hover,
.nps-cfg-drawer__body::-webkit-scrollbar-thumb:hover { background: #aeb9c6; }
.nps-cfg-summary__group {
	font-size: 12px;
	letter-spacing: .05em;
	text-transform: uppercase;
	color: #354151; /* between the "Your Request" title (#0f1b2d) and the row keys (#5b6675) so it reads as a heading */
	font-weight: 500;
	margin: 15px 0 5px;
}
.nps-cfg-summary__group:first-child { margin-top: 0; }
/* Rows are LEFT-ALIGNED with the label and value kept close together, not spread
   to opposite edges (the spread/justified pattern hurts scannability and breaks
   Gestalt proximity when values vary in length: GOV.UK Summary List, NN/g). A
   short value sits inline right after the label; a long value or long label
   stacks onto its own line beneath the label (Material two-line list pattern). */
.nps-cfg-summary__row {
	padding: 8px 0;
	border-top: 1px solid #eef1f5;
	line-height: 1.4;
}
/* Every row stacks for uniformity: label on its own line, value beneath it. */
.nps-cfg-summary__k { display: block; color: #5b6675; font-size: 13px; } /* label: smaller, muted */
.nps-cfg-summary__v { display: block; margin-top: 3px; color: #0f1b2d; font-weight: 600; } /* value: bold, full contrast */
.nps-cfg-summary__vc { overflow-wrap: break-word; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.nps-cfg-summary__empty { color: #8a93a1; margin: 0; }

/* --- HOT request (rush) control, injected after the needed-by date --------- */
.nps-hot {
	margin: 10px 0 4px;
	padding: 12px 14px;
	border: 1px solid #e2e8f0;
	border-radius: 3px;
	background: #fff;
}
.nps-hot.is-hot { border-color: #f3c0ba; background: #fdecea; }
.nps-hot__row { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; color: #0f1b2d; line-height: 1.45; margin: 0; }
.nps-hot__row input { margin-top: 3px; flex: none; width: 16px; height: 16px; }
.nps-hot__note { margin: 8px 0 0; color: #8a1c14; font-weight: 700; font-size: 13px; line-height: 1.4; }

/* Quantity / versions upgraded to a dropdown + an exact-entry field (B5). */
.nps-numsel { display: block; width: 100%; }
.nps-numexact { margin-top: 10px; }
.nps-numexact__label { display: block; font-size: 13px; color: #5b6675; margin-bottom: 4px; font-weight: 600; }

/* Version quantity allocation (B4): per-version rows + a live red/green remaining line. */
.nps-alloc__row { display: grid; grid-template-columns: 1fr 150px; gap: 12px; align-items: center; margin: 8px 0; }
.nps-alloc__label { font-size: 14px; color: #0f1b2d; }
.nps-alloc__qty { width: 100%; }
.nps-alloc__remaining { margin: 10px 0 0; font-weight: 700; font-size: 13px; color: #b3261e; }
.nps-alloc__remaining.is-ok { color: #1a7f4b; }
@media (max-width: 600px) { .nps-alloc__row { grid-template-columns: 1fr; gap: 4px; } }

/* US/Canada delivery fields (M1) injected into the ZIP wrap. */
.nps-deliv-country, .nps-deliv-street, .nps-deliv-city, .nps-deliv-region { margin-top: 12px; }
.nps-deliv__sel { display: block; width: 100%; }

/* Artwork status / rights / notes (C12). */
.nps-artstatus__sel { display: block; width: 100%; }
.nps-artstatus, .nps-artnotes { margin-top: 12px; }
.nps-artnotes textarea { display: block; width: 100%; }
.nps-artrights { margin-top: 10px; }
.nps-artrights__row { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; color: #0f1b2d; line-height: 1.45; margin: 0; }
.nps-artrights__row input { margin-top: 3px; flex: none; width: 16px; height: 16px; }

/* --- mobile bottom bar (fixed) + drawer ---------------------------------- */
/* On desktop the button row sits in the form as normal and these are inert. */
.nps-cfg-viewquote { display: none; }
.nps-cfg-drawer,
.nps-cfg-backdrop { display: none; }

/* --- responsive ----------------------------------------------------------- */
@media (max-width: 900px) {
	.nps-cfg-grid { grid-template-columns: 1fr; gap: 20px; }
	.nps-cfg-summary { display: none; } /* replaced by the bottom drawer */
	/* Mobile/tablet: keep the product name in the sticky bar (row 1, beside the logo)
	   and drop the progress bar to its own full-width row just beneath it, still sticky. */
	.nps-cfg-bar__inner { gap: 6px 12px; padding: 8px 14px; flex-wrap: wrap; }
	.nps-cfg-wrap { padding: 18px 16px 132px; } /* room for the fixed bottom bar */
	.nps-cfg-bar__product { display: block; flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	/* progress bar = full-width second row, its step-name label beneath it */
	.nps-cfg-steps { flex: 1 0 100%; max-width: none; margin-left: 0; margin-right: 0; gap: 5px; }
	.nps-cfg-step { min-width: 14px; }
		/* no hover response on mobile: a tap must not light a segment or show a
		   second label (the JS hover label is disabled on mobile too) */
		.nps-cfg-step.is-done:hover .nps-cfg-step__line { background: #1f5fa8; }
		.nps-cfg-step.is-upcoming:hover .nps-cfg-step__line { background: #dfe5ee; }

	/* fixed bottom bar: the "Your Request" trigger + the button row (compact) */
	.nps-cfg-mobilebar {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 55;
		background: #fff;
		border-top: 1px solid #e2e8f0;
		box-shadow: 0 -2px 10px rgba(15, 27, 45, .08);
		padding: 8px 14px calc(8px + env(safe-area-inset-bottom, 0px));
	}
	/* "View Request": underlined text, no caret. Doubled bottom padding = twice the
	   space between the trigger and the buttons (bar is a bit taller). */
	.nps-cfg-viewquote {
		display: block;
		width: 100%;
		background: transparent;
		border: 0;
		padding: 0 0 12px;
		font-size: 13px;
		font-weight: 700;
		color: #1f5fa8;
		text-decoration: underline;
		text-align: center;
		cursor: pointer;
	}
	/* buttons fill the width equally on mobile and are ~20% shorter than desktop */
	body.nps-configurator .nps-submit-row,
	body.nps-configurator .nps-actions {
		display: grid;
		grid-auto-flow: column;
		grid-auto-columns: 1fr;
		margin: 0;
	}
	body.nps-configurator .nps-submit-row .nps-back,
	body.nps-configurator .nps-submit-row .nps-submit {
		min-width: 0;
		padding-top: 9px;
		padding-bottom: 9px;
		font-size: 0.98rem;
	}

	/* backdrop + bottom-sheet drawer */
	.nps-cfg-backdrop {
		display: block;
		position: fixed;
		inset: 0;
		background: rgba(15, 27, 45, .45);
		opacity: 0;
		pointer-events: none;
		transition: opacity .2s ease;
		z-index: 70;
	}
	.nps-cfg-drawer {
		display: flex;
		flex-direction: column;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 71;
		max-height: 72vh;
		background: #fff;
		border-radius: 14px 14px 0 0;
		box-shadow: 0 -8px 30px rgba(15, 27, 45, .22);
		transform: translateY(100%);
		transition: transform .25s ease;
	}
	body.nps-cfg-drawer-open .nps-cfg-backdrop { opacity: 1; pointer-events: auto; }
	body.nps-cfg-drawer-open .nps-cfg-drawer { transform: translateY(0); }
	body.nps-cfg-drawer-open { overflow: hidden; }
	.nps-cfg-drawer__head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 16px 18px 10px;
		border-bottom: 1px solid #eef1f5;
	}
	.nps-cfg-drawer__title { margin: 0; }
	.nps-cfg-drawer__close {
		appearance: none; border: 0; background: transparent;
		font-size: 26px; line-height: 1; color: #5b6675; cursor: pointer; padding: 0 4px;
	}
	.nps-cfg-drawer__body {
			overflow-y: auto;
			padding: 12px 18px 22px;
			font-size: 14px;
			-webkit-overflow-scrolling: touch;
			/* A shadow at the top/bottom edge shows when there is more to scroll and
			   fades at the ends. Works on every browser (even iOS, which hides the
			   scrollbar), so the scrollability reads clearly on mobile. */
			background:
				linear-gradient(#fff 30%, hsla(0, 0%, 100%, 0)) 0 0 / 100% 22px no-repeat,
				linear-gradient(hsla(0, 0%, 100%, 0), #fff 70%) 0 100% / 100% 22px no-repeat,
				radial-gradient(farthest-side at 50% 0, rgba(15, 27, 45, .16), transparent) 0 0 / 100% 11px no-repeat,
				radial-gradient(farthest-side at 50% 100%, rgba(15, 27, 45, .16), transparent) 0 100% / 100% 11px no-repeat;
			background-attachment: local, local, scroll, scroll;
		}
}

/* Phones: 16px form controls so iOS Safari does not auto-zoom on field focus. */
@media (max-width: 600px) {
	body.nps-configurator input,
	body.nps-configurator select,
	body.nps-configurator textarea { font-size: 16px; }
}

@media (max-width: 520px) {
	.nps-cfg-h1 { font-size: 22px; }
}
