/* Modern Login Page Styles - Shadcn inspired */
:root {
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 222.2 84% 4.9%;
  --primary: 221.2 83.2% 53.3%;
  --primary-foreground: 210 40% 98%;
  --secondary: 210 40% 96.1%;
  --secondary-foreground: 222.2 47.4% 11.2%;
  --muted: 210 40% 96.1%;
  --muted-foreground: 215.4 16.3% 46.9%;
  --accent: 210 40% 96.1%;
  --accent-foreground: 222.2 47.4% 11.2%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 210 40% 98%;
  --border: 214.3 31.8% 91.4%;
  --input: 214.3 31.8% 91.4%;
  --ring: 221.2 83.2% 53.3%;
  --radius: 0.5rem;
}

/* Color themes */
:root {
  --primary-color: rgba(29, 161, 242, 1);
  --primary-color-transparent: rgba(29, 161, 242, 0.3);
  --primary-glow-color: rgba(29, 161, 242, 0.2);
}

:root[data-color-theme="teal"] {
  --primary: 172.5 66% 50.4%;
  --primary-foreground: 210 40% 98%;
  --ring: 172.5 66% 50.4%;
  --primary-color-transparent: rgba(20, 184, 166, 0.3);
  --primary-glow-color: rgba(20, 184, 166, 0.2);
}

:root[data-color-theme="mono"] {
  --primary: 220 14% 45%;
  --primary-foreground: 210 40% 98%;
  --ring: 220 14% 45%;
  --primary-color-transparent: rgba(100, 116, 139, 0.3);
  --primary-glow-color: rgba(100, 116, 139, 0.2);
}

:root[data-color-theme="orange"] {
  --primary: 24.6 95% 53.1%;
  --primary-foreground: 60 9.1% 97.8%;
  --ring: 24.6 95% 53.1%;
  --primary-color-transparent: rgba(249, 115, 22, 0.3);
  --primary-glow-color: rgba(249, 115, 22, 0.2);
}

:root[data-color-theme="sakura"] {
  --primary: 328 73% 59%;
  --primary-foreground: 60 9.1% 97.8%;
  --ring: 328 73% 59%;
  --primary-color-transparent: rgba(236, 72, 153, 0.3);
  --primary-glow-color: rgba(236, 72, 153, 0.2);
}

.dark {
  --background: 222.2 84% 4.9%;
  --foreground: 210 40% 98%;
  --card: 222.2 84% 4.9%;
  --card-foreground: 210 40% 98%;
  --popover: 222.2 84% 4.9%;
  --popover-foreground: 210 40% 98%;
  --primary: 217.2 91.2% 59.8%;
  --primary-foreground: 222.2 47.4% 11.2%;
  --secondary: 217.2 32.6% 17.5%;
  --secondary-foreground: 210 40% 98%;
  --muted: 217.2 32.6% 17.5%;
  --muted-foreground: 215 20.2% 65.1%;
  --accent: 217.2 32.6% 17.5%;
  --accent-foreground: 210 40% 98%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 210 40% 98%;
  --border: 217.2 32.6% 17.5%;
  --input: 217.2 32.6% 17.5%;
  --ring: 224.3 76.3% 48%;
}

/* Base styles */
.modern-login-page {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: hsl(var(--foreground));
  background-color: hsl(var(--background));
  transition: background-color 0.3s, color 0.3s;
  position: fixed; /* 使用fixed而不是relative，确保全屏覆盖 */
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 100vh;
  width: 100vw; /* 使用视口宽度确保全屏 */
  overflow: hidden; /* 移除所有滚动条 */
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect fill="none" width="100" height="100"/><rect fill="none" width="100" height="100"/><path fill="rgba(130, 130, 230, 0.03)" d="M0 0h100v50H50V0H0zm50 50h50v50H50z"/></svg>');
  background-size: 30px 30px;
  margin: 0;
  padding: 0;
}

/* 添加装饰元素 */
.modern-login-page::before {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: linear-gradient(45deg, var(--primary-color-transparent), transparent);
  top: -100px;
  left: -100px;
  filter: blur(30px);
  z-index: -1;
}

.modern-login-page::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: linear-gradient(45deg, transparent, var(--primary-color-transparent));
  bottom: -150px;
  right: -150px;
  filter: blur(30px);
  z-index: -1;
}

/* Smooth transitions for theme changes */
*, *::before, *::after {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

/* Theme controls in top right corner */
.theme-controls {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
  z-index: 100;
  align-items: center;
}

.theme-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.theme-btn:hover {
  background-color: hsl(var(--accent));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-dropdown {
  position: relative;
}

.theme-dropdown-content {
  position: absolute;
  top: 50px;
  right: 0;
  width: 200px;
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  display: none;
  z-index: 100;
  transform-origin: top right;
  transition: transform 0.2s ease, opacity 0.2s ease;
  opacity: 0;
  transform: scale(0.95);
}

.theme-dropdown.active .theme-dropdown-content {
  display: block;
  opacity: 1;
  transform: scale(1);
}

.theme-dropdown-header {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 10px;
  color: hsl(var(--foreground));
}

/* Hide default theme toggle */
#theme-toggle {
  display: none;
}

/* Show appropriate icon based on theme */
.dark .sun-icon {
  display: block;
}

.dark .moon-icon {
  display: none;
}

.sun-icon {
  display: none;
}

.moon-icon {
  display: block;
}

/* Card styles */
.modern-card {
  background-color: hsl(var(--card));
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
  width: 580px; /* 恢复原来更宽的卡片宽度 */
  padding: 30px;
  margin: 0 auto;
}

.dark .modern-card {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

/* Glass effect */
.glass-effect {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 2px solid var(--primary-color-transparent) !important;
  box-shadow: 0 0 30px var(--primary-glow-color), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
  animation: cardAppear 0.5s ease forwards;
}

.glass-effect::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.glass-effect::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary-color-transparent), transparent);
}

.dark .glass-effect {
  background: rgba(0, 0, 0, 0.25);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3), 0 0 35px var(--primary-glow-color) !important;
  border: 2px solid var(--primary-color-transparent) !important;
}

.dark .glass-effect::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.dark .glass-effect::after {
  background: linear-gradient(90deg, transparent, var(--primary-color-transparent), transparent);
}

/* Form styles */
.modern-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 20px; /* 增加输入框之间的间距 */
}

.input-icon {
  position: absolute;
  left: 15px; /* 稍微调整图标位置 */
  color: var(--primary-color);
  z-index: 2;
  top: 50%;
  transform: translateY(-50%); /* 确保图标垂直居中 */
}

.modern-input {
  display: block;
  width: 100%;
  padding: 0.85rem 0.75rem 0.85rem 45px; /* 增加高度和左侧内边距 */
  font-size: 1rem; /* 增加字体大小 */
  line-height: 1.5;
  color: hsl(var(--foreground));
  background-color: transparent;
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.modern-input:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsla(var(--ring), 0.3);
}

.dark .modern-input {
  background-color: hsl(var(--input));
}

.modern-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}

/* Button styles */
.form-wrapper {
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modern-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  height: 2.5rem;
  padding-left: 1rem;
  padding-right: 1rem;
  transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  cursor: pointer;
}

/* 验证码按钮样式 */
.btn-verify {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-top-right-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  background-color: var(--primary-color);
  color: white;
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0 1rem;
  cursor: pointer;
  z-index: 3;
  min-width: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.btn-verify:hover {
  background-color: var(--primary-color);
  opacity: 0.9;
}

/* 带验证码按钮的输入框样式调整 */
.has-verify-btn .modern-input {
  padding-right: 120px; /* 为验证码按钮留出空间 */
}

/* 确保验证码按钮在所有页面上都有正确的圆角 */
.modern-input-wrapper button.btn-verify {
  border-radius: 0 var(--radius) var(--radius) 0;
  overflow: hidden;
}

.modern-button-primary {
  background-color: var(--primary-color);
  color: white;
  border: none;
}

.modern-button-primary:hover {
  background-color: var(--primary-color);
  opacity: 0.9;
}

.modern-button-primary:focus {
  outline: none;
  box-shadow: 0 0 0 2px hsla(var(--ring), 0.3);
}

/* Text accent color for links */
.text-accent {
  color: var(--primary-color);
  text-decoration: none;
}

.text-accent:hover {
  text-decoration: underline;
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.theme-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: hsl(var(--muted));
  transition: .4s;
  border-radius: 20px;
}

.theme-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .theme-slider {
  background-color: hsl(var(--primary));
}

input:focus + .theme-slider {
  box-shadow: 0 0 1px hsl(var(--primary));
}

input:checked + .theme-slider:before {
  transform: translateX(20px);
}

/* Color theme selector */
.color-theme-selector {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.color-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid hsl(var(--border));
}

.color-dot.active {
  box-shadow: 0 0 0 2px white, 0 0 0 4px currentColor;
}

.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;
}

/* Main container styles */
.main-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.right-side {
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  box-sizing: border-box;
}

/* 确保所有元素都使用border-box */
*, *:before, *:after {
  box-sizing: border-box;
}

/* Responsive styles - 强化版本 */
@media all and (min-width: 1200px) {
  .modern-card {
    width: 580px !important; /* 保持桌面端卡片宽度一致并加强权重 */
    margin: 0 auto !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
  }
}

@media all and (max-width: 1199px) and (min-width: 993px) {
  .modern-card {
    width: 550px !important;
    margin: 0 auto !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
  }
}

@media all and (max-width: 992px) and (min-width: 769px) {
  .modern-card {
    width: 520px !important;
    margin: 0 auto !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
  }
}

@media all and (max-width: 768px) and (min-width: 577px) {
  .modern-card {
    width: 95% !important;
    max-width: 520px !important;
    padding: 25px !important;
    margin: 0 auto !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
  }
}

/* 移动端优化 - 强化版本 */
@media all and (max-width: 576px) {
  html, body {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }
  
  .modern-login-page {
    width: 100vw;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }

  .main-container {
    width: 100%;
    padding: 0;
    overflow: hidden;
  }
  
  .modern-card {
    width: 92% !important;
    max-width: 350px !important;
    padding: 20px !important;
    margin: 0 !important;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
  }
  
  .form-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    position: relative !important;
    overflow: hidden !important;
    height: 100% !important;
  }
  
  .right-side {
    padding: 0 !important;
    position: relative !important;
    height: 100% !important;
    overflow: hidden !important;
  }
}

/* Animation for theme toggle */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes cardAppear {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 修复登录加载时的圆圈问题 */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.animate-fade-in {
  animation: fadeIn 0.5s ease-in-out;
}
