/* ============================================================
   login.css - 登录页独立样式 (2026-09-04 18:26 C 方案重构)
   设计: 深蓝底 + 加大粒子光晕 + 白色实底登录框
   ============================================================ */

/* 2026-09-04 23:35 SPA 化: login.css 只在 login 模式下生效, app 模式下 body 背景交给 app.css */
html, body.login-page { background: #0a1230; margin: 0; min-height: 100vh; }
body.login-page {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #fff;
}

/* 2026-09-04 23:35 SPA 化: app 模式下隐藏登录 overlay (默认 body.app-page 没 login-page class) */
body.app-page .login-overlay,
body:not(.login-page):not(.app-page) .login-overlay {
  display: none !important;
}

/* --- 整屏深蓝渐变背景 --- */
body.login-page .login-overlay {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #050a1f 0%, #0a1230 35%, #1a2553 70%, #0a1230 100%);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

/* --- 光晕 (加大: 模糊半径 + 尺寸 + 数量) --- */
body.login-page .glow {
  position: absolute; border-radius: 50%;
  filter: blur(120px); pointer-events: none;
}
body.login-page .glow-1 {
  width: 900px; height: 900px;
  background: radial-gradient(circle, rgba(59,130,246,0.85) 0%, rgba(59,130,246,0.3) 40%, transparent 70%);
  top: -300px; left: -250px;
  opacity: 0.7;
  animation: glowFloat1 18s ease-in-out infinite;
}
body.login-page .glow-2 {
  width: 800px; height: 800px;
  background: radial-gradient(circle, rgba(139,92,246,0.85) 0%, rgba(139,92,246,0.3) 40%, transparent 70%);
  bottom: -250px; right: -200px;
  opacity: 0.7;
  animation: glowFloat2 22s ease-in-out infinite;
}
body.login-page .glow-3 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(236,72,153,0.6) 0%, rgba(236,72,153,0.2) 40%, transparent 70%);
  top: 40%; left: 60%;
  opacity: 0.5;
  animation: glowFloat3 25s ease-in-out infinite;
}
body.login-page .glow-4 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(34,211,238,0.7) 0%, transparent 70%);
  top: 30%; right: -100px;
  opacity: 0.5;
  animation: glowFloat4 20s ease-in-out infinite;
}

@keyframes glowFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(80px, 60px) scale(1.15); }
  66% { transform: translate(-50px, 100px) scale(0.9); }
}
@keyframes glowFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-100px, -50px) scale(1.2); }
  66% { transform: translate(60px, -80px) scale(0.85); }
}
@keyframes glowFloat3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-80px, 60px) scale(1.1); }
}
@keyframes glowFloat4 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-60px, -100px) scale(1.15); }
}

/* --- 粒子 (加大 + 加密 + 更大浮动) --- */
body.login-page .particle {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,0.7);
  pointer-events: none;
  box-shadow: 0 0 6px rgba(255,255,255,0.5);
}
body.login-page .p1 { width: 5px; height: 5px; }
body.login-page .p2 { width: 4px; height: 4px; opacity: 0.85; }
body.login-page .p3 { width: 7px; height: 7px; opacity: 0.6; background: rgba(96,165,250,0.9); box-shadow: 0 0 10px rgba(96,165,250,0.7); }
body.login-page .p4 { width: 3px; height: 3px; opacity: 0.9; background: rgba(167,139,250,0.9); box-shadow: 0 0 8px rgba(167,139,250,0.6); }

/* 25 个粒子分散全屏 (原来 12 个) */
body.login-page .particle:nth-of-type(1)  { top: 5%;   left: 10%; animation: float1 8s  infinite ease-in-out; }
body.login-page .particle:nth-of-type(2)  { top: 12%;  left: 45%; animation: float2 10s infinite ease-in-out; }
body.login-page .particle:nth-of-type(3)  { top: 8%;   left: 75%; animation: float3 12s infinite ease-in-out; }
body.login-page .particle:nth-of-type(4)  { top: 18%;  left: 25%; animation: float1 9s  infinite ease-in-out; }
body.login-page .particle:nth-of-type(5)  { top: 22%;  left: 88%; animation: float2 11s infinite ease-in-out; }
body.login-page .particle:nth-of-type(6)  { top: 30%;  left: 5%;  animation: float3 13s infinite ease-in-out; }
body.login-page .particle:nth-of-type(7)  { top: 35%;  left: 60%; animation: float1 10s infinite ease-in-out; }
body.login-page .particle:nth-of-type(8)  { top: 42%;  left: 80%; animation: float2 8s  infinite ease-in-out; }
body.login-page .particle:nth-of-type(9)  { top: 48%;  left: 15%; animation: float3 9s  infinite ease-in-out; }
body.login-page .particle:nth-of-type(10) { top: 55%;  left: 70%; animation: float1 11s infinite ease-in-out; }
body.login-page .particle:nth-of-type(11) { top: 62%;  left: 35%; animation: float2 12s infinite ease-in-out; }
body.login-page .particle:nth-of-type(12) { top: 68%;  left: 92%; animation: float3 10s infinite ease-in-out; }
body.login-page .particle:nth-of-type(13) { top: 72%;  left: 20%; animation: float1 9s  infinite ease-in-out; }
body.login-page .particle:nth-of-type(14) { top: 78%;  left: 55%; animation: float2 13s infinite ease-in-out; }
body.login-page .particle:nth-of-type(15) { top: 82%;  left: 78%; animation: float3 8s  infinite ease-in-out; }
body.login-page .particle:nth-of-type(16) { top: 88%;  left: 8%;  animation: float1 11s infinite ease-in-out; }
body.login-page .particle:nth-of-type(17) { top: 92%;  left: 45%; animation: float2 9s  infinite ease-in-out; }
body.login-page .particle:nth-of-type(18) { top: 38%;  left: 45%; animation: float3 14s infinite ease-in-out; }
body.login-page .particle:nth-of-type(19) { top: 50%;  left: 92%; animation: float1 10s infinite ease-in-out; }
body.login-page .particle:nth-of-type(20) { top: 25%;  left: 55%; animation: float2 12s infinite ease-in-out; }
body.login-page .particle:nth-of-type(21) { top: 65%;  left: 5%;  animation: float3 11s infinite ease-in-out; }
body.login-page .particle:nth-of-type(22) { top: 75%;  left: 38%; animation: float1 13s infinite ease-in-out; }
body.login-page .particle:nth-of-type(23) { top: 15%;  left: 60%; animation: float2 10s infinite ease-in-out; }
body.login-page .particle:nth-of-type(24) { top: 85%;  left: 65%; animation: float3 9s  infinite ease-in-out; }
body.login-page .particle:nth-of-type(25) { top: 45%;  left: 28%; animation: float1 12s infinite ease-in-out; }

/* 加大浮动幅度 (从 ±40px → ±80px) */
@keyframes float1 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(60px,-80px); } }
@keyframes float2 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-80px,60px); } }
@keyframes float3 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(50px,80px); } }

/* 2026-09-04 18:32 装饰字 "数字改变未来" 从背景移除 (用户要求)
   tech-text div 保留 (login.html 里没有则不生效), 如未来要加可独立控制 */

/* ============================================================
   登录框 - 白色实底 (C 方案核心改动)
   ============================================================ */
body.login-page .login-box {
  position: relative; z-index: 10;
  width: 420px; max-width: 92vw;
  padding: 44px 40px 36px;
  background: #ffffff;
  border: none;
  border-radius: 20px;
  box-shadow:
    0 30px 80px rgba(0,0,0,0.4),
    0 10px 30px rgba(59,130,246,0.2),
    0 0 0 1px rgba(255,255,255,0.1) inset;
  color: #1e293b;
  /* 2026-09-04 19:04 根治刷新煽动: 删除 boxAppear 动画 (opacity 0→1 + translateY 20px + scale 0.95→1)
     首帧直接 opacity:1 位置固定, 刷新不再有位置/大小渐变 */
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}
@keyframes boxAppear { from { opacity: 1; transform: none; } to { opacity: 1; transform: none; } }

body.login-page .login-box h5 {
  text-align: center; margin-bottom: 32px;
  font-size: 1.25rem; font-weight: 400; /* 2026-09-06 12:14 "数字改变未来" 调整小点 */
  color: #111827; /* 2026-09-04 19:00 黑色字体 (深灰近黑) */
  letter-spacing: 1px; /* 2026-09-06 12:14 字距同步收紧 */
  text-shadow: none;
}

body.login-page .login-box .form-control {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  color: #0f172a;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.95rem;
  transition: all .2s;
}
/* 2026-09-04 18:42 布局 v3: 输入框 / 按钮 短居中 */
body.login-page .input-wrap {
  display: flex;
  justify-content: center;
}
body.login-page .input-center {
  width: 220px;
  max-width: 100%;
  text-align: left; /* 2026-09-04 18:53 输入文字左对齐 (用户输入也左对齐) */
}
body.login-page .input-center::placeholder {
  color: #94a3b8;
  opacity: 1;
  text-align: left; /* 2026-09-04 18:53 placeholder 也左对齐 */
}
body.login-page .btn-center {
  width: 160px;
  letter-spacing: 8px;
  text-indent: 8px; /* 抵消 letter-spacing 让 “登 录” 视觉居中 */
}
body.login-page .login-box .form-control:hover {
  border-color: #cbd5e1;
}
body.login-page .login-box .form-control:focus {
  background: #ffffff;
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59,130,246,0.12);
  color: #0f172a;
  outline: none;
}
body.login-page .login-box .form-control::placeholder { color: #94a3b8; }

body.login-page .login-box .form-check-label { color: #475569; font-size: 0.875rem; }
body.login-page .login-box .form-check-input {
  border-color: #cbd5e1;
  cursor: pointer;
}
body.login-page .login-box .form-check-input:checked {
  background-color: #3b82f6;
  border-color: #3b82f6;
}

body.login-page .login-box #btnLogin {
  margin-top: 4px;
  padding: 11px 13px; font-size: 1rem; font-weight: 600;
  color: #ffffff;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  border: none;
  border-radius: 10px;
  transition: all .2s;
  box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}
body.login-page .login-box #btnLogin:hover {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  box-shadow: 0 6px 18px rgba(59,130,246,0.45);
  transform: translateY(-1px);
}
body.login-page .login-box #btnLogin:active {
  transform: translateY(0);
}
body.login-page .login-box #btnLogin:disabled {
  opacity: 0.7; cursor: wait;
  transform: none;
  box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}

/* 2026-09-04 18:47 修复: 登录页不加载 Bootstrap, .d-flex/.text-center/.gap-3 是死类
   全部改用 login.css 自己的 class */
body.login-page .remember-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
body.login-page .remember-row .form-check { padding-left: 1.5em; margin: 0; }
body.login-page .remember-row .form-check-input { margin-left: -1.5em; margin-top: 0; cursor: pointer; }
body.login-page .btn-wrap { display: flex; justify-content: center; }

body.login-page .login-hint {
  color: #94a3b8 !important;
  font-size: 0.825rem;
}

/* --- 错误提示 --- */
body.login-page #loginError {
  background: #fef2f2;
  border-left: 3px solid #dc2626;
  padding: 10px 14px;
  border-radius: 6px;
  color: #b91c1c !important;
  font-size: 0.875rem;
}

/* --- 响应式 --- */
@media (max-width: 480px) {
  body.login-page .login-box {
    width: 92vw;
    padding: 32px 24px 28px;
  }
  body.login-page .tech-text { font-size: 2.2rem; letter-spacing: 6px; }
}

/* 2026-09-04 22:11 修复: 登录按钮点击后加 spinner 视觉反馈, 避免用户感觉按钮 "煽动".
  login.js doLogin() 在 btn.disabled=true 后插入 .login-spinner span.
  不依赖 Bootstrap spinner (login.html 不加载 vendor.js / bootstrap.css). */
body.login-page .login-box #btnLogin .login-spinner {
  display: inline-block; width: 14px; height: 14px;
  margin-left: 8px; vertical-align: -2px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: loginSpin 0.8s linear infinite;
}
@keyframes loginSpin { to { transform: rotate(360deg); } }

/* 2026-09-04 22:46 修复: 点击瞬间禁用 transition + padding 预留 spinner 位置,
   避免文字 "登录中" + spinner 出现时 opacity 200ms 渐变 + 宽度跳变 引起 "煽动".
   - .btn-loading 加在 #btnLogin 上后, transition: none, 无渐变.
   - min-width + padding-right 让按钮宽度不变, 加 spinner 不闪.
*/
body.login-page .login-box #btnLogin.btn-loading {
  transition: none !important;
  opacity: 0.8;
  min-width: 160px;
}
body.login-page .login-box #btnLogin.btn-loading .login-spinner {
  display: inline-block;
  vertical-align: -2px;
  margin-left: 10px;
}
/* 默认隐藏 spinner, 只在 .btn-loading 时显示 (避免初始帧 spinner flash) */
body.login-page .login-box #btnLogin:not(.btn-loading) .login-spinner {
  display: none;
}
