/* 
 * Modern Login Page - 完全重构版
 * 设计原则：简洁、现代、响应式、无滚动条
 */

/* ---------- 基础变量 ---------- */
:root {
  /* 基础颜色 */
  --background: 0 0% 100%;
  --foreground: 222.2 47.4% 11.2%;
  --muted: 210 40% 96.1%;
  --muted-foreground: 215.4 16.3% 46.9%;
  --border: 214.3 31.8% 91.4%;
  --input: 214.3 31.8% 91.4%;
  --card: 0 0% 100%;
  --card-foreground: 222.2 47.4% 11.2%;
  --accent: 210 40% 96.1%;
  --accent-foreground: 222.2 47.4% 11.2%;
  --destructive: 0 100% 50%;
  --destructive-foreground: 210 40% 98%;
  --radius: 0.5rem;
  
  /* 主题色 - 默认蓝色 */
  --primary: 221.2 83.2% 53.3%;
  --primary-foreground: 210 40% 98%;
  --primary-glow: rgba(29, 78, 216, 0.15);
  --primary-rgb: 29, 78, 216;
  
  /* 浅色模式背景渐变色 */
  --gradient-1: #f8fafc;
  --gradient-2: #f1f5f9;
  --gradient-3: #e2e8f0;
  --gradient-4: #f8fafc;
  
  /* 动画时间 */
  --transition-fast: 0.15s;
  --transition-normal: 0.3s;
}

/* 深色模式变量 */
.dark {
  --background: 224 71% 4%;
  --foreground: 213 31% 91%;
  --muted: 223 47% 11%;
  --muted-foreground: 215.4 16.3% 56.9%;
  --border: 216 34% 17%;
  --input: 216 34% 17%;
  --card: 224 71% 4%;
  --card-foreground: 213 31% 91%;
  --accent: 216 34% 17%;
  --accent-foreground: 210 40% 98%;
  
  /* 深色模式背景渐变色 */
  --gradient-1: #000000;
  --gradient-2: #000819;
  --gradient-3: #002b66;
  --gradient-4: #000000;
}

/* 主题色变体 */
[data-color-theme="teal"] {
  --primary: 172.5 66% 50.4%;
  --primary-foreground: 210 40% 98%;
  --primary-glow: rgba(20, 184, 166, 0.15);
  --primary-rgb: 20, 184, 166;
  
  /* teal主题背景渐变 */
  --gradient-1: #042f2e;
  --gradient-2: #134e4a;
  --gradient-3: #115e59;
  --gradient-4: #042f2e;
}

[data-color-theme="mono"] {
  --primary: 220 14% 46%;
  --primary-foreground: 210 40% 98%;
  --primary-glow: rgba(100, 116, 139, 0.15);
  --primary-rgb: 100, 116, 139;
  
  /* mono主题背景渐变 */
  --gradient-1: #1e293b;
  --gradient-2: #334155;
  --gradient-3: #475569;
  --gradient-4: #1e293b;
}

[data-color-theme="orange"] {
  --primary: 24.6 95% 53.1%;
  --primary-foreground: 210 40% 98%;
  --primary-glow: rgba(249, 115, 22, 0.15);
  --primary-rgb: 249, 115, 22;
  
  /* orange主题背景渐变 */
  --gradient-1: #431407;
  --gradient-2: #7c2d12;
  --gradient-3: #9a3412;
  --gradient-4: #431407;
}

[data-color-theme="sakura"] {
  --primary: 328.6 73.7% 59.4%;
  --primary-foreground: 210 40% 98%;
  --primary-glow: rgba(236, 72, 153, 0.15);
  --primary-rgb: 236, 72, 153;
  
  /* sakura主题背景渐变 */
  --gradient-1: #500724;
  --gradient-2: #831843;
  --gradient-3: #9d174d;
  --gradient-4: #500724;
}

/* ---------- 全局重置 ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  position: absolute; /* 改为absolute而非fixed，允许滚动 */
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto; /* 显式允许垂直滚动 */
  overflow-x: hidden; /* 防止水平滚动 */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-overflow-scrolling: touch; /* 提升移动端滚动体验 */
}

body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* ---------- 布局结构 ---------- */
.modern-login-page {
  position: absolute; /* 改为absolute而非fixed */
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  min-width: 100vw;
  min-height: 100vh; /* 使用最小高度而非固定高度 */
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-y: auto; /* 显式允许垂直滚动 */
  overflow-x: hidden; /* 防止水平滚动 */
  -webkit-overflow-scrolling: touch; /* 提升移动端滚动体验 */
}

/* 背景图片效果 */
.modern-login-page::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('https://api.btstu.cn/sjbz/api.php?lx=fengjing&format=images');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: -2;
  transition: filter 0.3s ease;
}

/* 深色模式下降低背景亮度 */
.dark .modern-login-page::before {
  filter: brightness(0.5) saturate(1.2);
}

/* 添加半透明遮罩，增强可读性 */
.modern-login-page::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.2) 100%);
  z-index: -1;
  pointer-events: none;
}

.dark .modern-login-page::after {
  background: linear-gradient(135deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.4) 100%);
}

.main-container {
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  justify-content: center !important; /* 全局居中对齐 */
  align-items: center !important;
  position: relative !important;
  z-index: 1 !important;
  padding: 0 !important; /* 移除内边距 */
  pointer-events: none !important; /* 确保不影响子元素的点击 */
}

.main-container > * {
  pointer-events: auto; /* 恢复子元素的点击事件 */
}

.right-side {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

.form-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ---------- 卡片样式 ---------- */
.modern-card {
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border-radius: var(--radius);
  border: 1px solid rgba(var(--primary-rgb), 0.5); /* 使用主题色作为边框 */
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15); /* 保留阴影效果 */
  width: 550px; /* 缩小30px */
  padding: 2rem;
  transition: background-color var(--transition-normal), 
              border-color var(--transition-normal), 
              box-shadow var(--transition-normal),
              transform var(--transition-fast);
  position: relative;
  z-index: 2;
  animation: cardAppear 0.5s ease-out; /* 添加动画效果 */
}

/* 卡片效果 */
.glass-effect {
  background: #ffffff; /* 浅色模式下使用纯白色背景 */
  border: 2px solid rgba(var(--primary-rgb), 0.7); /* 更精细的边框 */
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2); /* 增强阴影 */
}

.glass-effect::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  border-radius: var(--radius);
  border: 1px solid rgba(var(--primary-rgb), 0.9);
  box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.7); /* 增强边框发光效果 */
  pointer-events: none;
  z-index: -1;
}

/* 深色模式下保留模糊效果 */
.dark .glass-effect {
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(20px);
  border: 2px solid rgba(var(--primary-rgb), 0.6);
}

.dark .glass-effect::before {
  border: 1px solid rgba(var(--primary-rgb), 0.8);
  box-shadow: 0 0 25px rgba(var(--primary-rgb), 0.6); /* 增强深色模式下的边框发光 */
}

/* ---------- 表单元素 ---------- */
.modern-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}

.modern-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.modern-input-wrapper.has-verify-btn .modern-input {
  padding-right: 120px; /* 为验证码按钮留出空间 */
}

.btn-verify {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 110px;
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--transition-fast), opacity var(--transition-fast);
}

.btn-verify:hover {
  background-color: hsl(var(--primary) / 0.9);
}

.btn-verify:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.modern-input {
  width: 100%;
  height: 2.75rem;
  padding: 0 1rem 0 2.5rem;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.modern-input:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-icon {
  position: absolute;
  left: 0.75rem;
  color: hsl(var(--muted-foreground));
}

/* ---------- 按钮样式 ---------- */
.modern-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.75rem;
  padding: 0 1.5rem;
  background-color: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.modern-button:hover {
  background-color: hsl(var(--accent));
}

.modern-button:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.modern-button-primary {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.modern-button-primary:hover {
  background-color: hsl(var(--primary) / 0.9);
}

.modern-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.w-100 {
  width: 100%;
}

/* ---------- 主题控制 ---------- */
.theme-controls {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  gap: 0.75rem;
  z-index: 100;
}

.theme-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background-color: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.theme-btn:hover {
  background-color: hsl(var(--accent));
}

/* 主题图标切换 */
.dark .sun-icon {
  display: block;
}

.dark .moon-icon {
  display: none;
}

.sun-icon {
  display: none;
}

.moon-icon {
  display: block;
}

/* 主题下拉菜单 */
.theme-dropdown {
  position: relative;
}

.theme-dropdown-content {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  width: 220px; /* 增加宽度防止文字溢出 */
  background-color: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  padding: 1rem;
  display: none;
  z-index: 100;
  overflow: hidden; /* 防止内容溢出 */
}

.theme-dropdown.active .theme-dropdown-content {
  display: block;
  animation: fadeIn var(--transition-fast) ease-in-out;
}

.theme-dropdown-header {
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
  color: hsl(var(--foreground));
}

.color-theme-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.color-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.color-option:hover {
  background-color: hsl(var(--accent));
}

.color-dot {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  position: relative;
}

.color-dot.active::after {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.color-dot.teal {
  background-color: #14b8a6;
  color: #14b8a6;
}

.color-dot.mono {
  background-color: #64748b;
  color: #64748b;
}

.color-dot.orange {
  background-color: #f97316;
  color: #f97316;
}

.color-dot.sakura {
  background-color: #ec4899;
  color: #ec4899;
}

/* ---------- 辅助类 ---------- */
.mb-0 {
  margin-bottom: 0;
}

.mb-3 {
  margin-bottom: 1rem;
}

.mb-4 {
  margin-bottom: 1.5rem;
}

.mt-4 {
  margin-top: 1.5rem;
}

.h3 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
}

.text-muted {
  color: hsl(var(--foreground) / 0.8); /* 更清晰的文字颜色 */
}

.dark .text-muted {
  color: rgba(255, 255, 255, 0.85); /* 深色模式下更亮的文字 */
}

.text-accent {
  color: hsl(var(--primary));
  text-decoration: none;
  transition: color var(--transition-fast);
}

.text-accent:hover {
  text-decoration: underline;
}

.text-sm {
  font-size: 0.875rem;
}

.d-flex {
  display: flex;
}

.justify-content-between {
  justify-content: space-between;
}

.align-items-center {
  align-items: center;
}

.text-center {
  text-align: center;
}

/* ---------- 加载效果 ---------- */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: var(--radius);
}

.dark .loading-overlay {
  background-color: rgba(17, 24, 39, 0.7);
}

.loading-spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid hsl(var(--muted));
  border-top-color: hsl(var(--primary));
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes cardAppear {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- 响应式设计 ---------- */
/* 桌面端 - 居中显示 */
@media (min-width: 1200px) {
  .modern-card {
    width: 550px;
  }
}

/* 平板电脑 */
@media (min-width: 992px) and (max-width: 1199px) {
  .modern-card {
    width: 520px;
  }
}

/* iPad和小屏幕笔记本 */
@media (min-width: 768px) and (max-width: 991px) {
  .modern-card {
    width: 500px;
    padding: 1.75rem;
  }
}

/* 大手机和小iPad */
@media (min-width: 576px) and (max-width: 767px) {
  .modern-card {
    width: 90%;
    max-width: 450px;
    padding: 1.5rem;
  }
}

/* 手机端 */
@media (max-width: 575px) {
  .modern-card {
    width: 95%;
    max-width: 350px;
    padding: 1.25rem;
  }
  
  .theme-controls {
    top: 1rem;
    right: 1rem;
  }
  
  .theme-btn {
    width: 2.25rem;
    height: 2.25rem;
  }
  
  .h3 {
    font-size: 1.25rem;
  }
  
  /* 手机端验证码按钮优化 */
  .btn-verify {
    width: 100px;
    font-size: 0.8rem;
  }
  
  .modern-input-wrapper.has-verify-btn .modern-input {
    padding-right: 105px;
  }
}
