/**
 * BWOD WC Product Pages — matrix + per-color styles.
 */

/* Hide the standard WooCommerce variations form only when JS has activated the matrix. */
body.bwod-pp-active form.cart.variations_form {
	display: none !important;
}

.bwod-pp {
	margin: 16px 0;
}

.bwod-pp-toggle {
	display: inline-flex;
	border: 1px solid #ccc;
	border-radius: 6px;
	overflow: hidden;
	margin-bottom: 12px;
}

.bwod-pp-toggle button {
	border: 0;
	background: transparent;
	padding: 8px 16px;
	cursor: pointer;
	font-size: 14px;
	color: #555;
	box-shadow: none;
}

/* Unpressed: readable light hover/focus with dark text (theme would force white-on-white). */
.bwod-pp-toggle button[aria-pressed="false"]:hover,
.bwod-pp-toggle button[aria-pressed="false"]:focus {
	color: #1f2d3d;
	background: #eef1f5;
	border: 0;
	box-shadow: none;
	outline: none;
}

/* Pressed: keep dark bg + white text even on hover/focus. */
.bwod-pp-toggle button[aria-pressed="true"],
.bwod-pp-toggle button[aria-pressed="true"]:hover,
.bwod-pp-toggle button[aria-pressed="true"]:focus {
	background: #1f2d3d;
	color: #fff;
	border: 0;
	box-shadow: none;
	outline: none;
}

.bwod-pp-scroll {
	overflow: auto;
	max-width: 100%;
	max-height: 70vh;
}

.bwod-pp-scrollhint {
	display: block;
	margin: 10px 0 0;
	padding: 7px 10px;
	font-size: 13px;
	font-weight: 600;
	color: #1f2d3d;
	text-align: center;
	background: #eef1f5;
	border-radius: 6px;
}

.bwod-pp-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

.bwod-pp-table th,
.bwod-pp-table td {
	border-bottom: 1px solid #eee;
	padding: 8px 6px;
	text-align: center;
}

.bwod-pp-table thead th {
	position: sticky;
	top: 0;
	background: #f7f7f7;
	z-index: 2;
	font-weight: 600;
}

.bwod-pp-table th.bwod-pp-rowhead {
	position: sticky;
	left: 0;
	background: #fff;
	z-index: 1;
	text-align: left;
	white-space: nowrap;
}

.bwod-pp-row.is-selected .bwod-pp-rowhead {
	background: #eef3fb;
}

.bwod-pp-dot {
	display: inline-block;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	border: 1px solid #ccc;
	background: #ddd;
	vertical-align: middle;
	margin-right: 8px;
}

.bwod-pp-rowname {
	vertical-align: middle;
}

.bwod-pp-code {
	color: #999;
	font-size: 12px;
}

/* Unavailable variant — kept subtle so a cluster of these (e.g. larger sizes on
   the right after canonical sorting) doesn't read as a grey "broken" block. */
.bwod-pp-none {
	background: #fcfcfc;
}

/* Scoped + max-width so the theme's broad `input { width:100% }` rules can't
   stretch the field (it was rendering ~230px / filling the whole cell). */
.bwod-pp .bwod-pp-qty {
	width: 56px;
	max-width: 56px;
	height: 34px;
	flex: 0 0 auto;
	text-align: center;
	border: 1px solid #ccc;
	border-radius: 6px;
	-moz-appearance: textfield;
}

.bwod-pp-qty::-webkit-outer-spin-button,
.bwod-pp-qty::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.bwod-pp-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 14px;
	align-items: flex-start;
}

.bwod-pp-swatch {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	width: 64px;
	padding: 0;
	border: 0;
	background: transparent;
	box-shadow: none;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
	font-size: 12px;
	color: #555;
}

/* Neutralise theme button hover/focus (white text + border/bg that caused a bounce). */
.bwod-pp-swatch:hover,
.bwod-pp-swatch:focus {
	color: #1f2d3d;
	border: 0;
	background: transparent;
	box-shadow: none;
	outline: none;
}

/* Clean hover affordance on the dot (no layout shift). */
.bwod-pp-swatch:hover .bwod-pp-dot {
	border-color: #1f2d3d;
}

/* Keyboard focus — outline doesn't affect layout. */
.bwod-pp-swatch:focus-visible {
	outline: 2px solid #1f2d3d;
	outline-offset: 3px;
	border-radius: 6px;
}

/* Equal height so multi-line names (e.g. "Solid svart") don't make the row jump.
   Constrain to the swatch width and break long words (e.g. "Kongeblå") so the
   label never overflows into the neighbouring swatch. */
.bwod-pp-swatch span:not(.bwod-pp-dot) {
	display: block;
	width: 100%;
	min-height: 2.6em;
	line-height: 1.3;
	text-align: center;
	overflow-wrap: break-word;
	word-break: break-word;
	hyphens: auto;
}

.bwod-pp-swatch .bwod-pp-dot {
	width: 34px;
	height: 34px;
	margin: 0;
}

.bwod-pp-swatch.is-selected .bwod-pp-dot {
	outline: 3px solid #1f2d3d;
	outline-offset: 2px;
}

.bwod-pp-steptitle {
	font-weight: 600;
	margin-bottom: 8px;
}

.bwod-pp-steprows {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
}

.bwod-pp-step {
	display: flex;
	align-items: center;
	gap: 6px;
}

.bwod-pp-steplabel {
	min-width: 34px;
	font-size: 13px;
	color: #555;
}

.bwod-pp-stepbtn {
	width: 32px;
	height: 34px;
	border: 1px solid #ccc;
	background: #fff;
	color: #1f2d3d;
	border-radius: 6px;
	cursor: pointer;
	font-size: 18px;
	font-weight: 600;
	line-height: 1;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.bwod-pp-stepbtn:hover,
.bwod-pp-stepbtn:focus {
	color: #1f2d3d;
	background: #f3f4f6;
	border-color: #9aa0a6;
	box-shadow: none;
	outline: none;
}

.bwod-pp-stepbtn:focus-visible {
	box-shadow: 0 0 0 3px rgba(31, 45, 61, 0.25);
}

.bwod-pp-single {
	display: grid;
	grid-template-columns: max-content max-content;
	align-items: center;
	gap: 10px 16px;
	margin: 4px 0 0;
}

/* Row wrapper joins the parent grid (display:contents) so the longest colour
   name (e.g. "Kongeblå") sets a shared name column and every input lines up. */
.bwod-pp-single-row {
	display: contents;
}

.bwod-pp-single-name {
	font-size: 14px;
	color: #1f2d3d;
}

.bwod-pp-foot {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	margin-top: 16px;
	padding-top: 14px;
	border-top: 2px solid #ddd;
}

.bwod-pp-foot-left {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.bwod-pp-total {
	font-size: 15px;
	color: #555;
}

.bwod-pp-total b {
	color: #111;
}

.bwod-pp-summary {
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: 12px;
	line-height: 1.6;
	color: #666;
}

.bwod-pp-summary strong {
	color: #1f2d3d;
	font-weight: 600;
}

.bwod-pp-add {
	background: #1f2d3d;
	color: #fff;
	border: 0;
	border-radius: 6px;
	padding: 12px 26px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
}

.bwod-pp-add:hover,
.bwod-pp-add:focus {
	color: #fff;
	background: #16202c;
	border: 0;
	box-shadow: none;
	outline: none;
}

.bwod-pp-add:focus-visible {
	box-shadow: 0 0 0 3px rgba(31, 45, 61, 0.45);
}

/* Disabled: keep the dimmed dark look, no theme hover border/bg. */
.bwod-pp-add:disabled,
.bwod-pp-add:disabled:hover,
.bwod-pp-add:disabled:focus {
	color: #fff;
	background: #1f2d3d;
	border: 0;
	box-shadow: none;
	outline: none;
	opacity: 0.5;
	cursor: not-allowed;
}

.bwod-pp-design {
	margin: 16px 0 0;
	padding: 16px 18px;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	background: #fff;
}

.bwod-pp-design-title {
	font-size: 15px;
	font-weight: 600;
	color: #1f2d3d;
	margin: 0 0 12px;
}

.bwod-pp-design-opts {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.bwod-pp-design-opt {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	border: 1px solid #d6d9de;
	border-radius: 8px;
	font-size: 14px;
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.bwod-pp-design-opt:hover {
	border-color: #9aa0a6;
}

.bwod-pp-design-opt:has(input:checked) {
	border-color: #1f2d3d;
	background: #f3f6fb;
}

.bwod-pp-upload {
	margin-top: 12px;
}

.bwod-pp-upload-hint {
	font-size: 12px;
	color: #777;
	margin: 6px 0 0;
}

.bwod-pp-upload-status {
	display: inline-block;
	margin-top: 6px;
	font-size: 13px;
	color: #1d6e56;
}

.bwod-pp-notice {
	margin-top: 10px;
	font-size: 14px;
	color: #1d6e56;
}

.bwod-pp-notice.is-error {
	color: #a32d2d;
}

@media (max-width: 768px) {
	.bwod-pp-foot {
		flex-direction: column;
		align-items: stretch;
	}
	.bwod-pp-add {
		width: 100%;
	}
	/* No tables on mobile — hide the matrix view + toggle, per-farge only. */
	.bwod-pp-toggle,
	.bwod-pp-view[data-pp-view="matrix"] {
		display: none;
	}
	/* Much smaller per-colour swatches on mobile (names kept). */
	.bwod-pp-swatch {
		width: 56px;
		font-size: 10px;
	}
	.bwod-pp-swatch .bwod-pp-dot {
		width: 26px;
		height: 26px;
	}
}
