/* ===== AI艺术字（浅色工作台 + 暗色风格舞台） ===== */

/* --- 左右分栏，与转换器布局对齐 --- */
.ai-layout {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	max-width: 1200px;
	margin: 0 auto;
}

/* --- 左侧控制面板 --- */
.ai-panel {
	flex: 0 0 300px;
	position: sticky;
	top: 12px;
	background: #fff;
	border: 1px solid var(--fc-line);
	border-radius: 12px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
	padding: 18px;
}

.ai-panel-loading,
.ai-panel-noscript {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 420px;
	margin: 0;
	font-size: 13px;
	color: var(--fc-muted);
}

.ai-panel-section {
	margin-bottom: 18px;
}

.ai-panel-title {
	margin: 0 0 10px;
	font-size: 14px;
	font-weight: 600;
	color: var(--fc-ink);
}

.ai-style-preview {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 118px;
	border-radius: 10px;
	overflow: hidden;
}

.ai-style-preview img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ai-style-name {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 8px 2px 0;
	font-size: 13px;
	color: var(--fc-muted);
}

.ai-style-change {
	font-size: 13px;
	color: var(--fc-accent);
}

.ai-style-change-disabled {
	color: #b0b6bd;
}

.ai-textarea-wrap {
	position: relative;
}

.ai-textarea-wrap textarea {
	width: 100%;
	resize: none;
	padding: 10px 12px 26px;
	font-size: 14px;
	line-height: 1.6;
	border: 1px solid var(--fc-line);
	border-radius: 10px;
	background: var(--fc-bg);
	transition: border-color 0.15s ease;
}

.ai-textarea-wrap textarea:focus {
	border-color: var(--fc-accent);
}

/* 未填写文字点「立即生成」：输入框闪烁高亮（两闪后自动恢复默认边框） */
.ai-text-flash {
	animation: ai-text-flash 1.1s ease-in-out;
}

@keyframes ai-text-flash {
	0%,
	35% {
		border-color: var(--fc-accent);
		box-shadow: 0 0 0 3px rgba(246, 96, 125, 0.28);
	}
	55% {
		border-color: var(--fc-line);
		box-shadow: none;
	}
	75% {
		border-color: var(--fc-accent);
		box-shadow: 0 0 0 3px rgba(246, 96, 125, 0.28);
	}
	100% {
		border-color: var(--fc-line);
		box-shadow: none;
	}
}

.ai-counter {
	position: absolute;
	right: 10px;
	bottom: 8px;
	font-size: 12px;
	color: #b0b6bd;
}

/* --- 比例 --- */
.ai-ratios {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 8px;
}

.ai-ratio {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 5px;
	padding: 8px 0 6px;
	font-size: 12px;
	color: var(--fc-muted);
	background: var(--fc-bg);
	border: 1px solid var(--fc-line);
	border-radius: 8px;
	cursor: pointer;
	transition:
		border-color 0.15s ease,
		color 0.15s ease,
		background 0.15s ease;
}

.ai-ratio:hover {
	border-color: var(--fc-accent);
	color: var(--fc-accent);
}

.ai-ratio.ai-on {
	border-color: var(--fc-accent);
	background: var(--fc-accent-tint);
	color: var(--fc-accent);
	font-weight: 600;
}

.ai-ratio-box {
	display: inline-block;
	border: 2px solid currentColor;
	border-radius: 3px;
	opacity: 0.75;
}

.ai-box-11 {
	width: 16px;
	height: 16px;
}
.ai-box-43 {
	width: 19px;
	height: 14px;
}
.ai-box-34 {
	width: 13px;
	height: 18px;
}
.ai-box-32 {
	width: 19px;
	height: 13px;
}
.ai-box-23 {
	width: 12px;
	height: 18px;
}
.ai-box-916 {
	width: 10px;
	height: 18px;
}
.ai-box-169 {
	width: 20px;
	height: 11px;
}
.ai-box-219 {
	width: 21px;
	height: 9px;
}

/* --- 数量 --- */
.ai-counts {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 8px;
}

.ai-count {
	padding: 7px 0;
	font-size: 13px;
	color: var(--fc-muted);
	background: var(--fc-bg);
	border: 1px solid var(--fc-line);
	border-radius: 8px;
	cursor: pointer;
	transition:
		border-color 0.15s ease,
		color 0.15s ease,
		background 0.15s ease;
}

.ai-count:hover {
	border-color: var(--fc-accent);
	color: var(--fc-accent);
}

.ai-count.ai-on {
	border-color: var(--fc-accent);
	background: var(--fc-accent-tint);
	color: var(--fc-accent);
	font-weight: 600;
}

/* 未登录的“2 张”按钮：disabled 按钮不派发 click，由外层包裹元素承接点击；
 * 按钮指针事件穿透到外层以触发登录提示，光标在外层保持 not-allowed */
.ai-count-wrap {
	display: block;
}
.ai-count-wrap .ai-count {
	width: 100%;
}
.ai-count-wrap.ai-count-locked {
	cursor: not-allowed;
}
.ai-count-wrap.ai-count-locked .ai-count {
	pointer-events: none;
}

/* --- 生成按钮 --- */
.ai-cost-note {
	margin: 2px 0 8px;
	padding: 8px 10px;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.5;
	color: #9a3412;
	text-align: center;
	background: #fff7ed;
	border: 1px solid #fed7aa;
	border-radius: 8px;
}

/* 消耗说明中的拆分（赠送/账户算力）明细小字 */
.ai-cost-detail {
	display: block;
	margin-top: 2px;
	font-size: 11px;
	font-weight: 500;
	color: #b45309;
}

.ai-generate {
	width: 100%;
	padding: 12px 0;
	font-size: 16px;
	font-weight: 700;
	letter-spacing: 0;
	color: #fff;
	background: linear-gradient(
		90deg,
		var(--fc-accent) 0%,
		var(--fc-accent-dark) 100%
	);
	border: none;
	border-radius: 10px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	transition:
		box-shadow 0.15s ease,
		transform 0.1s ease;
}

.ai-generate > .fa-solid {
	width: 1em;
	flex: 0 0 1em;
	letter-spacing: 0;
}

.ai-generate:hover {
	box-shadow: 0 6px 16px rgba(246, 96, 125, 0.35);
}

.ai-generate:active {
	transform: scale(0.98);
}

.ai-generate:disabled,
.ai-ratio:disabled,
.ai-count:disabled,
.ai-textarea-wrap textarea:disabled {
	cursor: not-allowed;
	opacity: 0.62;
}

.ai-generate:disabled:hover {
	box-shadow: none;
}

.ai-disclaimer {
	margin: 10px 0 0;
	font-size: 12px;
	color: #b0b6bd;
	text-align: center;
}

/* --- 右侧内容区（画廊 / 详情 / 生成结果） --- */
.ai-right-region {
	flex: 1;
	min-width: 0;
}

.ai-section {
	width: 100%;
	transition: opacity 0.15s ease;
}

.ai-right-region.ai-result-active .ai-section {
	display: none;
}

#aiGenerationResultRoot:empty {
	display: none;
}

.ai-result-panel {
	min-height: 470px;
	padding: 18px;
	background: #fff;
	border: 1px solid var(--fc-line);
	border-radius: 12px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.ai-result-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 18px;
}

.ai-result-header h2 {
	margin: 0 0 5px;
	font-size: 18px;
	font-weight: 700;
	color: var(--fc-ink);
}

.ai-result-header p {
	margin: 0;
	font-size: 13px;
	color: var(--fc-muted);
}

.ai-result-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 34px;
	width: 34px;
	height: 34px;
	padding: 0;
	color: var(--fc-muted);
	background: var(--fc-bg);
	border: 1px solid var(--fc-line);
	border-radius: 8px;
	cursor: pointer;
}

.ai-result-close:hover {
	color: var(--fc-accent);
	border-color: var(--fc-accent);
}

.ai-result-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	align-items: start;
	gap: 14px;
}

.ai-result-grid-1 {
	grid-template-columns: minmax(0, 1fr);
	max-width: 720px;
	margin-right: auto;
	margin-left: auto;
}

.ai-result-item {
	min-width: 0;
	margin: 0;
}

.ai-result-image-frame,
.ai-result-placeholder {
	width: 100%;
	max-height: 480px;
	background: #f2f4f7;
	border: 1px solid var(--fc-line);
	border-radius: 8px;
	overflow: hidden;
}

.ai-result-image-frame img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.ai-result-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 240px;
	animation: ai-result-pulse 1.5s ease-in-out infinite;
}

.ai-result-spinner {
	width: 30px;
	height: 30px;
	border: 3px solid #d8dde5;
	border-top-color: var(--fc-accent);
	border-radius: 50%;
	animation: ai-result-spin 0.9s linear infinite;
}

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

@keyframes ai-result-pulse {
	50% {
		background: #e9edf2;
	}
}

.ai-result-status,
.ai-result-message {
	margin: 16px 0 0;
	font-size: 13px;
	color: var(--fc-muted);
	text-align: center;
}

.ai-result-progress {
	width: min(420px, 100%);
	height: 8px;
	margin: 18px auto 0;
	background: #e5e9ef;
	border-radius: 4px;
	overflow: hidden;
}

.ai-result-progress span {
	display: block;
	height: 100%;
	background: var(--fc-accent);
	border-radius: inherit;
	transition: width 0.5s ease;
}

.ai-result-progress + .ai-result-status {
	margin-top: 8px;
}

.ai-result-download {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	width: 100%;
	min-height: 40px;
	margin-top: 10px;
	padding: 8px 12px;
	font-size: 14px;
	font-weight: 600;
	font-family: inherit;
	color: #fff;
	background: var(--fc-accent);
	border: none;
	border-radius: 8px;
	text-decoration: none;
	cursor: pointer;
}

.ai-result-download:hover {
	color: #fff;
	background: var(--fc-accent-dark);
}

.ai-result-download:disabled {
	cursor: default;
	opacity: 0.7;
}

/* 结果面板副标题下方的生成时间 */
.ai-result-time {
	margin-top: 4px;
	font-size: 12px;
	color: var(--fc-muted);
}

/* 元信息分隔符（比例/分辨率/计费/生成时间）：浅灰竖线，与文字同高、两侧留白 */
.ai-meta-sep {
	margin: 0 6px;
	color: #d8d8dc;
}

.ai-result-error {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 330px;
	padding: 24px;
	color: #9b354a;
	background: #fff6f7;
	border: 1px solid #f2cbd3;
	border-radius: 8px;
	text-align: center;
}

.ai-result-error .fa-solid {
	margin-bottom: 12px;
	font-size: 28px;
}

.ai-result-error p {
	margin: 0;
	font-size: 14px;
}

.ai-section.htmx-request,
.ai-section.htmx-swapping {
	opacity: 0.55;
	pointer-events: none;
}

.ai-gallery,
.ai-detail {
	background: #fff;
	border: 1px solid var(--fc-line);
	border-radius: 12px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
	padding: 14px 16px 18px;
}

.ai-cats {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 14px;
}

.ai-cat {
	display: inline-block;
	padding: 6px 14px;
	font-size: 13px;
	color: #4b5563;
	background: var(--fc-bg);
	border: 1px solid var(--fc-line);
	border-radius: 999px;
	cursor: pointer;
	transition:
		border-color 0.15s ease,
		color 0.15s ease,
		background 0.15s ease;
}

.ai-cat-intro {
	margin: 0 0 14px;
	font-size: 13px;
	color: var(--fc-muted);
}

/* --- 画廊分页 --- */
.ai-pager {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin-top: 18px;
	flex-wrap: wrap;
}

.ai-page {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 30px;
	height: 30px;
	padding: 0 8px;
	font-size: 13px;
	color: #4b5563;
	background: var(--fc-bg);
	border: 1px solid var(--fc-line);
	border-radius: 8px;
	text-decoration: none;
	cursor: pointer;
	transition:
		border-color 0.15s ease,
		color 0.15s ease,
		background 0.15s ease;
}

.ai-page:hover {
	border-color: var(--fc-accent);
	color: var(--fc-accent);
}

.ai-page.ai-page-on {
	background: var(--fc-accent-tint);
	border-color: var(--fc-accent);
	color: var(--fc-accent);
	font-weight: 600;
}

.ai-page.ai-page-disabled {
	color: #c7ccd6;
	cursor: not-allowed;
	pointer-events: none;
}

.ai-page-info {
	margin-left: 8px;
	font-size: 13px;
	color: var(--fc-muted);
}

/* --- 详情视图 --- */
.ai-back {
	display: inline-block;
	margin-bottom: 12px;
	font-size: 13px;
	color: var(--fc-accent);
}

.ai-detail-stage {
	position: relative;
	max-height: 600px;
	border-radius: 12px;
	overflow: hidden;
}

.ai-detail-stage img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ai-detail-meta {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 12px;
	font-size: 13px;
}

.ai-detail-label {
	background: var(--fc-bg);
	border: 1px solid var(--fc-line);
	border-radius: 6px;
	padding: 2px 8px;
	color: var(--fc-muted);
}

.ai-detail-cat {
	color: var(--fc-accent);
}

.ai-detail-word {
	color: var(--fc-ink);
	font-weight: 600;
}

.ai-detail-name {
	margin: 14px 0 8px;
	font-size: 20px;
	font-weight: 700;
	color: var(--fc-ink);
}

.ai-detail-desc {
	margin: 0 0 16px;
	font-size: 14px;
	line-height: 1.9;
	color: var(--fc-muted);
}

.ai-related-title {
	margin: 4px 0 12px;
	font-size: 15px;
	font-weight: 600;
	color: var(--fc-ink);
}

.ai-related-grid {
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.ai-cat:hover {
	border-color: var(--fc-accent);
	color: var(--fc-accent);
}

.ai-cat.ai-on {
	background: var(--fc-accent-tint);
	border-color: var(--fc-accent);
	color: var(--fc-accent);
	font-weight: 600;
}

.ai-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
	gap: 12px;
}

.ai-card {
	padding: 0 0 10px;
	background: #fff;
	border: 1px solid var(--fc-line);
	border-radius: 10px;
	overflow: hidden;
	cursor: pointer;
	text-align: center;
	transition:
		border-color 0.15s ease,
		box-shadow 0.15s ease,
		transform 0.15s ease;
}

.ai-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 14px rgba(30, 41, 59, 0.1);
	border-color: var(--fc-accent);
}

.ai-card.ai-card-on {
	border-color: var(--fc-accent);
	box-shadow: 0 0 0 2px var(--fc-accent-tint);
}

.ai-card.ai-card-on .ai-card-name {
	color: var(--fc-accent);
	font-weight: 600;
}

.ai-stage {
	display: block;
	position: relative;
	width: 100%;
	height: 112px;
	overflow: hidden;
}

.ai-stage img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ai-stage-empty {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	background: #f0f2f7;
	color: #aab1bd;
	font-size: 12px;
}

.ai-card-name {
	display: block;
	padding-top: 8px;
	font-size: 13px;
	color: var(--fc-muted);
}

.ai-empty {
	margin: 30px 0;
	text-align: center;
	font-size: 14px;
	color: var(--fc-muted);
}

/* --- 提示气泡 --- */
.ai-toast {
	position: fixed;
	top: 76px;
	left: 50%;
	transform: translateX(-50%) translateY(-8px);
	padding: 10px 22px;
	font-size: 14px;
	font-weight: 500;
	color: #1f2937;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 999px;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
	opacity: 0;
	pointer-events: none;
	transition:
		opacity 0.25s ease,
		transform 0.25s ease;
	z-index: 10000;
}

/* 类型配色：info 白底深字（默认）/ success 绿 / warning 橙 / error 红。
 * 彩色类型带浅色描边 + 强投影，在深色 header 上也清晰可辨 */
.ai-toast-info {
	background: #fff;
}

.ai-toast-success {
	color: #fff;
	background: #22a06b;
	border-color: rgba(255, 255, 255, 0.45);
}

.ai-toast-warning {
	color: #fff;
	background: #e8590c;
	border-color: rgba(255, 255, 255, 0.45);
}

.ai-toast-error {
	color: #fff;
	background: #e03131;
	border-color: rgba(255, 255, 255, 0.45);
}

.ai-toast-show {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* --- 响应式 --- */
@media only screen and (max-width: 900px) {
	.ai-layout {
		flex-direction: column;
	}

	.ai-panel {
		position: static;
		flex: none;
		width: 100%;
	}

	.ai-right-region {
		width: 100%;
	}

	.ai-result-panel {
		min-height: 380px;
		padding: 14px;
	}

	.ai-result-grid,
	.ai-result-grid-1 {
		grid-template-columns: minmax(0, 1fr);
	}

	.ai-result-image-frame,
	.ai-result-placeholder {
		max-height: 420px;
	}

	.ai-grid {
		grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	}

	.ai-detail-stage {
		height: 220px;
	}

	.ai-detail-meta {
		flex-wrap: wrap;
	}
}

/* ---------- 生成历史横条（生成器下方） ---------- */
.ai-history-root {
	margin-top: 20px;
	max-width: 1200px;
	margin-left: auto;
	margin-right: auto;
}
/** 未登录不渲染历史横条：容器为空时不留白 */
.ai-history-root:empty {
	display: none;
}
.ai-history {
	background: #fff;
	border: 1px solid #eef0f3;
	border-radius: 12px;
	padding: 14px 16px 10px;
}
.ai-history-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 10px;
}
.ai-history-title {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	color: #374151;
}
.ai-history-title .fa-clock-rotate-left {
	margin-right: 4px;
	font-size: 13px;
	color: #9ca3af;
}
.ai-history-more {
	border: none;
	background: none;
	padding: 0;
	font-size: 13px;
	color: #e84e6c;
	cursor: pointer;
}
.ai-history-more:hover {
	text-decoration: underline;
}
.ai-history-track {
	display: flex;
	gap: 10px;
	overflow-x: auto;
	padding-bottom: 6px;
}
.ai-history-item {
	flex: 0 0 auto;
	width: 64px;
	text-decoration: none;
}
.ai-history-thumb {
	display: block;
	width: 64px;
	height: 64px;
	border-radius: 8px;
	overflow: hidden;
	background: #f3f4f6;
	border: 1px solid #eef0f3;
}
.ai-history-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.ai-history-thumb-status {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	font-size: 11px;
	color: #9ca3af;
}
.ai-history-text {
	display: block;
	margin-top: 4px;
	font-size: 11px;
	line-height: 1.3;
	color: #6b7280;
	text-align: center;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.ai-history-item:hover .ai-history-thumb {
	border-color: #f3c1cc;
}
.ai-history-empty {
	margin: 0;
	padding: 8px 0;
	font-size: 13px;
	color: #9ca3af;
}
