/* ==========================================================================
   Zandrelo AI Suite — frontend styles
   Concept: a darkroom (image side) crossed with a terminal (code side).
   The amber accent reads as a photographic safelight; the cyan accent
   reads as a phosphor terminal. Both live on one shared charcoal base.
   All selectors are scoped under .zandrelo-suite to stay out of the
   host theme's way.
   ========================================================================== */

.zandrelo-suite {
	--zdr-bg: #18161a;
	--zdr-surface: #221f26;
	--zdr-surface-raised: #2b2731;
	--zdr-border: #3a3640;
	--zdr-text: #f0eae2;
	--zdr-text-muted: #a89f9a;
	--zdr-image: #e8622c;
	--zdr-image-dim: rgba(232, 98, 44, 0.14);
	--zdr-code: #4dd9c0;
	--zdr-code-dim: rgba(77, 217, 192, 0.14);
	--zdr-accent: var(--zdr-image);
	--zdr-accent-dim: var(--zdr-image-dim);

	all: initial;
	box-sizing: border-box;
	display: block;
	max-width: 640px;
	margin: 2rem 0;
	background: var(--zdr-bg);
	border: 1px solid var(--zdr-border);
	border-radius: 10px;
	padding: 1.75rem;
	font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
	color: var(--zdr-text);
	-webkit-font-smoothing: antialiased;
}

.zandrelo-suite *,
.zandrelo-suite *::before,
.zandrelo-suite *::after {
	box-sizing: border-box;
	font-family: inherit;
	color: inherit;
}

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500&display=swap');

/* ---- Tabs (styled like physical toggle switches) ---- */

.zandrelo-tabs {
	display: flex;
	gap: 6px;
	margin-bottom: 1.25rem;
	padding: 4px;
	background: var(--zdr-surface);
	border: 1px solid var(--zdr-border);
	border-radius: 8px;
	width: fit-content;
}

.zandrelo-tab {
	appearance: none;
	border: none;
	background: transparent;
	color: var(--zdr-text-muted);
	font-family: 'IBM Plex Mono', monospace;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	padding: 7px 16px;
	border-radius: 5px;
	cursor: pointer;
	transition: color 0.15s ease, background-color 0.15s ease;
}

.zandrelo-tab:hover {
	color: var(--zdr-text);
}

.zandrelo-tab[data-tool="image"].is-active {
	background: var(--zdr-image-dim);
	color: var(--zdr-image);
}

.zandrelo-tab[data-tool="code"].is-active {
	background: var(--zdr-code-dim);
	color: var(--zdr-code);
}

/* ---- Panels ---- */

.zandrelo-panel {
	display: none;
}

.zandrelo-panel.is-active {
	display: block;
	animation: zdr-fade-in 0.2s ease;
}

.zandrelo-panel[data-accent="image"] {
	--zdr-accent: var(--zdr-image);
	--zdr-accent-dim: var(--zdr-image-dim);
}

.zandrelo-panel[data-accent="code"] {
	--zdr-accent: var(--zdr-code);
	--zdr-accent-dim: var(--zdr-code-dim);
}

@keyframes zdr-fade-in {
	from { opacity: 0; transform: translateY(2px); }
	to { opacity: 1; transform: translateY(0); }
}

.zandrelo-label {
	display: block;
	font-family: 'IBM Plex Mono', monospace;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--zdr-accent);
	margin-bottom: 8px;
}

.zandrelo-prompt {
	all: revert;
	box-sizing: border-box;
	display: block;
	width: 100%;
	background: var(--zdr-surface);
	border: 1px solid var(--zdr-border);
	border-radius: 6px;
	color: var(--zdr-text);
	font-family: 'IBM Plex Sans', sans-serif;
	font-size: 14px;
	line-height: 1.5;
	padding: 12px 14px;
	resize: vertical;
	min-height: 76px;
	outline: none;
	transition: border-color 0.15s ease;
}

.zandrelo-prompt::placeholder {
	color: var(--zdr-text-muted);
	opacity: 0.75;
}

.zandrelo-prompt:focus {
	border-color: var(--zdr-accent);
}

/* ---- Controls row ---- */

.zandrelo-controls {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 12px;
}

.zandrelo-generate-btn {
	all: revert;
	box-sizing: border-box;
	appearance: none;
	border: 1px solid var(--zdr-accent);
	background: var(--zdr-accent-dim);
	color: var(--zdr-accent);
	font-family: 'IBM Plex Mono', monospace;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	padding: 9px 20px;
	border-radius: 6px;
	cursor: pointer;
	transition: background-color 0.15s ease, transform 0.1s ease;
}

.zandrelo-generate-btn:hover:not(:disabled) {
	background: var(--zdr-accent);
	color: var(--zdr-bg);
}

.zandrelo-generate-btn:active:not(:disabled) {
	transform: scale(0.98);
}

.zandrelo-generate-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.zandrelo-remaining {
	font-family: 'IBM Plex Mono', monospace;
	font-size: 11px;
	color: var(--zdr-text-muted);
	letter-spacing: 0.04em;
}

/* ---- Signature element: the exposure meter ----
   A row of notches that light up left-to-right like a light meter /
   VU meter while a generation is in flight. Hidden at rest. */

.zandrelo-meter {
	display: none;
	gap: 4px;
	margin-top: 14px;
}

.zandrelo-panel.is-generating .zandrelo-meter {
	display: flex;
}

.zandrelo-meter span {
	flex: 1;
	height: 5px;
	background: var(--zdr-surface-raised);
	border-radius: 2px;
	overflow: hidden;
	position: relative;
}

.zandrelo-panel.is-generating .zandrelo-meter span {
	background: var(--zdr-accent-dim);
}

.zandrelo-panel.is-generating .zandrelo-meter span::after {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--zdr-accent);
	animation: zdr-meter-tick 1.4s ease-in-out infinite;
}

.zandrelo-meter span:nth-child(1)::after { animation-delay: 0.0s; }
.zandrelo-meter span:nth-child(2)::after { animation-delay: 0.08s; }
.zandrelo-meter span:nth-child(3)::after { animation-delay: 0.16s; }
.zandrelo-meter span:nth-child(4)::after { animation-delay: 0.24s; }
.zandrelo-meter span:nth-child(5)::after { animation-delay: 0.32s; }
.zandrelo-meter span:nth-child(6)::after { animation-delay: 0.40s; }
.zandrelo-meter span:nth-child(7)::after { animation-delay: 0.48s; }
.zandrelo-meter span:nth-child(8)::after { animation-delay: 0.56s; }

@keyframes zdr-meter-tick {
	0%, 100% { opacity: 0.15; }
	50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
	.zandrelo-panel.is-generating .zandrelo-meter span::after {
		animation: none;
		opacity: 0.6;
	}
	.zandrelo-panel.is-active {
		animation: none;
	}
}

/* ---- Error state ---- */

.zandrelo-error {
	display: none;
	margin-top: 12px;
	padding: 10px 12px;
	border: 1px solid var(--zdr-accent);
	border-radius: 6px;
	background: var(--zdr-accent-dim);
	color: var(--zdr-text);
	font-size: 13px;
	line-height: 1.4;
}

.zandrelo-error.is-visible {
	display: block;
}

/* ---- Result area ---- */

.zandrelo-result {
	margin-top: 16px;
}

.zandrelo-result-empty {
	border: 1px dashed var(--zdr-border);
	border-radius: 6px;
	padding: 28px 16px;
	text-align: center;
	color: var(--zdr-text-muted);
	font-size: 13px;
}

/* Image result: framed like a print sitting in a tray */
.zandrelo-result-image {
	border: 1px solid var(--zdr-border);
	border-radius: 6px;
	padding: 10px;
	background: var(--zdr-surface);
}

.zandrelo-result-image img {
	all: revert;
	display: block;
	width: 100%;
	height: auto;
	border-radius: 3px;
}

.zandrelo-result-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 10px;
}

.zandrelo-action-btn {
	all: revert;
	appearance: none;
	border: 1px solid var(--zdr-border);
	background: var(--zdr-surface-raised);
	color: var(--zdr-text);
	font-family: 'IBM Plex Mono', monospace;
	font-size: 11px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	padding: 6px 12px;
	border-radius: 5px;
	cursor: pointer;
	text-decoration: none;
	display: inline-block;
}

.zandrelo-action-btn:hover {
	border-color: var(--zdr-accent);
	color: var(--zdr-accent);
}

/* Code result: terminal-style inset panel */
.zandrelo-result-code {
	position: relative;
	border: 1px solid var(--zdr-border);
	border-radius: 6px;
	background: #131217;
}

.zandrelo-result-code pre {
	all: revert;
	margin: 0;
	padding: 16px;
	overflow-x: auto;
	font-family: 'IBM Plex Mono', monospace;
	font-size: 13px;
	line-height: 1.6;
	color: var(--zdr-text);
	white-space: pre-wrap;
	word-break: break-word;
}

.zandrelo-result-code .zandrelo-result-actions {
	padding: 8px 12px 12px;
	margin-top: 0;
}

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

@media (max-width: 480px) {
	.zandrelo-suite {
		padding: 1.1rem;
		border-radius: 8px;
	}
	.zandrelo-controls {
		flex-wrap: wrap;
		gap: 10px;
	}
}

/* ---- Accessibility: visible keyboard focus ---- */

.zandrelo-suite button:focus-visible,
.zandrelo-suite textarea:focus-visible {
	outline: 2px solid var(--zdr-accent);
	outline-offset: 2px;
}
