/* 3D Flipbook Studio (extension package). The modal chrome (backdrop,
   frame, header, footer, close, 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
   (prefix wpiefb- so sibling studios never collide). The three column
   body, the settings cards and the checkered view mirror the 3D Gallery,
   Text and Mockup Studios. */

#wpie-root .wpiefb-dialog {
	width: min( 1420px, 97vw );
	height: min( 880px, 94vh );
}

#wpie-root .wpiefb-dialog .dsm-body {
	display: flex;
	min-height: 0;
	padding: 0;
	overflow: hidden;
}

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

/* --------------------------------- panels -------------------------------- */

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

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

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

#wpie-root .wpiefb-left > *,
#wpie-root .wpiefb-side > * {
	flex: none;
	min-width: 0;
}

#wpie-root .wpiefb-sub {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

/* ---------------------------------- view --------------------------------- */

#wpie-root .wpiefb-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 .wpiefb-view canvas {
	width: 100%;
	height: 100%;
	touch-action: none;
	outline: none;
}

/* Where the paper can be taken hold of. Over the view, never in it: the
   marks must not scale with the paper, and must never reach a still. */
#wpie-root .wpiefb-view canvas.wpiefb-grips {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 2;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

#wpie-root .wpiefb-empty {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: grid;
	place-items: center;
	padding: 0 40px;
	font-size: 12px;
	line-height: 1.5;
	color: var( --ed-text-dim, #8b929c );
	text-align: center;
	pointer-events: none;
}

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

#wpie-root .wpiefb-bar {
	position: absolute;
	bottom: 12px;
	left: 50%;
	z-index: 2;
	display: flex;
	gap: 8px;
	align-items: center;
	padding: 4px 6px;
	background: rgba( 0, 0, 0, 0.42 );
	border-radius: 999px;
	transform: translateX( -50% );
}

#wpie-root .wpiefb-where {
	min-width: 150px;
	font-size: 11px;
	color: var( --ed-text-dim, #c3c9d3 );
	text-align: center;
}

/* The sculpting tools: a small strip standing over the preview. */
#wpie-root .wpiefb-tools {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 3;
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 4px;
	background: rgba( 0, 0, 0, 0.42 );
	border-radius: 10px;
}

#wpie-root .wpiefb-tool {
	display: grid;
	place-items: center;
	width: 28px;
	height: 28px;
	padding: 0;
	color: var( --ed-text-dim, #c3c9d3 );
	cursor: pointer;
	background: transparent;
	border: 0;
	border-radius: 7px;
}

#wpie-root .wpiefb-tool:hover {
	color: #fff;
	background: rgba( 255, 255, 255, 0.12 );
}

#wpie-root .wpiefb-tool.is-on {
	color: #fff;
	background: var( --ed-accent, #3b66ff );
}

/* Nothing to undo yet: the button stays where it is, so the strip does
   not jump about, but says plainly that it has nothing to give. */
#wpie-root .wpiefb-tool.is-off {
	opacity: 0.32;
	cursor: default;
}

#wpie-root .wpiefb-tool.is-off:hover {
	color: var( --ed-text-dim, #c3c9d3 );
	background: transparent;
}

#wpie-root .wpiefb-toolgap {
	height: 1px;
	margin: 2px 3px;
	background: rgba( 255, 255, 255, 0.18 );
}

/* ------------------------------ the models ------------------------------- */

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

#wpie-root .wpiefb-model {
	display: flex;
	flex-direction: column;
	gap: 4px;
	align-items: center;
	padding: 9px 4px 7px;
	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 .wpiefb-model:hover {
	color: var( --ed-text, #e8ecf1 );
	border-color: var( --ed-accent, #3b66ff );
}

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

#wpie-root .wpiefb-modelcards {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

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

#wpie-root .wpiefb-list {
	display: flex;
	flex-direction: column;
	gap: 3px;
	margin-top: 8px;
}

#wpie-root .wpiefb-item {
	position: relative;
	display: flex;
	gap: 7px;
	align-items: center;
	padding: 3px 4px;
	cursor: grab;
	border: 1px solid transparent;
	border-radius: 6px;
}

#wpie-root .wpiefb-item:hover {
	border-color: var( --ed-border, #3a3f47 );
}

#wpie-root .wpiefb-item-thumb {
	flex: none;
	width: 34px;
	height: 34px;
	object-fit: cover;
	cursor: pointer;
	border: 1px solid var( --ed-border, #3a3f47 );
	border-radius: 4px;
}

#wpie-root .wpiefb-pill {
	flex: none;
	min-width: 18px;
	padding: 1px 4px;
	font-size: 10px;
	color: var( --ed-text, #e8ecf1 );
	text-align: center;
	background: rgba( 59, 102, 255, 0.35 );
	border-radius: 999px;
}

#wpie-root .wpiefb-item-title {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	font-size: 11px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

#wpie-root .wpiefb-rm {
	flex: none;
	width: 20px;
	height: 20px;
	padding: 0;
	font-size: 12px;
	line-height: 1;
	color: var( --ed-text-dim, #8b929c );
	cursor: pointer;
	background: transparent;
	border: 1px solid transparent;
	border-radius: 4px;
}

#wpie-root .wpiefb-rm:hover {
	color: #ff6b6b;
	border-color: #ff6b6b;
}

#wpie-root .wpiefb-note {
	margin-top: 6px;
	font-size: 10px;
	color: var( --ed-text-dim, #8b929c );
}

#wpie-root .wpiefb-file {
	display: none;
}

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

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

#wpie-root .wpiefb-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 .wpiefb-code {
	position: absolute;
	right: 12px;
	bottom: 56px;
	z-index: 3;
	width: 60%;
	height: 90px;
	font-family: var( --ed-mono, monospace );
	font-size: 10px;
}
