/* auth.css — 登录 / 注册 / 修改密码 共享样式
   Apple 设计语言:
   - 中性灰页面底 (#f5f5f7) + 顶部极淡蓝色氛围光,单张悬浮白卡 (18px 圆角 + 柔和分层阴影)
   - 分组式灰底输入 (46px 高 / 12px 圆角),聚焦蓝色光环
   - 胶囊主按钮 (48px),按压 scale 反馈
   - 卡片入场 250ms Apple 曲线 cubic-bezier(0.32, 0.72, 0, 1)
   仅覆盖三个认证页面,不动 app.css 的全局视觉系统。
   注意:认证页不加载 app.css,所有缓动/时长在此内联。
*/

/* ---- 主题变量 (Apple 调色板,与 app.css token 层对齐) ---- */
:root {
	--auth-bg: #f5f5f7; /* 页面背景 (Apple signature gray) */
	--auth-page-glow: rgba(0, 113, 227, 0.05); /* 顶部氛围光 */
	--auth-card-bg: #ffffff;
	--auth-card-shadow:
		0 2px 8px rgba(0, 0, 0, 0.05), 0 12px 32px rgba(0, 0, 0, 0.08);
	--auth-radius: 18px;
	--auth-border: #d2d2d7; /* hairline */
	--auth-fg: #1d1d1f; /* Apple near-black */
	--auth-fg-muted: #86868b;
	--auth-fg-subtle: #6e6e73;
	--auth-primary: #0071e3; /* Apple blue,与 app.css --primary 一致 */
	--auth-primary-hover: #0077ed;
	--auth-primary-soft: #e5f0fb;
	--auth-danger: #d70015;
	--auth-icon: #86868b;
	--auth-icon-focus: #0071e3;
	--auth-input-bg: #f5f5f7; /* 白卡内的分组灰填充 */
	--auth-divider: #e8e8ed;
	--auth-focus-ring: rgba(0, 113, 227, 0.22);
	/* 临时密码 banner (暖色 well) */
	--auth-warn-bg: #fff3e0;
	--auth-warn-border: #f0d9b5;
	--auth-warn-fg: #7a4a00;
	--auth-warn-strong: #5e3a00;
	--auth-warn-em-bg: #f5dfae;
}
/* 暗色模式:沿用系统主题,与 app.css 的 dark 变量协调 */
@media (prefers-color-scheme: dark) {
	:root {
		--auth-bg: #111113;
		--auth-page-glow: rgba(10, 132, 255, 0.08);
		--auth-card-bg: #1c1c1e;
		--auth-card-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
		--auth-border: #38383a;
		--auth-fg: #f5f5f7;
		--auth-fg-muted: #8e8e93;
		--auth-fg-subtle: #a1a1a6;
		--auth-primary: #0a84ff;
		--auth-primary-hover: #409cff;
		--auth-primary-soft: #0a2e4f;
		--auth-danger: #ff453a;
		--auth-icon: #8e8e93;
		--auth-icon-focus: #0a84ff;
		--auth-input-bg: #2a2a2e;
		--auth-divider: #2a2a2e;
		--auth-focus-ring: rgba(10, 132, 255, 0.3);
		--auth-warn-bg: #33290a;
		--auth-warn-border: #4a3d12;
		--auth-warn-fg: #e8c96a;
		--auth-warn-strong: #ffd60a;
		--auth-warn-em-bg: #4a3d12;
	}
}

/* 暗色模式:与应用手动主题切换 (data-theme="dark" 设在 <html>) 协调,
   与 app.css 的 :root[data-theme="dark"] 一致;与上方 media 块保持同步 */
:root[data-theme="dark"] {
	--auth-bg: #111113;
	--auth-page-glow: rgba(10, 132, 255, 0.08);
	--auth-card-bg: #1c1c1e;
	--auth-card-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
	--auth-border: #38383a;
	--auth-fg: #f5f5f7;
	--auth-fg-muted: #8e8e93;
	--auth-fg-subtle: #a1a1a6;
	--auth-primary: #0a84ff;
	--auth-primary-hover: #409cff;
	--auth-primary-soft: #0a2e4f;
	--auth-danger: #ff453a;
	--auth-icon: #8e8e93;
	--auth-icon-focus: #0a84ff;
	--auth-input-bg: #2a2a2e;
	--auth-divider: #2a2a2e;
	--auth-focus-ring: rgba(10, 132, 255, 0.3);
	--auth-warn-bg: #33290a;
	--auth-warn-border: #4a3d12;
	--auth-warn-fg: #e8c96a;
	--auth-warn-strong: #ffd60a;
	--auth-warn-em-bg: #4a3d12;
}

/* ---- 页面布局 ---- */
html,
body {
	height: 100%;
}
body {
	margin: 0;
	background:
		radial-gradient(
			1200px 800px at 50% -10%,
			var(--auth-page-glow),
			transparent 60%
		),
		var(--auth-bg);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px 16px;
	font:
		14px/1.5 -apple-system,
		BlinkMacSystemFont,
		"Helvetica Neue",
		"PingFang SC",
		"Hiragino Sans GB",
		"Microsoft YaHei",
		sans-serif;
	color: var(--auth-fg);
	min-height: 100vh;
}

/* ---- 卡片:单张悬浮白卡,分层柔和阴影 + Apple 曲线入场 ---- */
@keyframes authCardIn {
	from {
		opacity: 0;
		transform: translateY(8px) scale(0.98);
	}
}
.auth-card {
	width: 100%;
	max-width: 400px;
	background: var(--auth-card-bg);
	border: 1px solid var(--auth-border);
	border-radius: var(--auth-radius);
	box-shadow: var(--auth-card-shadow);
	padding: 40px 36px 32px;
	animation: authCardIn 250ms cubic-bezier(0.32, 0.72, 0, 1) both;
}

/* ---- 顶部品牌区(logo + 标题 + 副标题) ---- */
.auth-brand {
	text-align: center;
	margin-bottom: 24px;
}
.auth-logo {
	width: 64px;
	height: 64px;
	margin: 0 auto 16px;
	display: block;
	filter: drop-shadow(0 4px 10px rgba(0, 113, 227, 0.18));
}
.auth-title {
	font-size: 24px;
	font-weight: 700;
	color: var(--auth-fg);
	margin: 0 0 6px;
	letter-spacing: -0.02em; /* 大字收紧字距 (Apple optical tracking) */
}
.auth-subtitle {
	font-size: 13px;
	color: var(--auth-fg-muted);
	margin: 0;
	letter-spacing: 0;
}

/* ---- 表单 ---- */
.auth-form {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

/* 输入字段容器:相对定位,用于图标绝对定位 */
.auth-field {
	position: relative;
}
/* 分组式输入:灰底填充 + 透明边框,聚焦才显蓝框光环 */
.auth-field input {
	width: 100%;
	height: 46px;
	padding: 0 44px 0 40px; /* 左 40 让出图标,右 44 让出可能的小图标 */
	font-size: 14px;
	font-family: inherit;
	color: var(--auth-fg);
	background: var(--auth-input-bg);
	border: 1px solid transparent;
	border-radius: 12px;
	outline: none;
	transition:
		border-color 120ms cubic-bezier(0.32, 0.72, 0, 1),
		box-shadow 120ms cubic-bezier(0.32, 0.72, 0, 1),
		background 120ms cubic-bezier(0.32, 0.72, 0, 1);
}
.auth-field input::placeholder {
	color: var(--auth-fg-muted);
}
.auth-field input:hover {
	border-color: var(--auth-border);
}
.auth-field input:focus {
	border-color: var(--auth-primary);
	box-shadow: 0 0 0 4px var(--auth-focus-ring);
}
/* 字段级错误状态:与 aria-invalid 配合使用 */
.auth-field input[aria-invalid="true"] {
	border-color: var(--auth-danger);
	box-shadow: 0 0 0 4px rgba(215, 0, 21, 0.15);
}

/* 输入框左侧图标 */
.auth-icon {
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%);
	width: 16px;
	height: 16px;
	color: var(--auth-icon);
	pointer-events: none;
	transition: color 120ms cubic-bezier(0.32, 0.72, 0, 1);
}
.auth-field input:focus ~ .auth-icon,
.auth-field input:focus + .auth-icon {
	color: var(--auth-icon-focus);
}

/* 密码右侧的「显示 / 隐藏」按钮 */
.auth-toggle {
	position: absolute;
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
	width: 28px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	padding: 0;
	cursor: pointer;
	color: var(--auth-icon);
	border-radius: 6px;
	transition:
		color 120ms cubic-bezier(0.32, 0.72, 0, 1),
		background 120ms cubic-bezier(0.32, 0.72, 0, 1);
}
.auth-toggle:hover {
	color: var(--auth-primary);
	background: var(--auth-primary-soft);
}
.auth-toggle svg {
	width: 16px;
	height: 16px;
}

/* P2-8 (2026-08-31): 移动端把 .auth-toggle 触控区扩到 40px (iOS HIG 推荐 ≥44px,
 * 桌面端保持 28px 不影响布局)。input 右侧 padding 同步增加以容纳扩大的按钮。 */
@media (max-width: 639px) {
	.auth-toggle {
		width: 40px;
		height: 40px;
	}
	.auth-field input {
		padding-right: 56px;
	}
}

/* ---- 错误提示 ---- */
.auth-error {
	min-height: 18px;
	font-size: 12px;
	color: var(--auth-fg-muted);
	padding: 2px 2px 0;
}
.auth-error.is-error {
	color: var(--auth-danger);
}

/* ---- 提交按钮(Apple 胶囊主按钮,按压 scale 反馈) ---- */
.auth-submit {
	margin-top: 4px;
	width: 100%;
	height: 48px;
	font-size: 16px;
	font-weight: 600;
	letter-spacing: 0;
	color: #ffffff;
	background: var(--auth-primary);
	border: none;
	border-radius: 999px;
	cursor: pointer;
	transition:
		background 120ms cubic-bezier(0.32, 0.72, 0, 1),
		transform 120ms cubic-bezier(0.32, 0.72, 0, 1);
}
.auth-submit:hover:not(:disabled) {
	background: var(--auth-primary-hover);
}
.auth-submit:active:not(:disabled) {
	transform: scale(0.97);
}
.auth-submit:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* ---- 底部链接区 ---- */
.auth-foot {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 18px;
	padding-top: 18px;
	border-top: 1px solid var(--auth-divider);
	font-size: 13px;
}
.auth-foot a {
	color: var(--auth-fg-subtle);
	text-decoration: none;
	transition: color 120ms cubic-bezier(0.32, 0.72, 0, 1);
}
.auth-foot a:hover {
	color: var(--auth-primary);
}

/* 底部辅助说明文字:用于"忘记密码? 请联系管理员重置"这类次级提示 */
.auth-remark {
	font-size: 12px;
	color: var(--auth-fg-muted);
}

/* 修改密码页面顶部说明文字 */
.auth-hint {
	margin: 0 0 18px;
	padding: 10px 14px;
	font-size: 13px;
	color: var(--auth-fg-subtle);
	background: var(--auth-primary-soft);
	border-radius: 12px;
	line-height: 1.5;
}

/* ---- 全局盒模型重置 (放在文件末尾,覆盖 :root 之外的所有默认样式) ---- */
*,
*::before,
*::after {
	box-sizing: border-box;
}

/* 临时密码 banner:管理员 reset 密码后用户首次登录必须改密 (暖色 well,经 token 化) */
.auth-temp-banner {
	margin: 0 0 18px;
	padding: 10px 14px;
	border-radius: 8px;
	background: var(--auth-warn-bg);
	color: var(--auth-warn-fg);
	border: 1px solid var(--auth-warn-border);
	font-size: 13px;
	line-height: 1.5;
}
.auth-temp-banner strong {
	display: block;
	margin-bottom: 4px;
	color: var(--auth-warn-strong);
}
.auth-temp-banner em {
	font-style: normal;
	font-weight: 600;
	background: var(--auth-warn-em-bg);
	padding: 0 4px;
	border-radius: 3px;
}

/* 认证页不加载 app.css,自带 reduced-motion 开关 */
@media (prefers-reduced-motion: reduce) {
	.auth-card {
		animation: none;
	}
	* {
		transition-duration: 0.01ms !important;
	}
}
