/* ========================================
   统一认证页面样式（整体重设计版）
   布局：桌面分屏（左品牌面板 + 右表单卡），移动端单栏
   ======================================== */

/* 引入统一变量 */
@import url('variables.css');

/* ========================================
   全局重置
   ======================================== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

/* ========================================
   认证页面变量（覆盖默认值）
   ======================================== */
:root {
  --auth-primary: var(--primary);
  --auth-primary-dark: var(--primary-dark);
  --auth-primary-bg: var(--primary-bg);
  --auth-bg: var(--gray-50);
  --auth-card-bg: var(--bg-card);
  --auth-text: var(--text-primary);
  --auth-text-secondary: var(--text-secondary);
  --auth-text-muted: var(--text-muted);
  --auth-border: var(--border-color);
  --auth-input-bg: var(--gray-50);
  --auth-error: var(--danger);
  --auth-error-bg: rgba(239, 68, 68, 0.08);
  --auth-success: var(--success);
  --auth-success-bg: rgba(16, 185, 129, 0.08);
  --auth-warning: var(--warning);
  --auth-warning-bg: rgba(245, 158, 11, 0.08);
  --auth-gradient-start: var(--primary);
  --auth-gradient-end: #8b5cf6;
  /* 品牌面板使用更深的渐变端，保证白字对比度 >= 4.5:1 */
  --auth-brand-start: #7c3aed;
  --auth-brand-end: #5b21b6;
  --auth-transition: var(--transition-base);
}

/* 图片分享主题 */
.image-share-theme {
  --auth-primary: #ec4899;
  --auth-primary-dark: #be185d;
  --auth-primary-bg: rgba(236, 72, 153, 0.08);
  --auth-gradient-start: #ec4899;
  --auth-gradient-end: #8b5cf6;
  --auth-brand-start: #7c3aed;
  --auth-brand-end: #5b21b6;
}

/* 主站点主题 (frontend) */
.frontend-theme {
  --auth-primary: #8b5cf6;
  --auth-primary-dark: #7c3aed;
  --auth-primary-bg: rgba(139, 92, 246, 0.08);
  --auth-gradient-start: #8b5cf6;
  --auth-gradient-end: #ec4899;
  --auth-brand-start: #7c3aed;
  --auth-brand-end: #5b21b6;
}

/* ========================================
   页面基础
   ======================================== */
.auth-page {
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--auth-text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background:
    radial-gradient(1100px 600px at 88% -12%, var(--auth-primary-bg) 0%, transparent 62%),
    radial-gradient(900px 520px at -12% 112%, var(--auth-primary-bg) 0%, transparent 55%),
    var(--auth-bg);
}

/* ========================================
   分屏外壳
   ======================================== */
.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  width: 100%;
  max-width: 1040px;
  max-height: calc(100vh - 64px);
  background: var(--auth-card-bg);
  border-radius: 28px;
  overflow: hidden;
  box-shadow:
    0 25px 60px -18px rgba(2, 6, 23, 0.28),
    0 0 0 1px rgba(2, 6, 23, 0.05);
  animation: authShellIn 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authShellIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ========================================
   品牌面板
   ======================================== */
.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 56px 48px;
  color: #fff;
  background: linear-gradient(160deg, var(--auth-brand-start) 0%, var(--auth-brand-end) 100%);
  overflow: hidden;
  isolation: isolate;
}

/* 装饰光斑 */
.auth-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(420px 280px at 12% 8%, rgba(255, 255, 255, 0.16) 0%, transparent 60%),
    radial-gradient(360px 300px at 92% 90%, rgba(255, 255, 255, 0.1) 0%, transparent 55%);
}

/* 底部压暗，保证描述/备案文字对比度 */
.auth-brand::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.2) 100%);
}

/* 签名元素：主题渐变圆徽（站点名首字符） */
.auth-brand-badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  margin-bottom: 28px;
  user-select: none;
}

.auth-brand-name {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.25;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

.auth-brand-desc {
  margin-top: 12px;
  max-width: 320px;
  font-size: 15px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.auth-brand-icp {
  margin-top: 44px;
  font-size: 12px;
  letter-spacing: 0.3px;
  color: rgba(255, 255, 255, 0.55);
}

/* ========================================
   表单卡片
   ======================================== */
.auth-card {
  padding: 48px 52px;
  background: var(--auth-card-bg);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.auth-card-header {
  margin-bottom: 28px;
}

.auth-card-header h2 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--auth-text);
}

.auth-card-header p {
  margin-top: 8px;
  font-size: 14px;
  color: var(--auth-text-muted);
}

/* ========================================
   提示信息
   ======================================== */
.auth-alert {
  padding: 13px 16px;
  border-radius: 12px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: authAlertIn 0.3s ease;
}

@keyframes authAlertIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-alert i {
  font-size: 17px;
  flex-shrink: 0;
}

.auth-alert-error {
  background: var(--auth-error-bg);
  color: var(--auth-error);
  border: 1px solid rgba(239, 68, 68, 0.14);
  border-left: 3px solid var(--auth-error);
}

.auth-alert-success {
  background: var(--auth-success-bg);
  color: var(--auth-success);
  border: 1px solid rgba(16, 185, 129, 0.14);
  border-left: 3px solid var(--auth-success);
}

.auth-alert-warning {
  background: var(--auth-warning-bg);
  color: var(--auth-warning);
  border: 1px solid rgba(245, 158, 11, 0.14);
  border-left: 3px solid var(--auth-warning);
}

/* ========================================
   表单
   ======================================== */
.auth-form {
  width: 100%;
}

.auth-form .form-group {
  margin-bottom: 20px;
}

.auth-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--auth-text-secondary);
  margin-bottom: 8px;
}

.auth-form label .required {
  color: var(--auth-error);
  margin-left: 2px;
}

/* 密码输入框容器 */
.password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field input {
  flex: 1;
  padding-right: 48px;
}

.toggle-password {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--auth-text-muted);
  font-size: 15px;
  transition: var(--auth-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.toggle-password:hover {
  color: var(--auth-primary);
  background: var(--auth-primary-bg);
}

/* 输入框 */
.auth-input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--auth-border);
  border-radius: 12px;
  font-size: 15px;
  color: var(--auth-text);
  background: var(--auth-input-bg);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  font-family: inherit;
}

.auth-input:focus {
  border-color: var(--auth-primary);
  background: var(--auth-card-bg);
  box-shadow: 0 0 0 4px var(--auth-primary-bg);
}

.auth-input::placeholder {
  color: var(--auth-text-muted);
}

/* 验证码输入 */
.auth-input-code {
  font-size: 26px;
  letter-spacing: 10px;
  text-align: center;
  font-weight: 700;
  font-family: var(--font-mono);
}

/* 禁用输入框 */
.auth-input[disabled] {
  background: var(--gray-100);
  color: var(--gray-400);
  cursor: not-allowed;
  opacity: 0.7;
}

/* 字段内联错误（AJAX 登录） */
.field-error {
  display: none;
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--auth-error);
}

.field-error:not(:empty) {
  display: block;
}

.auth-input.has-error {
  border-color: var(--auth-error);
  box-shadow: 0 0 0 4px var(--auth-error-bg);
}

/* 表单描述/帮助文本 */
.form-text {
  font-size: 12px;
  display: block;
  margin-top: 6px;
  color: var(--auth-text-muted);
  line-height: 1.4;
}

/* ========================================
   记住登录
   ======================================== */
.remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 20px;
  cursor: pointer;
  font-size: 14px;
  color: var(--auth-text-secondary);
  user-select: none;
}

.remember-me input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--auth-primary);
  cursor: pointer;
}

/* ========================================
   按钮
   ======================================== */
.auth-btn {
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  position: relative;
}

.auth-btn-primary {
  background: linear-gradient(135deg, var(--auth-gradient-start), var(--auth-gradient-end));
  color: #fff;
  box-shadow: 0 4px 14px rgba(2, 6, 23, 0.18);
}

.auth-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(2, 6, 23, 0.24);
}

.auth-btn-primary:active {
  transform: translateY(0);
}

.auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* 加载态 */
.auth-btn-primary.is-loading::after {
  content: '';
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: authSpin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes authSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ========================================
   链接区域
   ======================================== */
.auth-links {
  margin-top: 26px;
  text-align: center;
}

.auth-links p,
.auth-links a {
  font-size: 14px;
  color: var(--auth-text-muted);
  margin: 10px 0;
}

.auth-links a {
  color: var(--auth-primary);
  text-decoration: none;
  font-weight: 500;
  transition: var(--auth-transition);
}

.auth-links a:hover {
  color: var(--auth-primary-dark);
  text-decoration: underline;
}

/* ========================================
   协议勾选
   ======================================== */
.agreement-group {
  margin-bottom: 18px !important;
  padding: 12px 14px;
  background: var(--auth-input-bg);
  border: 1px solid var(--auth-border);
  border-radius: 12px;
}

.auth-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--auth-text-muted);
  line-height: 1.6;
  user-select: none;
}

.auth-checkbox-label input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--auth-primary);
  cursor: pointer;
  margin-top: 2px;
  flex-shrink: 0;
}

.auth-checkbox-label a {
  color: var(--auth-primary);
  font-weight: 500;
  text-decoration: none;
  transition: var(--auth-transition);
}

.auth-checkbox-label a:hover {
  color: var(--auth-primary-dark);
  text-decoration: underline;
}

/* 字段辅助提示（大写锁定等） */
.field-hint {
  font-size: 12px;
  line-height: 1.5;
  margin-top: 6px;
}

.caps-hint {
  color: var(--auth-warning);
  font-weight: 500;
}

/* 登录安全提示 */
.auth-security-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--auth-text-muted);
  text-align: center;
}

.auth-security-note i {
  color: var(--auth-success);
  font-size: 13px;
}

/* ========================================
   图形验证码
   ======================================== */
.captcha-group {
  margin-bottom: 18px !important;
}

.captcha-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.captcha-image-wrapper {
  border: 1.5px solid var(--auth-border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  line-height: 0;
  flex-shrink: 0;
  background: var(--auth-card-bg);
  transition: var(--auth-transition);
}

.captcha-image-wrapper:hover {
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 4px var(--auth-primary-bg);
}

.captcha-image-wrapper svg {
  display: block;
  width: 120px;
  height: 40px;
}

.captcha-refresh {
  background: var(--auth-input-bg);
  border: 1.5px solid var(--auth-border);
  border-radius: 12px;
  cursor: pointer;
  padding: 10px;
  color: var(--auth-text-muted);
  font-size: 15px;
  transition: var(--auth-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  height: 44px;
  width: 44px;
}

.captcha-refresh:hover {
  color: var(--auth-primary);
  border-color: var(--auth-primary);
  background: var(--auth-primary-bg);
}

/* ========================================
   第三方登录
   ======================================== */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 22px 0 16px;
  color: var(--auth-text-muted);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--auth-border), transparent);
}

.auth-divider span {
  padding: 0 16px;
  white-space: nowrap;
}

.oauth-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 8px;
}

.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1.5px solid var(--auth-border);
  border-radius: 10px;
  background: var(--auth-card-bg);
  color: var(--oauth-color, var(--auth-text));
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  min-width: 104px;
}

.oauth-btn:hover {
  background: var(--oauth-color, var(--auth-primary));
  color: #fff;
  border-color: var(--oauth-color, var(--auth-primary));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(2, 6, 23, 0.16);
}

.oauth-btn:active {
  transform: translateY(0);
}

.oauth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.oauth-btn i {
  font-size: 18px;
}

/* 特定平台 hover 色 */
.oauth-btn-github:hover { background: #333; border-color: #333; }
.oauth-btn-wechat:hover { background: #07C160; border-color: #07C160; }
.oauth-btn-qq:hover { background: #12B7F5; border-color: #12B7F5; }
.oauth-btn-weibo:hover { background: #E6162D; border-color: #E6162D; }
.oauth-btn-google:hover { background: #4285F4; border-color: #4285F4; }

/* ========================================
   弹窗
   ======================================== */
.auth-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(2, 6, 23, 0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.auth-modal-overlay.active {
  display: flex;
  opacity: 1;
}

.auth-modal-content {
  background: var(--bg-card);
  border-radius: 20px;
  max-width: 720px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(2, 6, 23, 0.35);
  animation: authModalIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

@keyframes authModalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(16px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.auth-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 28px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.auth-modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--auth-text);
}

.auth-modal-close {
  background: var(--gray-100);
  border: none;
  font-size: 22px;
  color: var(--gray-500);
  cursor: pointer;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--auth-transition);
  line-height: 1;
}

.auth-modal-close:hover {
  background: var(--gray-200);
  color: var(--gray-700);
  transform: rotate(90deg);
}

.auth-modal-body {
  padding: 24px 28px;
  overflow-y: auto;
  flex: 1;
  line-height: 1.8;
  font-size: 14px;
  color: var(--auth-text-secondary);
}

.auth-modal-body h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--auth-text);
  margin-top: 20px;
  margin-bottom: 8px;
}

.auth-modal-body h3:first-child {
  margin-top: 0;
}

.auth-modal-body p {
  margin-bottom: 8px;
  text-align: justify;
}

.auth-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 18px 28px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.auth-modal-footer .auth-btn {
  width: auto;
  padding: 10px 24px;
}

/* ========================================
   键盘可达性
   ======================================== */
.auth-input:focus-visible,
.auth-btn:focus-visible,
.toggle-password:focus-visible,
.captcha-refresh:focus-visible,
.oauth-btn:focus-visible,
.auth-links a:focus-visible,
.auth-checkbox-label a:focus-visible,
.auth-modal-close:focus-visible {
  outline: 2px solid var(--auth-primary);
  outline-offset: 2px;
}

/* ========================================
   响应式
   ======================================== */
@media (max-width: 860px) {
  .auth-page {
    padding: 20px 16px;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    max-height: none;
    border-radius: 22px;
  }

  /* 品牌面板改为顶部条 */
  .auth-brand {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    padding: 22px 26px;
  }

  .auth-brand-badge {
    width: 44px;
    height: 44px;
    font-size: 20px;
    margin-bottom: 0;
  }

  .auth-brand-name {
    font-size: 20px;
  }

  .auth-brand-desc,
  .auth-brand-icp {
    display: none;
  }

  .auth-card {
    padding: 34px 32px;
  }
}

@media (max-width: 480px) {
  .auth-page {
    padding: 12px;
  }

  .auth-shell {
    border-radius: 18px;
  }

  .auth-brand {
    padding: 18px 20px;
  }

  .auth-card {
    padding: 28px 20px;
  }

  .auth-card-header h2 {
    font-size: 22px;
  }

  .oauth-buttons {
    gap: 8px;
  }

  .oauth-btn {
    padding: 9px 12px;
    min-width: 88px;
    font-size: 12px;
  }

  .auth-modal-content {
    max-height: 92vh;
    border-radius: 16px;
  }

  .auth-modal-header,
  .auth-modal-body,
  .auth-modal-footer {
    padding-left: 20px;
    padding-right: 20px;
  }
}

/* ========================================
   动效偏好
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
