/* 3D Text 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 (prefix wpiert- so the sibling 3D Mockup Studio
   never collides). */

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

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

.wpiert-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;
}

.wpiert-view canvas {
	max-width: calc( 100% - 28px );
	max-height: calc( 100% - 28px );
	cursor: grab;
	border-radius: 4px;
}

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

.wpiert-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;
}

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

/* The side is a flex column: without this its cards keep their default
   flex-shrink and get compressed to fit the panel height instead of
   overflowing, so overflow-y: auto never triggers and the scrollbar never
   appears. Pinning the direct children to their natural height lets the
   column overflow and scroll. */
.wpiert-side > * {
	flex-shrink: 0;
}

.wpiert-seg {
	display: flex;
}

.wpiert-seg button {
	flex: 1;
}

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

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

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

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

/* Text inputs fill their grid cell like the selects do. The host .dsm-input
   has no width, so it kept its intrinsic size and overflowed the narrow
   column (title/subtitle looked wider than the font dropdown and clipped). */
.wpiert-row .dsm-input {
	width: 100%;
	box-sizing: border-box;
}

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

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

.wpiert-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;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.wpiert-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;
}

.wpiert-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;
}

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

.wpiert-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 );
}

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

.wpiert-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;
}

/* The text input. */
.wpiert-dialog textarea.wpiert-text {
	min-height: 52px;
	font-size: 13px;
	line-height: 1.4;
	resize: vertical;
}

/* Transparent-background swatch. */
.wpiert-swatch.wpiert-checker {
	background:
		repeating-conic-gradient(
			rgba( 128, 128, 128, 0.45 ) 0 25%,
			rgba( 255, 255, 255, 0.14 ) 0 50%
		)
		0 0 / 8px 8px;
}

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

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

/* Text | Logo mode switch + logo controls. */
.wpiert-mode {
	margin-bottom: 2px;
}

.wpiert-checkbox {
	justify-self: start;
	width: 15px;
	height: 15px;
	accent-color: var( --accent, #3b66ff );
}

/* Checkbox rows: full-width label, control right-aligned. */
.wpiert-row.wpiert-wide {
	grid-template-columns: 1fr auto;
}

/* Route Studio specifics. */
.wpiert-empty {
	position: absolute;
	max-width: 70%;
	padding: 10px 18px;
	font-size: 13px;
	color: var( --ed-text-muted, #9aa1ab );
	text-align: center;
	background: var( --ed-panel, #1d2126 );
	border: 1px solid var( --ed-border, #333a44 );
	border-radius: 10px;
}

.wpiert-status.error {
	color: #e5484d;
}

.wpiert-reset {
	padding: 3px 9px;
	font-size: 11px;
	color: var( --ed-text-dim, #b9c0cc );
	cursor: pointer;
	background: var( --ed-panel-alt, #262b33 );
	border: 1px solid var( --ed-border, #333a44 );
	border-radius: 6px;
}

.wpiert-row .wpiert-colorhost {
	justify-self: start;
}

.wpiert-row.has-color {
	grid-template-columns: 94px auto 1fr;
}
