/* ==========================================================================
   Nexora Commerce — order builder (Build A Box, Bulk Pricing modules)
   Header + benefit tiles, product grid, sticky summary panel.
   ========================================================================== */

.nxc-builder .nxc-tone--cyan { --tone: var(--nxc-color-cyan-100); --tone-ink: var(--nxc-color-cyan-700); }
.nxc-builder .nxc-tone--blue { --tone: var(--nxc-color-blue-100); --tone-ink: var(--nxc-color-blue); }
.nxc-builder .nxc-tone--navy { --tone: var(--nxc-color-navy-100); --tone-ink: var(--nxc-color-navy); }
.nxc-builder .nxc-tone--cyan-soft { --tone: var(--nxc-color-cyan-50); --tone-ink: var(--nxc-color-cyan-700); }
.nxc-builder .nxc-tone--blue-soft { --tone: var(--nxc-color-blue-50); --tone-ink: var(--nxc-color-blue-700); }
.nxc-builder .nxc-tone--navy-soft { --tone: var(--nxc-color-navy-50); --tone-ink: var(--nxc-color-navy-700); }

.nxc-builder { padding-block: clamp(2rem, 1.5rem + 2vw, 3.25rem) var(--nxc-section-y); }
.nxc-builder__head { max-width: 640px; margin-bottom: var(--nxc-space-6); }
.nxc-builder__eyebrow { margin: 0 0 var(--nxc-space-3); color: var(--nxc-color-muted); font-size: var(--nxc-fs-2xs); font-weight: var(--nxc-fw-semibold); letter-spacing: var(--nxc-tracking-wide); text-transform: uppercase; }
.nxc-builder__title { margin: 0 0 var(--nxc-space-4); font-size: clamp(2.25rem, 1.6rem + 2.6vw, 3.25rem); font-weight: var(--nxc-fw-bold); letter-spacing: -.035em; line-height: 1.05; }
.nxc-builder__title .nxc-serif { font-style: italic; }
.nxc-builder__text { margin: 0; color: var(--nxc-color-muted); font-size: var(--nxc-fs-md); line-height: 1.6; }

.nxc-builder__tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--nxc-space-3); margin: 0 0 var(--nxc-space-8); padding: 0; list-style: none; }
.nxc-builder__tile { display: flex; flex-direction: column; justify-content: space-between; min-height: 132px; padding: var(--nxc-space-5); border-radius: var(--nxc-radius-lg); background: var(--tone); }
.nxc-builder__tile-value { display: flex; align-items: baseline; margin: 0; color: var(--nxc-color-ink); font-family: var(--nxc-font-serif); font-size: clamp(2rem, 1.6rem + 1.5vw, 2.75rem); font-weight: 500; line-height: 1; letter-spacing: -.02em; }
.nxc-builder__tile-value .nxc-serif { font-style: italic; }
.nxc-builder__tile-label { display: grid; gap: .15rem; margin: var(--nxc-space-4) 0 0; }
.nxc-builder__tile-label strong { color: var(--nxc-color-ink); font-size: var(--nxc-fs-sm); }
.nxc-builder__tile-label span { color: var(--nxc-color-muted); font-size: var(--nxc-fs-2xs); }

.nxc-builder__layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--nxc-space-6); align-items: start; }
.nxc-builder__search { display: flex; align-items: center; gap: .5rem; margin-bottom: var(--nxc-space-4); padding-inline: 1rem; border: var(--nxc-border); border-radius: var(--nxc-radius-pill); background: var(--nxc-color-surface); }
.nxc-builder__search:focus-within { border-color: var(--nxc-color-primary); background: #fff; box-shadow: 0 0 0 4px var(--nxc-color-primary-tint); }
.nxc-builder__search .nxc-icon { flex: none; width: 16px; height: 16px; color: var(--nxc-color-muted); }
.nxc-builder__search input { flex: 1; min-width: 0; min-height: 44px; padding: 0; border: 0; background: transparent; font: inherit; font-size: var(--nxc-fs-sm); outline: 0; }

.nxc-builder__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--nxc-space-4); margin: 0; padding: 0; list-style: none; }
.nxc-builder__item { display: flex; flex-direction: column; border: 1px solid #edf0f4; border-radius: var(--nxc-radius-lg); background: #fff; overflow: hidden; transition: border-color var(--nxc-dur), box-shadow var(--nxc-dur); }
.nxc-builder__item[hidden] { display: none; }
.nxc-builder__item.is-selected { border-color: var(--nxc-color-ink); box-shadow: 0 0 0 1px var(--nxc-color-ink); }
.nxc-builder__media { position: relative; aspect-ratio: 4 / 3; }
.nxc-builder__media img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; transform: scale(.9); }
.nxc-builder__count { position: absolute; top: 10px; right: 10px; padding: .25rem .55rem; border-radius: var(--nxc-radius-pill); background: var(--nxc-color-ink); color: #fff; font-size: var(--nxc-fs-xs); font-weight: var(--nxc-fw-bold); }
.nxc-builder__count[hidden] { display: none; }
.nxc-builder__body { display: flex; flex: 1; flex-direction: column; gap: var(--nxc-space-2); padding: var(--nxc-space-4); }
.nxc-builder__name { margin: 0; font-size: var(--nxc-fs-sm); font-weight: var(--nxc-fw-bold); }
.nxc-builder__name a { color: var(--nxc-color-ink); text-decoration: none; }
.nxc-builder__price { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .4rem; margin: 0 0 var(--nxc-space-2); font-size: var(--nxc-fs-sm); }
.nxc-builder__price strong { color: var(--nxc-color-ink); font-size: var(--nxc-fs-base); }
.nxc-builder__price del { color: var(--nxc-color-muted); font-size: var(--nxc-fs-2xs); }
.nxc-builder__price-note { color: var(--nxc-color-success); font-size: var(--nxc-fs-2xs); font-weight: var(--nxc-fw-semibold); }
/* Strength rows */
.nxc-builder__options { display: grid; gap: .35rem; }
.nxc-builder__option { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 34px; padding: .35rem .75rem; border: 1px solid var(--nxc-color-border); border-radius: var(--nxc-radius-pill); background: #fff; color: var(--nxc-color-ink); font: inherit; font-size: var(--nxc-fs-xs); font-weight: var(--nxc-fw-semibold); text-align: left; cursor: pointer; transition: border-color var(--nxc-dur), background-color var(--nxc-dur), color var(--nxc-dur); }
.nxc-builder__option:hover:not(:disabled) { border-color: var(--nxc-color-ink); }
.nxc-builder__option.is-active { border-color: var(--nxc-color-ink); background: var(--nxc-color-ink); color: #fff; }
.nxc-builder__option-price { color: var(--nxc-color-muted); font-weight: var(--nxc-fw-medium, 500); }
.nxc-builder__option.is-active .nxc-builder__option-price { color: rgba(255, 255, 255, .7); }
.nxc-builder__option-count { margin-left: .2rem; font-weight: var(--nxc-fw-bold); }
.nxc-builder__option:disabled { border-style: dashed; color: var(--nxc-color-muted); text-decoration: line-through; cursor: not-allowed; }
.nxc-builder__option:disabled .nxc-builder__option-price { text-decoration: none; }
.nxc-builder__per { color: var(--nxc-color-muted); font-size: var(--nxc-fs-2xs); }
.nxc-builder__price-note.is-warn { color: #b45309; }
.nxc-builder__count.is-warn { background: #fef3c7; color: #92400e; }

/* Add / stepper / +N */
.nxc-builder__actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .4rem; margin-top: auto; }
.nxc-builder__add { grid-column: 1 / -1; }
.nxc-builder__add[hidden], .nxc-builder__stepper[hidden], .nxc-builder__quick[hidden] { display: none; }
.nxc-builder__quick { min-width: 52px; min-height: 42px; padding: 0 .9rem; border: 0; border-radius: var(--nxc-radius-pill); background: var(--nxc-color-ink); color: #fff; font: inherit; font-size: var(--nxc-fs-sm); font-weight: var(--nxc-fw-bold); cursor: pointer; transition: background-color var(--nxc-dur); }
.nxc-builder__quick:hover { background: var(--nxc-color-ink-hover); }
.nxc-builder__stepper:only-child, .nxc-builder__actions:not(:has(.nxc-builder__quick)) .nxc-builder__stepper { grid-column: 1 / -1; }
.nxc-builder__stepper { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; min-height: 42px; border: 1px solid var(--nxc-color-ink); border-radius: var(--nxc-radius-pill); background: #fff; overflow: hidden; }
.nxc-builder__step { display: grid; place-items: center; height: 100%; border: 0; background: transparent; color: var(--nxc-color-ink); transition: background-color var(--nxc-dur); }
.nxc-builder__step:hover { background: var(--nxc-color-surface); }
.nxc-builder__step .nxc-icon { width: 16px; height: 16px; }
.nxc-builder__qty { width: 100%; min-width: 0; height: 100%; padding: 0; border: 0; background: transparent; color: var(--nxc-color-ink); font-size: var(--nxc-fs-base); font-weight: var(--nxc-fw-bold); text-align: center; -moz-appearance: textfield; }
.nxc-builder__qty::-webkit-inner-spin-button, .nxc-builder__qty::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
.nxc-builder__qty:focus-visible { outline: 2px solid var(--nxc-color-primary); outline-offset: -2px; }
.nxc-builder__none { padding: var(--nxc-space-8); color: var(--nxc-color-muted); text-align: center; }
.nxc-builder__none[hidden] { display: none; }

.nxc-builder__summary { position: sticky; top: calc(var(--nxc-header-h) + var(--nxc-admin-bar) + 1rem); }
.nxc-builder__panel { padding: var(--nxc-space-5); border: 1px solid #edf0f4; border-radius: var(--nxc-radius-xl); background: #fff; box-shadow: var(--nxc-shadow-sm); }
.nxc-builder__panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--nxc-space-4); }
.nxc-builder__panel-head h2 { margin: 0; font-size: var(--nxc-fs-md); font-weight: var(--nxc-fw-bold); }
.nxc-builder__units { color: var(--nxc-color-muted); font-size: var(--nxc-fs-xs); }
.nxc-builder__tiers { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 var(--nxc-space-3); padding: 0; list-style: none; }
.nxc-builder__tiers li { padding: .25rem .6rem; border: 1px solid var(--nxc-color-border); border-radius: var(--nxc-radius-pill); color: var(--nxc-color-muted); font-size: var(--nxc-fs-2xs); font-weight: var(--nxc-fw-semibold); }
.nxc-builder__tiers li.is-reached { border-color: var(--nxc-color-ink); background: var(--nxc-color-ink); color: #fff; }
.nxc-builder__progress { height: 6px; margin-bottom: var(--nxc-space-2); border-radius: var(--nxc-radius-pill); background: var(--nxc-color-surface); overflow: hidden; }
.nxc-builder__progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--nxc-color-primary), var(--nxc-color-accent)); transform: scaleX(0); transform-origin: left; transition: transform var(--nxc-dur-slow) var(--nxc-ease); }
.nxc-builder__hint { margin: 0 0 var(--nxc-space-4); color: var(--nxc-color-muted); font-size: var(--nxc-fs-xs); }

.nxc-builder__lines { display: grid; gap: .5rem; max-height: 320px; margin: 0 0 var(--nxc-space-3); padding: 0; overflow-y: auto; list-style: none; }
.nxc-builder__line { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "img name remove" "img qty price"; gap: .15rem .6rem; align-items: center; padding: .5rem; border: 1px solid #edf0f4; border-radius: var(--nxc-radius-md); }
.nxc-builder__line img { grid-area: img; width: 40px; height: 40px; border-radius: 8px; background: var(--nxc-color-surface); object-fit: contain; mix-blend-mode: multiply; }
.nxc-builder__line-name { grid-area: name; overflow: hidden; color: var(--nxc-color-ink); font-size: var(--nxc-fs-xs); font-weight: var(--nxc-fw-semibold); white-space: nowrap; text-overflow: ellipsis; }
.nxc-builder__line-qty { grid-area: qty; display: inline-flex; align-items: center; justify-self: start; border: 1px solid var(--nxc-color-border); border-radius: var(--nxc-radius-pill); }
.nxc-builder__line-qty button { width: 26px; height: 24px; border: 0; background: none; color: var(--nxc-color-ink); }
.nxc-builder__line-qty span { min-width: 22px; font-size: var(--nxc-fs-xs); font-weight: var(--nxc-fw-bold); text-align: center; }
.nxc-builder__line-price { grid-area: price; color: var(--nxc-color-ink); font-size: var(--nxc-fs-xs); font-weight: var(--nxc-fw-semibold); text-align: right; }
.nxc-builder__line-remove { grid-area: remove; justify-self: end; width: 22px; height: 22px; border: 0; border-radius: 50%; background: none; color: var(--nxc-color-muted); line-height: 1; }
.nxc-builder__line-remove:hover { background: #fdecee; color: var(--nxc-color-sale); }
/* Summary: one block per compound (volume pricing) */
.nxc-builder--group .nxc-builder__lines { gap: .6rem; max-height: 420px; }
.nxc-builder__group { padding: .7rem; border: 1px solid #edf0f4; border-radius: var(--nxc-radius-md); background: #fff; transition: background-color var(--nxc-dur), border-color var(--nxc-dur); }
.nxc-builder__group.is-under { border-color: #fcd34d; background: #fffbeb; }
.nxc-builder__group-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .45rem; }
.nxc-builder__group-head img { flex: none; width: 36px; height: 36px; border-radius: 8px; background: var(--nxc-color-surface); object-fit: contain; mix-blend-mode: multiply; }
.nxc-builder__group-name { display: grid; flex: 1; min-width: 0; }
.nxc-builder__group-name strong { overflow: hidden; color: var(--nxc-color-ink); font-size: var(--nxc-fs-xs); text-overflow: ellipsis; white-space: nowrap; }
.nxc-builder__group-name small { color: var(--nxc-color-muted); font-size: var(--nxc-fs-2xs); }
.nxc-builder__flag { flex: none; padding: .2rem .5rem; border-radius: var(--nxc-radius-pill); background: var(--nxc-color-ink); color: #fff; font-size: .625rem; font-weight: var(--nxc-fw-bold); letter-spacing: .04em; text-transform: uppercase; }
.nxc-builder__flag--more { background: #fde68a; color: #92400e; }
.nxc-builder__row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .3rem 0; }
.nxc-builder__row-label { color: var(--nxc-color-muted); font-size: var(--nxc-fs-2xs); }
.nxc-builder__group-foot { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-top: .35rem; padding-top: .45rem; border-top: 1px solid rgba(15, 23, 42, .06); font-size: var(--nxc-fs-2xs); }
.nxc-builder__group-foot > span:first-child { color: var(--nxc-color-muted); }
.nxc-builder__group.is-under .nxc-builder__group-foot > span:first-child { color: #92400e; }
.nxc-builder__group-total { display: inline-flex; flex: none; align-items: baseline; gap: .3rem; }
.nxc-builder__group-total strong { color: var(--nxc-color-ink); font-size: var(--nxc-fs-sm); }
.nxc-builder__group-total del { color: var(--nxc-color-muted); }
.nxc-builder__tierbox { margin: 0 0 var(--nxc-space-4); padding: .75rem; border: 1px solid #edf0f4; border-radius: var(--nxc-radius-md); }
.nxc-builder__tierbox .nxc-builder__tiers { margin-bottom: .4rem; }
.nxc-builder__tierbox .nxc-builder__tiers li { flex: 1; text-align: center; }
.nxc-builder__tiernote { margin: 0; color: var(--nxc-color-muted); font-size: var(--nxc-fs-2xs); line-height: 1.45; }
.nxc-builder__submit:disabled { opacity: 1; background: var(--nxc-color-surface); border-color: var(--nxc-color-border); color: var(--nxc-color-muted); cursor: not-allowed; }

.nxc-builder__empty { padding: var(--nxc-space-4); border: 1px dashed var(--nxc-color-navy-200); border-radius: var(--nxc-radius-md); color: var(--nxc-color-muted); font-size: var(--nxc-fs-xs); text-align: center; }

.nxc-builder__slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; margin: 0 0 var(--nxc-space-4); padding: 0; list-style: none; }
.nxc-builder__slots li { position: relative; aspect-ratio: 1; border: 1px dashed var(--nxc-color-navy-200); border-radius: 10px; background: var(--nxc-color-surface); overflow: hidden; }
.nxc-builder__slots li.is-filled { border-style: solid; border-color: #edf0f4; background: var(--nxc-color-blue-50); }
.nxc-builder__slots img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.nxc-builder__slots li[data-more]::after { content: attr(data-more); position: absolute; inset: 0; display: grid; place-items: center; background: rgba(1, 25, 51, .6); color: #fff; font-size: var(--nxc-fs-sm); font-weight: var(--nxc-fw-bold); }

.nxc-builder__totals { margin: 0 0 var(--nxc-space-4); padding-top: var(--nxc-space-3); border-top: 1px solid #edf0f4; }
.nxc-builder__totals > div { display: flex; justify-content: space-between; padding: .3rem 0; font-size: var(--nxc-fs-sm); }
.nxc-builder__totals dt { color: var(--nxc-color-muted); }
.nxc-builder__totals dd { margin: 0; color: var(--nxc-color-ink); font-weight: var(--nxc-fw-semibold); }
.nxc-builder__saving dd { color: var(--nxc-color-success); }
.nxc-builder.has-saving .nxc-builder__saving dt { color: var(--nxc-color-success); }
.nxc-builder__totals > .nxc-builder__total { margin-top: .3rem; padding-top: .6rem; border-top: 1px solid #edf0f4; }
.nxc-builder__total dt, .nxc-builder__total dd { color: var(--nxc-color-ink); font-size: var(--nxc-fs-md); font-weight: var(--nxc-fw-bold); }
.nxc-builder__note { margin: var(--nxc-space-3) 0 0; color: var(--nxc-color-muted); font-size: var(--nxc-fs-2xs); text-align: center; }
.nxc-builder__note a { color: var(--nxc-color-primary); font-weight: var(--nxc-fw-semibold); }

@media (max-width: 1100px) {
	.nxc-builder__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
	.nxc-builder__tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.nxc-builder__layout { grid-template-columns: minmax(0, 1fr); }
	.nxc-builder__summary { position: sticky; bottom: 0; top: auto; z-index: 5; order: 2; }
	.nxc-builder__lines, .nxc-builder__slots { display: none; }
	.nxc-builder__panel { border-radius: var(--nxc-radius-lg) var(--nxc-radius-lg) 0 0; box-shadow: var(--nxc-shadow-lg); }
	/* Compact sticky bar: count, total and the button; detail lives on the cards. */
	.nxc-builder__panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .5rem .75rem; padding: var(--nxc-space-3) var(--nxc-space-4); }
	.nxc-builder__panel-head { grid-column: 1 / -1; margin: 0; }
	.nxc-builder__panel-head h2 { font-size: var(--nxc-fs-sm); }
	.nxc-builder__tiers, .nxc-builder__tierbox, .nxc-builder__totals > div:not(.nxc-builder__total), .nxc-builder__note:not(:has(a)), .nxc-builder--group .nxc-builder__progress { display: none; }
	.nxc-builder__progress, .nxc-builder__hint { grid-column: 1 / -1; margin: 0; }
	.nxc-builder__totals { margin: 0; padding: 0; border: 0; }
	.nxc-builder__totals > .nxc-builder__total { margin: 0; padding: 0; border: 0; }
	.nxc-builder__total dt { display: none; }
	.nxc-builder__submit { width: auto; min-height: 44px; padding-inline: 1rem; font-size: var(--nxc-fs-sm); }
	.nxc-builder__note { grid-column: 1 / -1; margin: 0; }
}
@media (max-width: 560px) {
	.nxc-builder__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--nxc-space-2); }
	.nxc-builder__body { padding: var(--nxc-space-3); }
	.nxc-builder__actions { grid-template-columns: minmax(0, 1fr); }
	.nxc-builder__stepper { grid-template-columns: 36px minmax(0, 1fr) 36px; }
	.nxc-builder__quick { min-height: 36px; }
	.nxc-builder__option { padding-inline: .6rem; }
}

/* Inside the store page layout (page.php already provides the container) */
.nxc-store .nxc-builder { padding-top: 0; }
.nxc-store .nxc-builder > .nxc-container { max-width: none; padding-inline: 0; }
