﻿/* ============ 黑白灰极简 · 高级入场动画 ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #fafafa;
  --card: #ffffff;
  --ink: #111827;
  --sub: #52525b;
  --mute: #a1a1aa;
  --border: #e8e8eb;
  --border-hover: #d5d5da;
  --ring: rgba(17, 24, 39, 0.06);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);      /* easeOutExpo，高级入场动效的核心曲线 */
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* 带回弹的弹簧曲线 */
  --danger: #e5484d;
  /* 水墨色：深墨灰，非纯黑，带一点宣纸感 */
  --primary: #2f343a;
  --primary-hover: #1f2328;
  --primary-soft: rgba(47, 52, 58, 0.12);
  --primary-glow: rgba(47, 52, 58, 0.28);
}

html, body { height: 100%; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--ink); color: #fff; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ============ 背景：点阵 + 缓慢漂移的色块 ============ */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

/* 细密点阵，营造高级质感 */
.bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, #e2e2e6 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 45%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 90% 80% at 50% 45%, #000 20%, transparent 75%);
}

.blob {
  position: absolute;
  width: 42vmax; height: 42vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.75;
}

.blob-a {
  top: -18%; left: -12%;
  background: #f0ece3;
  animation: drift-a 34s ease-in-out infinite alternate;
}

.blob-b {
  bottom: -22%; right: -10%;
  background: #ebebf1;
  animation: drift-b 40s ease-in-out infinite alternate;
}

@keyframes drift-a {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(9%, 7%) scale(1.12); }
}
@keyframes drift-b {
  from { transform: translate(0, 0) scale(1.08); }
  to   { transform: translate(-8%, -6%) scale(0.96); }
}

/* ============ 舞台与卡片 ============ */
.stage {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
}

.card {
  position: relative;
  width: min(460px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 52px 48px 42px;
  box-shadow:
    0 1px 2px rgba(10, 10, 10, 0.03),
    0 28px 56px -24px rgba(10, 10, 10, 0.10);
  animation: card-in 0.8s var(--ease) backwards;
}

/* 聚光灯边框：只有边框一圈，不污染内容 */
.card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 22px;
  padding: 1px;
  background: radial-gradient(200px circle at var(--mx, 50%) var(--my, 50%),
      rgba(10, 10, 10, 0.35), transparent 65%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
          mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.5s var(--ease);
  pointer-events: none;
}

.card:hover::before { opacity: 1; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

/* ============ 入场节奏：错落模糊升起 ============ */
.card-brand, .eyebrow, .sub, #loginForm > * {
  animation: fade-up 0.65s var(--ease) backwards;
}

.card-brand { animation-delay: 0.18s; }
.eyebrow    { animation-delay: 0.26s; }
.sub        { animation-delay: 0.52s; }
#loginForm > *:nth-child(1) { animation-delay: 0.58s; }
#loginForm > *:nth-child(2) { animation-delay: 0.64s; }
#loginForm > *:nth-child(3) { animation-delay: 0.70s; }
#loginForm > *:nth-child(4) { animation-delay: 0.76s; }
#loginForm > *:nth-child(5) { animation-delay: 0.82s; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* 标题逐字模糊升起 */
.title span {
  display: inline-block;
  animation: char-in 0.7s var(--ease) backwards;
}
.title span:nth-child(1) { animation-delay: 0.30s; }
.title span:nth-child(2) { animation-delay: 0.37s; }
.title span:nth-child(3) { animation-delay: 0.44s; }
.title span:nth-child(4) { animation-delay: 0.51s; }

@keyframes char-in {
  from { opacity: 0; transform: translateY(12px); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}

/* ============ 品牌与标题 ============ */
.card-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.mark {
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  border-radius: 9px;
}

.sys { font-size: 13px; font-weight: 500; color: var(--sub); letter-spacing: 0.02em; }

.eyebrow {
  margin-top: 38px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--mute);
}

.title {
  margin-top: 12px;
  text-align: center;
  font-size: 31px;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.3;
}

.sub {
  margin-top: 10px;
  text-align: center;
  font-size: 14px;
  color: var(--sub);
}

/* ============ 表单标签与输入 ============ */
#loginForm { margin-top: 32px; }

.field {
  position: relative;
  margin-top: 16px;
}

.field input {
  width: 100%;
  height: 54px;
  padding: 20px 42px 6px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--ink);
  font-family: inherit;
  font-size: 14.5px;
  caret-color: var(--ink);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.field input::placeholder { color: transparent; }

.field input:hover { border-color: var(--border-hover); }

.field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.field input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 60px #fff inset;
  -webkit-text-fill-color: var(--ink);
  transition: background-color 99999s;
}

/* 标签：默认时居中，聚焦/有值时上移变小 */
.field label {
  position: absolute;
  left: 14px;
  top: 27px;
  transform: translateY(-50%);
  font-size: 14.5px;
  color: var(--mute);
  pointer-events: none;
  transition: all 0.28s var(--ease);
}

.field input:focus + label,
.field input:not(:placeholder-shown) + label {
  top: 15px;
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--sub);
}

.field.error input { border-color: var(--danger); }
.field.error input:focus { box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.10); }

/* 密码可见性切换 */
.eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  border-radius: 8px;
  color: var(--mute);
  cursor: pointer;
  transition: color 0.2s, background 0.2s, transform 0.2s var(--spring);
}

.eye:hover { color: var(--ink); background: #f4f4f5; }
.eye:active { transform: translateY(-50%) scale(0.88); }
.eye svg { width: 17px; height: 17px; }
.eye .i-off { display: none; }
.eye.on .i-on { display: none; }
.eye.on .i-off { display: block; }

/* 大写锁定提示 */
.caps {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin-top: 0;
  font-size: 12px;
  color: #b45309;
  transition: max-height 0.3s var(--ease), opacity 0.3s, margin-top 0.3s;
}

.caps.show {
  max-height: 24px;
  opacity: 1;
  margin-top: 8px;
}

/* ============ 记住账号 / 忘记密码 ============ */
.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  font-size: 13px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--sub);
  cursor: pointer;
  user-select: none;
}

.check input { position: absolute; opacity: 0; width: 0; height: 0; }

.box {
  width: 16px; height: 16px;
  border: 1px solid #d4d4d8;
  border-radius: 5px;
  background: #fff;
  display: grid;
  place-items: center;
  transition: background 0.2s var(--ease), border-color 0.2s, transform 0.25s var(--spring);
}

.box::after {
  content: "";
  width: 8px; height: 4px;
  margin-top: -2px;
  border-left: 1.6px solid #fff;
  border-bottom: 1.6px solid #fff;
  transform: rotate(-45deg) scale(0);
  transition: transform 0.22s var(--spring);
}

.check:hover .box { border-color: var(--primary); }
.check input:checked + .box { background: var(--primary); border-color: var(--primary); }
.check input:checked + .box::after { transform: rotate(-45deg) scale(1); }
.check:active .box { transform: scale(0.85); }

.link {
  color: var(--sub);
  text-decoration: none;
  transition: color 0.2s;
}

.link:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }

/* ============ 登录按钮 + 状态机 ============ */
.btn-magnet {
  display: block;
  margin-top: 28px;
  will-change: transform;
}

.btn-magnet.return {
  transition: transform 0.55s var(--spring);
}

.btn {
  position: relative;
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 4px;
  text-indent: 4px;
  cursor: pointer;
  box-shadow: 0 8px 20px -8px var(--primary-glow);
  transition: background 0.25s var(--ease), transform 0.18s var(--spring), box-shadow 0.3s;
}

.btn:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 12px 28px -8px rgba(31, 35, 40, 0.38);
}

.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { cursor: default; }

.btn-label {
  display: inline-block;
  transition: opacity 0.18s, transform 0.25s var(--ease);
}

.spinner {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px; height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s;
  animation: spin 0.7s linear infinite;
}

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

.check-svg {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 20px; height: 20px;
}

.check-svg path {
  fill: none;
  stroke: #fff;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
}

.btn.loading .btn-label { opacity: 0; transform: scale(0.85); }
.btn.loading .spinner { opacity: 1; }

.btn.success .btn-label,
.btn.success .spinner { opacity: 0; }
.btn.success .check-svg path { animation: draw 0.45s var(--ease) 0.05s forwards; }

@keyframes draw { to { stroke-dashoffset: 0; } }

.btn.shake { animation: shake 0.45s var(--ease); }

@keyframes shake {
  15% { transform: translateX(-7px); }
  35% { transform: translateX(6px); }
  55% { transform: translateX(-4px); }
  75% { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

/* ============ 提示信息 ============ */
.msg {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  transition: max-height 0.35s var(--ease), opacity 0.3s, margin-top 0.3s, padding 0.3s;
}

.msg-error, .msg-success, .msg-info {
  max-height: 80px;
  opacity: 1;
  margin-top: 16px;
  padding: 10px 13px;
}

.msg-error   { color: var(--danger); background: #fef2f2; border: 1px solid #fecaca; }
.msg-success { color: #16a34a; background: #f0fdf4; border: 1px solid #bbf7d0; }
.msg-info    { color: var(--sub); background: #f4f4f5; border: 1px solid var(--border); }

.page-foot {
  margin-top: 28px;
  font-size: 12px;
  color: var(--mute);
  animation: fade-up 0.65s var(--ease) 0.95s backwards;
}

/* ============ 响应式与动效偏好 ============ */
@media (max-width: 480px) {
  .card { padding: 40px 28px 32px; border-radius: 18px; }
  .title { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
