/* CSS Custom Properties - Light Mode (default) */
:root {
	/* Layout */
	--ii-sidebar-width: 260px;
	--ii-assets-sidebar-width: 288px;
	--ii-rec-panel-width: 288px;
	--header-sidebar-height: 3rem;

	/* Backgrounds */
	--ii-bg-primary: #f3f4f6;
	--ii-surface-white: #fafafa;
	--ii-bg-secondary: #f9fafb;
	--ii-bg-tertiary: #f3f4f6;
	--ii-bg-hover: #e5e7eb;
	--ii-bg-active: #d1d5db;

	/* Text */
	--ii-text-primary: #111827;
	--ii-text-secondary: #374151;
	--ii-text-tertiary: #525d6b;

	/* Accent / Brand */
	--ii-accent: #2563eb;
	--ii-accent-hover: #1d4ed8;
	--ii-accent-dim: rgba(37, 99, 235, 0.1);
	--ii-primary: #0d5fff;
	--ii-primary-tinted: #f0f4ff;
	--ii-primary-hover: #333333;

	/* Borders & Dividers */
	--ii-border: #e5e7eb;

	/* Gradients */
	--ii-gradient-start: #232526;
	--ii-gradient-mid: #414345;
	--ii-gradient-end: #1a1a1a;

	/* Inputs */
	--ii-input-bg: #ffffff;

	/* Shadows */
	--ii-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
	--ii-shadow-elegant:
		0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);

	/* Radius */
	--ii-radius-sm: 8px;
	--ii-radius-md: 12px;
	--ii-radius-lg: 16px;
	--ii-radius-rounded: 20px;
	--ii-radius-lgx: 24px;
	--ii-radius-xl: 32px;

	/* Motion */
	--ii-transition: 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);

	/* Typography */
	--ii-font-display: Inter, sans-serif;
	--ii-font-body: Inter, sans-serif;

	/* Toast system */
	--ai-toast-bg: #ffffff;
	--ai-toast-border: rgba(0, 0, 0, 0.08);
	--ai-toast-shadow:
		0 4px 24px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
	--ai-toast-radius: 12px;
	--ai-toast-text-primary: #111827;
	--ai-toast-text-secondary: #4b5563;
	--ai-toast-error: #ef4444;

	/* Toast System Semantic Helpers */
	--ai-toast-close-hover: rgba(0, 0, 0, 0.05);
	--ai-toast-progress-track: rgba(0, 0, 0, 0.08);
	--ai-toast-action-bg: rgba(0, 0, 0, 0.05);
	--ai-toast-action-border: rgba(0, 0, 0, 0.08);
	--ai-toast-action-hover-bg: rgba(0, 0, 0, 0.08);
	--ai-toast-action-hover-border: rgba(0, 0, 0, 0.12);
	--ai-toast-btn-border: rgba(0, 0, 0, 0.12);
	--ai-toast-btn-hover-bg: rgba(0, 0, 0, 0.05);
	--ai-toast-upload-fill: rgba(0, 0, 0, 0.75);

	/* Image Viewer system */
	--ii-viewer-backdrop-bg: rgba(255, 255, 255, 0.92);
	--ii-viewer-bg: #ffffff;
	--ii-viewer-sidebar-bg: #f9fafb;
	--ii-viewer-border: #e5e7eb;
	--ii-viewer-shadow:
		0 32px 80px rgba(0, 0, 0, 0.12), 0 8px 24px rgba(0, 0, 0, 0.06);
	--ii-viewer-text-primary: #111827;
	--ii-viewer-text-secondary: #374151;
	--ii-viewer-text-faint: #525d6b;
	--ii-viewer-control-bg: rgba(0, 0, 0, 0.04);
	--ii-viewer-control-border: rgba(0, 0, 0, 0.08);
	--ii-viewer-control-hover-bg: rgba(0, 0, 0, 0.08);
	--ii-viewer-control-hover-border: rgba(0, 0, 0, 0.12);
	--ii-viewer-control-text: #374151;
	--ii-viewer-control-hover-text: #111827;
	--ii-viewer-nav-bg: rgba(255, 255, 255, 0.9);
	--ii-viewer-nav-border: #e5e7eb;
	--ii-viewer-nav-hover-bg: #ffffff;
	--ii-viewer-nav-color: #374151;
	--ii-viewer-nav-color-hover: #111827;
	--ii-viewer-skeleton-base: linear-gradient(
		90deg,
		#f3f4f6 25%,
		#e5e7eb 50%,
		#f3f4f6 75%
	);
	--ii-viewer-sidebar-skeleton-base: linear-gradient(
		90deg,
		#f3f4f6 25%,
		#e5e7eb 50%,
		#f3f4f6 75%
	);
	--ii-viewer-zoom-track: rgba(0, 0, 0, 0.15);
	--ii-viewer-zoom-pct-color: #525d6b;
	--ii-viewer-zoom-reset-color: #525d6b;
	--ii-viewer-zoom-reset-hover-color: #374151;
	--ii-viewer-badge-bg: #f3f4f6;
	--ii-viewer-badge-border: #e5e7eb;
	--ii-viewer-badge-text: #374151;
	--ii-viewer-brand-color: #2563eb;
	--ii-viewer-brand-hover-color: #1d4ed8;
	--ii-viewer-author-avatar-bg: #f3f4f6;
	--ii-viewer-author-avatar-border: #e5e7eb;
	--ii-viewer-author-avatar-icon: #525d6b;
	--ii-viewer-author-btn-bg: #ffffff;
	--ii-viewer-author-btn-border: #cbd5e1;
	--ii-viewer-author-btn-text: #374151;
	--ii-viewer-author-btn-hover-bg: #f1f5f9;
	--ii-viewer-author-btn-hover-border: #94a3b8;
	--ii-viewer-workspace-btn-text: #2563eb;
	--ii-viewer-workspace-btn-hover-text: #1d4ed8;

	/* SEMANTIC TOKENS - redefine only what changes in [data-theme="dark"] below */

	/* Sticky section-title backdrop (sidebar) */
	--ii-sticky-title-bg: rgba(255, 255, 255, 0.8);

	/* Checkbox */
	--ii-checkbox-bg: #fafafa;
	--ii-checkbox-border: #d1d5db;

	/* Empty / "add assets" button */
	--ii-empty-btn-bg: #fafbfc;
	--ii-empty-btn-border: #cbd5e1;
	--ii-empty-btn-hover-bg: #f1f5f9;
	--ii-muted-icon: #64748b;

	/* Input row glass surface */
	--ii-input-row-bg: rgba(255, 255, 255, 0.7);

	/* Popper / dropdown menu */
	--ii-popper-bg: #fafafa;
	--ii-popper-border: rgba(0, 0, 0, 0.08);
	--ii-popper-separator: rgba(0, 0, 0, 0.08);
	--ii-popper-shadow:
		0 10px 38px -10px rgba(22, 23, 24, 0.35),
		0 10px 20px -15px rgba(22, 23, 24, 0.2);

	/* Danger / destructive actions */
	--ii-danger: #dc2626;
	--ii-danger-text: #dc2626;
	--ii-danger-solid: #ef4444;
	--ii-danger-solid-border: #dc2626;
	--ii-danger-solid-text: #ffffff;
	--ii-danger-bg: rgba(239, 68, 68, 0.07);
	--ii-danger-border: rgba(239, 68, 68, 0.28);
	--ii-danger-badge-bg: rgba(239, 68, 68, 0.1);
	--ii-danger-badge-border: rgba(239, 68, 68, 0.22);

	/* Error / warning message blocks */
	--ii-error-msg-bg: #fffcfc;
	--ii-error-msg-border: #fee2e2;
	--ii-error-text: #b91c1c;
	--ii-retry-bg: #ffffff;
	--ii-retry-border: #fecaca;
	--ii-retry-color: #dc2626;
	--ii-retry-hover-bg: #fef2f2;
	--ii-retry-hover-border: #fca5a5;

	/* Bulk action bar */
	--ii-bulk-bar-bg: #fafafa;
	--ii-bulk-bar-shadow:
		0 -4px 16px rgba(0, 0, 0, 0.06), 0 -1px 4px rgba(0, 0, 0, 0.04);

	/* Image download overlay button */
	--ii-img-dl-btn-bg: rgba(255, 255, 255, 0.92);

	/* Image-mode modal close button (floats over the always-dark blurred backdrop) */
	--ii-modal-image-close-bg: rgba(17, 24, 39, 0.45);
	--ii-modal-image-close-bg-hover: rgba(17, 24, 39, 0.75);
	--ii-modal-image-close-icon: #ffffff;

	/* Skeleton loading placeholders */
	--ii-skeleton-base: #eeeeee;
	--ii-skeleton-shimmer-1: #f3f4f6;
	--ii-skeleton-shimmer-2: #e5e7eb;
	--ii-skeleton-btn-bg: #f3f4f6;
	--ii-skeleton-send-bg: #f0f4ff;

	--separator-spacing: 0.37rem;
}

/* CSS Custom Properties - Dark Mode */
[data-theme='dark'] {
	color-scheme: dark;

	/* Dark palette foundation */
	--ii-dk-base: #0b0b0e;
	--ii-dk-surface-1: #111116;
	--ii-dk-surface-2: #18181e;
	--ii-dk-surface-3: #1f1f26;
	--ii-dk-hover: #262630;
	--ii-dk-active: #2e2e3a;
	--ii-dk-border: #28282f;
	--ii-dk-text-primary: #e5e5ea;
	--ii-dk-text-secondary: #b2b2be;
	/* bumped from #7c7c88 for readability */
	--ii-dk-text-faint: #8a8a96;
	/* bumped from #4a4a56 for readability */
	--ii-dk-text-body: #d0d0d8;
	/* bumped from #c2c2cc */
	--ii-dk-link: #5b96f7;
	--ii-dk-link-hover: #81b0fa;
	--ii-dk-error-bg: #1e1212;
	--ii-dk-error-border: rgba(239, 68, 68, 0.22);
	--ii-dk-tooltip-bg: rgba(11, 11, 14, 0.96);
	--ii-dk-shimmer-base: #18181e;
	--ii-dk-shimmer-peak: #1f1f26;

	/* Studio UI token overrides */
	--ii-bg-primary: #0b0b0e;
	--ii-surface-white: #111116;
	--ii-bg-secondary: #18181e;
	--ii-bg-tertiary: #1f1f26;
	--ii-bg-hover: #262630;
	--ii-bg-active: #2e2e3a;
	--ii-text-primary: #e5e5ea;
	--ii-text-secondary: #b2b2be;
	/* bumped from #7c7c88 - much more readable */
	--ii-text-tertiary: #8a8a96;
	/* bumped from #4a4a56 - visible but still subordinate */
	--ii-border: #28282f;
	--ii-accent: #3b82f6;
	--ii-accent-hover: #2563eb;
	--ii-accent-dim: rgba(59, 130, 246, 0.14);
	--ii-primary: #5b96f7;
	--ii-primary-tinted: rgba(59, 130, 246, 0.1);
	--ii-primary-hover: #e5e5ea;
	--ii-input-bg: #18181e;
	--ii-shadow: 0 1px 3px rgba(0, 0, 0, 0.55), 0 1px 2px rgba(0, 0, 0, 0.4);
	--ii-shadow-elegant:
		0 4px 6px -1px rgba(0, 0, 0, 0.55), 0 2px 4px -2px rgba(0, 0, 0, 0.4);

	/* Semantic token overrides */
	--ii-sticky-title-bg: rgba(17, 17, 22, 0.85);

	--ii-checkbox-bg: #18181e;
	--ii-checkbox-border: #28282f;

	--ii-empty-btn-bg: #18181e;
	--ii-empty-btn-border: #28282f;
	--ii-empty-btn-hover-bg: #262630;
	--ii-muted-icon: #b2b2be;
	/* bumped to match text-secondary */

	--ii-input-row-bg: rgba(17, 17, 22, 0.7);

	--ii-popper-bg: #18181e;
	--ii-popper-border: #28282f;
	--ii-popper-separator: #28282f;
	--ii-popper-shadow:
		0 10px 38px -10px rgba(0, 0, 0, 0.65),
		0 10px 20px -15px rgba(0, 0, 0, 0.45);

	/* Danger - slightly lighter red so it reads well on dark */
	--ii-danger: #f87171;
	--ii-danger-text: #f87171;
	--ii-danger-solid: #ef4444;
	--ii-danger-solid-border: #dc2626;
	--ii-danger-solid-text: #ffffff;
	--ii-danger-bg: rgba(239, 68, 68, 0.1);
	--ii-danger-border: rgba(239, 68, 68, 0.32);
	--ii-danger-badge-bg: rgba(239, 68, 68, 0.12);
	--ii-danger-badge-border: rgba(239, 68, 68, 0.28);

	--ii-error-msg-bg: #1e1212;
	--ii-error-msg-border: rgba(239, 68, 68, 0.22);
	--ii-error-text: #f87171;
	--ii-retry-bg: #18181e;
	--ii-retry-border: rgba(239, 68, 68, 0.3);
	--ii-retry-color: #f87171;
	--ii-retry-hover-bg: #262630;
	--ii-retry-hover-border: rgba(239, 68, 68, 0.5);

	--ii-bulk-bar-bg: #111116;
	--ii-bulk-bar-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4);

	--ii-img-dl-btn-bg: rgba(11, 11, 14, 0.88);

	--ii-modal-image-close-bg: rgba(255, 255, 255, 0.18);
	--ii-modal-image-close-bg-hover: rgba(255, 255, 255, 0.32);
	--ii-modal-image-close-icon: #ffffff;

	--ii-skeleton-base: #18181e;
	--ii-skeleton-shimmer-1: #18181e;
	--ii-skeleton-shimmer-2: #1f1f26;
	--ii-skeleton-btn-bg: #18181e;
	--ii-skeleton-send-bg: #1f1f26;

	/* Toast system overrides */
	--ai-toast-bg: #1c1c1e;
	--ai-toast-border: rgba(255, 255, 255, 0.08);
	--ai-toast-shadow:
		0 4px 24px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.4);
	--ai-toast-text-primary: #fafafa;
	--ai-toast-text-secondary: rgba(255, 255, 255, 0.5);
	--ai-toast-error: #f87171;

	/* Toast System Semantic Helpers Overrides */
	--ai-toast-close-hover: rgba(255, 255, 255, 0.08);
	--ai-toast-progress-track: rgba(255, 255, 255, 0.12);
	--ai-toast-action-bg: rgba(255, 255, 255, 0.12);
	--ai-toast-action-border: rgba(255, 255, 255, 0.2);
	--ai-toast-action-hover-bg: rgba(255, 255, 255, 0.22);
	--ai-toast-action-hover-border: rgba(255, 255, 255, 0.35);
	--ai-toast-btn-border: rgba(255, 255, 255, 0.25);
	--ai-toast-btn-hover-bg: rgba(255, 255, 255, 0.12);
	--ai-toast-upload-fill: rgba(255, 255, 255, 0.92);

	/* Image Viewer system overrides */
	--ii-viewer-backdrop-bg: rgba(17, 24, 39, 0.88);
	--ii-viewer-bg: #0d0e12;
	--ii-viewer-sidebar-bg: #13151c;
	--ii-viewer-border: rgba(255, 255, 255, 0.07);
	--ii-viewer-shadow:
		0 32px 80px rgba(0, 0, 0, 0.7), 0 8px 24px rgba(0, 0, 0, 0.4);
	--ii-viewer-text-primary: rgba(255, 255, 255, 0.88);
	--ii-viewer-text-secondary: rgba(255, 255, 255, 0.55);
	--ii-viewer-text-faint: rgba(255, 255, 255, 0.48);
	--ii-viewer-control-bg: rgba(255, 255, 255, 0.05);
	--ii-viewer-control-border: rgba(255, 255, 255, 0.1);
	--ii-viewer-control-hover-bg: rgba(255, 255, 255, 0.12);
	--ii-viewer-control-hover-border: rgba(255, 255, 255, 0.2);
	--ii-viewer-control-text: rgba(255, 255, 255, 0.6);
	--ii-viewer-control-hover-text: #ffffff;
	--ii-viewer-nav-bg: rgba(26, 29, 39, 0.75);
	--ii-viewer-nav-border: rgba(255, 255, 255, 0.12);
	--ii-viewer-nav-hover-bg: rgba(255, 255, 255, 0.16);
	--ii-viewer-nav-color: rgba(255, 255, 255, 0.8);
	--ii-viewer-nav-color-hover: #ffffff;
	--ii-viewer-skeleton-base: linear-gradient(
		90deg,
		#1a1c24 25%,
		#22242f 50%,
		#1a1c24 75%
	);
	--ii-viewer-sidebar-skeleton-base: linear-gradient(
		90deg,
		#1e2130 25%,
		#272a3a 50%,
		#1e2130 75%
	);
	--ii-viewer-zoom-track: rgba(255, 255, 255, 0.2);
	--ii-viewer-zoom-pct-color: rgba(255, 255, 255, 0.55);
	--ii-viewer-zoom-reset-color: rgba(255, 255, 255, 0.48);
	--ii-viewer-zoom-reset-hover-color: rgba(255, 255, 255, 0.75);
	--ii-viewer-badge-bg: rgba(255, 255, 255, 0.06);
	--ii-viewer-badge-border: rgba(255, 255, 255, 0.1);
	--ii-viewer-badge-text: rgba(255, 255, 255, 0.55);
	--ii-viewer-brand-color: rgba(96, 165, 250, 0.85);
	--ii-viewer-brand-hover-color: rgba(147, 197, 253, 1);
	--ii-viewer-author-avatar-bg: rgba(255, 255, 255, 0.06);
	--ii-viewer-author-avatar-border: rgba(255, 255, 255, 0.1);
	--ii-viewer-author-avatar-icon: rgba(255, 255, 255, 0.55);
	--ii-viewer-author-btn-bg: transparent;
	--ii-viewer-author-btn-border: rgba(255, 255, 255, 0.12);
	--ii-viewer-author-btn-text: rgba(255, 255, 255, 0.55);
	--ii-viewer-author-btn-hover-bg: rgba(255, 255, 255, 0.07);
	--ii-viewer-author-btn-hover-border: rgba(255, 255, 255, 0.2);
	--ii-viewer-workspace-btn-text: rgba(147, 185, 255, 0.85);
	--ii-viewer-workspace-btn-hover-text: rgb(147, 185, 255);
}

[data-theme='light'] .ii-bubble-back {
	border-color: rgba(0, 0, 0, 0.08);
	background: rgba(255, 255, 255, 0.72);
}

[data-theme='light'] .ii-bubble-front {
	box-shadow:
		0 4px 18px rgba(0, 0, 0, 0.12),
		0 1px 4px rgba(0, 0, 0, 0.08);
	border-color: rgba(0, 0, 0, 0.08);
}

[data-theme='light'] .ii-bubble-stack:hover .ii-bubble-front,
[data-theme='light'] .ii-bubble-stack:focus-visible .ii-bubble-front {
	box-shadow:
		0 8px 28px rgba(0, 0, 0, 0.16),
		0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme='light'] .ii-bubble-back--1 {
	opacity: 0.72;
}

[data-theme='light'] .ii-bubble-back--2 {
	opacity: 0.5;
}

[data-theme='light'] .ii-bubble-back--3 {
	opacity: 0.3;
}

[data-theme='light'] .ii-bubble-stack:hover .ii-bubble-back--1,
[data-theme='light'] .ii-bubble-stack:focus-visible .ii-bubble-back--1 {
	opacity: 0.8;
}

[data-theme='light'] .ii-bubble-stack:hover .ii-bubble-back--2,
[data-theme='light'] .ii-bubble-stack:focus-visible .ii-bubble-back--2 {
	opacity: 0.56;
}

[data-theme='light'] .ii-bubble-stack:hover .ii-bubble-back--3,
[data-theme='light'] .ii-bubble-stack:focus-visible .ii-bubble-back--3 {
	opacity: 0.34;
}

[data-theme='light'] .ii-bubble-count {
	background: rgba(0, 0, 0, 0.42);
}

[data-theme='light'] .ii-creations-show-more-btn {
	color: var(--ii-text-secondary);
}

[data-theme='light'] .ii-creation-skeleton-card,
[data-theme='light'] .ii-creations-skeleton-group-title {
	background: rgba(0, 0, 0, 0.06);
}

@media (max-width: 1024px) {
	:root {
		--ii-sidebar-width: 260px;
	}
}
