/* Textile Studio. The modal chrome (backdrop, frame, header, footer,
   buttons, selects, 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, prefixed wpiets- so sibling
   studios never collide. Three columns, cards, chequerboard view: the
   same shape as the Gallery, Mockup and Flip studios. */

#wpie-root .wpiets-dialog {
	width: min( 1660px, 98vw );
	height: min( 880px, 94vh );
}

#wpie-root .wpiets-body {
	display: flex;
	flex: 1;
	min-height: 0;
}

#wpie-root .wpiets-left,
#wpie-root .wpiets-side {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 12px;
	overflow-x: hidden;
	overflow-y: auto;
	scrollbar-gutter: stable;
}

#wpie-root .wpiets-left {
	width: 250px;
	min-width: 250px;
	border-right: 1px solid var( --ed-border, #2a2f36 );
}

#wpie-root .wpiets-side {
	width: 290px;
	min-width: 290px;
	border-left: 1px solid var( --ed-border, #2a2f36 );
}

/* Cards in a flex column must not shrink, or they clip their own content
   instead of letting the column scroll. */
#wpie-root .wpiets-left > *,
#wpie-root .wpiets-side > * {
	flex: none;
	min-width: 0;
}

#wpie-root .wpiets-view {
	position: relative;
	display: grid;
	flex: 1;
	place-items: stretch;
	min-width: 0;
	overflow: hidden;
	background: repeating-conic-gradient(
			rgba( 128, 128, 128, 0.07 ) 0 25%,
			transparent 0 50%
		)
		0 0 / 22px 22px;
}

#wpie-root .wpiets-canvas {
	width: 100%;
	height: 100%;
	touch-action: none;
	outline: none;
	cursor: grab;
}

#wpie-root .wpiets-canvas:active {
	cursor: grabbing;
}

#wpie-root .wpiets-hint,
#wpie-root .wpiets-busy {
	position: absolute;
	top: 10px;
	left: 50%;
	z-index: 2;
	padding: 4px 12px;
	font-size: 11px;
	color: var( --ed-text-dim, #8b929c );
	white-space: nowrap;
	pointer-events: none;
	background: rgba( 0, 0, 0, 0.4 );
	border-radius: 999px;
	transform: translateX( -50% );
}

#wpie-root .wpiets-busy {
	top: auto;
	bottom: 16px;
	color: var( --ed-text, #e8ecf1 );
	background: rgba( 0, 0, 0, 0.62 );
}

/* ------------------------------- the cards -------------------------------- */

#wpie-root .wpiets-card {
	background: var( --ed-panel-alt, #1b1f26 );
	border: 1px solid var( --ed-border, #2a2f36 );
	border-radius: 10px;
}

#wpie-root .wpiets-cardhead {
	display: flex;
	gap: 6px;
	align-items: center;
	padding: 9px 11px 0;
	font-size: 11px;
	font-weight: 600;
	color: var( --ed-text-dim, #8b929c );
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

#wpie-root .wpiets-cardbody {
	display: flex;
	flex-direction: column;
	gap: 7px;
	padding: 9px 11px 11px;
}

#wpie-root .wpiets-row {
	display: flex;
	gap: 8px;
	align-items: center;
}

#wpie-root .wpiets-label {
	flex: none;
	width: 92px;
	font-size: 11px;
	color: var( --ed-text-dim, #a7adb7 );
}

#wpie-root .wpiets-row .dsm-range {
	flex: 1;
	min-width: 0;
}

#wpie-root .wpiets-value {
	flex: none;
	min-width: 38px;
	font-size: 11px;
	color: var( --ed-text-dim, #c3c9d3 );
	text-align: right;
}

#wpie-root .wpiets-colour {
	flex: none;
	width: 34px;
	height: 24px;
	padding: 0;
	cursor: pointer;
	background: transparent;
	border: 1px solid var( --ed-border, #3a3f47 );
	border-radius: 5px;
}

/* ------------------------- scenes and fabric chips ------------------------ */

#wpie-root .wpiets-scenes {
	display: grid;
	grid-template-columns: repeat( 2, 1fr );
	gap: 6px;
}

#wpie-root .wpiets-scene,
#wpie-root .wpiets-chip {
	padding: 8px 6px;
	font-size: 11px;
	color: var( --ed-text-dim, #a7adb7 );
	cursor: pointer;
	background: transparent;
	border: 1px solid var( --ed-border, #3a3f47 );
	border-radius: 8px;
}

#wpie-root .wpiets-scene:hover,
#wpie-root .wpiets-chip:hover {
	color: var( --ed-text, #e8ecf1 );
	border-color: var( --accent, #3b66ff );
}

#wpie-root .wpiets-scene.is-on,
#wpie-root .wpiets-chip.is-on {
	color: var( --ed-text, #e8ecf1 );
	background: rgba( 59, 102, 255, 0.14 );
	border-color: var( --accent, #3b66ff );
}

#wpie-root .wpiets-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
}

#wpie-root .wpiets-chip {
	padding: 5px 9px;
	border-radius: 999px;
}

/* --------------------------------- source --------------------------------- */

#wpie-root .wpiets-btnrow {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

#wpie-root .wpiets-btnrow .ai-btn {
	flex: 1 1 auto;
	min-width: 0;
}

#wpie-root .wpiets-thumb img {
	display: block;
	width: 100%;
	max-height: 130px;
	object-fit: contain;
	border: 1px solid var( --ed-border, #3a3f47 );
	border-radius: 6px;
}

#wpie-root .wpiets-note {
	font-size: 10px;
	line-height: 1.5;
	color: var( --ed-text-dim, #8b929c );
}

#wpie-root .wpiets-status {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	font-size: 11px;
	color: var( --ed-text-dim, #8b929c );
	text-overflow: ellipsis;
	white-space: nowrap;
}

#wpie-root .wpiets-status.is-bad {
	color: #ff6b6b;
}

/* Design sources: one full-width button per row. */
#wpie-root .wpiets-srccol {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

#wpie-root .wpiets-srccol .ai-btn {
	width: 100%;
}

/* v2.0: the pluck toggle - a visible pill on the stage, top right. */
#wpie-root .wpiets-pluck {
	position: absolute;
	top: 10px;
	right: 12px;
	z-index: 3;
	display: inline-flex;
	gap: 6px;
	align-items: center;
	padding: 5px 11px;
	font-size: 11px;
	color: var( --ed-text, #e8ecf1 );
	cursor: pointer;
	background: rgba( 0, 0, 0, 0.45 );
	border: 1px solid var( --ed-border, #3a3f47 );
	border-radius: 999px;
}

#wpie-root .wpiets-pluck[aria-pressed='true'] {
	background: rgba( 59, 102, 255, 0.35 );
	border-color: var( --accent, #3b66ff );
}

#wpie-root .wpiets-view.is-pluck .wpiets-canvas {
	cursor: grab;
}

#wpie-root .wpiets-view.is-pluck .wpiets-canvas:active {
	cursor: grabbing;
}
