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

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

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

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

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

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

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

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

.wpiefp-seg {
	display: flex;
}

.wpiefp-seg button {
	flex: 1;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.wpiefp-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. */
.wpiefp-dialog textarea.wpiefp-text {
	min-height: 52px;
	font-size: 13px;
	line-height: 1.4;
	resize: vertical;
}

/* Transparent-background swatch. */
.wpiefp-swatch.wpiefp-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. */
.wpiefp-spinrow {
	display: flex;
	gap: 8px;
}

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

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

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

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

/* Route Studio specifics. */
.wpiefp-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;
}

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

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

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

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

/* Format grid (left pane). */
.wpiefp-gridwrap {
	display: block;
	padding: 18px;
	overflow-y: auto;

	/* No transparency checker here: the grid is a gallery, not a
	   canvas - calm solid surfaces only. */
	background: none;
}

.wpiefp-formats {
	width: 100%;
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 210px, 1fr ) );
	gap: 14px;
}

.wpiefp-format {
	display: flex;
	flex-direction: column;
	gap: 0;
	padding: 0;
	overflow: hidden;
	cursor: pointer;
	background: var( --ed-panel-alt, rgba( 255, 255, 255, 0.03 ) );
	border: 1px solid var( --ed-border, #333a44 );
	border-radius: 10px;
	opacity: 0.4;
	transition: opacity 0.15s, border-color 0.15s;
}

.wpiefp-format.active {
	border-color: var( --accent, #3b66ff );
	opacity: 1;
}

.wpiefp-thumbbox {
	display: grid;
	place-items: center;
	height: 180px;
	padding: 14px;
	background: var( --ed-panel, #1a1e24 );
	border-bottom: 1px solid var( --ed-border, #333a44 );
}

.wpiefp-view .wpiefp-thumb {
	max-width: none;
	max-height: none;

	/* White backing: transparent document areas read like paper
	   instead of a nervous checker. */
	background: #fff;
	border: 1px solid rgba( 127, 127, 127, 0.35 );
	border-radius: 2px;
}

.wpiefp-caption {
	display: flex;
	gap: 8px;
	justify-content: space-between;
	padding: 8px 12px 9px;
	font-size: 11px;
	color: var( --ed-text-dim, #b9c0cc );
	white-space: nowrap;
}

.wpiefp-caption span:first-child {
	overflow: hidden;
	text-overflow: ellipsis;
}

.wpiefp-dims {
	color: var( --ed-text-muted, #8b93a1 );
}

.wpiefp-selrow {
	display: flex;
	gap: 8px;
}

.wpiefp-selrow .ai-btn {
	flex: 1;
}

/* 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 .wpiefp-side > * {
	flex-shrink: 0;
}
