:root {
  --primary-color: #4361ee;
  --primary-light: #4895ef;
  --secondary-color: #3f37c9;
  --accent-color: #f72585;
  --light-gray: #f8f9fa;
  --medium-gray: #e9ecef;
  --dark-gray: #6c757d;
  --dark: #212529;
  --success: #4cc9f0;
  --error: #f72585;
  --bg-gradient-light: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  --bg-color-dark: #121212;
  --card-bg-light: white;
  --card-bg-dark: #1e1e1e;
  --text-color-light: #212529;
  --text-color-dark: #e9ecef;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-gradient: var(--bg-color-dark);
    --card-bg: var(--card-bg-dark);
    --text-color: var(--text-color-dark);
  }
}

@media (prefers-color-scheme: light) {
  :root {
    --bg-gradient: var(--bg-gradient-light);
    --card-bg: var(--card-bg-light);
    --text-color: var(--text-color-light);
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 
               Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', 
               sans-serif;
  background: var(--bg-gradient, var(--bg-gradient-light));
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-color, var(--text-color-light));
  line-height: 1.6;
  transition: background-color 0.3s ease;
}

.auth-container {
  background-color: var(--card-bg, var(--card-bg-light));
  padding: 2.5rem;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  width: 100%;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

/* 登录容器宽度 */
.login-container {
  max-width: 450px;
}

/* 注册容器宽度 */
.register-container {
  max-width: 700px;
}

#loginFormContainer {
  max-width: 400px;
  margin: 0 auto;
}

#registerFormContainer {
  max-width: 650px;
  margin: 0 auto;
}

.auth-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

.auth-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.auth-header h1 {
  color: var(--primary-color);
  font-size: 2rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.auth-header p {
  color: var(--dark-gray);
  font-size: 0.95rem;
  font-weight: 400;
}

.form-group {
  margin-bottom: 1.5rem;
  position: relative;
}

.form-group .input-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dark-gray);
  z-index: 1;
  font-size: 1.2rem;
  pointer-events: none;
}

/* Remix Icon 样式调整 */
.input-icon {
  font-size: 1.2rem;
}

.form-group .input-wrapper {
  position: relative;
}

.form-group label {
  display: block;
  margin-bottom: 0.75rem;
  color: var(--dark);
  font-size: 0.95rem;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 1rem 1rem 1rem 2.5rem;
  border: 2px solid var(--medium-gray);
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background-color: var(--light-gray);
  color: var(--text-color, var(--text-color-light));
  font-family: inherit;
  position: relative;
  height: 3.5rem; /* 固定高度确保一致性 */
  box-sizing: border-box;
}

@media (prefers-color-scheme: dark) {
  body {
    background: var(--bg-color-dark);
  }
  
  .auth-container {
    background-color: var(--card-bg-dark);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  }
  
  .auth-header h1 {
    color: rgba(255, 255, 255, 0.95);
  }
  
  .auth-header p {
    color: rgba(255, 255, 255, 0.7);
  }
  
  .form-group label {
    color: rgba(255, 255, 255, 0.85);
  }
  
  .form-group input {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
  }
  
  .form-group input::placeholder {
    color: rgba(255, 255, 255, 0.4);
  }
  
  .form-group input:focus {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: var(--primary-color);
  }
  
  .input-icon {
    color: rgba(255, 255, 255, 0.6);
  }
  
  .auth-switch {
    color: rgba(255, 255, 255, 0.6);
  }
  
  .auth-switch a {
    color: var(--primary-light);
  }
  
  .password-tips {
    color: rgba(255, 255, 255, 0.7);
  }
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
  background-color: white;
}

.form-group .input-wrapper:focus-within .input-icon {
  color: var(--primary-color);
}

.form-group input::placeholder {
  color: var(--dark-gray);
  opacity: 0.6;
}

.error-message {
  color: var(--error);
  font-size: 0.875rem;
  margin: 0.75rem 0;
  min-height: 1.5rem;
  display: none;
  font-weight: 500;
}

@media (max-width: 480px) {
  .error-message {
    font-size: 0.8125rem;
    margin: 0.5rem 0;
  }
  
  .auth-switch {
    margin-top: 1.25rem;
  }
  
  .auth-switch a {
    padding: 0.25rem 0;
    display: inline-block;
    margin-left: 0.25rem;
  }
}

.btn-auth {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  font-family: inherit;
}

.btn-auth:hover {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.btn-auth:active {
  transform: translateY(0);
}

.btn-auth:disabled {
  background: var(--medium-gray);
  color: var(--dark-gray);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-switch {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.95rem;
  color: var(--dark-gray);
}

.auth-switch a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  margin-left: 0.5rem;
  transition: all 0.2s ease;
}

.auth-switch a:hover {
  color: var(--accent-color);
  text-decoration: underline;
}

/* 多列表单样式 */
.form-row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -0.75rem;
  margin-bottom: 1rem;
}

.form-group-half {
  flex: 0 0 calc(50% - 1.5rem);
  margin: 0 0.75rem;
}

.code-input-group {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
}

.code-input-group .input-wrapper {
  flex: 1;
  min-width: 0; /* 防止溢出 */
}

.btn-code {
  flex: 0 0 auto;
  padding: 0 1rem;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  height: 40px;
  min-width: 130px;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin: 0; /* 移除垂直居中调整 */
  -webkit-tap-highlight-color: transparent;
}

.btn-code:hover {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.btn-code:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-code:disabled {
  background: var(--medium-gray);
  color: var(--dark-gray);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.8;
}

/* 加载状态动画 */
@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.6; }
  100% { opacity: 1; }
}

.btn-loading {
  animation: pulse 1.5s infinite ease-in-out;
}

/* 动画效果 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

.auth-form {
  animation: fadeIn 0.4s ease forwards;
}

#loginContainer {
  animation: slideInLeft 0.5s ease forwards;
}

#registerContainer {
  animation: slideInRight 0.5s ease forwards;
}

/* 密码强度指示器 */
.password-strength {
  height: 4px;
  border-radius: 2px;
  margin-top: 8px;
  transition: all 0.3s ease;
  background: var(--medium-gray);
  overflow: hidden;
}

.password-strength-bar {
  height: 100%;
  width: 0;
  transition: all 0.3s ease;
}

.strength-weak {
  width: 33.3%;
  background-color: var(--error);
}

.strength-medium {
  width: 66.6%;
  background-color: #f59e0b;
}

.strength-strong {
  width: 100%;
  background-color: var(--success);
}

.password-tips {
  font-size: 0.75rem;
  color: var(--dark-gray);
  margin-top: 4px;
  display: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
  body {
    padding: 1.5rem 0;
  }
  
  .auth-container {
    padding: 2rem;
    margin: 0 1.5rem;
    border-radius: 14px;
    max-width: 100%;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
  }
  
  .login-container,
  .register-container {
    max-width: 100%;
  }
  
  .auth-header {
    margin-bottom: 1.75rem;
  }
}

@media (max-width: 480px) {
  body {
    padding: 1rem 0;
  }
  
  .auth-container {
    padding: 1.5rem;
    margin: 0 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  }
  
  .form-group input {
    height: 3.25rem;
    padding: 0.875rem 0.875rem 0.875rem 2.5rem;
    border-radius: 6px;
  }
  
  .auth-header h1 {
    font-size: 1.75rem;
  }
  
  .input-icon {
    left: 0.875rem;
  }
  
  .btn-auth {
    padding: 0.875rem;
    height: 3.25rem;
    border-radius: 6px;
    margin-top: 0.75rem;
  }
  
  .form-row {
    flex-direction: column;
    margin: 0;
    gap: 1.25rem;
  }
  
  .form-group-half {
    flex: 0 0 100%;
    margin: 0;
    width: 100%;
  }
  
  .form-group {
    margin-bottom: 1.25rem;
  }
  
  .form-group label {
    margin-bottom: 0.4rem;
    display: block;
  }
  
  .form-group-half:last-child {
    margin-bottom: 0;
  }
  
  .code-input-group {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }
  
  .code-input-group .input-wrapper {
    width: 100%;
  }
  
  .btn-code {
    width: 100%;
    justify-content: center;
    padding: 0.75rem;
    height: 46px;
    font-size: 1rem;
    margin-top: 0;
    border-radius: 6px;
  }
}

@media (max-width: 360px) {
  .auth-container {
    padding: 1.25rem;
    margin: 0 0.5rem;
  }
  
  .auth-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }
  
  .auth-header p {
    font-size: 0.85rem;
  }
  
  .form-group label {
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
  }
  
  .form-group input {
    font-size: 0.95rem;
    height: 3rem;
    padding: 0.75rem 0.75rem 0.75rem 2.25rem;
  }
  
  .btn-code {
    height: 42px;
    font-size: 0.9rem;
  }
  
  .btn-auth {
    height: 3rem;
  }
  
  .form-group {
    margin-bottom: 1rem;
  }
  
  .form-row {
    gap: 1rem;
  }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px; /* 防止iOS缩放 */
    -webkit-appearance: none; /* 移除iOS默认样式 */
    appearance: none;
  }
  
  .btn-auth, .btn-code {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation; /* 优化触摸操作 */
  }
  
  /* 增加触摸区域 */
  .form-group label,
  .auth-switch a {
    padding: 2px 0;
  }
}

/* 横屏模式优化 */
@media (max-height: 480px) and (orientation: landscape) {
  body {
    align-items: flex-start;
    padding: 1rem 0;
    height: auto;
    min-height: 100vh;
  }
  
  .auth-container {
    margin: 0 auto;
    max-height: 85vh;
    overflow-y: auto;
    padding: 1.25rem;
  }
  
  .auth-header {
    margin-bottom: 1rem;
  }
  
  .auth-header h1 {
    font-size: 1.5rem;
  }
  
  .form-group {
    margin-bottom: 0.75rem;
  }
  
  .form-row {
    margin-bottom: 0.5rem;
    gap: 1rem;
  }
  
  .form-group-half {
    margin-bottom: 0.5rem;
  }
  
  .code-input-group {
    flex-direction: row;
    gap: 0.5rem;
  }
  
  .btn-code {
    height: 3rem;
    min-width: 120px;
  }
}