/* ==========================================================================
 * STL Product Viewer 2.10.0
 * Purchase-first simple configurator + advanced 3D modal
 * ======================================================================= */

.spv-viewer-wrapper {
	--spv-accent: #2f6fed;
	--spv-accent-soft: #eef4ff;
	--spv-border: #e3e5e8;
	--spv-text: #171717;
	--spv-muted: #686b70;
	--spv-surface: #ffffff;
	--spv-soft: #f7f7f6;
	box-sizing: border-box;
	min-width: 0;
	max-width: 100%;
	margin: 14px 0 18px;
	font-size: 14px;
	color: var(--spv-text);
}

.spv-viewer-wrapper *,
.spv-viewer-wrapper *::before,
.spv-viewer-wrapper *::after {
	box-sizing: border-box;
}


/* --------------------------------------------------------------------------
 * Product summary card alignment
 * ----------------------------------------------------------------------- */

.spv-summary-card-host {
	--spv-border: #e3e5e8;
	--spv-text: #171717;
	--spv-muted: #686b70;
	--spv-surface: #ffffff;
	--spv-soft: #f7f7f6;
	padding: 20px 22px;
	border: 1px solid #e3e5e8;
	border-radius: 14px;
	background: #ffffff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.035);
}

.spv-summary-card-host > *:first-child {
	margin-top: 0 !important;
}

.spv-summary-card-host > *:last-child {
	margin-bottom: 0 !important;
}

.spv-summary-card-host .spv-card-title,
.spv-summary-card-host h1.product_title,
.spv-summary-card-host h1.entry-title,
.spv-summary-card-host .wp-block-post-title,
.spv-summary-card-host .wc-block-components-product-title {
	margin-top: 0;
	margin-bottom: 12px;
}

.spv-summary-card-host .spv-card-price,
.spv-summary-card-host p.price,
.spv-summary-card-host .price,
.spv-summary-card-host .wc-block-components-product-price {
	margin-bottom: 14px;
}

.spv-summary-card-host .spv-card-excerpt,
.spv-summary-card-host .woocommerce-product-details__short-description,
.spv-summary-card-host .product-short-description,
.spv-summary-card-host .wp-block-post-excerpt,
.spv-summary-card-host .wc-block-components-product-details__short-description,
.spv-summary-card-host .wc-block-product-excerpt {
	margin-bottom: 0;
}

.spv-summary-card-host .spv-viewer-wrapper {
	margin: 16px 0 0;
}

.spv-summary-card-host .spv-simple-configurator {
	margin-top: 0;
	padding: 16px 0 0;
	border: 0;
	border-top: 1px solid #ececec;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
}

/* --------------------------------------------------------------------------
 * Simple / regular-customer view
 * ----------------------------------------------------------------------- */

.spv-simple-configurator {
	background: var(--spv-surface);
	border: 1px solid var(--spv-border);
	border-radius: 10px;
	padding: 14px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.025);
}

.spv-simple-heading {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin-bottom: 11px;
}

.spv-simple-heading strong {
	font-size: 13px;
	line-height: 1.35;
}

.spv-simple-heading span {
	font-size: 11px;
	line-height: 1.35;
	color: var(--spv-muted);
}

.spv-simple-fields {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
}

.spv-simple-field {
	display: block;
	min-width: 0;
	margin: 0;
}

.spv-simple-field > span,
.spv-simple-label {
	display: block;
	margin: 0 0 5px;
	font-size: 12px;
	font-weight: 650;
	line-height: 1.3;
	color: #303236;
}

.spv-simple-field select,
.spv-filament-dropdown {
	width: 100%;
	min-height: 39px;
	margin: 0;
	padding: 7px 32px 7px 10px;
	border: 1px solid #d8dadd;
	border-radius: 7px;
	background-color: #fff;
	box-shadow: none;
	font: inherit;
	font-size: 12px;
	line-height: 1.35;
	color: #222;
}

.spv-simple-field select:focus,
.spv-filament-dropdown:focus,
.spv-part-input input[type="number"]:focus {
	border-color: var(--spv-accent);
	outline: 2px solid rgba(47, 111, 237, 0.14);
	outline-offset: 0;
}

.spv-simple-color-control {
	margin-top: 11px;
}

.spv-simple-color-swatches,
.spv-color-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.spv-simple-color-swatch,
.spv-color-swatch {
	position: relative;
	width: 28px;
	height: 28px;
	min-width: 28px;
	padding: 0;
	border: 1px solid #d0d2d5;
	border-radius: 50%;
	background: var(--spv-swatch, #ddd);
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
	cursor: pointer;
}

.spv-simple-color-swatch::after {
	content: "";
	position: absolute;
	inset: 3px;
	border-radius: 50%;
	background: var(--spv-swatch, #ddd);
}

.spv-simple-color-swatch:hover,
.spv-simple-color-swatch:focus-visible,
.spv-color-swatch:hover,
.spv-color-swatch:focus-visible {
	outline: none;
	border-color: #7b7e84;
}

.spv-simple-color-swatch.is-selected,
.spv-color-swatch.is-selected {
	border-color: var(--spv-accent);
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--spv-accent);
}

.spv-choice-summary {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 38px;
	margin-top: 12px;
	padding: 8px 10px;
	border-radius: 7px;
	background: #f5f5f4;
	font-size: 11px;
	line-height: 1.35;
	color: #50535a;
}

.spv-choice-summary strong {
	color: #232427;
}

.spv-choice-summary-icon {
	flex: 0 0 auto;
	display: inline-flex;
	color: #565a61;
}

.spv-simple-preview-card {
	display: grid;
	grid-template-columns: 118px minmax(0, 1fr);
	gap: 12px;
	align-items: center;
	margin-top: 12px;
	padding: 9px;
	border-top: 1px solid #ececeb;
	background: #fff;
}

.spv-canvas-home,
.spv-modal-canvas-slot,
.spv-canvas-frame {
	min-width: 0;
	max-width: 100%;
}

.spv-canvas-frame {
	position: relative;
}

.spv-stl-canvas {
	position: relative;
	width: 100%;
	height: 105px;
	min-width: 0;
	max-width: 100%;
	overflow: hidden;
	border: 1px solid #e1e3e6;
	border-radius: 8px;
	background: #f3f3f2;
	cursor: grab;
}

.spv-stl-canvas:active {
	cursor: grabbing;
}

.spv-stl-canvas canvas {
	position: absolute;
	top: 0;
	left: 0;
	display: block;
}

.spv-viewer-loading,
.spv-viewer-error {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 10px;
	font-size: 11px;
	line-height: 1.35;
	color: #7a7d82;
	text-align: center;
}

.spv-canvas-chip {
	position: absolute;
	top: 7px;
	left: 7px;
	z-index: 2;
	padding: 2px 6px;
	border-radius: 999px;
	background: rgba(20, 20, 20, 0.78);
	font-size: 9px;
	font-weight: 700;
	line-height: 1.35;
	letter-spacing: .04em;
	color: #fff;
	pointer-events: none;
}

.spv-simple-preview-copy {
	min-width: 0;
}

.spv-simple-preview-copy > strong {
	display: block;
	margin-bottom: 2px;
	font-size: 13px;
	line-height: 1.3;
}

.spv-simple-preview-copy p {
	margin: 0 0 8px;
	font-size: 10.5px;
	line-height: 1.45;
	color: var(--spv-muted);
}

.spv-open-configurator {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	min-height: 34px;
	padding: 7px 11px;
	border: 1px solid #bfc2c7;
	border-radius: 7px;
	background: #fff;
	font: inherit;
	font-size: 11px;
	font-weight: 650;
	line-height: 1.2;
	color: #202124;
	cursor: pointer;
}

.spv-open-configurator:hover,
.spv-open-configurator:focus-visible {
	border-color: #8c9096;
	background: #fafafa;
	outline: none;
}

/* --------------------------------------------------------------------------
 * Advanced configurator modal
 * ----------------------------------------------------------------------- */

.spv-configurator-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.spv-configurator-modal.is-open {
	display: flex;
}

.spv-configurator-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(18, 20, 24, 0.58);
	backdrop-filter: blur(2px);
}

.spv-configurator-dialog {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	width: min(1080px, 100%);
	max-height: min(820px, calc(100vh - 48px));
	overflow: hidden;
	border: 1px solid #d9dce1;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 24px 70px rgba(0, 0, 0, .26);
}

.spv-configurator-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 20px;
	padding: 18px 20px 15px;
	border-bottom: 1px solid #eceef1;
}

.spv-configurator-header h2 {
	margin: 0 0 3px;
	padding: 0;
	font-size: 21px;
	line-height: 1.25;
}

.spv-configurator-header p {
	margin: 0;
	font-size: 12px;
	line-height: 1.45;
	color: var(--spv-muted);
}

.spv-configurator-close {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid #e0e2e5;
	border-radius: 50%;
	background: #fff;
	font-size: 26px;
	font-weight: 300;
	line-height: 1;
	color: #34363a;
	cursor: pointer;
}

.spv-configurator-body {
	display: grid;
	grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr);
	gap: 20px;
	min-height: 0;
	padding: 18px 20px;
	overflow: auto;
}

.spv-modal-preview-column,
.spv-modal-options-column {
	min-width: 0;
}

.spv-modal-canvas-slot .spv-stl-canvas {
	height: 500px;
	border-radius: 10px;
	border-color: #dfe1e5;
}

.spv-modal-canvas-slot .spv-canvas-chip {
	display: none;
}

.spv-modal-hint {
	margin: 7px 0 0;
	font-size: 10.5px;
	line-height: 1.4;
	color: #7a7d82;
	text-align: center;
}

.spv-options-title {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 10px;
	font-size: 11px;
	font-weight: 750;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: #4b4e54;
}

.spv-options-title::after {
	content: "";
	flex: 1 1 auto;
	height: 1px;
	background: #e5e7ea;
}

.spv-part-controls {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 0;
}

.spv-part-field {
	min-width: 0;
	padding: 11px 12px;
	border: 1px solid #e1e3e6;
	border-radius: 9px;
	background: #fafafa;
}

.spv-part-field-live {
	border-color: #cad9fb;
	background: #f7f9ff;
}

.spv-part-field-name {
	margin-bottom: 8px;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.3;
}

.spv-part-live-badge {
	display: inline-block;
	margin-left: 7px;
	padding: 2px 6px;
	border-radius: 999px;
	background: #e8efff;
	font-size: 9px;
	font-weight: 650;
	letter-spacing: .03em;
	text-transform: uppercase;
	color: var(--spv-accent);
	vertical-align: middle;
}

.spv-part-field-inputs {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.spv-part-input {
	display: flex;
	flex: 1 1 110px;
	flex-direction: column;
	gap: 4px;
	margin: 0;
	font-size: 10.5px;
	color: #55585e;
}

.spv-part-input-row {
	display: flex;
	align-items: center;
	gap: 5px;
}

.spv-part-input input[type="number"] {
	width: 100%;
	min-width: 0;
	height: 36px;
	padding: 6px 8px;
	border: 1px solid #d5d8dc;
	border-radius: 6px;
	background: #fff;
	font: inherit;
	font-size: 12px;
}

.spv-part-unit {
	flex: 0 0 auto;
	font-size: 10px;
	color: #84878d;
}

.spv-color-control {
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px solid #e5e6e8;
}

.spv-color-label {
	margin-bottom: 7px;
	font-size: 11px;
	font-weight: 650;
	color: #45484d;
}

.spv-color-swatch {
	width: 26px;
	height: 26px;
	min-width: 26px;
	background: #ddd;
}

.spv-color-caption {
	margin-top: 7px;
	font-size: 10px;
	color: #73767c;
}

.spv-filament-select {
	margin-top: 10px;
	padding: 11px 12px;
	border: 1px solid #e1e3e6;
	border-radius: 9px;
	background: #fafafa;
}

.spv-filament-label {
	margin-bottom: 6px;
	font-size: 12px;
	font-weight: 700;
}

.spv-filament-caption {
	margin-top: 6px;
	font-size: 10.5px;
	line-height: 1.4;
	color: #696c72;
}

.spv-filament-caption strong {
	color: #303236;
}

.spv-estimate {
	margin-top: 10px;
	padding: 9px 11px;
	border-radius: 8px;
	background: var(--spv-accent-soft);
}

.spv-estimate-line {
	padding: 1px 0;
	font-size: 11px;
	line-height: 1.4;
	color: #51545b;
}

.spv-estimate-cost {
	padding-top: 3px;
	font-size: 13px;
	font-weight: 700;
	color: #235cba;
}

.spv-configurator-footer {
	display: flex;
	justify-content: flex-end;
	padding: 12px 20px;
	border-top: 1px solid #eceef1;
	background: #fafafa;
}

.spv-configurator-done {
	min-height: 40px;
	padding: 9px 16px;
	border: 1px solid #111;
	border-radius: 7px;
	background: #111;
	font: inherit;
	font-size: 12px;
	font-weight: 700;
	color: #fff;
	cursor: pointer;
}

html.spv-modal-open,
html.spv-modal-open body {
	overflow: hidden;
}

/* --------------------------------------------------------------------------
 * Full-width placement stays simple first, but has a little more breathing room.
 * ----------------------------------------------------------------------- */

.spv-placement-full_width .spv-simple-configurator {
	max-width: 760px;
	margin-left: auto;
	margin-right: auto;
}

/* --------------------------------------------------------------------------
 * Admin metabox / settings styles
 * ----------------------------------------------------------------------- */

.spv-admin-preview {
	width: 100%;
	height: 300px;
	overflow: hidden;
	border: 1px solid #ddd;
	border-radius: 6px;
	background: #f5f5f5;
}

.spv-admin-preview canvas {
	display: block;
}

#spv-parts-table input.small-text {
	width: 90px;
}

#spv-parts-table td {
	vertical-align: middle;
	padding: 6px 8px;
}

.spv-filaments-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
	margin-bottom: 10px;
}

.spv-filament-group {
	min-width: 220px;
}

.spv-filament-group h5 {
	margin: 0 0 6px;
	font-size: 12px;
	letter-spacing: .03em;
	text-transform: uppercase;
	color: #666;
}

.spv-filament-checkbox {
	display: flex;
	align-items: baseline;
	gap: 6px;
	padding: 3px 0;
	cursor: pointer;
}

.spv-filament-name {
	min-width: 80px;
	font-weight: 600;
}

.spv-filament-tag {
	font-size: 12px;
	color: #888;
}

#spv-parts-table .spv-preview-group {
	min-width: 190px;
	max-width: 240px;
}

#spv-parts-table .spv-preview-group-help {
	display: block;
	max-width: 240px;
	margin-top: 4px;
	font-size: 11px;
}

#spv-parts-table .spv-enable-cell {
	white-space: nowrap;
	text-align: center;
}

#spv-parts-table .spv-dimensions-disabled .spv-part-shape,
#spv-parts-table .spv-dimensions-disabled .spv-part-width,
#spv-parts-table .spv-dimensions-disabled .spv-part-length,
#spv-parts-table .spv-dimensions-disabled .spv-part-height,
#spv-parts-table .spv-colors-disabled .spv-preview-group {
	opacity: .55;
}

/* --------------------------------------------------------------------------
 * Responsive
 * ----------------------------------------------------------------------- */

@media (max-width: 780px) {
	.spv-configurator-modal {
		padding: 0;
	}

	.spv-configurator-dialog {
		width: 100%;
		height: 100%;
		max-height: none;
		border: 0;
		border-radius: 0;
	}

	.spv-configurator-body {
		display: block;
		padding: 14px;
	}

	.spv-modal-canvas-slot .spv-stl-canvas {
		height: 300px;
	}

	.spv-modal-options-column {
		margin-top: 16px;
	}

	.spv-configurator-header {
		padding: 14px;
	}

	.spv-configurator-footer {
		position: sticky;
		bottom: 0;
		padding: 10px 14px;
	}

	.spv-configurator-done {
		width: 100%;
	}
}

@media (max-width: 520px) {
	.spv-summary-card-host {
		padding: 14px;
	}

	.spv-simple-configurator {
		padding: 12px;
	}

	.spv-simple-heading {
		display: block;
	}

	.spv-simple-heading span {
		display: block;
		margin-top: 2px;
	}

	.spv-simple-fields {
		grid-template-columns: 1fr;
	}

	.spv-simple-preview-card {
		grid-template-columns: 96px minmax(0, 1fr);
		gap: 10px;
		padding-left: 0;
		padding-right: 0;
	}

	.spv-stl-canvas {
		height: 94px;
	}

	.spv-open-configurator {
		width: 100%;
	}

	.spv-modal-canvas-slot .spv-stl-canvas {
		height: 250px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.spv-configurator-backdrop {
		backdrop-filter: none;
	}
}

/* --------------------------------------------------------------------------
 * Color / texture finish chooser
 * ----------------------------------------------------------------------- */

.spv-simple-appearance-control {
	margin-top: 11px;
}

.spv-simple-appearance-heading,
.spv-appearance-control-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 8px;
}

.spv-simple-appearance-heading .spv-simple-label,
.spv-appearance-control-header .spv-color-label {
	margin-bottom: 0;
}

.spv-appearance-tabs {
	display: inline-flex;
	gap: 2px;
	padding: 2px;
	border: 1px solid #dedfe2;
	border-radius: 8px;
	background: #f4f4f3;
}

.spv-appearance-tab {
	min-height: 28px;
	padding: 5px 10px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	box-shadow: none;
	font: inherit;
	font-size: 10.5px;
	font-weight: 650;
	line-height: 1.2;
	color: #686b70;
	cursor: pointer;
}

.spv-appearance-tab.is-active {
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
	color: #202124;
}

.spv-simple-appearance-panel,
.spv-appearance-panel {
	display: none;
}

.spv-simple-appearance-panel.is-active,
.spv-appearance-panel.is-active {
	display: block;
}

.spv-simple-texture-swatches,
.spv-texture-swatches {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 8px;
}

.spv-simple-texture-swatch,
.spv-texture-swatch {
	position: relative;
	display: flex;
	min-width: 0;
	flex-direction: column;
	gap: 5px;
	align-items: stretch;
	padding: 4px;
	border: 1px solid #d8dade;
	border-radius: 8px;
	background: #fff;
	box-shadow: none;
	font: inherit;
	font-size: 9.5px;
	font-weight: 600;
	line-height: 1.2;
	color: #33363a;
	text-align: left;
	cursor: pointer;
}

.spv-simple-texture-swatch img,
.spv-texture-swatch img {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border-radius: 5px;
	background: #eee;
}

.spv-simple-texture-swatch span,
.spv-texture-swatch span {
	display: block;
	overflow: hidden;
	padding: 0 2px 1px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.spv-simple-texture-swatch:hover,
.spv-simple-texture-swatch:focus-visible,
.spv-texture-swatch:hover,
.spv-texture-swatch:focus-visible {
	border-color: #8f9298;
	outline: none;
}

.spv-simple-texture-swatch.is-selected,
.spv-texture-swatch.is-selected {
	border-color: var(--spv-accent);
	box-shadow: 0 0 0 2px rgba(47, 111, 237, .16);
}

.spv-appearance-control {
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px solid #e5e6e8;
}

.spv-appearance-control .spv-color-control {
	margin-top: 0;
	padding-top: 0;
	border-top: 0;
}

.spv-appearance-caption {
	margin-top: 7px;
	font-size: 10px;
	line-height: 1.35;
	color: #73767c;
}

/* 3D Viewer Settings: texture library */
.spv-texture-admin-table td {
	vertical-align: middle;
}

.spv-texture-image-picker {
	display: flex;
	align-items: center;
	gap: 10px;
}

.spv-texture-admin-preview {
	display: block;
	width: 54px;
	height: 54px;
	object-fit: cover;
	border: 1px solid #dcdcde;
	border-radius: 6px;
	background: #f6f7f7;
}

.spv-texture-admin-preview[src=""] {
	display: none;
}

@media (max-width: 520px) {
	.spv-simple-texture-swatches,
	.spv-texture-swatches {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.spv-simple-appearance-heading,
	.spv-appearance-control-header {
		align-items: flex-start;
		flex-direction: column;
	}
}

/* Per-part custom text field */
.spv-text-control { margin-top: 10px; }
.spv-text-control .spv-color-label { display: block; margin-bottom: 4px; }
.spv-part-text-input { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid #d0d5dd; border-radius: 6px; font-size: 14px; }
.spv-part-text-input:focus { outline: 2px solid #2271b1; outline-offset: 1px; }
.spv-text-note { margin-top: 3px; font-size: 12px; color: #667085; }
.spv-text-max-label { display: block; margin-top: 4px; }
.spv-text-max-label input { width: 64px; }
.spv-simple-text-field { margin: 12px 0; }
.spv-simple-text-field .spv-simple-label { display: block; margin-bottom: 4px; }
