/* ===================================================================
 * auth.css — v2 账号系统样式（启动闪屏 / 登录页 / 侧边栏账号菜单）
 * 依赖 style.css 中的设计 token（CSS 变量）。
 * =================================================================== */

/* ============ 启动闪屏 ============ */
.boot-splash {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: var(--bg);
  transition: opacity 0.35s ease;
}
.boot-splash.hide { opacity: 0; pointer-events: none; }
.boot-logo {
  width: 64px; height: 64px; border-radius: 20px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 30px; font-weight: 800;
  box-shadow: 0 14px 40px color-mix(in srgb, var(--accent) 45%, transparent);
  animation: boot-pulse 1.3s ease-in-out infinite;
}
@keyframes boot-pulse {
  50% { transform: scale(1.09); filter: brightness(1.12); }
}

/* ============ 登录 / 注册页 ============ */
.auth-screen {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px; padding: 24px;
  background:
    radial-gradient(1200px 700px at 72% -10%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 62%),
    var(--bg);
  overflow: hidden;
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s ease;
}
.auth-screen.show { opacity: 1; pointer-events: auto; }

/* 背景光斑 */
.auth-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.auth-orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.42; }
.auth-orb.o1 {
  width: 440px; height: 440px; background: var(--accent);
  top: -140px; left: -100px;
  animation: orb-drift-1 16s ease-in-out infinite alternate;
}
.auth-orb.o2 {
  width: 380px; height: 380px; background: var(--accent-2);
  bottom: -120px; right: -80px; opacity: 0.3;
  animation: orb-drift-2 19s ease-in-out infinite alternate;
}
.auth-orb.o3 {
  width: 260px; height: 260px; background: var(--accent-hi);
  bottom: 18%; left: 10%; opacity: 0.22;
  animation: orb-drift-1 22s ease-in-out infinite alternate-reverse;
}
[data-theme="light"] .auth-orb { opacity: 0.2; }
[data-theme="light"] .auth-orb.o2 { opacity: 0.16; }
[data-theme="light"] .auth-orb.o3 { opacity: 0.12; }
@keyframes orb-drift-1 { to { transform: translate(60px, 40px) scale(1.08); } }
@keyframes orb-drift-2 { to { transform: translate(-50px, -36px) scale(1.12); } }

/* 登录页右上角主题切换 */
.auth-theme { position: absolute; top: 14px; right: 14px; z-index: 2; }

/* 玻璃拟态卡片 */
.auth-card {
  position: relative; z-index: 1;
  width: min(400px, 100%);
  padding: 34px 30px 24px;
  border-radius: 24px;
  border: 1px solid color-mix(in srgb, var(--border-strong) 85%, transparent);
  background: color-mix(in srgb, var(--bg-elevated) 76%, transparent);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: auth-rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes auth-rise {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.auth-card.shake { animation: auth-shake 0.4s ease; }
@keyframes auth-shake {
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}

.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-logo {
  width: 56px; height: 56px; border-radius: 17px; margin: 0 auto 14px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 26px; font-weight: 800;
  box-shadow: 0 12px 34px color-mix(in srgb, var(--accent) 42%, transparent);
}
.auth-brand h1 { margin: 0 0 4px; font-size: 20px; letter-spacing: 0.3px; }
.auth-sub { margin: 0; color: var(--text-dim); font-size: 13px; }

/* 登录 / 注册切换 tab */
.auth-tabs {
  position: relative;
  display: grid; grid-template-columns: 1fr 1fr;
  padding: 4px; margin-bottom: 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.auth-tab {
  position: relative; z-index: 1;
  padding: 8px 0; border: none; border-radius: 9px;
  background: transparent; color: var(--text-dim);
  font-size: 14px; font-weight: 600;
  transition: color 0.18s;
}
.auth-tab.active { color: var(--text); }
.auth-ink {
  position: absolute; top: 4px; bottom: 4px; left: 4px;
  width: calc(50% - 4px);
  border-radius: 9px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.16);
  transition: transform 0.24s cubic-bezier(0.3, 1.1, 0.4, 1);
}
.auth-tabs[data-mode="register"] .auth-ink { transform: translateX(100%); }

/* 顶部提示条（如"登录已过期"） */
.auth-notice {
  margin-bottom: 12px; padding: 9px 12px;
  border-radius: 10px; font-size: 12.5px; line-height: 1.5;
  color: var(--accent-hi);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

/* 表单 */
.auth-form { display: flex; flex-direction: column; gap: 13px; }
.auth-field label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--text-dim); margin-bottom: 6px;
}
.auth-input-wrap { position: relative; }
.auth-input-wrap .auth-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-faint); pointer-events: none;
}
.auth-input-wrap input {
  width: 100%; padding: 11px 40px 11px 38px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg-input); color: var(--text);
  font-size: 14px; font-family: inherit; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-input-wrap input::placeholder { color: var(--text-faint); }
.auth-input-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.auth-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border: none; border-radius: 8px;
  background: transparent; color: var(--text-faint);
  display: grid; place-items: center;
  transition: color 0.12s, background 0.12s;
}
.auth-eye:hover { color: var(--text); background: var(--bg-hover); }
.auth-eye .i-hide { display: none; }
.auth-eye.showing .i-show { display: none; }
.auth-eye.showing .i-hide { display: block; }

/* 错误提示 */
.auth-error {
  padding: 9px 12px; border-radius: 10px;
  font-size: 12.5px; line-height: 1.5; color: var(--danger);
  background: color-mix(in srgb, var(--danger) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 38%, transparent);
  animation: auth-rise 0.2s ease both;
}

/* 提交按钮 */
.auth-submit {
  position: relative;
  margin-top: 2px; padding: 12px;
  border: none; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hi));
  color: #fff; font-size: 15px; font-weight: 700; letter-spacing: 1px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 34%, transparent);
  transition: filter 0.15s, transform 0.1s, opacity 0.15s;
}
.auth-submit:hover:not(:disabled) { filter: brightness(1.09); }
.auth-submit:active:not(:disabled) { transform: scale(0.985); }
.auth-submit:disabled { opacity: 0.72; cursor: wait; }
.auth-spinner {
  display: none; width: 17px; height: 17px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.35); border-top-color: #fff;
  animation: auth-spin 0.7s linear infinite;
}
.auth-submit.loading .auth-spinner { display: inline-block; }
.auth-submit.loading .auth-submit-label { display: none; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

.auth-foot {
  margin: 18px 0 0; text-align: center;
  font-size: 13px; color: var(--text-dim);
}
.auth-link {
  border: none; background: none; padding: 0 2px;
  color: var(--accent-hi); font-size: 13px; font-weight: 600;
}
.auth-link:hover { text-decoration: underline; }

.auth-copy { position: relative; z-index: 1; margin: 0; color: var(--text-faint); font-size: 12px; }

/* ============ 侧边栏账号区 ============ */
.account-wrap {
  position: relative;
  margin-top: 6px; padding-top: 8px;
  border-top: 1px solid var(--border);
}
.account-btn {
  width: 100%; padding: 7px 10px;
  display: flex; align-items: center; gap: 10px;
  border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-dim);
  transition: background 0.12s, color 0.12s;
}
.account-btn:hover { background: var(--bg-hover); color: var(--text); }
.account-avatar {
  flex: 0 0 28px; width: 28px; height: 28px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 13px; font-weight: 700; text-transform: uppercase;
}
.account-email {
  flex: 1; min-width: 0; text-align: left;
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.account-caret { flex: 0 0 auto; transition: transform 0.18s; }
.account-wrap.open .account-caret { transform: rotate(180deg); }

.account-menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px);
  z-index: 30; padding: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow);
  opacity: 0; transform: translateY(6px); pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.account-wrap.open .account-menu { opacity: 1; transform: none; pointer-events: auto; }
.account-menu-head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 5px;
}
.account-menu-email {
  min-width: 0; flex: 1;
  font-size: 12.5px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.account-badge {
  flex: 0 0 auto; padding: 1px 8px;
  font-size: 11px; border-radius: 99px;
  color: var(--accent-hi);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.account-menu-item {
  width: 100%; padding: 9px 11px;
  display: flex; align-items: center; gap: 9px;
  border: none; border-radius: 9px;
  background: transparent; color: var(--text-dim);
  font-size: 13.5px;
  transition: background 0.12s, color 0.12s;
}
.account-menu-item:hover { background: var(--bg-hover); color: var(--text); }
.account-menu-item.danger:hover {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

/* ============ 响应式 / 动效偏好 ============ */
@media (max-width: 480px) {
  .auth-card { padding: 28px 22px 20px; border-radius: 20px; }
  .auth-orb { filter: blur(70px); }
}
@media (prefers-reduced-motion: reduce) {
  .auth-orb, .boot-logo { animation: none; }
}
