/* Decisive Colour & Size Matrix */
.dwcsm {
	--dwcsm-ink: #222;
	--dwcsm-muted: #767676;
	--dwcsm-line: #dcdcdc;
	--dwcsm-cell: #ececec;
	--dwcsm-ring: #3aa55d;
	--dwcsm-bolt: #4a9fd8;
	--dwcsm-ruler: #ec6b23;
	--dwcsm-accent: var(--wd-primary-color, #138670);
	--dwcsm-sw-size: 36px;
	color: var(--dwcsm-ink);
	margin: 0 0 24px;
	max-width: 100%;
}
.dwcsm *, .dwcsm *::before, .dwcsm *::after { box-sizing: border-box; }

/* ---------- Colour ---------- */
.dwcsm-colour-head {
	display: flex; align-items: center; justify-content: space-between;
	gap: 12px; margin: 0 0 8px;
}
.dwcsm-title { font-size: 15px; font-weight: 600; line-height: 1.3; }
.dwcsm-colour-name { font-weight: 400; color: var(--dwcsm-muted); }
.dwcsm-view-toggle {
	display: inline-flex; align-items: center; justify-content: center;
	width: 28px; height: 28px; min-height: 0; padding: 3px; margin: 0;
	background: transparent !important; border: 0; border-radius: 6px;
	color: var(--dwcsm-ink); cursor: pointer; box-shadow: none;
}
.dwcsm-view-toggle:hover, .dwcsm-view-toggle[aria-pressed="true"] { background: #f1f1f1 !important; }
.dwcsm-view-toggle .dwcsm-ico { width: 18px; height: 18px; fill: currentColor; }

.dwcsm-swatches {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(var(--dwcsm-sw-size), 1fr));
	gap: 10px 12px;
	padding: 12px 14px;
	border: 1px solid var(--dwcsm-line);
	margin: 0 0 18px;
	justify-items: center;
}
.dwcsm-swatch {
	position: relative;
	display: inline-flex; flex-direction: column; align-items: center; gap: 6px;
	padding: 0; margin: 0; min-height: 0; width: auto; height: auto;
	background: transparent !important; border: 0; box-shadow: none;
	color: var(--dwcsm-ink); cursor: pointer; line-height: 1.2;
	text-transform: none; letter-spacing: 0;
}
.dwcsm-dot {
	display: block;
	width: var(--dwcsm-sw-size); height: var(--dwcsm-sw-size);
	border-radius: 50%;
	background: var(--dwcsm-sw, #bbb);
	border: 2px solid #2a2a2a;
	transition: box-shadow .15s ease, transform .15s ease;
}
.dwcsm-swatch:hover .dwcsm-dot { transform: scale(1.06); }
.dwcsm-swatch.is-active .dwcsm-dot {
	border-color: var(--dwcsm-ring);
	box-shadow: 0 0 0 1px var(--dwcsm-ring), inset 0 0 0 2px #fff;
}
.dwcsm-swatch:focus-visible { outline: none; }
.dwcsm-swatch:focus-visible .dwcsm-dot { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--dwcsm-ink); }
.dwcsm-swatch.is-unknown .dwcsm-dot {
	background: repeating-linear-gradient(45deg, #e6e6e6 0 6px, #f6f6f6 6px 12px);
}
.dwcsm-swatch-name { display: none; font-size: 12px; text-align: center; max-width: 84px; word-break: break-word; }
.dwcsm-badge {
	/* Anchored to the dot (top-right), not the button, which the theme may stretch to the grid cell. */
	position: absolute; top: -5px; right: auto; left: calc(50% + var(--dwcsm-sw-size) / 2 - 12px);
	min-width: 17px; height: 17px; padding: 0 4px;
	border-radius: 9px; background: var(--dwcsm-ring); color: #fff;
	font-size: 10px; font-weight: 700; line-height: 17px; text-align: center;
	box-shadow: 0 0 0 2px #fff;
}
.dwcsm-badge[hidden] { display: none; }

/* Named view */
.dwcsm.show-names .dwcsm-swatches { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
.dwcsm.show-names .dwcsm-swatch-name { display: block; }

/* ---------- Sizes ---------- */
.dwcsm-size-head {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	margin: 0 0 10px;
}
.dwcsm .dwcsm-h { margin: 0; font-size: clamp(17px, 1.8vw, 20px); font-weight: 700; line-height: 1.15; color: var(--dwcsm-ink); }
.dwcsm-sizing {
	display: inline-flex; align-items: center; gap: 8px;
	font-size: 14px; color: var(--dwcsm-ink) !important; text-decoration: underline; text-underline-offset: 3px;
	white-space: nowrap;
}
.dwcsm-sizing[hidden] { display: none; }
.dwcsm-ico-ruler { width: 20px; height: 20px; color: var(--dwcsm-ruler); }
.dwcsm-delivery {
	display: flex; align-items: center; gap: 8px;
	margin: 0 0 16px; font-size: 17px; font-weight: 600;
}
.dwcsm-ico-bolt { width: 20px; height: 20px; color: var(--dwcsm-bolt); flex: none; }

.dwcsm.is-js .dwcsm-panel:not(.is-active) { display: none; }
.dwcsm.is-js .dwcsm-panel-title { display: none; }
.dwcsm-panel + .dwcsm-panel { margin-top: 16px; }
.dwcsm-panel-title { font-weight: 600; margin: 0 0 8px; }

.dwcsm-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
	gap: 8px;
}
.dwcsm-cell {
	background: var(--dwcsm-cell);
	padding: 0 4px 4px;
	display: flex; flex-direction: column;
}
.dwcsm-cell-head {
	position: relative;
	display: flex; align-items: center; justify-content: center;
	min-height: 32px; padding: 4px 14px;
}
.dwcsm-size { font-size: 15px; font-weight: 600; text-align: center; }
.dwcsm-fast { position: absolute; top: 6px; right: 4px; line-height: 0; }
.dwcsm-cell-body { background: #fff; flex: 1; display: flex; flex-direction: column; }
.dwcsm-stepper {
	display: grid; grid-template-columns: 22px 1fr 22px; align-items: center;
	padding: 4px 2px; margin: 0 3px;
	border-bottom: 1px solid #e3e3e3;
}
.dwcsm .dwcsm-stepper button {
	width: 22px; height: 28px; min-height: 0; padding: 0; margin: 0;
	background: transparent !important; border: 0; box-shadow: none;
	font-size: 18px; font-weight: 400; line-height: 1; color: var(--dwcsm-ink);
	cursor: pointer; border-radius: 4px;
}
.dwcsm .dwcsm-stepper .dwcsm-minus { color: #9a9a9a; }
.dwcsm .dwcsm-stepper button:hover:not(:disabled) { background: #f2f2f2 !important; color: var(--dwcsm-ink); }
.dwcsm .dwcsm-stepper button:disabled { opacity: .35; cursor: not-allowed; }
.dwcsm .dwcsm-qty {
	width: 100%; min-width: 0; height: 28px; min-height: 0; padding: 0;
	border: 0 !important; box-shadow: none !important; background: transparent;
	font-size: 16px; font-weight: 400; color: #7a7a7a; text-align: center;
	-moz-appearance: textfield; appearance: textfield;
}
.dwcsm .dwcsm-qty::-webkit-outer-spin-button,
.dwcsm .dwcsm-qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.dwcsm .dwcsm-qty:focus { outline: 2px solid var(--dwcsm-ring); outline-offset: -2px; border-radius: 4px; }
.dwcsm-cell.has-qty { background: #d9eedf; }
.dwcsm-cell.has-qty .dwcsm-qty { color: var(--dwcsm-ink); font-weight: 600; }
.dwcsm-stock { display: flex; flex-direction: column; align-items: center; padding: 5px 2px 6px; text-align: center; line-height: 1.3; }
.dwcsm-stock-label { font-size: 12px; }
.dwcsm-stock-sub { font-size: 11px; white-space: nowrap; color: var(--dwcsm-muted); }
.dwcsm-cell.is-out .dwcsm-stock-label, .dwcsm-cell.is-na .dwcsm-stock-label { color: #b3261e; }
.dwcsm-cell.is-out .dwcsm-cell-body, .dwcsm-cell.is-na .dwcsm-cell-body,
.dwcsm-cell.is-out .dwcsm-size, .dwcsm-cell.is-na .dwcsm-size { opacity: .55; }

/* ---------- Summary + actions ---------- */
.dwcsm-summary { margin: 24px 0 0; border: 1px solid var(--dwcsm-line); padding: 16px 18px; }
.dwcsm-summary[hidden] { display: none; }
.dwcsm-summary-title { margin: 0 0 10px; font-weight: 600; }
.dwcsm-lines { list-style: none; margin: 0; padding: 0; }
.dwcsm-line {
	display: grid; grid-template-columns: 18px 1fr auto auto; align-items: center; gap: 10px;
	padding: 7px 0; border-bottom: 1px solid #f0f0f0; font-size: 15px;
}
.dwcsm-line-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--dwcsm-sw, #bbb); border: 2px solid #2a2a2a; }
.dwcsm-line-price { color: var(--dwcsm-muted); white-space: nowrap; }
.dwcsm .dwcsm-line-remove {
	width: 26px; height: 26px; min-height: 0; padding: 0; margin: 0;
	background: transparent !important; border: 0; box-shadow: none;
	font-size: 20px; line-height: 1; color: #999; cursor: pointer;
}
.dwcsm .dwcsm-line-remove:hover { color: #b3261e; }
.dwcsm-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-top: 12px; font-size: 16px; }
.dwcsm-total-price { font-size: 20px; }

.dwcsm-message { margin: 14px 0 0; font-size: 15px; }
.dwcsm-message:empty { display: none; }
.dwcsm-message.is-error { color: #b3261e; }
.dwcsm-message.is-success { color: #1e6b3a; }
.dwcsm-message a { font-weight: 600; text-decoration: underline; }

.dwcsm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.dwcsm .dwcsm-actions .button {
	width: 100%; min-height: 48px; margin: 0; border-radius: 30px;
	font-weight: 600; font-size: 15px; text-transform: none; letter-spacing: 0;
	color: #fff; border: 0; cursor: pointer;
}
.dwcsm .dwcsm-actions .dwcsm-add { background: var(--dwcsm-accent); }
.dwcsm .dwcsm-actions .dwcsm-buy { background: #242424; }
.dwcsm .dwcsm-actions .button:hover { filter: brightness(1.1); color: #fff; }
.dwcsm .dwcsm-actions .button:disabled, .dwcsm .dwcsm-actions .button.is-loading { opacity: .5; cursor: not-allowed; }

@media (max-width: 480px) {
	.dwcsm { --dwcsm-sw-size: 32px; }
	.dwcsm-swatches { gap: 14px 10px; padding: 16px 12px; }
	.dwcsm-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
	.dwcsm-actions { grid-template-columns: 1fr; }
}

/* ---------- Active quantity-discount tier (Woodmart dynamic discounts table) ---------- */
.wd-dynamic-discounts tbody tr.dwcsm-tier-active,
.wd-dynamic-discounts tbody tr.dwcsm-tier-active:hover {
	background-color: #dff3e5 !important;
}
.wd-dynamic-discounts tbody tr.dwcsm-tier-active td {
	color: #1e6b3a;
	font-weight: 600;
	transition: background-color .2s ease, color .2s ease;
}
.wd-dynamic-discounts tbody tr.dwcsm-tier-active td:first-child {
	box-shadow: inset 4px 0 0 #3aa55d;
}
.wd-dynamic-discounts tbody tr.dwcsm-tier-active td .amount,
.wd-dynamic-discounts tbody tr.dwcsm-tier-active td .wd-price-unit {
	color: #1e6b3a;
}

/* Tier pricing in the selection summary */
.dwcsm-total-was { color: var(--dwcsm-muted); font-weight: 400; font-size: .8em; margin-right: 4px; }
.dwcsm-total-tier { margin: 6px 0 0; font-size: 13px; color: #1e6b3a; font-weight: 600; }
.dwcsm-total-tier[hidden] { display: none; }

/* ---------- Samples & MOQ ---------- */
.dwcsm-moq { margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; background: #f6f7f7; font-size: 13px; line-height: 1.5; }
.dwcsm-moq[hidden] { display: none; }
.dwcsm-moq span { display: block; }
.dwcsm-moq small { display: block; color: #767676; font-size: 12px; }
.dwcsm-moq .dwcsm-moq-good { color: #1e6b3a; font-weight: 600; }
.dwcsm-moq .dwcsm-moq-bad { color: #b3261e; font-weight: 600; }
.dwcsm .dwcsm-actions .button.dwcsm-moq-locked, .dwcsm .dwcsm-actions button.dwcsm-moq-locked { opacity: .45; cursor: not-allowed; }
#dwcsm-moq-modal { position: fixed; inset: 0; z-index: 100000; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; padding: 16px; }
#dwcsm-moq-modal .dwcsm-mm { background: #fff; color: #222; width: min(460px, 100%); border-radius: 12px; padding: 22px; box-shadow: 0 12px 32px rgba(0,0,0,.25); }
#dwcsm-moq-modal h3 { margin: 0 0 6px; font-size: 20px; }
#dwcsm-moq-modal p { margin: 0 0 14px; font-size: 14px; color: #555; }
#dwcsm-moq-modal .dwcsm-mm-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid #eee; font-size: 14px; color: #b3261e; font-weight: 600; }
#dwcsm-moq-modal button { border-radius: 20px; padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; border: 0; min-height: 0; line-height: 1.4; text-transform: none; letter-spacing: 0; }
#dwcsm-moq-modal .dwcsm-mm-add { background: var(--wd-primary-color, #138670); color: #fff; white-space: nowrap; }
#dwcsm-moq-modal .dwcsm-mm-act { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 16px; }
#dwcsm-moq-modal .dwcsm-mm-keep { background: #242424; color: #fff; }
#dwcsm-moq-modal .dwcsm-mm-close { background: #eee; color: #333; }
.dwcsm-moq-blocked { margin: 0; padding: 12px; border-radius: 8px; background: #fdecea; color: #b3261e; font-size: 13px; text-align: center; }
#dwcsm-moq-modal .dwcsm-mm-nostock { color: #767676; font-weight: 400; font-size: 12px; text-align: right; max-width: 55%; }
#dwcsm-moq-modal .dwcsm-mm-btns { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.dwcsm-moq-remove { display: inline-block; margin: 4px 0 6px; padding: 4px 12px; border: 1px solid #b3261e; border-radius: 20px; background: #fff; color: #b3261e; font-size: 12px; font-weight: 600; line-height: 1.4; min-height: 0; text-transform: none; letter-spacing: 0; cursor: pointer; }
.dwcsm-moq-remove:hover { background: #b3261e; color: #fff; }
#dwcsm-moq-modal .dwcsm-moq-remove { margin: 0; white-space: nowrap; border: 1px solid #b3261e; background: #fff; color: #b3261e; }

/* Room for 2–3 digit quantities (Oct 2026) */
.dwcsm .dwcsm-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
.dwcsm .dwcsm-stepper { grid-template-columns: 22px minmax(36px, 1fr) 22px; }
.dwcsm .dwcsm-stepper .dwcsm-qty { min-width: 36px; width: 100%; padding: 0 2px !important; text-align: center; font-variant-numeric: tabular-nums; overflow: visible; text-overflow: clip; }
