/* =============================================
   Freemail 登录页美化主题
   ============================================= */

:root{
  --surface: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 25%, #f8fafc 50%, #fff1f2 75%, #fef3e8 100%);
  --surface-overlay: linear-gradient(135deg, rgba(248, 250, 252, 0.9) 0%, rgba(241, 245, 249, 0.95) 100%);
  --card: rgba(255, 255, 255, 0.75);
  --card-shadow: rgba(255, 255, 255, 0.2);
  --card-glass: rgba(255, 255, 255, 0.5);
  --muted: #64748b;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-active: #4338ca;
  --primary-light: rgba(99, 102, 241, 0.12);
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --border-glass: rgba(255, 255, 255, 0.35);
  --text: #0f172a;
  --text-light: #334155;
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.12);
  --success: #10b981;
  --radius: 24px;
  --radius-sm: 14px;
  --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.12);
  --shadow-glass: 0 8px 32px rgba(99, 102, 241, 0.12);
  --shadow-glow: 0 0 60px rgba(99, 102, 241, 0.15);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* 允许选择文本的重要元素 */
input,
textarea,
select,
.selectable {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* 移动端触摸优化 */
@media (max-width: 768px) {
  button,
  .btn {
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
  }
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--surface);
  background-attachment: fixed;
  font-family: 'SF Pro Display', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow: hidden;
}

body::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: 
    radial-gradient(ellipse at 20% 80%, rgba(99, 102, 241, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(236, 72, 153, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 40% 40%, rgba(16, 185, 129, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 70%, rgba(245, 158, 11, 0.1) 0%, transparent 50%);
  animation: backgroundShift 20s ease-in-out infinite alternate;
  z-index: -1;
}

body::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse 100% 60% at 50% 0%, rgba(99, 102, 241, 0.08), transparent),
    radial-gradient(ellipse 80% 50% at 0% 100%, rgba(236, 72, 153, 0.06), transparent),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(16, 185, 129, 0.06), transparent);
  z-index: -1;
  animation: backgroundPulse 10s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes backgroundShift {
  0% { transform: translateX(-30px) translateY(-20px) rotate(0deg) scale(1); }
  50% { transform: translateX(20px) translateY(15px) rotate(0.5deg) scale(1.03); }
  100% { transform: translateX(30px) translateY(20px) rotate(-0.5deg) scale(1.05); }
}

@keyframes backgroundPulse {
  0% { opacity: 0.7; }
  100% { opacity: 1; }
}

.center {
  position: relative;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  z-index: 1;
}

.card {
  width: min(90vw, 440px);
  background: var(--card);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-radius: var(--radius);
  padding: 48px 44px;
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-glass), var(--shadow-glow);
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: cardSlideIn 0.7s var(--spring);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-gradient);
  border-radius: var(--radius) var(--radius) 0 0;
}

.card::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 0;
  right: 0;
  height: 100px;
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.05) 0%, transparent 100%);
  pointer-events: none;
}

@keyframes cardSlideIn {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.9);
    filter: blur(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  animation: logoFloat 4s ease-in-out infinite;
  filter: drop-shadow(0 8px 16px rgba(99, 102, 241, 0.25));
  position: relative;
  z-index: 1;
}

.logo svg {
  width: 72px;
  height: 72px;
  color: var(--primary);
  stroke: currentColor;
  transition: transform 0.3s ease;
}

.logo:hover svg {
  transform: rotate(-10deg) scale(1.1);
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0px) rotate(0deg) scale(1); }
  25% { transform: translateY(-6px) rotate(-2deg) scale(1.02); }
  50% { transform: translateY(-12px) rotate(0deg) scale(1.05); }
  75% { transform: translateY(-6px) rotate(2deg) scale(1.02); }
}

h1 {
  font-size: 30px;
  font-weight: 800;
  margin: 0 0 32px 0;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.03em;
  background-size: 200% 200%;
  animation: gradientFlow 4s ease infinite;
  position: relative;
  z-index: 1;
}

@keyframes gradientFlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.err {
  color: var(--danger);
  min-height: 24px;
  margin-bottom: 20px;
  font-weight: 600;
  font-size: 14px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(248, 113, 113, 0.08));
  border: 1px solid rgba(239, 68, 68, 0.25);
  display: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
  position: relative;
  z-index: 1;
}

.err:not(:empty) {
  display: block;
  animation: errorShake 0.5s var(--spring);
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-6px) rotate(-0.5deg); }
  30% { transform: translateX(5px) rotate(0.5deg); }
  45% { transform: translateX(-4px) rotate(-0.3deg); }
  60% { transform: translateX(3px) rotate(0.3deg); }
  75% { transform: translateX(-2px); }
}

.input {
  width: 100%;
  padding: 16px 20px;
  border: 1.5px solid var(--border-glass);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  background: var(--card-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  font-size: 16px;
  transition: all 0.25s var(--ease-out-expo);
  font-weight: 500;
  color: var(--text);
  position: relative;
  z-index: 1;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light), 0 4px 16px rgba(99, 102, 241, 0.15);
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.98);
}

.input:hover:not(:focus) {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.8);
}

.input::placeholder {
  color: var(--muted);
  font-weight: 400;
}

.btn {
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary-gradient);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  transition: all 0.25s var(--ease-out-expo);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transition: left 0.5s var(--ease-out-expo);
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, transparent 50%);
  border-radius: inherit;
  pointer-events: none;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  background: linear-gradient(135deg, var(--primary-hover) 0%, #7c3aed 50%, #a855f7 100%);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn:active {
  transform: translateY(-1px) scale(0.98);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
  transition-duration: 0.1s;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.4), 0 0 0 3px rgba(99, 102, 241, 0.3);
}

/* ===== 主题切换按钮 ===== */
.theme-toggle-login {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
}

.theme-toggle-login:hover {
  transform: scale(1.1) rotate(15deg);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.3);
  background: #6366f1;
  border-color: #6366f1;
}

.theme-toggle-login:hover svg {
  color: white;
}

.theme-toggle-login svg {
  color: #6366f1;
  transition: color 0.3s ease;
}

/* 暗黑模式 */
:root.dark .theme-toggle-login {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(255, 255, 255, 0.15);
}

:root.dark .theme-toggle-login:hover {
  background: #6366f1;
  border-color: #6366f1;
}

/* ===== 暗色模式变量覆盖（由 login_black.css 合并） ===== */
/* =============================================
   Login 页面暗黑模式样式
   ============================================= */

:root.dark {
  /* 登录页面背景 */
  --login-bg: linear-gradient(135deg, #0f172a 0%, #1e1b4b 25%, #1e293b 50%, #18181b 75%, #1c1917 100%);
  --login-card-bg: rgba(30, 41, 59, 0.85);
  --login-border: rgba(255, 255, 255, 0.1);
}

:root.dark body {
  background: var(--login-bg);
}

:root.dark body::before {
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.2), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(236, 72, 153, 0.15), transparent),
    radial-gradient(ellipse 50% 60% at 0% 80%, rgba(16, 185, 129, 0.15), transparent);
}

/* 登录卡片 */
:root.dark .login-card,
:root.dark .login-box,
:root.dark .card {
  background: var(--login-card-bg);
  border: 1px solid var(--login-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Logo */
:root.dark .logo {
  color: #a5b4fc;
}

/* 标题 */
:root.dark .login h1,
:root.dark .login-title {
  color: #f8fafc;
}

/* 副标题 */
:root.dark .login-subtitle,
:root.dark .login h2 {
  color: #94a3b8;
}

/* 表单标签 */
:root.dark .field-label,
:root.dark label {
  color: #e2e8f0;
}

/* 输入框 */
:root.dark .input,
:root.dark input[type="text"],
:root.dark input[type="password"],
:root.dark input[type="email"] {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f8fafc;
}

:root.dark .input::placeholder,
:root.dark input::placeholder {
  color: #64748b;
}

:root.dark .input:focus,
:root.dark input:focus {
  background: rgba(15, 23, 42, 0.8);
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* 下拉框 */
:root.dark .select,
:root.dark select {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f8fafc;
}

/* 按钮 */
:root.dark .btn {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

:root.dark .btn:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: #6366f1;
  color: #a5b4fc;
}

:root.dark .btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  color: white;
  border: none;
}

:root.dark .btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #9333ea 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

:root.dark .btn-secondary {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

:root.dark .btn-secondary:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: #6366f1;
  color: #a5b4fc;
}

/* 错误提示 */
:root.dark .error,
:root.dark .error-message {
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}

/* 提示文字 */
:root.dark .hint,
:root.dark .field-hint {
  color: #64748b;
}

/* 链接 */
:root.dark a,
:root.dark .link {
  color: #818cf8;
}

:root.dark a:hover,
:root.dark .link:hover {
  color: #a5b4fc;
}

/* 加载动画 */
:root.dark .loading {
  color: #6366f1;
}

/* 页脚 */
:root.dark .login-footer,
:root.dark .footer {
  color: #64748b;
}

/* 分割线 */
:root.dark .divider,
:root.dark hr {
  border-color: rgba(255, 255, 255, 0.1);
}

/* 社交登录按钮 */
:root.dark .social-btn {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

:root.dark .social-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.3);
}

/* 复选框 */
:root.dark input[type="checkbox"] {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(255, 255, 255, 0.2);
}

:root.dark input[type="checkbox"]:checked {
  background: #6366f1;
  border-color: #6366f1;
}

/* 记住我标签 */
:root.dark .remember-me label,
:root.dark .remember-me {
  color: #94a3b8;
}

/* 管理员链接 */
:root.dark .admin-link {
  color: #64748b;
}

:root.dark .admin-link:hover {
  color: #818cf8;
}

/* Toast 提示 */
:root.dark .toast {
  background: rgba(30, 41, 59, 0.95);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

:root.dark .toast.toast-success {
  border-color: rgba(16, 185, 129, 0.5);
}

:root.dark .toast.toast-error {
  border-color: rgba(239, 68, 68, 0.5);
}