/* ========================================
   统一认证页面样式（优化版）
   ======================================== */

/* 引入统一变量 */
@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-light: var(--primary-light);
  --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-radius: var(--radius-lg);
  --auth-radius-sm: var(--radius-sm);
  --auth-shadow: var(--shadow-lg);
  --auth-shadow-lg: var(--shadow-xl);
  --auth-transition: var(--transition-base);
}

/* 图片分享主题 */
.image-share-theme {
  --auth-primary: #667eea;
  --auth-primary-light: #7c8ef0;
  --auth-primary-dark: #5a6fd6;
  --auth-primary-bg: rgba(102, 126, 234, 0.08);
  --auth-gradient-start: #667eea;
  --auth-gradient-end: #764ba2;
}

/* 默认主题渐变 */
.auth-page:not(.image-share-theme):not(.frontend-theme) {
  --auth-gradient-start: var(--primary);
  --auth-gradient-end: var(--accent);
}

/* 主站点主题 (frontend) */
.frontend-theme {
  --auth-primary: var(--success);
  --auth-primary-light: var(--success-light);
  --auth-primary-dark: var(--success-dark);
  --auth-primary-bg: var(--success-bg);
  --auth-gradient-start: var(--success);
  --auth-gradient-end: var(--success-dark);
}

/* 默认主题渐变 */
.auth-page:not(.image-share-theme):not(.frontend-theme) {
  --auth-gradient-start: var(--primary);
  --auth-gradient-end: #7c3aed;
}

/* ========================================
   页面基础样式
   ======================================== */
.auth-page {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--auth-text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) var(--space-5);
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  background: var(--auth-bg);
}

/* 渐变背景装饰 */
.auth-page::before {
  content: '';
  position: fixed;
  top: -40%;
  right: -20%;
  width: 80%;
  height: 80%;
  background: radial-gradient(ellipse at center, var(--auth-primary-bg) 0%, transparent 70%);
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
}

.auth-page::after {
  content: '';
  position: fixed;
  bottom: -30%;
  left: -15%;
  width: 70%;
  height: 70%;
  background: radial-gradient(ellipse at center, rgba(99, 102, 241, 0.06) 0%, transparent 70%);
  opacity: 0.8;
  pointer-events: none;
  z-index: 0;
}

/* ========================================
   认证容器
   ======================================== */
.auth-container {
  width: 100%;
  max-width: 440px;
  background: var(--auth-card-bg);
  border-radius: 20px;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.05),
    0 10px 30px -5px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(0, 0, 0, 0.03);
  padding: var(--space-12) var(--space-10);
  animation: authSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 1;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

@keyframes authSlideUp {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ========================================
   头部
   ======================================== */
.auth-header {
  text-align: center;
  margin-bottom: var(--space-10);
}

.auth-header h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--auth-text);
  margin: 0 0 var(--space-3) 0;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--auth-gradient-start), var(--auth-gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-header p {
  font-size: var(--text-base);
  color: var(--auth-text-muted);
  margin: 0;
  font-weight: 400;
  letter-spacing: 0.3px;
}

/* ========================================
   提示信息
   ======================================== */
.auth-alert {
  padding: var(--space-4) var(--space-5);
  border-radius: 12px;
  margin-bottom: var(--space-6);
  font-size: var(--text-base);
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  animation: authAlertIn 0.3s ease;
}

@keyframes authAlertIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-alert i {
  font-size: 18px;
  flex-shrink: 0;
}

.auth-alert-error {
  background: var(--auth-error-bg);
  color: var(--auth-error);
  border: 1px solid rgba(239, 68, 68, 0.12);
  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.12);
  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.12);
  border-left: 3px solid var(--auth-warning);
}

/* ========================================
   表单
   ======================================== */
.auth-form {
  width: 100%;
}

.auth-form .form-group {
  margin-bottom: var(--space-6);
}

.auth-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--auth-text-secondary);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-form label .required {
  color: var(--auth-error);
  margin-left: 2px;
  font-size: 14px;
}

/* ========================================
   密码输入框容器
   ======================================== */
.password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field input {
  flex: 1;
  padding-right: 48px;
}

/* ========================================
   显示密码按钮
   ======================================== */
.toggle-password {
  position: absolute;
  right: var(--space-3);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-1);
  color: var(--auth-text-muted);
  font-size: var(--text-base);
  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: 14px 16px;
  border: 1.5px solid var(--auth-border);
  border-radius: 12px;
  font-size: var(--text-md);
  color: var(--auth-text);
  background: var(--auth-input-bg);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
  outline: none;
  font-family: inherit;
}

.auth-input:focus {
  border-color: var(--auth-primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 4px var(--auth-primary-bg), 0 2px 8px rgba(0, 0, 0, 0.04);
  transform: translateY(-1px);
}

.auth-input::placeholder {
  color: var(--auth-text-muted);
  font-weight: 400;
}

/* 验证码输入 */
.auth-input-code {
  font-size: 26px;
  letter-spacing: 10px;
  text-align: center;
  font-weight: 700;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* 禁用输入框 */
.auth-input[disabled] {
  background: var(--gray-100);
  color: var(--gray-400);
  cursor: not-allowed;
  opacity: 0.7;
}

/* ========================================
   表单描述文本
   ======================================== */
.auth-form-desc {
  color: var(--auth-text-secondary);
  font-size: var(--text-base);
  margin-bottom: var(--space-5);
  line-height: 1.6;
}

/* ========================================
   表单帮助文本
   ======================================== */
.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: var(--space-2);
  margin-bottom: var(--space-6);
  cursor: pointer;
  font-size: 14px;
  color: var(--auth-text-secondary);
  user-select: none;
}

.remember-me input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--auth-primary);
  cursor: pointer;
  border-radius: 4px;
}

/* ========================================
   按钮
   ======================================== */
.auth-btn {
  width: 100%;
  padding: 14px var(--space-6);
  border: none;
  border-radius: 12px;
  font-size: var(--text-md);
  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: var(--space-2);
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.auth-btn-primary {
  background: linear-gradient(135deg, var(--auth-gradient-start), var(--auth-gradient-end));
  color: #fff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.auth-btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.auth-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.auth-btn-primary:hover::before {
  opacity: 1;
}

.auth-btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ========================================
   链接区域
   ======================================== */
.auth-links {
  margin-top: var(--space-8);
  text-align: center;
}

.auth-links p,
.auth-links a {
  font-size: 14px;
  color: var(--auth-text-muted);
  margin: var(--space-3) 0;
}

.auth-links a {
  color: var(--auth-primary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
}

.auth-links a::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--auth-primary);
  transition: width 0.25s ease;
}

.auth-links a:hover {
  color: var(--auth-primary-dark);
}

.auth-links a:hover::after {
  width: 100%;
}

.auth-links .auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-5) 0;
  color: var(--auth-text-muted);
  font-size: var(--text-sm);
}

.auth-links .auth-divider::before,
.auth-links .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--auth-border);
}

/* ========================================
   用户协议
   ======================================== */
.agreement-group {
  margin-bottom: var(--space-6) !important;
}

.auth-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
  font-size: 13px;
  color: var(--auth-text-muted);
  line-height: 1.6;
  user-select: none;
}

.auth-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--auth-primary);
  cursor: pointer;
  margin-top: 2px;
  flex-shrink: 0;
  border-radius: 4px;
}

.auth-checkbox-label a {
  color: var(--auth-primary);
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
}

.auth-checkbox-label a:hover {
  color: var(--auth-primary-dark);
  text-decoration: underline;
}

/* ========================================
   弹窗
   ======================================== */
.auth-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  padding: var(--space-5);
  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(0, 0, 0, 0.2),
    0 0 0 1px rgba(0, 0, 0, 0.05);
  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: var(--space-6) var(--space-8);
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}

.auth-modal-header h2 {
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--auth-text);
}

.auth-modal-close {
  background: var(--gray-100);
  border: none;
  font-size: var(--text-2xl);
  color: var(--gray-500);
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
}

.auth-modal-close:hover {
  background: var(--gray-200);
  color: var(--gray-700);
  transform: rotate(90deg);
}

.auth-modal-body {
  padding: var(--space-7) var(--space-8);
  overflow-y: auto;
  flex: 1;
  line-height: 1.8;
  font-size: var(--text-base);
  color: var(--auth-text-secondary);
}

.auth-modal-body h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--auth-text);
  margin-top: var(--space-5);
  margin-bottom: var(--space-2);
}

.auth-modal-body h3:first-child {
  margin-top: 0;
}

.auth-modal-body p {
  margin-bottom: var(--space-2);
  text-align: justify;
}

.auth-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-8);
  border-top: 1px solid var(--gray-200);
  flex-shrink: 0;
}

/* ========================================
   图形验证码
   ======================================== */
.captcha-group {
  margin-bottom: var(--space-6) !important;
}

.captcha-container {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.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(--bg-card);
  transition: all 0.25s ease;
}

.captcha-image-wrapper:hover {
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 4px var(--auth-primary-bg);
  transform: translateY(-1px);
}

.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: var(--space-3);
  color: var(--auth-text-muted);
  font-size: var(--text-base);
  transition: all 0.25s ease;
  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);
  transform: rotate(180deg);
}

/* ========================================
   响应式
   ======================================== */
@media (max-width: 480px) {
  .auth-page {
    padding: var(--space-5) var(--space-4);
    align-items: flex-start;
    padding-top: var(--space-10);
  }

  .auth-container {
    padding: var(--space-8) var(--space-6);
    border-radius: 16px;
  }

  .auth-header {
    margin-bottom: var(--space-8);
  }

  .auth-header h1 {
    font-size: 24px;
  }

  .auth-header p {
    font-size: 13px;
  }

  .auth-form .form-group {
    margin-bottom: var(--space-5);
  }

  .auth-form label {
    font-size: 12px;
  }

  .auth-input {
    padding: 12px 14px;
    font-size: 15px;
  }

  .auth-btn {
    padding: 13px var(--space-5);
  }

  .auth-modal-content {
    max-height: 92vh;
    border-radius: 16px;
  }

  .auth-modal-header {
    padding: var(--space-5) var(--space-6);
  }

  .auth-modal-body {
    padding: var(--space-5) var(--space-6);
  }

  .auth-modal-footer {
    padding: var(--space-4) var(--space-6);
  }
}

@media (max-width: 360px) {
  .auth-container {
    padding: var(--space-6) var(--space-5);
  }

  .auth-header h1 {
    font-size: 22px;
  }
}