/* 3D Mockup Studio (extension package). The modal chrome (backdrop,
   frame, header, close, selects, chips, tiles, buttons, scrollbars)
   comes from the editor's own modal design (dsm family) - the dialog
   mounts inside #wpie-root exactly for that. Only studio-specific
   layout lives here. */

.wpie3d-dialog {
	display: flex;
	flex-direction: column;
	width: min( 1120px, 96vw );
	height: min( 760px, 92vh );
}

.wpie3d-body {
	display: flex;
	flex: 1;
	min-height: 0;
}

.wpie3d-view {
	position: relative;
	display: grid;
	flex: 1;
	place-items: center;
	min-width: 0;

	/* Oversized scene canvases must scale down, never paint over the
	   dialog footer. */
	overflow: hidden;
	background:
		repeating-conic-gradient(
			rgba( 128, 128, 128, 0.07 ) 0 25%,
			transparent 0 50%
		)
		0 0 / 22px 22px;
}

/* "Show document": the flattened document sits contain-fitted behind the
   transparent scene canvas (inline background-image, set by main.js). */
.wpie3d-view.is-doc {
	background-color: #05060a;
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
}

#wpie-root .wpie3d-docbtn {
	position: absolute;
	top: 10px;
	right: 12px;
	z-index: 3;
	display: inline-flex;
	gap: 6px;
	align-items: center;
	padding: 4px 11px;
	font-size: 11px;
	color: var( --ed-text-muted, #9aa1ab );
	cursor: pointer;
	background: var( --ed-panel, #1d2126 );
	border: 1px solid var( --ed-border, #333a44 );
	border-radius: 999px;
	opacity: 0.92;
}

#wpie-root .wpie3d-docbtn:hover {
	color: var( --ed-text, #e6e9ee );
}

#wpie-root .wpie3d-docbtn[aria-pressed='true'] {
	color: #fff;
	background: var( --ed-accent, #3b66ff );
	border-color: var( --ed-accent, #3b66ff );
}

.wpie3d-docbtn svg {
	width: 13px;
	height: 13px;
}

.wpie3d-view canvas {
	max-width: 100%;
	max-height: 100%;
	cursor: grab;
	border-radius: 4px;
}

.wpie3d-view canvas:active {
	cursor: grabbing;
}

.wpie3d-hint {
	position: absolute;
	bottom: 10px;
	left: 12px;
	padding: 3px 9px;
	font-size: 11px;
	color: var( --ed-text-muted, #9aa1ab );
	pointer-events: none;
	background: var( --ed-panel, #1d2126 );
	border-radius: 999px;
	opacity: 0.9;
}

.wpie3d-side {
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 320px;
	padding: 14px;
	overflow-y: auto;
	border-left: 1px solid var( --ed-border, #333a44 );
}

.wpie3d-seg {
	display: flex;
}

.wpie3d-seg button {
	flex: 1;
}

.wpie3d-controls {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.wpie3d-row {
	display: grid;
	grid-template-columns: 94px 1fr;
	gap: 8px;
	align-items: center;
}

.wpie3d-row.has-val {
	grid-template-columns: 94px 1fr 34px;
}

.wpie3d-row .dsm-label {
	overflow: hidden;
	font-size: 10.5px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wpie3d-val {
	font-size: 10.5px;
	font-variant-numeric: tabular-nums;
	color: var( --ed-text-muted, #8b93a1 );
	text-align: right;
	white-space: nowrap;
}

/* Settings cards. */
.wpie3d-card {
	overflow: hidden;
	background: var( --ed-panel-alt, rgba( 255, 255, 255, 0.03 ) );
	border: 1px solid var( --ed-border, #333a44 );
	border-radius: 10px;
}

.wpie3d-card-head {
	display: flex;
	gap: 9px;
	align-items: center;
	padding: 14px 16px 4px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	color: var( --ed-text-dim, #b9c0cc );
	text-transform: uppercase;
}

.wpie3d-card-head svg {
	flex: none;
	opacity: 0.85;
}

.wpie3d-card-body {
	display: flex;
	flex-direction: column;
	gap: 9px;
	padding: 9px 16px 15px;
}

/* Model picker tiles. */
.wpie3d-grid.wpie3d-models {
	grid-template-columns: repeat( 3, 1fr );
	max-height: 276px;
}

.wpie3d-models .dsm-tile {
	min-width: 0;
	padding: 5px 3px 4px;
}

.wpie3d-models .wpie3d-thumb {
	background: none;
}

.wpie3d-models .wpie3d-tile-label {
	font-size: 10px;
}

/* Body color presets. */
.wpie3d-swatches {
	display: flex;
	gap: 7px;
	padding: 2px 0 2px 68px;
}

.wpie3d-swatch {
	width: 18px;
	height: 18px;
	padding: 0;
	cursor: pointer;
	border: 1px solid rgba( 255, 255, 255, 0.35 );
	border-radius: 50%;
}

.wpie3d-dialog .wpie3d-colorhost input[type='color'] {
	width: 46px;
	height: 24px;
}

.wpie3d-swatch:hover {
	transform: scale( 1.15 );
}

.wpie3d-swatch.active {
	box-shadow: 0 0 0 2px var( --ed-bg, #14171c ),
		0 0 0 4px var( --accent, #3b66ff );
}

.wpie3d-colorhost {
	display: flex;
	align-items: center;
}

.wpie3d-grid {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 88px, 1fr ) );
	gap: 8px;
	max-height: 320px;
	padding: 2px;
	overflow-y: auto;
}

.wpie3d-tile {
	position: relative;
	gap: 4px;
	padding: 8px 6px 6px;
}

.wpie3d-thumb {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: contain;
	background:
		repeating-conic-gradient(
			rgba( 128, 128, 128, 0.08 ) 0 25%,
			transparent 0 50%
		)
		0 0 / 12px 12px;
	border-radius: 4px;
}

.wpie3d-tile-badge {
	position: absolute;
	top: 4px;
	right: 4px;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	font-size: 10px;
	font-weight: 700;
	line-height: 16px;
	color: #fff;
	text-align: center;
	background: var( --accent, #3b66ff );
	border-radius: 999px;
}

.wpie3d-tile-label {
	max-width: 100%;
	overflow: hidden;
	font-size: 10.5px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wpie3d-sect {
	margin-top: 4px;
	padding-top: 10px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	color: var( --ed-text-dim, #b9c0cc );
	text-transform: uppercase;
	border-top: 1px solid var( --ed-border, #333a44 );
}

.wpie3d-note {
	min-height: 14px;
	font-size: 11px;
	color: var( --ed-text-muted, #8b93a1 );
}

.wpie3d-dialog input[type='color'] {
	width: 100%;
	height: 28px;
	padding: 2px;
	cursor: pointer;
	background: var( --ed-panel-alt, #262b33 );
	border: 1px solid var( --ed-border, #333a44 );
	border-radius: 6px;
}

/* 360 spin export buttons. */
.wpie3d-spinrow {
	display: flex;
	gap: 8px;
}

.wpie3d-spinrow .ai-btn {
	flex: 1;
}

/* Per-surface fit + position: compact indented row under the source. */
.wpie3d-surffit {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: -2px 0 8px 12px;
}

.wpie3d-surffit .dsm-select {
	flex: 0 0 128px;
	min-width: 0;
}

.wpie3d-surffit .dsm-range {
	flex: 1;
	min-width: 0;
}

/* The side column is a flex column with its own scroll area. Without
   this the cards keep the default flex-shrink and get SQUEEZED instead
   of overflowing, so overflow-y never triggers and the panel simply has
   no scrollbar - the content below the fold becomes unreachable.
   (Bug class from 2026-07-17, fixed in five studios then; swept across
   the family on 2026-08-01.) */
#wpie-root .wpie3d-side > * {
	flex-shrink: 0;
}

/* Custom scene: item rows (product select + remove) and add button. */
.wpie3d-item-head {
	display: flex;
	gap: 6px;
	align-items: center;
	margin: 10px 0 2px;
}
.wpie3d-item-head .dsm-select {
	flex: 1;
	min-width: 0;
}
.wpie3d-item-remove {
	flex: none;
	width: 24px;
	height: 24px;
	border-radius: 6px;
	border: 1px solid var( --ed-border, #333a46 );
	background: transparent;
	color: var( --text-muted, #9aa3b2 );
	cursor: pointer;
	font-size: 14px;
	line-height: 1;
}
.wpie3d-item-remove:hover {
	color: #fff;
	border-color: var( --accent, #4a8cff );
}
.wpie3d-additem {
	width: 100%;
	margin-top: 10px;
}
