/* Main Content */
.ii-main {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-width: 0;
	position: relative;
	background: var(--ii-bg-primary);
}

[data-theme='dark'] .ii-main {
	background: var(--ii-dk-surface-1);
}

/* Chat Area */
/* ---- Chat area: disable browser scroll anchoring ----
   Without this, DOM mutations above the viewport (tab re-renders,
   badge outerHTML swaps, height lock/unlock) cause the browser to
   auto-adjust scrollTop, making the page jump to the bottom.     */
#iiChatArea {
	overflow-anchor: none;
}

.ii-chat-area {
	flex: 1;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	padding: 32px;
	transition:
		padding-bottom 0.2s ease,
		opacity 0.3s ease,
		visibility 0.3s ease;
}

/* Welcome Screen */
.ii-welcome {
	display: none;
}

/* Welcome Header */
.ii-welcome-header {
	margin-bottom: 18px;
	width: 100%;
	display: none;
}

.ii-main.is-empty .ii-welcome-header {
	display: block;
}

.ii-welcome-header h1 {
	text-align: center;
	font-size: 3.3rem;
	line-height: 1.2;
	font-weight: 500;
	letter-spacing: -1px;
	color: var(--ii-text-primary);
}

/* Suggestion Cards */
.ii-welcome-suggestions {
	display: none;
	flex-direction: row;
	flex-wrap: nowrap;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	gap: 6px;
	width: 100%;
	position: relative;
	margin-top: 12px;
	padding: 0 0 4px;
}

.ii-welcome-suggestions::-webkit-scrollbar {
	display: none;
}

/* Only show when the main area is empty (no messages yet) */
.ii-main.is-empty .ii-welcome-suggestions {
	display: flex;
}

.ii-suggestion-card {
	flex: 1 1 160px;
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	background: var(--ii-surface-white);
	border: 1px solid var(--ii-border);
	border-radius: 50px;
	cursor: pointer;
	text-align: left;
	position: relative;
	overflow: hidden;
	white-space: normal;
	font-family: var(--ii-font-body, Inter, sans-serif);
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
	transition:
		border-color 0.18s ease,
		translate 0.18s cubic-bezier(0.2, 0.8, 0.2, 1),
		scale 0.18s cubic-bezier(0.2, 0.8, 0.2, 1),
		box-shadow 0.18s ease;
}

.ii-suggestion-card:hover {
	background: var(--ii-input-bg);
	border-color: var(--ii-border);
	translate: 0 -2px;
	box-shadow:
		0 8px 24px rgba(0, 0, 0, 0.08),
		0 2px 6px rgba(0, 0, 0, 0.04);
}

.ii-suggestion-card:active {
	translate: 0 0;
	scale: 0.97;
	box-shadow: none;
}

/* Welcome Entrance Animations */
@keyframes ii-header-in {
	from {
		opacity: 0;
		transform: translateY(70px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes ii-card-in {
	from {
		opacity: 0;
		translate: 0 -16px;
	}

	to {
		opacity: 1;
		translate: 0 0;
	}
}

.ii-main.is-empty .ii-welcome-header {
	animation: ii-header-in 1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.ii-main.is-empty .ii-suggestion-card {
	animation: ii-card-in 0.48s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.ii-main.is-empty .ii-suggestion-card:nth-child(1) {
	animation-delay: 160ms;
}

.ii-main.is-empty .ii-suggestion-card:nth-child(2) {
	animation-delay: 230ms;
}

.ii-main.is-empty .ii-suggestion-card:nth-child(3) {
	animation-delay: 300ms;
}

.ii-main.is-empty .ii-suggestion-card:nth-child(4) {
	animation-delay: 370ms;
}

.ii-main.is-empty .ii-suggestion-card:nth-child(5) {
	animation-delay: 440ms;
}

/* Card title */
.ii-suggestion-title {
	font-size: 13px;
	font-weight: 600;
	color: var(--ii-text-primary);
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	flex: 1;
	min-width: 0;
}

/* "More Presets" button spans both columns */
.ii-welcome-suggestions-footer {
	grid-column: 1 / -1;
	display: flex;
	justify-content: center;
	margin-top: 2px;
}

.ii-more-presets-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 18px;
	border: 1.5px dashed var(--ii-border);
	border-radius: var(--ii-radius-rounded);
	background: transparent;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--ii-text-secondary);
	cursor: pointer;
	font-family: var(--ii-font-body, Inter, sans-serif);
	outline: none;
	-webkit-tap-highlight-color: transparent;
	transition:
		border-color 0.16s ease,
		color 0.16s ease,
		background 0.16s ease;
}

.ii-more-presets-btn svg {
	flex-shrink: 0;
	transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ii-more-presets-btn:hover {
	border-color: var(--ii-accent);
	border-style: solid;
	color: var(--ii-accent);
	background: var(--ii-accent-dim);
}

.ii-more-presets-btn:hover svg {
	transform: rotate(90deg);
}

.ii-more-presets-btn:focus-visible {
	box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.28);
}

/* Chat Lazy Loading */
.ii-chat-sentinel {
	height: 1px;
	width: 100%;
	flex-shrink: 0;
}

.ii-chat-spinner {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 16px;
	width: 100%;
}

/* Messages */
.ii-messages {
	max-width: 860px;
	width: 100%;
	margin: 0 auto;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 24px;
}

/* .ii-message {
    padding: 16px;
    border-radius: 16px;
    background: var(--ii-surface-white);
    border: 1px solid var(--ii-border);
    box-shadow: var(--ii-shadow);
    width: 100%;
display: flex;
flex-direction: column;
gap: 12px;
animation: iiFadeIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

*/
.ii-message.user,
.ii-message.ai {
	padding: 16px 20px;
	background: var(--ii-bg-primary);
	border-radius: 16px;
	border: 1px solid var(--ii-border);
	overflow: hidden;
	margin-bottom: 0;
	box-shadow: none;
}

.ii-message.ai {
	background: var(--ii-surface-white);
	align-self: flex-start;
}

.ii-message-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.ii-message.ai .ii-message-header,
.ii-message.user .ii-message-header {
	margin-bottom: 6px;
}

.ii-message-avatar-group {
	display: flex;
	align-items: center;
	gap: 8px;
}

.ii-message-avatar {
	flex-shrink: 0;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-family: var(--ii-font-display);
	font-weight: 600;
}

.ii-message.user .ii-message-avatar {
	background: var(--ii-bg-tertiary);
	color: var(--ii-text-primary);
}

.ii-message.ai .ii-message-avatar {
	background: linear-gradient(
		135deg,
		var(--ii-gradient-start),
		var(--ii-gradient-end)
	);
	color: #fff;
	border-radius: 6px;
}

.ii-message-name {
	font-size: 13px;
	font-weight: 600;
	color: var(--ii-text-primary);
}

.ii-message.user .ii-message-name {
	font-size: 10px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--ii-text-tertiary);
	white-space: nowrap;
	margin-right: 3px;
	flex-shrink: 0;
}

.ii-message-content {
	flex: 1;
	min-width: 0;
}

.ii-message-content p {
	margin: 0 0 16px;
	font-size: 14px;
	line-height: 1.6;
	color: var(--ii-text-secondary);
	font-weight: 400;
}

.ii-message-content p:last-child {
	margin-bottom: 0;
}

/* Error Message & Retry */
.ii-error-message .ii-error-avatar {
	background: #fff0f0;
	color: #ef4444;
}

.ii-error-content-wrapper {
	background: var(--ii-error-msg-bg);
	border: 1px solid var(--ii-error-msg-border);
	padding: 16px 20px;
	border-radius: var(--ii-radius-md);
	display: inline-flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 16px;
	box-shadow: 0 4px 12px rgba(239, 68, 68, 0.04);
}

.ii-error-content-wrapper p {
	color: var(--ii-error-text);
	font-size: 15px;
	max-height: 90px;
	overflow-y: scroll;
}

.ii-retry-btn {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	border-radius: var(--ii-radius-rounded);
	border: 1px solid var(--ii-retry-border);
	background: var(--ii-retry-bg);
	color: var(--ii-retry-color);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: all var(--ii-transition);
}

.ii-retry-btn:hover:not(:disabled) {
	background: var(--ii-retry-hover-bg);
	border-color: var(--ii-retry-hover-border);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(220, 38, 38, 0.08);
}

.ii-retry-btn:disabled {
	opacity: 0.6;
	cursor: default;
}

/* Sidebar Chat Item Links */
a.ii-chat-item {
	text-decoration: none;
	color: var(--ii-text-primary);
}

/* Edit Wrapper Styling */
.ii-edit-wrapper {
	display: none;
	align-items: flex-start;
	gap: 10px;
	border-radius: var(--ii-radius-sm);
	margin-bottom: 4px;
}

/* The bar is the unified container: it shows whenever there is an image being
   edited OR there are selected asset chips inside it. */
.ii-edit-wrapper:has(.ii-edit-image-preview),
.ii-edit-wrapper:has(.ii-asset-chip) {
	display: flex;
}

.ii-edit-image-preview {
	width: 56px;
	height: 56px;
	position: relative;
	flex-shrink: 0;
}

/* Vertical separator between edit preview image and asset chips */
.ii-edit-separator {
	display: none;
	width: 1px;
	height: 36px;
	background: linear-gradient(
		to bottom,
		transparent,
		var(--ii-border) 20%,
		var(--ii-border) 80%,
		transparent
	);
	align-self: center;
	margin: 0 4px;
	flex-shrink: 0;
}

[data-theme='dark'] .ii-edit-separator {
	background: linear-gradient(
		to bottom,
		transparent,
		var(--ii-dk-border, #374151) 20%,
		var(--ii-dk-border, #374151) 80%,
		transparent
	);
}

.ii-edit-wrapper:has(.ii-edit-image-preview):has(.ii-asset-chip)
	.ii-edit-separator {
	display: block;
}

/* Soft accent ring around the edit preview (mirrors ref/marker chip rings) */
.ii-edit-image-preview img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: var(--ii-radius-sm);
	box-shadow:
		var(--ii-shadow),
		0 0 0 2px rgba(37, 99, 235, 0.65);
}

[data-theme='dark'] .ii-edit-image-preview img {
	box-shadow:
		var(--ii-shadow),
		0 0 0 2px rgba(96, 165, 250, 0.6);
}

/* Edit badge: top-left icon */
.ii-edit-image-preview .ii-edit-badge {
	position: absolute;
	top: 3px;
	left: 3px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--ii-accent, #2563eb);
	color: #fff;
	z-index: 4;
	pointer-events: none;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.ii-edit-image-preview .ii-edit-badge svg {
	width: 10px;
	height: 10px;
}

/* Darkening overlay on hover to surface the view button */
.ii-edit-image-preview::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: var(--ii-radius-sm);
	background: rgba(0, 0, 0, 0);
	transition: background 0.18s ease;
	pointer-events: none;
}

.ii-edit-image-preview:hover::after {
	background: rgba(0, 0, 0, 0.45);
}

/* Centered "view in modal" button */
.ii-edit-image-preview .ii-asset-view-btn {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%) scale(0.85);
	width: 22px;
	height: 22px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: none;
	cursor: pointer;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	opacity: 0;
	z-index: 5;
	backdrop-filter: blur(2px);
	transition:
		opacity 0.18s ease,
		transform 0.18s ease,
		background 0.15s ease;
}

.ii-edit-image-preview:hover .ii-asset-view-btn {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}

.ii-edit-image-preview .ii-asset-view-btn:hover {
	background: rgba(0, 0, 0, 0.8);
}

.ii-edit-image-preview .ii-asset-view-btn svg {
	width: 14px;
	height: 14px;
}

.ii-edit-actions {
	display: flex;
	align-items: center;
	gap: 2px;
	margin-left: auto;
	flex-shrink: 0;
}

.ii-edit-bar-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 3px;
	width: 36px;
	height: 36px;
	padding: 0;
	border-radius: var(--ii-radius-rounded);
	cursor: pointer;
	transition:
		background 0.15s ease,
		border-color 0.15s ease,
		color 0.15s ease;
	flex-shrink: 0;
	line-height: 1;
}

.ii-exit-edit-btn,
.ii-insights-edit-btn {
	border: none;
	background: transparent;
	color: var(--ii-text-primary);
}

.ii-exit-edit-btn:hover,
.ii-insights-edit-btn:hover {
	background: var(--ii-bg-active);
	color: var(--ii-text-primary);
}

.ii-editor-tools {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px;
	margin-bottom: 0;
	padding: 0;
}

.ii-edit-bar-btn svg {
	width: 16px;
	height: 16px;
}

/* Image Actions Overlay */
.ii-image-actions {
	position: absolute;
	top: 14px;
	right: 14px;
	display: flex;
	gap: 4px;
	opacity: 0;
	transition: opacity var(--ii-transition, 0.2s);
	z-index: 10;
}

.ii-generated-image-wrapper:hover .ii-image-actions,
.ii-image-actions:hover,
.ii-image-actions:has(.is-popper-open),
.ii-image-actions.has-popper-open {
	opacity: 1;
}

.ii-image-action-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	backdrop-filter: blur(4px);
	border: 1px solid;
	border-radius: 2rem;
	background: rgba(26, 29, 39, 0.75);
	border-color: rgba(255, 255, 255, 0.1);
	color: #f0f1f5;
	cursor: pointer;
	transition: all var(--ii-transition, 0.2s);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	position: relative;
	text-decoration: none;
}

.ii-image-action-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.ii-image-action-btn svg {
	flex-shrink: 0;
	width: 14px;
	height: 14px;
}

/* Edit Action Button (prominent) */
.ii-edit-action-btn {
	width: auto;
	padding: 0 10px;
	gap: 5px;
	background: var(--ii-accent);
	border-color: transparent;
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.01em;
}

.ii-edit-action-btn:hover {
	background: var(--ii-accent-hover);
	border-color: transparent;
	color: #fff;
}

/* Edit Indicator & Buttons */
.ii-cancel-edit-btn {
	position: absolute;
	top: -8px;
	right: -8px;
	background: rgba(0, 0, 0, 0.6);
	border: none;
	color: #fff;
	cursor: pointer;
	padding: 2px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: all 0.2s;
	backdrop-filter: blur(2px);
	z-index: 10;
}

.ii-edit-image-preview:hover .ii-cancel-edit-btn {
	opacity: 1;
}

.ii-cancel-edit-btn:hover {
	background: #ea4335;
	transform: scale(1.1);
}

.ii-cancel-edit-btn svg {
	width: 12px;
	height: 12px;
}

/* Combined Messages */
.ii-message.ii-combined-message {
	padding: 0;
	background: var(--ii-bg-primary);
	border-radius: var(--ii-radius-lg);
	border: 1px solid var(--ii-border);
	overflow: hidden;
	margin-bottom: 0;
	box-shadow: none;
}

.ii-message-prompt-section {
	padding: 16px;
	border-bottom: 1px solid rgba(229, 231, 235, 0.5);
	display: flex;
	flex-direction: column;
	gap: 6px;
	align-items: flex-start;
	background: var(--ii-surface-white);
}

.ii-message-prompt-text {
	font-size: 1rem;
	color: var(--ii-text-primary);
	padding-top: 2px;
	line-height: 1.5;
	margin: 0;
	white-space: pre-wrap;
}

/* Pills inline within chat bubble prompt text */
.ii-message-prompt-text .ii-mention-pill {
	white-space: nowrap;
	vertical-align: middle;
	position: relative;
	top: -1px;
}

.ii-message-gallery-section {
	padding: 8px;
	background: var(--ii-bg-primary);
	display: flex;
	flex-direction: column;
}

.ii-combined-message .ii-generated-image-wrapper {
	position: relative;
	width: 100%;
	border-radius: var(--ii-radius-md);
	padding: 8px 0;
}

.ii-combined-message .ii-generated-image-link {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	overflow: hidden;
	/* clips object-fit: cover to rounded corners */
}

.ii-combined-message .ii-generated-image-link img {
	/* width: 100%; */
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
	border-radius: 4px;
}

/* Image Skeleton Loading */
.ii-generated-image-wrapper.ii-image-loading {
	overflow: hidden;
	border-radius: 12px;
}

.ii-image-skeleton {
	position: absolute;
	inset: 0;
	border-radius: 12px;
	background: linear-gradient(
		90deg,
		var(--ii-bg-secondary, #f3f4f6) 25%,
		var(--ii-bg-hover, #e5e7eb) 50%,
		var(--ii-bg-secondary, #f3f4f6) 75%
	);
	background-size: 200% 100%;
	animation: iiSkeletonShimmer 1.8s infinite linear;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Status label shown over the skeleton */
.ii-skeleton-label {
	font-size: 12px;
	font-weight: 500;
	color: var(--ii-text-tertiary, #9ca3af);
	letter-spacing: 0.02em;
	z-index: 2;
	pointer-events: none;
	user-select: none;
}

/* Hide action buttons while image is still loading (page entry) */
.ii-generated-image-wrapper.ii-image-loading .ii-image-actions {
	display: none;
}

/* Hide action buttons while a variant is generating (pending skeleton active) */
.ii-generated-image-wrapper:has([data-variant-pending]) .ii-image-actions {
	display: none;
}

.ii-image-hidden {
	opacity: 0;
	filter: blur(16px);
}

.ii-image-revealed {
	opacity: 1;
	filter: blur(0);
	transition:
		opacity 0.2s ease,
		filter 0.25s ease;
}

.ii-version-badge {
	background: rgba(0, 0, 0, 0.5);
	color: #ffffff;
	font-size: 10px;
	padding: 4px 8px;
	border-radius: 4px;
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: 500;
}

.ii-message-prompt-section .ii-prompt-badges {
	margin-top: 4px;
}

.ii-prompt-badge {
	display: inline-flex;
	align-items: center;
	padding: 6px 12px;
	border-radius: 9999px;
	background: var(--ii-surface-white);
	border: 1px solid var(--ii-border);
	font-size: 11px;
	font-weight: 500;
	color: var(--ii-text-secondary);
	font-family: var(--ii-font-body);
	box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
	transition:
		color var(--ii-transition),
		background var(--ii-transition);
}

.ii-message-divider {
	height: 1px;
	background: var(--ii-border);
	width: 100%;
	margin: 0;
	border: none;
}

.ii-generated-image-wrapper {
	padding: 24px;
	position: relative;
	display: flex;
	flex-direction: column;
	aspect-ratio: 16 / 9;
	background: var(--ii-surface-white);
	border: 1px solid var(--ii-border);
}

.ii-generated-image-link {
	overflow: hidden;
}

.ii-image-container {
	position: relative;
}

/* Generation Receipt */
.ii-generation-receipt {
	display: flex;
	align-items: flex-start;
	flex-direction: column;
	gap: 6px;
	margin-top: 8px;
	padding: 10px 14px;
	background: var(--ii-surface-white);
	border: 1px solid var(--ii-border);
	border-radius: var(--ii-radius-md);
	flex-wrap: wrap;
}

.ii-receipt-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 8px;
	flex-wrap: wrap;
}

.ii-receipt-action-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	background: var(--ii-surface-white);
	border: 1px solid var(--ii-border);
	border-radius: 999px;
	color: var(--ii-text-primary);
	font-size: 13px;
	font-weight: 500;
	line-height: 1;
	cursor: pointer;
	transition: all var(--ii-transition);
}

.ii-receipt-action-btn svg {
	width: 15px;
	height: 15px;
	flex-shrink: 0;
}

.ii-receipt-action-btn:hover {
	background: var(--ii-bg-hover);
}

.ii-receipt-insights-credit {
	display: flex;
	align-items: center;
	gap: 4px;
	color: var(--ii-text-primary);
	letter-spacing: 0.03em;
}

.ii-receipt-insights-credit svg {
	width: 14px;
	height: 14px;
}

.ii-prompt-header {
	display: flex;
	align-items: center;
	gap: 2px;
	width: 100%;
}

.ii-prompt-label {
	font-size: 12px;
	font-weight: 500;
	text-transform: none;
	letter-spacing: normal;
	color: var(--ii-text-tertiary);
	white-space: nowrap;
	margin-right: 3px;
	flex-shrink: 0;
}

.ii-copy-prompt-btn,
.ii-reuse-prompt-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 4px;
	background: transparent;
	border: none;
	border-radius: 6px;
	color: var(--ii-text-tertiary);
	cursor: pointer;
	transition: all var(--ii-transition);
}

.ii-reuse-prompt-btn svg {
	width: 18px;
	height: 18px;
}

.ii-copy-prompt-btn svg {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
}

.ii-copy-prompt-btn:hover,
.ii-reuse-prompt-btn:hover {
	background: var(--ii-bg-hover);
	color: var(--ii-accent);
}

.ii-copy-prompt-btn.is-done {
	/* color: #10b981; */
	/* background: rgba(16, 185, 129, 0.1); */
}

/* Pending (generating) Skeleton inside image wrapper */
.ii-variant-pending-skeleton {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 12px;
	background: linear-gradient(
		90deg,
		var(--ii-bg-secondary, #f3f4f6) 25%,
		var(--ii-bg-hover, #e5e7eb) 50%,
		var(--ii-bg-secondary, #f3f4f6) 75%
	);
	background-size: 200% 100%;
	animation: iiSkeletonShimmer 1.8s infinite linear;
	z-index: 3;
}

.ii-variant-loading-skeleton {
	position: absolute;
	inset: 0;
	z-index: 5;
	border-radius: 12px;
	pointer-events: none;
	background: linear-gradient(
		90deg,
		var(--ii-bg-secondary, #f3f4f6) 25%,
		var(--ii-bg-hover, #e5e7eb) 50%,
		var(--ii-bg-secondary, #f3f4f6) 75%
	);
	background-size: 200% 100%;
	animation: iiSkeletonShimmer 1.8s infinite linear;
}

/* Image wrapper: must be relative + hidden for slide transitions */
.ii-generated-image-wrapper {
	position: relative;
	overflow: hidden;
}

/* Wrapper height transition only when switching aspect ratios */

/* Asset Chips in Prompt Bar */
.ii-asset-chips-container {
	display: flex;
	flex: 1;
	min-width: 0;
	flex-wrap: nowrap;
	align-items: center;
	gap: 8px;
	padding: 10px 2px;
	margin: -10px 0;
	overflow-x: auto;
	overflow-y: visible;
	-webkit-overflow-scrolling: touch;
	scroll-behavior: smooth;
	scrollbar-width: none; /* Firefox */
}

.ii-asset-chips-container::-webkit-scrollbar {
	display: none;
}

/* Square thumbnail chip, mirroring .ii-edit-image-preview. The whole chip is
   the drag handle; the View and remove buttons are excluded from dragging. */
.ii-asset-chip {
	position: relative;
	width: 56px;
	height: 56px;
	flex-shrink: 0;
	border-radius: var(--ii-radius-sm);
	background: var(--ii-bg-tertiary);
	cursor: grab;
}

/* One-shot entry animation, added only on chip creation and removed once it
   plays. Kept off the base rule so Sortable moving an existing chip (mid-drag
   or on drop) never flips animation-name and re-triggers it. */
.ii-asset-chip.ii-chip-enter {
	animation: iiFadeIn 0.2s ease;
}

.ii-asset-chip:active {
	cursor: grabbing;
}

.ii-asset-chip-thumb {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: var(--ii-radius-sm);
	box-shadow: var(--ii-shadow);
	pointer-events: none;
	user-select: none;
}

/* Darkening overlay on hover to surface the View button */
.ii-asset-chip::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: var(--ii-radius-sm);
	background: rgba(0, 0, 0, 0);
	transition: background 0.18s ease;
	pointer-events: none;
}

.ii-asset-chip:hover::after {
	background: rgba(0, 0, 0, 0.45);
}

/* Centered "view in modal" button (same treatment as the edit preview) */
.ii-asset-chip .ii-asset-view-btn {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%) scale(0.85);
	width: 22px;
	height: 22px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: none;
	cursor: pointer;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	opacity: 0;
	z-index: 5;
	backdrop-filter: blur(2px);
	transition:
		opacity 0.18s ease,
		transform 0.18s ease,
		background 0.15s ease;
}

.ii-asset-chip:hover .ii-asset-view-btn {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}

.ii-asset-chip .ii-asset-view-btn:hover {
	background: rgba(0, 0, 0, 0.8);
}

.ii-asset-chip .ii-asset-view-btn svg {
	width: 14px;
	height: 14px;
}

/* Cancel button: top-right corner, revealed on hover (like .ii-cancel-edit-btn) */
.ii-asset-chip-remove {
	position: absolute;
	top: -8px;
	right: -8px;
	width: 20px;
	height: 20px;
	padding: 2px;
	border: none;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	z-index: 6;
	backdrop-filter: blur(2px);
	transition: all 0.2s ease;
}

.ii-asset-chip:hover .ii-asset-chip-remove {
	opacity: 1;
}

.ii-asset-chip-remove:hover {
	background: #ea4335;
	transform: scale(1.1);
}

.ii-asset-chip-remove svg {
	width: 12px;
	height: 12px;
}

/* SortableJS drag states */
.ii-chip-ghost {
	opacity: 0;
	pointer-events: none;
}

.ii-chip-chosen {
	cursor: grabbing;
}

.ii-chip-drag-active {
	opacity: 1;
	z-index: 99999;
	cursor: grabbing;
	transition: none;
	animation: none;

	box-shadow:
		0 12px 28px rgba(0, 0, 0, 0.18),
		0 4px 10px rgba(0, 0, 0, 0.08),
		0 0 0 2px color-mix(in srgb, var(--ii-accent, #3b82f6) 25%, transparent);
	border-radius: var(--ii-radius-sm);

	will-change: transform;
	filter: brightness(1.04);
}

[data-theme='dark'] .ii-chip-drag-active {
	box-shadow:
		0 12px 28px rgba(0, 0, 0, 0.45),
		0 4px 10px rgba(0, 0, 0, 0.25),
		0 0 0 2px color-mix(in srgb, var(--ii-accent) 35%, transparent);
	filter: brightness(1.12);
}

body.ii-is-sorting,
body.ii-is-sorting * {
	cursor: grabbing;
	user-select: none;
	-webkit-user-select: none;
}

body.ii-is-sorting .ii-asset-chip::after {
	background: rgba(0, 0, 0, 0);
}

body.ii-is-sorting .ii-asset-chip .ii-asset-view-btn,
body.ii-is-sorting .ii-asset-chip .ii-asset-chip-remove {
	opacity: 0;
	pointer-events: none;
}

/* Reference Image Chip */
.ii-asset-chip--ref .ii-asset-chip-thumb {
	box-shadow:
		var(--ii-shadow),
		0 0 0 2px rgba(139, 92, 246, 0.75);
}

[data-theme='dark'] .ii-asset-chip--ref .ii-asset-chip-thumb {
	box-shadow:
		var(--ii-shadow),
		0 0 0 2px rgba(167, 139, 250, 0.7);
}

/* Marked Area Chip */
.ii-asset-chip--marker .ii-asset-chip-thumb {
	box-shadow:
		var(--ii-shadow),
		0 0 0 2px rgba(245, 158, 11, 0.85);
}

/* Optimistic Upload Chip (pasted image, still uploading) */
.ii-asset-chip--uploading {
	cursor: default;
}

.ii-asset-chip--uploading .ii-ca-upload-spinner {
	background: rgba(0, 0, 0, 0.35);
	border-radius: var(--ii-radius-sm);
}

/* Chat Area Skeleton */
.ii-chat-skeleton {
	display: flex;
	flex-direction: column;
	flex: 1;
	overflow: hidden;
	position: absolute;
	width: 100%;
	height: 100%;
	z-index: 15;
	transition:
		opacity 0.3s ease,
		visibility 0.3s ease;
}

.ii-chat-area-skeleton {
	flex: 1;
	display: flex;
	flex-direction: column;
	padding: 32px;
	padding-top: 64px;
}

/* .ii-app.is-loaded .ii-chat-skeleton {
    display: none;
}

.ii-app:not([data-is-home="1"]):not(.is-loaded) #iiChatArea,
.ii-app:not([data-is-home="1"]):not(.is-loaded) .ii-input-wrapper {
    display: none;
} */
.ii-app.is-loaded .ii-chat-skeleton {
	opacity: 0;
	visibility: hidden;
}

.ii-app:not([data-is-home='1']):not(.is-loaded) #iiChatArea,
.ii-app:not([data-is-home='1']):not(.is-loaded) .ii-input-wrapper {
	opacity: 0;
	visibility: hidden;
}

/* Base Skeleton Class for items that need shimmer */
.ii-skeleton-tab,
.ii-skeleton-chip,
.ii-skeleton-badge,
.ii-skeleton-text-line {
	background-color: var(--ii-skeleton-base);
	background-image: linear-gradient(
		90deg,
		var(--ii-bg-secondary, #f3f4f6) 25%,
		var(--ii-bg-hover, #e5e7eb) 50%,
		var(--ii-bg-secondary, #f3f4f6) 75%
	);
	background-size: 200% 100%;
	animation: iiSkeletonShimmer 1.8s infinite linear;
	border-color: transparent;
	position: relative;
	overflow: hidden;
	transition: none;
	pointer-events: none;
	display: inline-block;
}

.ii-skeleton-text-line {
	display: block;
	height: 14px;
	width: 60%;
	margin-top: 6px;
	border-radius: 4px;
}

.ii-skeleton-badge {
	width: 60px;
	height: 24px;
	border-radius: 6px;
}

.ii-skeleton-tab {
	width: 48px;
	height: 28px;
	border-radius: 12px;
}

.ii-skeleton-chip {
	width: 50px;
	height: 50px;
	border-radius: 0.5rem;
}

/* Override the default 50x50 chip size for the receipt-actions pill placeholders */
.ii-receipt-actions .ii-skeleton-chip {
	width: 96px;
	height: 30px;
	border-radius: 999px;
}

.ii-receipt-actions .ii-skeleton-chip.ii-receipt-action-skeleton--wide {
	width: 150px;
}

/* Skeleton Input Area */
.ii-input-wrapper-skeleton {
	position: absolute;
	bottom: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 100%;
	max-width: 860px;
	padding-bottom: 16px;
	z-index: 10;
	transition:
		bottom 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
		transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ii-skeleton-input-container {
	background: var(--ii-surface-white);
	border: 1px solid var(--ii-border);
	border-radius: var(--ii-radius-lgx);
	padding: 16px;
	box-shadow: var(--ii-shadow-elegant);
}

.ii-skeleton-input-row {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.ii-skeleton-input-field {
	height: 48px;
	width: 100%;
	background-color: #f9fafb;
	background-image: linear-gradient(
		90deg,
		#f9fafb 25%,
		#f1f5f9 50%,
		#f9fafb 75%
	);
	background-size: 200% 100%;
	animation: iiSkeletonShimmer 1.8s infinite linear;
	border-radius: 12px;
	display: block;
}

.ii-skeleton-btn {
	width: 36px;
	height: 36px;
	border-radius: var(--ii-radius-rounded);
	background: var(--ii-skeleton-btn-bg);
	display: inline-block;
}

.ii-skeleton-dropdown {
	width: 80px;
	height: 36px;
	border-radius: var(--ii-radius-rounded);
	background: var(--ii-skeleton-btn-bg);
	display: inline-block;
}

.ii-skeleton-send-btn {
	width: 120px;
	height: 36px;
	border-radius: 12px;
	background: var(--ii-skeleton-send-bg);
	display: inline-block;
}

/* Animated Placeholder — zero-height container inserted before #iiInput so it naturally aligns with the input's text start position */

.ii-animated-placeholder {
	position: relative;
	height: 0;
	overflow: visible;
	width: 100%;
	pointer-events: none;
	transition: opacity 0.15s ease;
}

.ii-animated-placeholder.is-hidden {
	opacity: 0;
	pointer-events: none;
}

.ii-aph-text {
	position: absolute;
	top: 8px;
	/* matches .ii-input padding-top */
	left: 0;
	right: 0;
	color: var(--ii-text-tertiary);
	font-size: 1rem;
	line-height: 1.625;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transform: translateY(0);
	opacity: 1;
	transition:
		transform 0.42s cubic-bezier(0.4, 0, 0.2, 1),
		opacity 0.42s ease;
	will-change: transform, opacity;
}

.ii-aph-text.state-exiting {
	transform: translateY(-65%);
	opacity: 0;
}

.ii-aph-text.state-below {
	transform: translateY(65%);
	opacity: 0;
	transition: none;
}

.ii-message-prompt-text {
	display: -webkit-box;
	-webkit-line-clamp: 1;
	line-clamp: 1;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* "Full Prompt" expand button */
.ii-prompt-expand-btn,
.ii-prompt-menu-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 4px;
	background: transparent;
	border: none;
	border-radius: 6px;
	color: var(--ii-text-tertiary);
	cursor: pointer;
	transition: all var(--ii-transition);
}

.ii-prompt-expand-btn svg {
	fill: var(--ii-text-tertiary);
}
.ii-prompt-expand-btn:hover svg {
	fill: var(--ii-accent);
}

.ii-prompt-menu-btn {
	margin-left: auto;
}

.ii-prompt-expand-btn:hover,
.ii-prompt-menu-btn:hover {
	background: var(--ii-bg-hover);
	color: var(--ii-accent);
}

.ii-prompt-expand-btn svg,
.ii-prompt-menu-btn svg {
	flex-shrink: 0;
	transition: color 0.16s ease;
}

/* Reduced-motion */
@media (prefers-reduced-motion: reduce) {
	.ii-prompt-expand-btn,
	.ii-prompt-menu-btn {
		transition: none;
	}
}

/* Scroll To Bottom Button - floats centered on the input container's top edge */
.ii-scroll-to-bottom {
	position: absolute;
	top: 0;
	left: 50%;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.9);
	backdrop-filter: blur(16px) saturate(180%);
	-webkit-backdrop-filter: blur(16px) saturate(180%);
	border: 1px solid rgba(17, 24, 39, 0.08);
	color: var(--ii-text-primary);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 15;
	transition:
		opacity 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
		transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
	box-shadow:
		0 4px 16px rgba(17, 24, 39, 0.1),
		inset 0 1px 0 rgba(255, 255, 255, 0.7);
	opacity: 0;
	transform: translate(-50%, calc(-50% + 10px)) scale(0.8);
	pointer-events: none;
	outline: none;
}

.ii-scroll-to-bottom.is-visible {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
	pointer-events: auto;
}

[data-theme='dark'] .ii-scroll-to-bottom {
	background: rgba(30, 32, 40, 0.35);
	border-color: rgba(255, 255, 255, 0.12);
	color: #e5e7eb;
	box-shadow:
		0 4px 20px rgba(0, 0, 0, 0.3),
		inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

@media (max-width: 1024px) {
	/* Slightly reduce chat padding */
	.ii-chat-area {
		padding: 24px 20px;
		padding-bottom: 140px;
	}

	.ii-welcome-header h1 {
		font-size: 3.5rem;
	}
}

/* Full-prompt modal body text — preserve user line breaks */
.ii-prompt-Modal-text {
	white-space: pre-wrap;
	word-break: break-word;
	margin: 0;
}

/* No-access state: center the EmptyState vertically and horizontally */
