/**
 * Neuralumen AI Image Creator Studio — Admin Stylesheet
 * Adapted from docs/ui/styles.css with .nlaic-shell scoping.
 *
 * @package Neuralumen AI Image Creator
 */

/* ------------------------------------------------------------------ */
/*  WP Admin Reset — neutralise default admin chrome on studio page   */
/* ------------------------------------------------------------------ */

.nlaic-wrap {
	margin: 0 !important;
	padding: 0 !important;
	max-width: none !important;
}

/* Front-end [neuralumen_ai_image_creator] shortcode: sit inside theme content */
.nlaic-frontend-studio.nlaic-wrap {
	margin-left: auto !important;
	margin-right: auto !important;
	max-width: 1320px !important;
	padding: 0 12px 24px !important;
}

.nlaic-shortcode-notice {
	padding: 12px 16px;
	border-radius: 12px;
	background: var(--panel-soft, #f0f0f0);
	border: 1px solid var(--line, #ddd);
	font-weight: 600;
}

.nlaic-wrap #wpbody-content > .notice,
.nlaic-wrap .update-nag {
	display: none !important;
}

/* ------------------------------------------------------------------ */
/*  Design Tokens                                                     */
/* ------------------------------------------------------------------ */

.nlaic-shell {
	--radius-xl: 28px;
	--radius-lg: 20px;
	--radius-md: 16px;
	--radius-sm: 999px;
	--font-sans: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
	--font-serif: "Instrument Serif", Georgia, serif;
}

.nlaic-shell[data-theme="dark"] {
	--bg: #0b0d10;
	--bg-elevated: #12161b;
	--panel: #11151a;
	--panel-soft: #151b22;
	--line: rgba(255, 255, 255, 0.08);
	--text: #f4f6f8;
	--muted: #98a3ad;
	--accent: #f2efe8;
	--accent-strong: #d9d4c8;
	--shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
	--art-a: #f4d59a;
	--art-b: #c0633a;
	--art-c: #3b4158;
}

/* ------------------------------------------------------------------ */
/*  Base                                                              */
/* ------------------------------------------------------------------ */

.nlaic-shell *,
.nlaic-shell *::before,
.nlaic-shell *::after {
	box-sizing: border-box;
}

.nlaic-shell {
	margin: 0;
	min-height: 100vh;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font-sans);
	transition: background 180ms ease, color 180ms ease;
	font-size: 14px;
	line-height: 1.5;
}

.nlaic-shell button,
.nlaic-shell input,
.nlaic-shell select,
.nlaic-shell textarea {
	font: inherit;
	color: inherit;
}

.nlaic-shell button {
	border: 0;
	cursor: pointer;
}

/* ------------------------------------------------------------------ */
/*  Layout                                                            */
/* ------------------------------------------------------------------ */

.nlaic-shell .page-shell {
	max-width: 1320px;
	margin: 0 auto;
	padding: 24px;
}

.nlaic-shell .topbar {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 20px;
	margin-bottom: 22px;
}

/* ------------------------------------------------------------------ */
/*  Typography                                                        */
/* ------------------------------------------------------------------ */

.nlaic-shell .eyebrow,
.nlaic-shell .mini-label {
	margin: 0;
	font-size: 0.72rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--muted);
	font-weight: 800;
}

.nlaic-shell .title-tooltip {
	position: relative;
	display: inline-flex;
	width: fit-content;
}

.nlaic-shell .title-tooltip::after {
	content: attr(data-tooltip);
	position: absolute;
	left: 0;
	bottom: calc(100% + 10px);
	width: min(260px, 70vw);
	padding: 10px 12px;
	border-radius: 14px;
	background: var(--bg-elevated);
	border: 1px solid var(--line);
	box-shadow: var(--shadow);
	color: var(--text);
	font-size: 0.78rem;
	font-weight: 600;
	line-height: 1.45;
	letter-spacing: 0;
	text-transform: none;
	opacity: 0;
	pointer-events: none;
	transform: translateY(4px);
	transition: opacity 140ms ease, transform 140ms ease;
	z-index: 25;
}

.nlaic-shell .title-tooltip:hover::after,
.nlaic-shell .title-tooltip:focus-visible::after {
	opacity: 1;
	transform: translateY(0);
}

.nlaic-shell h1,
.nlaic-shell h2,
.nlaic-shell p {
	margin: 0;
	padding: 0;
}

.nlaic-shell h1 {
	max-width: 12ch;
	font-family: var(--font-sans);
	font-size: clamp(1.4rem, 3vw, 2rem);
	font-weight: 800;
	line-height: 1;
	letter-spacing: -0.03em;
}

.nlaic-shell h2 {
	font-size: 1.25rem;
	line-height: 1.1;
}

.nlaic-shell .subtle-copy,
.nlaic-shell .expansion-grid p {
	color: var(--muted);
	line-height: 1.55;
}

/* ------------------------------------------------------------------ */
/*  Workspace Grid                                                    */
/* ------------------------------------------------------------------ */

.nlaic-shell .workspace-grid {
	display: grid;
	grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
	gap: 18px;
}

.nlaic-shell .panel {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius-xl);
	box-shadow: var(--shadow);
}

.nlaic-shell .control-panel,
.nlaic-shell .preview-panel {
	padding: 24px;
}

.nlaic-shell .control-panel {
	display: flex;
	flex-direction: column;
	gap: 22px;
}

/* ------------------------------------------------------------------ */
/*  Fields                                                            */
/* ------------------------------------------------------------------ */

.nlaic-shell .field-cluster {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.nlaic-shell .cluster-label {
	font-size: 0.72rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--muted);
	font-weight: 800;
}

.nlaic-shell .section-copy {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.nlaic-shell .reference-grid,
.nlaic-shell .action-rail {
	display: grid;
	gap: 10px;
}

.nlaic-shell .field-group {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.nlaic-shell [hidden],
.nlaic-shell .field-group[hidden] {
	display: none !important;
}

.nlaic-shell .field-group > span {
	font-size: 0.9rem;
	font-weight: 700;
}

.nlaic-shell .field-inline,
.nlaic-shell .range-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.nlaic-shell .resolution-value {
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--muted);
}

.nlaic-shell .range-meta {
	color: var(--muted);
	font-size: 0.74rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.nlaic-shell textarea,
.nlaic-shell select {
	width: 100%;
	color: var(--text);
	-webkit-text-fill-color: var(--text);
	background: var(--bg-elevated);
	border: 1px solid var(--line);
	border-radius: 18px;
	padding: 15px 16px;
	outline: none;
	transition: border-color 160ms ease, background 160ms ease;
}

.nlaic-shell textarea {
	min-height: 160px;
	resize: vertical;
	line-height: 1.55;
	caret-color: var(--text);
}

.nlaic-shell textarea::placeholder,
.nlaic-shell select::placeholder,
.nlaic-shell .nlaic-text-input::placeholder {
	color: var(--muted);
	-webkit-text-fill-color: var(--muted);
	opacity: 1;
}

.nlaic-shell textarea:focus,
.nlaic-shell select:focus,
.nlaic-shell input[type="range"]:focus {
	border-color: rgba(255, 255, 255, 0.18);
}

.nlaic-shell .control-grid,
.nlaic-shell .variation-row,
.nlaic-shell .expansion-grid {
	display: grid;
	gap: 10px;
}

.nlaic-shell .control-grid {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.nlaic-shell .reference-grid {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.nlaic-shell input[type="range"] {
	width: 100%;
	accent-color: var(--accent-strong);
}

/* ------------------------------------------------------------------ */
/*  Buttons                                                           */
/* ------------------------------------------------------------------ */

.nlaic-shell .primary-button,
.nlaic-shell .secondary-button {
	width: 100%;
	padding: 14px 18px;
	border-radius: var(--radius-sm);
	font-weight: 800;
}

.nlaic-shell .primary-button {
	background: var(--accent);
	color: var(--bg);
}

.nlaic-shell .primary-button:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.nlaic-shell .secondary-button {
	background: var(--panel-soft);
	border: 1px solid var(--line);
	color: var(--text);
}

/* ------------------------------------------------------------------ */
/*  Preview Panel                                                     */
/* ------------------------------------------------------------------ */

.nlaic-shell .preview-panel {
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.nlaic-shell .editor-stage {
	display: grid;
	grid-template-columns: 72px minmax(0, 1fr);
	gap: 12px;
	align-items: stretch;
}

/* ------------------------------------------------------------------ */
/*  Next Step Card                                                    */
/* ------------------------------------------------------------------ */

.nlaic-shell .next-step-card {
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 18px;
	border-radius: 22px;
	background: var(--panel-soft);
	border: 1px solid var(--line);
}

.nlaic-shell .next-step-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 10px;
}

.nlaic-shell .next-step-button {
	display: flex;
	flex-direction: column;
	align-items: start;
	gap: 8px;
	padding: 16px;
	border-radius: 18px;
	background: transparent;
	border: 1px solid var(--line);
	color: var(--text);
	text-align: left;
}

.nlaic-shell .next-step-button strong {
	font-size: 0.98rem;
	font-weight: 700;
}

.nlaic-shell .next-step-button:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.nlaic-shell .next-step-primary {
	background: var(--bg-elevated);
}

/* ------------------------------------------------------------------ */
/*  Edit Dock                                                         */
/* ------------------------------------------------------------------ */

.nlaic-shell .edit-dock {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 10px;
	border-radius: 22px;
	background: var(--panel-soft);
	border: 1px solid var(--line);
}

.nlaic-shell .edit-tool {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	aspect-ratio: 1 / 1;
	border-radius: 16px;
	background: transparent;
	border: 1px solid var(--line);
	color: var(--muted);
}

.nlaic-shell .edit-tool.is-active {
	background: var(--bg-elevated);
	color: var(--text);
}

/* Edit dock: optional hover tooltips (controls panel shows active tool) */
.nlaic-shell .edit-tool::after {
	content: attr(data-tooltip);
	position: absolute;
	left: calc(100% + 10px);
	top: 50%;
	width: 190px;
	padding: 10px 12px;
	border-radius: 14px;
	background: var(--bg-elevated);
	border: 1px solid var(--line);
	box-shadow: var(--shadow);
	color: var(--text);
	font-size: 0.78rem;
	font-weight: 600;
	line-height: 1.45;
	opacity: 0;
	pointer-events: none;
	transform: translateY(-50%) translateX(-4px);
	transition: opacity 140ms ease, transform 140ms ease;
	z-index: 25;
}

.nlaic-shell .edit-tool:hover::after,
.nlaic-shell .edit-tool:focus-visible::after {
	opacity: 1;
	transform: translateY(-50%) translateX(0);
}

/* ------------------------------------------------------------------ */
/*  Tool Icons                                                        */
/* ------------------------------------------------------------------ */

.nlaic-shell .tool-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.1rem;
	height: 1.1rem;
	flex: 0 0 auto;
}

.nlaic-shell .tool-icon svg {
	width: 100%;
	height: 100%;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* ------------------------------------------------------------------ */
/*  Reference Cards & Rail Pills                                      */
/* ------------------------------------------------------------------ */

.nlaic-shell .reference-card,
.nlaic-shell .rail-pill {
	padding: 16px;
	border-radius: 18px;
	background: var(--panel-soft);
	border: 1px solid var(--line);
	color: var(--text);
}

.nlaic-shell .reference-card {
	display: flex;
	flex-direction: column;
	align-items: start;
	justify-content: space-between;
	gap: 8px;
	min-height: 92px;
	text-align: left;
}

.nlaic-shell .reference-card strong {
	font-size: 0.95rem;
	font-weight: 700;
}

.nlaic-shell .reference-card .ref-thumb {
	width: 100%;
	height: 60px;
	object-fit: cover;
	border-radius: 10px;
	margin-top: 4px;
}

.nlaic-shell .panel-heading {
	display: flex;
	align-items: end;
	justify-content: space-between;
	gap: 18px;
}

.nlaic-shell .panel-heading > div {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.nlaic-shell .subtle-copy {
	max-width: 26rem;
	font-size: 0.78rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.nlaic-shell .action-rail {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.nlaic-shell .action-rail-group {
	display: flex;
	align-items: center;
	gap: 10px;
}

.nlaic-shell .action-rail-group-right {
	justify-content: flex-end;
}

.nlaic-shell .rail-pill {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 14px;
	background: transparent;
	color: var(--muted);
	font-weight: 700;
	scroll-snap-align: start;
}

.nlaic-shell .rail-pill.is-active {
	background: var(--panel-soft);
	color: var(--text);
}

.nlaic-shell .rail-pill:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

/* ------------------------------------------------------------------ */
/*  Variation Strip                                                   */
/* ------------------------------------------------------------------ */

.nlaic-shell .variation-strip {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.nlaic-shell .variation-strip-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.nlaic-shell .action-rail,
.nlaic-shell .variation-row,
.nlaic-shell .edit-dock,
.nlaic-shell .modal-edit-dock {
	scrollbar-width: none;
	scroll-snap-type: x proximity;
}

.nlaic-shell .action-rail::-webkit-scrollbar,
.nlaic-shell .variation-row::-webkit-scrollbar,
.nlaic-shell .edit-dock::-webkit-scrollbar,
.nlaic-shell .modal-edit-dock::-webkit-scrollbar {
	display: none;
}

.nlaic-shell .variation-row {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.nlaic-shell .variation-card {
	padding: 14px;
	border-radius: 18px;
	background: var(--panel-soft);
	border: 1px solid var(--line);
	color: var(--text);
	display: flex;
	flex-direction: column;
	gap: 6px;
	text-align: left;
	scroll-snap-align: start;
	cursor: pointer;
}

.nlaic-shell .variation-card span {
	font-size: 0.78rem;
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	font-weight: 800;
}

.nlaic-shell .variation-card.is-selected {
	background: var(--bg-elevated);
	border-color: #ef4444;
	box-shadow: 0 0 0 2px #ef4444, 0 0 0 5px rgba(239, 68, 68, 0.18);
}

.nlaic-shell .variation-card .var-thumb {
	width: 100%;
	height: auto;
	object-fit: contain;
	display: block;
	border-radius: 10px;
	margin-top: 4px;
}

/* ------------------------------------------------------------------ */
/*  Expansion Card                                                    */
/* ------------------------------------------------------------------ */

.nlaic-shell .expansion-card {
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 18px;
	border-radius: 22px;
	background: var(--panel-soft);
	border: 1px solid var(--line);
}

.nlaic-shell .expansion-grid {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.nlaic-shell .expansion-grid article {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* ------------------------------------------------------------------ */
/*  Art Surface                                                       */
/* ------------------------------------------------------------------ */

.nlaic-shell .art-frame {
	padding: 14px;
	border-radius: calc(var(--radius-xl) - 4px);
	background: var(--panel-soft);
	border: 1px solid var(--line);
}

.nlaic-shell .art-surface-button {
	display: block;
	width: 100%;
	padding: 0;
	background: transparent;
	border-radius: 22px;
	overflow: hidden;
}

.nlaic-shell .art-surface {
	position: relative;
	min-height: 560px;
	border-radius: 22px;
	overflow: hidden;
	/* Default preview should be blank until an image exists */
	background: none;
}

.nlaic-shell .art-surface.has-image {
	background: none;
}

.nlaic-shell .art-surface .generated-image {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 22px;
}

.nlaic-shell .art-surface-button:hover .art-surface,
.nlaic-shell .art-surface-button:focus-visible .art-surface {
	filter: brightness(1.04);
}

.nlaic-shell .art-expand-indicator {
	position: absolute;
	top: 16px;
	right: 16px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border-radius: 999px;
	background: rgba(11, 13, 16, 0.34);
	border: 1px solid rgba(255, 255, 255, 0.12);
	color: rgba(255, 255, 255, 0.92);
	backdrop-filter: blur(10px);
	pointer-events: none;
	z-index: 2;
}

.nlaic-shell .art-expand-indicator svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.9;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.nlaic-shell .art-surface::before {
	content: "";
	position: absolute;
	inset: 12% 10% auto auto;
	width: 42%;
	aspect-ratio: 1;
	border-radius: 38% 62% 56% 44%;
	background: rgba(11, 13, 16, 0.16);
	filter: blur(8px);
	display: none;
}

.nlaic-shell .art-surface.has-image::before,
.nlaic-shell .art-surface.has-image::after {
	display: none;
}

.nlaic-shell .art-surface::after {
	content: "";
	position: absolute;
	inset: auto auto 12% 9%;
	width: 48%;
	height: 20%;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.14);
	filter: blur(10px);
	display: none;
}

.nlaic-shell .art-caption {
	position: absolute;
	left: 18px;
	right: 18px;
	bottom: 18px;
	display: flex;
	align-items: end;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 18px;
	border-radius: 18px;
	background: rgba(11, 13, 16, 0.42);
	color: #f9fafb;
	backdrop-filter: blur(10px);
	z-index: 2;
}

.nlaic-shell .art-caption .eyebrow {
	color: rgba(255, 255, 255, 0.72);
}

/* ------------------------------------------------------------------ */
/*  Art Modal                                                         */
/* ------------------------------------------------------------------ */

.nlaic-shell .art-modal {
	position: fixed;
	inset: 0;
	display: grid;
	place-items: center;
	padding: 24px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 160ms ease;
	z-index: 100000;
}

.nlaic-shell .art-modal.is-open {
	opacity: 1;
	pointer-events: auto;
}

.nlaic-shell .art-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(4, 6, 8, 0.76);
	backdrop-filter: blur(10px);
}

.nlaic-shell .art-modal-panel {
	position: relative;
	width: min(1080px, 100%);
	max-height: calc(100vh - 48px);
	display: flex;
	flex-direction: column;
	gap: 18px;
	padding: 20px;
	border-radius: 24px;
	background: var(--panel);
	border: 1px solid var(--line);
	box-shadow: var(--shadow);
}

.nlaic-shell .art-modal-topbar,
.nlaic-shell .art-modal-controls,
.nlaic-shell .zoom-group {
	display: flex;
	align-items: center;
}

.nlaic-shell .art-modal-topbar,
.nlaic-shell .art-modal-controls {
	justify-content: space-between;
	gap: 16px;
}

.nlaic-shell .art-modal-stage {
	display: grid;
	grid-template-columns: 72px minmax(0, 1fr);
	align-items: center;
	min-height: 0;
	border-radius: 20px;
	background: var(--panel-soft);
	border: 1px solid var(--line);
	padding: 18px;
}

.nlaic-shell .art-modal-canvas {
	display: grid;
	place-items: center;
	min-height: 0;
	overflow: hidden;
	border-radius: 18px;
	touch-action: none;
	user-select: none;
}

.nlaic-shell .art-modal-surface {
	width: min(100%, 760px);
	aspect-ratio: 1 / 1;
	margin: 0 auto;
	transform-origin: center center;
	transition: transform 140ms ease;
}

.nlaic-shell .modal-edit-dock {
	height: 100%;
}

.nlaic-shell .art-modal-edit-tool-host {
	min-height: 0;
	max-height: min(40vh, 320px);
	overflow-y: auto;
	flex-shrink: 0;
}

.nlaic-shell .art-modal-edit-tool-host:not([hidden]) {
	display: block;
}

.nlaic-shell .edit-tool-panel-anchor:empty {
	display: none;
}

.nlaic-shell .art-modal-canvas.is-draggable {
	cursor: grab;
}

.nlaic-shell .art-modal-canvas.is-dragging {
	cursor: grabbing;
}

/* ------------------------------------------------------------------ */
/*  Text drag handle (modal)                                           */
/* ------------------------------------------------------------------ */

.nlaic-shell .text-drag-handle {
	position: absolute;
	transform: translate(-50%, -50%);
	cursor: move;
	user-select: none;
	touch-action: none;
	z-index: 10;
	max-width: 80%;
	padding: 6px 10px;
	border-radius: 8px;
	background: rgba(0, 0, 0, 0.55);
	border: 1.5px dashed rgba(255, 255, 255, 0.7);
	color: #fff;
	font-size: 0.85rem;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.3;
	pointer-events: auto;
}

.nlaic-shell .text-drag-handle[hidden] {
	display: none;
}

.nlaic-shell .text-drag-handle:hover,
.nlaic-shell .text-drag-handle.is-dragging {
	border-color: var(--accent);
	background: rgba(0, 0, 0, 0.72);
}

.nlaic-shell .art-modal-image {
	width: 100%;
	height: 100%;
	border-radius: 22px;
	background:
		radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.34), transparent 18%),
		radial-gradient(circle at 66% 28%, rgba(255, 255, 255, 0.1), transparent 22%),
		linear-gradient(140deg, var(--art-a) 0%, var(--art-b) 38%, var(--art-c) 100%);
	position: relative;
	overflow: hidden;
	background-size: cover;
	background-position: center;
}

.nlaic-shell .art-modal-image.has-image {
	background: none;
}

.nlaic-shell .art-modal-image .generated-image {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	border-radius: 22px;
}

.nlaic-shell .art-modal-image::before {
	content: "";
	position: absolute;
	inset: 12% 10% auto auto;
	width: 42%;
	aspect-ratio: 1;
	border-radius: 38% 62% 56% 44%;
	background: rgba(11, 13, 16, 0.16);
	filter: blur(8px);
}

.nlaic-shell .art-modal-image.has-image::before,
.nlaic-shell .art-modal-image.has-image::after {
	display: none;
}

.nlaic-shell .art-modal-image::after {
	content: "";
	position: absolute;
	inset: auto auto 12% 9%;
	width: 48%;
	height: 20%;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.14);
	filter: blur(10px);
}

.nlaic-shell .icon-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border-radius: 999px;
	background: var(--panel-soft);
	border: 1px solid var(--line);
	color: var(--text);
}

.nlaic-shell .zoom-group {
	gap: 10px;
}

.nlaic-shell .zoom-slider-group {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 220px;
}

/* ------------------------------------------------------------------ */
/*  API usage modal                                                   */
/* ------------------------------------------------------------------ */

.nlaic-shell .nlaic-usage-modal {
	position: fixed;
	inset: 0;
	display: grid;
	place-items: center;
	padding: 24px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 160ms ease;
	z-index: 100001;
}

.nlaic-shell .nlaic-usage-modal.is-open {
	opacity: 1;
	pointer-events: auto;
}

.nlaic-shell .nlaic-usage-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(4, 6, 8, 0.76);
	backdrop-filter: blur(10px);
}

.nlaic-shell .nlaic-usage-modal-panel {
	position: relative;
	width: min(640px, 100%);
	max-height: calc(100vh - 48px);
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 20px;
	border-radius: 24px;
	background: var(--panel);
	border: 1px solid var(--line);
	box-shadow: var(--shadow);
}

.nlaic-shell .nlaic-usage-modal-topbar {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
}

.nlaic-shell .nlaic-usage-modal-scroll {
	overflow: auto;
	max-height: min(56vh, 420px);
	border-radius: 16px;
	background: var(--panel-soft);
	border: 1px solid var(--line);
}

.nlaic-shell .nlaic-usage-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.nlaic-shell .nlaic-usage-table th,
.nlaic-shell .nlaic-usage-table td {
	padding: 10px 12px;
	text-align: left;
	border-bottom: 1px solid var(--line);
	vertical-align: top;
}

.nlaic-shell .nlaic-usage-table th {
	font-weight: 600;
	color: var(--text-muted, rgba(255, 255, 255, 0.65));
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	position: sticky;
	top: 0;
	z-index: 2;
	background: var(--panel-soft);
}

.nlaic-shell .nlaic-usage-table td.num,
.nlaic-shell .nlaic-usage-table th.num {
	text-align: right;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.nlaic-shell .nlaic-usage-table tfoot td {
	font-weight: 600;
	border-bottom: none;
	background: rgba(0, 0, 0, 0.12);
}

.nlaic-shell .nlaic-usage-notes {
	margin: 0;
	padding: 10px 12px;
	font-size: 12px;
	color: var(--text-muted, rgba(255, 255, 255, 0.65));
	line-height: 1.45;
}

.nlaic-shell .nlaic-usage-notes[hidden] {
	display: none;
}

.nlaic-shell .nlaic-usage-detail {
	display: block;
	font-size: 11px;
	color: var(--text-muted, rgba(255, 255, 255, 0.55));
	margin-top: 4px;
}

/* ------------------------------------------------------------------ */
/*  Generating Animation                                              */
/* ------------------------------------------------------------------ */

.nlaic-shell.is-generating .art-surface {
	animation: nlaic-pulse 1.4s linear infinite;
}

@keyframes nlaic-pulse {
	0%   { filter: saturate(1) brightness(1); }
	50%  { filter: saturate(1.06) brightness(1.08); }
	100% { filter: saturate(1) brightness(1); }
}

/* ------------------------------------------------------------------ */
/*  Toast Notification                                                */
/* ------------------------------------------------------------------ */

.nlaic-toast-container {
	position: fixed;
	top: 32px;
	bottom: auto;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	z-index: 200000;
	pointer-events: none;
}

/* Sit below the WP admin bar in wp-admin (32px desktop bar, 46px on narrow screens). */
body.admin-bar .nlaic-toast-container {
	top: 40px;
}
@media screen and (max-width: 782px) {
	body.admin-bar .nlaic-toast-container {
		top: 54px;
	}
}

.nlaic-toast {
	padding: 12px 20px;
	border-radius: 999px;
	font-family: "Manrope", sans-serif;
	font-size: 0.85rem;
	font-weight: 700;
	color: #f4f6f8;
	background: #1a1f26;
	border: 1px solid rgba(255, 255, 255, 0.1);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
	pointer-events: auto;
	cursor: pointer;
	animation: nlaic-toast-in 280ms ease forwards;
	white-space: nowrap;
}

.nlaic-toast.is-success { background: #1a3326; border-color: rgba(52, 211, 153, 0.3); }
.nlaic-toast.is-error   { background: #331a1a; border-color: rgba(248, 113, 113, 0.3); }
.nlaic-toast.is-info    { background: #1a1f26; }

.nlaic-toast.is-leaving {
	animation: nlaic-toast-out 200ms ease forwards;
}

.nlaic-toast a {
	color: inherit;
	text-decoration: underline;
	margin-left: 8px;
}

@keyframes nlaic-toast-in {
	from { opacity: 0; transform: translateY(-12px); }
	to   { opacity: 1; transform: translateY(0); }
}

@keyframes nlaic-toast-out {
	from { opacity: 1; transform: translateY(0); }
	to   { opacity: 0; transform: translateY(-12px); }
}

/* ------------------------------------------------------------------ */
/*  Spinner Overlay                                                   */
/* ------------------------------------------------------------------ */

.nlaic-shell .nlaic-spinner {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(11, 13, 16, 0.5);
	border-radius: 22px;
	z-index: 10;
}

.nlaic-shell .nlaic-spinner::after {
	content: "";
	width: 40px;
	height: 40px;
	border: 3px solid rgba(255, 255, 255, 0.2);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: nlaic-spin 0.7s linear infinite;
}

@keyframes nlaic-spin {
	to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------------ */
/*  Responsive                                                        */
/* ------------------------------------------------------------------ */

@media (max-width: 980px) {
	.nlaic-shell .workspace-grid {
		grid-template-columns: 1fr;
		gap: 14px;
	}

	.nlaic-shell .preview-panel { order: 1; }
	.nlaic-shell .control-panel { order: 2; }

	.nlaic-shell .control-grid,
	.nlaic-shell .expansion-grid,
	.nlaic-shell .reference-grid,
	.nlaic-shell .next-step-grid {
		grid-template-columns: 1fr;
	}

	.nlaic-shell .field-inline,
	.nlaic-shell .range-meta {
		align-items: start;
		flex-direction: column;
	}

	.nlaic-shell .editor-stage {
		grid-template-columns: 1fr;
	}

	.nlaic-shell .edit-dock {
		order: 2;
		display: grid;
		grid-auto-flow: column;
		grid-auto-columns: 64px;
		overflow-x: auto;
		overflow-y: hidden;
		padding-bottom: 2px;
	}

	.nlaic-shell .art-modal-panel,
	.nlaic-shell .art-modal-controls,
	.nlaic-shell .zoom-group {
		width: 100%;
	}

	.nlaic-shell .art-modal-stage,
	.nlaic-shell .art-modal-controls,
	.nlaic-shell .zoom-group {
		flex-direction: column;
		align-items: stretch;
	}

	.nlaic-shell .art-modal-stage {
		grid-template-columns: 1fr;
	}

	.nlaic-shell .modal-edit-dock {
		order: 2;
		display: grid;
		grid-auto-flow: column;
		grid-auto-columns: 64px;
		overflow-x: auto;
		overflow-y: hidden;
		height: auto;
		padding-bottom: 2px;
	}

	.nlaic-shell .action-rail {
		justify-content: space-between;
		overflow-x: auto;
		overflow-y: hidden;
		padding-bottom: 2px;
	}

	.nlaic-shell .action-rail-group {
		flex: 0 0 auto;
	}

	.nlaic-shell .variation-row {
		grid-auto-flow: column;
		grid-auto-columns: minmax(140px, 1fr);
		grid-template-columns: none;
		overflow-x: auto;
		overflow-y: hidden;
		padding-bottom: 2px;
	}

	.nlaic-shell .panel-heading {
		flex-direction: column;
		align-items: start;
		gap: 10px;
	}

	.nlaic-shell .art-surface {
		min-height: 420px;
	}
}

@media (max-width: 680px) {
	.nlaic-shell .page-shell {
		max-width: 460px;
		padding:
			max(16px, calc(10px + env(safe-area-inset-top)))
			max(16px, calc(12px + env(safe-area-inset-right)))
			max(28px, calc(20px + env(safe-area-inset-bottom)))
			max(16px, calc(12px + env(safe-area-inset-left)));
	}

	.nlaic-shell .topbar {
		align-items: center;
		justify-content: flex-end;
		margin-bottom: 14px;
		padding: 10px 12px;
		background: rgba(17, 21, 26, 0.92);
		border: 1px solid var(--line);
		border-radius: 18px;
		backdrop-filter: blur(16px);
		display: flex;
	}

	.nlaic-shell .expansion-grid,
	.nlaic-shell .reference-grid,
	.nlaic-shell .next-step-grid {
		grid-template-columns: 1fr;
	}

	.nlaic-shell .panel {
		border-radius: 20px;
	}

	.nlaic-shell h1 {
		font-size: 1.25rem;
	}

	.nlaic-shell .control-panel,
	.nlaic-shell .preview-panel {
		padding: 14px;
	}

	.nlaic-shell .preview-panel {
		background: transparent;
		border: 0;
		box-shadow: none;
		padding: 0;
		gap: 10px;
	}

	.nlaic-shell .field-cluster,
	.nlaic-shell .control-panel,
	.nlaic-shell .preview-panel,
	.nlaic-shell .expansion-card,
	.nlaic-shell .next-step-card {
		gap: 12px;
	}

	.nlaic-shell .section-copy {
		gap: 8px;
	}

	.nlaic-shell .reference-card,
	.nlaic-shell .next-step-button {
		min-height: 84px;
		padding: 14px;
	}

	.nlaic-shell .panel-heading > div {
		gap: 6px;
	}

	.nlaic-shell .panel-heading {
		padding-inline: 2px;
	}

	.nlaic-shell .subtle-copy {
		display: inline-flex;
		align-items: center;
		max-width: none;
		padding: 6px 9px;
		border-radius: 999px;
		background: var(--panel-soft);
		border: 1px solid var(--line);
		line-height: 1;
	}

	.nlaic-shell .action-rail,
	.nlaic-shell .variation-row {
		margin-inline: -2px;
		padding-inline: 2px;
	}

	.nlaic-shell .rail-pill {
		padding: 10px 12px;
		min-height: 48px;
		justify-content: start;
		border-radius: 16px;
	}

	.nlaic-shell .variation-card {
		min-height: 74px;
		border-radius: 16px;
		padding: 12px;
	}

	.nlaic-shell .action-rail {
		grid-auto-columns: minmax(132px, 1fr);
		gap: 8px;
	}

	.nlaic-shell .variation-row {
		grid-auto-columns: minmax(124px, 1fr);
		gap: 8px;
	}

	.nlaic-shell .edit-dock,
	.nlaic-shell .modal-edit-dock {
		grid-auto-columns: 52px;
		gap: 8px;
		padding: 0;
		border-radius: 0;
		background: transparent;
		border: 0;
	}

	.nlaic-shell .edit-tool {
		border-radius: 14px;
	}

	.nlaic-shell .editor-stage {
		gap: 8px;
	}

	.nlaic-shell .art-frame {
		padding: 8px;
		border-radius: 18px;
		background: rgba(21, 27, 34, 0.78);
	}

	.nlaic-shell .art-surface {
		min-height: 252px;
		border-radius: 18px;
	}

	.nlaic-shell .art-caption {
		left: 12px;
		right: 12px;
		bottom: 12px;
		padding: 10px 12px;
		border-radius: 14px;
		flex-direction: column;
		align-items: start;
		gap: 6px;
	}

	.nlaic-shell .art-expand-indicator {
		top: 12px;
		right: 12px;
		width: 36px;
		height: 36px;
	}

	.nlaic-shell .field-inline {
		align-items: start;
		flex-direction: column;
		gap: 6px;
	}

	.nlaic-shell .range-meta {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		width: 100%;
	}

	.nlaic-shell .title-tooltip::after,
	.nlaic-shell .edit-tool::after {
		left: 50%;
		top: auto;
		bottom: calc(100% + 10px);
		width: min(220px, calc(100vw - 48px));
		transform: translateX(-50%) translateY(4px);
	}

	.nlaic-shell .title-tooltip:hover::after,
	.nlaic-shell .title-tooltip:focus-visible::after,
	.nlaic-shell .edit-tool:hover::after,
	.nlaic-shell .edit-tool:focus-visible::after {
		transform: translateX(-50%) translateY(0);
	}

	.nlaic-shell .art-modal {
		padding: 12px;
	}

	.nlaic-shell .art-modal-panel {
		padding: 14px;
		max-height: calc(100vh - 24px);
	}

	.nlaic-shell .art-modal-stage {
		padding: 12px;
	}

	.nlaic-shell .art-modal-image,
	.nlaic-shell .art-modal-surface {
		border-radius: 18px;
	}

	.nlaic-shell .zoom-slider-group {
		min-width: 0;
	}

	.nlaic-shell .expansion-card,
	.nlaic-shell .next-step-card {
		padding: 14px;
		border-radius: 18px;
	}

	.nlaic-shell .variation-strip {
		gap: 8px;
	}

	.nlaic-shell .workspace-grid {
		gap: 12px;
	}
}

@media (max-width: 420px) {
	.nlaic-shell .topbar {
		gap: 10px;
	}

	.nlaic-shell .subtle-copy {
		font-size: 0.72rem;
	}

	.nlaic-shell .preview-panel,
	.nlaic-shell .control-panel {
		padding: 12px;
	}

	.nlaic-shell .preview-panel {
		padding: 0;
	}

	.nlaic-shell .action-rail {
		grid-auto-columns: minmax(124px, 1fr);
	}

	.nlaic-shell .variation-row {
		grid-auto-columns: minmax(118px, 1fr);
	}

	.nlaic-shell .art-surface {
		min-height: 228px;
	}

	.nlaic-shell .next-step-button strong,
	.nlaic-shell .reference-card strong {
		font-size: 0.92rem;
	}

	.nlaic-shell .rail-pill {
		min-height: 46px;
		padding: 9px 11px;
	}

	.nlaic-shell .edit-dock,
	.nlaic-shell .modal-edit-dock {
		grid-auto-columns: 48px;
	}
}

/* ------------------------------------------------------------------ */
/*  Tool Action Panels (erase / expand)                                */
/* ------------------------------------------------------------------ */

/* AI Expand: hidden in the studio UI (backend /expand REST route unchanged). */
.nlaic-shell .rail-pill[data-rail="expand"],
.nlaic-shell [id^="expand-panel"] {
	display: none !important;
}

.nlaic-shell .art-expand-indicator {
	display: none !important;
}

.nlaic-shell .tool-action-panel {
	padding: 18px 20px;
	border-radius: 22px;
	background: var(--panel-soft);
	border: 1px solid var(--line);
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.nlaic-shell .tool-action-panel .eyebrow {
	margin-bottom: 2px;
}

.nlaic-shell .tool-panel-hint {
	font-size: 0.82rem;
	color: var(--muted);
	line-height: 1.5;
	margin: 0;
}

.nlaic-shell .tool-panel-row {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.nlaic-shell .tool-panel-actions {
	display: flex;
	gap: 10px;
}

.nlaic-shell .tool-panel-actions .primary-button,
.nlaic-shell .tool-panel-actions .secondary-button {
	width: auto;
	flex: 1;
	padding: 11px 16px;
}

/* ------------------------------------------------------------------ */
/*  Expand Panel — direction grid                                      */
/* ------------------------------------------------------------------ */

.nlaic-shell .direction-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.nlaic-shell .dir-btn {
	padding: 8px 14px;
	border-radius: var(--radius-sm);
	background: var(--bg-elevated);
	border: 1px solid var(--line);
	color: var(--muted);
	font-size: 0.82rem;
	font-weight: 700;
}

.nlaic-shell .dir-btn.is-active {
	background: var(--accent);
	color: var(--bg);
	border-color: transparent;
}

/* ------------------------------------------------------------------ */
/*  Edit tool control panel (glyph → shows matching sub-panel)         */
/* ------------------------------------------------------------------ */

.nlaic-shell .edit-tool-panel {
	gap: 16px;
}

.nlaic-shell .edit-sub-panel {
	display: none;
}

.nlaic-shell .edit-sub-panel:not([hidden]) {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.nlaic-shell .crop-grid,
.nlaic-shell .text-tool-grid,
.nlaic-shell .shape-tool-grid {
	display: grid;
	gap: 10px;
}

.nlaic-shell .crop-grid {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.nlaic-shell .text-tool-grid {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.nlaic-shell .shape-tool-grid {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.nlaic-shell .nlaic-color-input {
	width: 100%;
	height: 42px;
	padding: 4px 6px;
	border-radius: 10px;
	background: var(--bg-elevated);
	border: 1px solid var(--line);
	cursor: pointer;
}

/* ------------------------------------------------------------------ */
/*  Tool panels — text inputs (erase / expand)                         */
/* ------------------------------------------------------------------ */

.nlaic-shell .nlaic-text-input {
	width: 100%;
	color: var(--text);
	-webkit-text-fill-color: var(--text);
	background: var(--bg-elevated);
	border: 1px solid var(--line);
	border-radius: 14px;
	padding: 11px 14px;
	outline: none;
	font: inherit;
	caret-color: var(--text);
	transition: border-color 160ms ease;
}

.nlaic-shell .nlaic-text-input:focus {
	border-color: rgba(255, 255, 255, 0.2);
}

/* ------------------------------------------------------------------ */
/*  Erase Mask Canvas (inside modal)                                   */
/* ------------------------------------------------------------------ */

.nlaic-shell .erase-mask-canvas {
	display: none;
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border-radius: 22px;
	cursor: crosshair;
	z-index: 10;
	touch-action: none;
}

.nlaic-shell .art-modal-canvas {
	position: relative;
}

/* ------------------------------------------------------------------ */
/*  Erase brush controls (floating in modal)                           */
/* ------------------------------------------------------------------ */

.nlaic-shell .erase-brush-controls {
	position: absolute;
	top: 14px;
	left: 14px;
	z-index: 20;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 14px;
	border-radius: 999px;
	background: rgba(11, 13, 16, 0.82);
	border: 1px solid rgba(255, 255, 255, 0.14);
	backdrop-filter: blur(10px);
	color: #f4f6f8;
	font-size: 0.78rem;
	font-weight: 700;
}

.nlaic-shell .erase-brush-controls input[type="range"] {
	width: 100px;
	accent-color: #f4f6f8;
}

/* ------------------------------------------------------------------ */
/*  Mint NFT — enabled state                                           */
/* ------------------------------------------------------------------ */

.nlaic-shell .rail-pill#mint-nft-btn:not(:disabled) {
	border-color: var(--line);
	background: transparent;
	color: var(--muted);
}

.nlaic-shell .rail-pill#mint-nft-btn:not(:disabled):hover {
	background: var(--panel-soft);
	color: var(--text);
}

/* ------------------------------------------------------------------ */
/*  Responsive — tool panels                                           */
/* ------------------------------------------------------------------ */

@media (max-width: 680px) {
	.nlaic-shell .crop-grid,
	.nlaic-shell .shape-tool-grid {
		grid-template-columns: 1fr;
	}

	.nlaic-shell .text-tool-grid {
		grid-template-columns: 1fr;
	}

	.nlaic-shell .tool-panel-actions {
		flex-direction: column;
	}
}
