/* 用户系统：顶部导航右侧的登录/注册入口与登录弹窗。
 * 入口与现有导航（.nav-list）相互独立：独立元素、独立样式。 */

/* ---------- 顶部入口（独立元素，紧贴导航右侧同一行） ---------- */
/* 给 header 建立定位上下文：移动端入口相对它定位 */
.blog-header {
	position: relative;
}

/* 导航行：导航列表 + 登录入口同一行整体居中，入口紧贴导航右侧 */
@media (min-width: 768px) {
	.blog-header-nav-row {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		gap: 12px;
		margin: 24px 0 18px;
	}
	/* 导航列表原有的上下外边距移到行容器上，避免与入口错位 */
	#navbarResponsive {
		margin: 0;
	}
}

.user-entry {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	z-index: 20;
}

.user-compute-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	min-height: 38px;
	padding: 8px 10px;
	font-size: 13px;
	font-weight: 600;
	color: #ffe59a;
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 229, 154, 0.32);
	border-radius: 8px;
	text-decoration: none;
}
.user-compute-badge:hover,
.user-compute-badge:focus-visible {
	color: #fff0bc;
	background: rgba(255, 255, 255, 0.14);
}
.user-compute-hidden {
	display: none;
}

.user-entry-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 38px;
	padding: 8px 14px;
	font-size: 14px;
	font-weight: 500;
	letter-spacing: 0.02em;
	color: #e5e7eb;
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 8px;
	cursor: pointer;
	transition:
		background 0.15s ease,
		border-color 0.15s ease,
		color 0.15s ease;
}
.user-entry-btn:hover,
.user-entry-btn:focus-visible {
	color: #fff;
	background: rgba(255, 255, 255, 0.14);
	border-color: rgba(255, 255, 255, 0.32);
	outline: none;
}

/* 小屏幕：入口占用原菜单按钮的位置，与站名在首行对齐 */
@media (max-width: 767px) {
	.blog-header-nav-row {
		display: block;
		margin: 0;
	}
	.user-entry {
		display: inline-flex;
		position: absolute;
		right: 16px;
		top: 25px;
	}
	.user-entry-btn {
		min-height: 34px;
		padding: 6px 10px;
		font-size: 13px;
	}
	.user-compute-badge {
		min-height: 34px;
		padding: 6px 8px;
		font-size: 12px;
	}
}

@media (max-width: 340px) {
	.user-entry-btn {
		gap: 4px;
		padding-right: 8px;
		padding-left: 8px;
		font-size: 12px;
	}
}

/* ---------- 登录/注册弹窗 ---------- */
.user-dialog-overlay {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(0, 0, 0, 0.45);
}
/* display:flex 会覆盖 hidden 属性，这里显式恢复隐藏 */
.user-dialog-overlay[hidden] {
	display: none;
}

.user-dialog {
	width: 100%;
	max-width: 380px;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
	overflow: hidden;
}

.user-dialog-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px 0;
}

.user-dialog-title {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	color: #1f2937;
}

.user-dialog-close {
	width: 32px;
	height: 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	line-height: 1;
	color: #9ca3af;
	background: transparent;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition:
		background 0.15s ease,
		color 0.15s ease;
}
.user-dialog-close:hover {
	color: #374151;
	background: #f3f4f6;
}

.user-dialog-body {
	padding: 16px 20px 20px;
}

.user-field {
	margin-bottom: 14px;
}

.user-field-label {
	display: block;
	margin-bottom: 6px;
	font-size: 13px;
	color: #4b5563;
}

.user-field-input {
	width: 100%;
	height: 42px;
	padding: 0 12px;
	font-size: 15px;
	color: #1f2937;
	background: #f9fafb;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	box-sizing: border-box;
	transition:
		border-color 0.15s ease,
		box-shadow 0.15s ease;
}
.user-field-input:focus {
	outline: none;
	border-color: #e84e6c;
	box-shadow: 0 0 0 3px rgba(232, 78, 108, 0.12);
}

.user-code-row {
	display: flex;
	gap: 10px;
}
.user-code-row .user-field-input {
	flex: 1;
	min-width: 0;
}

.user-send-btn {
	flex: 0 0 auto;
	width: 118px;
	height: 42px;
	font-size: 13px;
	color: #e84e6c;
	background: #fdf2f4;
	border: 1px solid #f5c6d0;
	border-radius: 8px;
	cursor: pointer;
	transition:
		background 0.15s ease,
		border-color 0.15s ease,
		opacity 0.15s ease;
}
.user-send-btn:hover:not(:disabled) {
	background: #fbe4e9;
	border-color: #ef9db0;
}
.user-send-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.user-dialog-msg {
	min-height: 18px;
	margin: 0 0 10px;
	font-size: 13px;
	line-height: 1.5;
	color: #dc2626;
}

.user-submit-btn {
	width: 100%;
	height: 44px;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.06em;
	color: #fff;
	background: linear-gradient(135deg, #f0617e, #e84e6c);
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: filter 0.15s ease;
}
.user-submit-btn:hover:not(:disabled) {
	filter: brightness(1.05);
}
.user-submit-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.user-dialog-tip {
	margin: 12px 0 0;
	font-size: 12px;
	text-align: center;
	color: #9ca3af;
}

/* ---------- 用户中心页（/user console） ---------- */
.uc-console {
	max-width: 720px;
	margin: 0 auto;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 16px;
}

.uc-card {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	padding: 18px 20px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.uc-profile {
	grid-column: 1 / -1;
	display: flex;
	align-items: center;
	gap: 14px;
}

.uc-avatar {
	width: 56px;
	height: 56px;
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 22px;
	color: #fff;
	background: linear-gradient(135deg, #f0617e, #e84e6c);
	border-radius: 50%;
}

.uc-name {
	margin: 0 0 4px;
	font-size: 18px;
	font-weight: 600;
	color: #1f2937;
}

.uc-phone {
	margin: 0;
	font-size: 13px;
	color: #6b7280;
}

.uc-card h2 {
	margin: 0 0 8px;
	font-size: 15px;
	font-weight: 600;
	color: #374151;
}

.uc-balance {
	margin: 0;
	font-size: 28px;
	font-weight: 700;
	color: #e84e6c;
}

/* 余额下的明细小字：hover/聚焦弹出赠送算力表格（纯 CSS 交互） */
.uc-balance-detail {
	position: relative;
	display: inline-block;
	margin: 6px 0 0;
	font-size: 13px;
	color: #9ca3af;
	cursor: help;
}
.uc-balance-detail:focus-visible {
	outline: none;
}
.uc-balance-detail .fa-circle-info {
	margin-left: 2px;
	font-size: 12px;
	color: #c3c7cf;
}
.uc-balance-detail .uc-grants {
	position: absolute;
	left: 0;
	top: calc(100% + 10px);
	z-index: 40;
	display: none;
	min-width: 300px;
	margin: 0;
	padding: 8px 12px;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
	border-collapse: collapse;
}
.uc-balance-detail.uc-has-grants:hover .uc-grants,
.uc-balance-detail.uc-has-grants:focus-within .uc-grants {
	display: table;
}
/* 无赠送算力时隐藏 info 图标 */
.uc-balance-detail:not(.uc-has-grants) .fa-circle-info {
	display: none;
}

/* 真实 table：列宽由浏览器统一计算，跨行严格对齐 */
.uc-grants th,
.uc-grants td {
	padding: 5px 10px;
	font-size: 12px;
	line-height: 1.5;
	text-align: left;
	white-space: nowrap;
}
.uc-grants th {
	font-weight: 600;
	color: #6b7280;
	border-bottom: 1px solid #eef0f2;
}
.uc-grants td {
	color: #374151;
}
.uc-grants td:nth-child(2) {
	font-weight: 600;
}

.uc-recharge-btn {
	width: 100%;
	height: 38px;
	margin-top: 14px;
	font-size: 14px;
	font-weight: 600;
	color: #fff;
	background: #e84e6c;
	border: 0;
	border-radius: 8px;
	cursor: pointer;
}
.uc-recharge-btn:hover {
	background: #d94260;
}

.uc-recharge-overlay {
	position: fixed;
	inset: 0;
	z-index: 1100;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(0, 0, 0, 0.45);
}
.uc-recharge-overlay[hidden] {
	display: none;
}
.uc-recharge-dialog {
	width: min(420px, 100%);
	padding: 20px;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.2);
}
.uc-recharge-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 18px;
}
.uc-recharge-head h2 {
	margin: 0;
	font-size: 18px;
	color: #1f2937;
}
.uc-recharge-close {
	width: 32px;
	height: 32px;
	font-size: 22px;
	line-height: 1;
	color: #6b7280;
	background: transparent;
	border: 0;
	border-radius: 6px;
	cursor: pointer;
}
.uc-recharge-close:hover {
	background: #f3f4f6;
}
.uc-recharge-options {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
}
.uc-recharge-option {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 3px;
	height: 48px;
	font-size: 14px;
	color: #374151;
	background: #fff;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	cursor: pointer;
	transition:
		border-color 0.15s ease,
		box-shadow 0.15s ease,
		background 0.15s ease;
}
.uc-recharge-option:hover {
	border-color: #e84e6c;
}
.uc-recharge-option.is-selected {
	font-weight: 600;
	color: #e84e6c;
	background: #fdf2f4;
	border-color: #e84e6c;
	box-shadow: 0 0 0 3px rgba(232, 78, 108, 0.12);
}
/* 选项上的价格（10 算力 = 1 元） */
.uc-recharge-price {
	font-size: 12px;
	font-weight: 400;
	line-height: 1.2;
	color: #9ca3af;
}
.uc-recharge-option.is-selected .uc-recharge-price {
	color: #e84e6c;
}
/* 费率提示 */
.uc-recharge-rate {
	margin: 0 0 10px;
	font-size: 12px;
	text-align: center;
	color: #9ca3af;
}
/* 待支付金额：小字标签 + 大号金额 */
.uc-recharge-total {
	display: flex;
	align-items: baseline;
	justify-content: center;
	gap: 8px;
	margin: 14px 0 0;
	padding: 10px 0;
	background: #fdf2f4;
	border-radius: 8px;
}
.uc-recharge-total-label {
	font-size: 13px;
	color: #9ca3af;
}
.uc-recharge-total-amount {
	font-size: 24px;
	font-weight: 700;
	line-height: 1;
	color: #e84e6c;
}
.uc-recharge-submit {
	width: 100%;
	height: 44px;
	margin-top: 18px;
	font-size: 15px;
	font-weight: 600;
	color: #fff;
	background: #e84e6c;
	border: 0;
	border-radius: 8px;
	cursor: pointer;
}
.uc-recharge-msg {
	min-height: 18px;
	margin: 8px 0 0;
	font-size: 13px;
	text-align: center;
	color: #b45309;
}

.uc-muted,
.uc-empty {
	margin: 6px 0 0;
	font-size: 13px;
	color: #9ca3af;
}

/* 生成历史页未登录提示里的“去登录”按钮 */
.uh-login-btn {
	display: inline-block;
	margin: 0 0 0 8px;
	padding: 4px 14px;
	font-size: 13px;
	line-height: 1.5;
	vertical-align: middle;
	color: #e84e6c;
	background: #fdf2f4;
	border: 1px solid #f5c6d0;
	border-radius: 8px;
	cursor: pointer;
	transition: background 0.15s ease;
}
.uh-login-btn:hover {
	background: #fbe4e9;
	border-color: #ef9db0;
}

.uc-logout {
	grid-column: 1 / -1;
	width: 100%;
	height: 44px;
	font-size: 15px;
	color: #e84e6c;
	background: #fff;
	border: 1px solid #f5c6d0;
	border-radius: 8px;
	cursor: pointer;
	transition: background 0.15s ease;
}
.uc-logout:hover {
	background: #fdf2f4;
}

/* ---------- 已登录面板 ---------- */
.user-account-info {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px;
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	margin-bottom: 16px;
}

.user-account-avatar {
	width: 44px;
	height: 44px;
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	color: #fff;
	background: linear-gradient(135deg, #f0617e, #e84e6c);
	border-radius: 50%;
}

.user-account-meta {
	min-width: 0;
}
.user-account-name {
	margin: 0 0 3px;
	font-size: 15px;
	font-weight: 600;
	color: #1f2937;
}
.user-account-phone {
	margin: 0;
	font-size: 13px;
	color: #6b7280;
}

/* ---------- 用户中心生成历史卡片（最近 2 张图 + …） ---------- */
.uc-history {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 4px;
	text-decoration: none;
	min-height: 56px;
}
.uc-history:hover .uc-history-thumb {
	border-color: #f3c1cc;
}
.uc-history-thumb {
	width: 56px;
	height: 56px;
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 8px;
	overflow: hidden;
	background: #f3f4f6;
	border: 1px solid #eef0f3;
	font-size: 11px;
	color: #9ca3af;
}
.uc-history-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.uc-history-more {
	flex: 0 0 auto;
	width: 40px;
	height: 56px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 22px;
	font-weight: 700;
	color: #d1d5db;
	background: #f9fafb;
	border-radius: 8px;
}
.uc-history:hover .uc-history-more {
	color: #e84e6c;
}

/* ---------- 生成历史列表页（/user/history） ---------- */
.uh-list {
	max-width: 720px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.uh-item {
	display: flex;
	align-items: center;
	gap: 14px;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	padding: 12px 16px;
	text-decoration: none;
	transition:
		box-shadow 0.15s ease,
		border-color 0.15s ease;
}
.uh-item:hover {
	border-color: #f3c1cc;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}
.uh-thumb {
	flex: 0 0 auto;
	width: 72px;
	height: 72px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 8px;
	overflow: hidden;
	background: #f3f4f6;
	font-size: 12px;
	color: #9ca3af;
}
.uh-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.uh-body {
	flex: 1 1 auto;
	min-width: 0;
}
.uh-text {
	display: block;
	font-size: 15px;
	font-weight: 600;
	color: #1f2937;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.uh-sub {
	display: block;
	margin-top: 4px;
	font-size: 12px;
	color: #9ca3af;
}
.uh-status {
	flex: 0 0 auto;
	font-size: 12px;
	padding: 2px 10px;
	border-radius: 999px;
	background: #f3f4f6;
	color: #6b7280;
}
.uh-status-succeeded {
	background: #ecfdf5;
	color: #059669;
}
.uh-status-failed {
	background: #fef2f2;
	color: #dc2626;
}
.uh-status-partial {
	background: #fffbeb;
	color: #d97706;
}
.uh-status-pending,
.uh-status-processing {
	background: #eff6ff;
	color: #2563eb;
}
