:root {
  --primary: #4361ee;
  --primary-light: #4895ef;
  --danger: #f72585;
  --success: #4cc9f0;
  --dark: #2b2d42;
  --light: #f8f9fa;
  --gray: #adb5bd;
  --border-radius: 12px;
  --shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 15px 30px rgba(0, 0, 0, 0.15);
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Poppins", sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #ffffff 100%);
  min-height: 100vh;
  display: flex; /* 新增：让页面垂直居中 */
  flex-direction: column; /* 新增：防止footer错位 */
  justify-content: center;
  padding: 20px;
  color: var(--dark);
  line-height: 1.6;
  margin: 0; /* 重置默认margin */
}

/* 容器优化：增强视觉层次+垂直居中 */
.container {
  max-width: 900px;
  width: 100%;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  margin: auto; /* 关键：垂直+水平居中 */
  transition: box-shadow 0.3s ease;
}

.container:hover {
  box-shadow: var(--shadow-hover); /* 新增：容器悬浮阴影增强 */
}

.form-container {
  padding: 40px;
  flex: 1;
  width: 400px;
  display: flex; /* 新增：表单内部垂直排版 */
  flex-direction: column;
}

/* Logo样式优化 */
.form-container img {
  margin: 0 auto 20px; /* 居中+间距优化 */
  transition: transform 0.3s ease;
}

.form-container img:hover {
  transform: scale(1.02); /* 新增：logo悬浮微放大 */
}

.illustration {
  flex: 1;
  background: var(--gradient-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
  position: relative;
  overflow: hidden;
}

/* 插图背景添加光效（不影响原有插图） */
.illustration::after {
  content: "";
  position: absolute;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  top: 20%;
  right: 20%;
  filter: blur(50px);
  animation: float-light 8s ease-in-out infinite;
}

@keyframes float-light {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-20px, -20px); }
}

.illustration img {
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.2));
  animation: float-illustration 6s ease-in-out infinite; /* 新增：插图漂浮动画 */
}

@keyframes float-illustration {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

h1 {
  font-size: 2.2rem;
  margin-bottom: 10px;
  color: var(--primary);
  font-weight: 600;
}

.subtitle {
  color: var(--gray);
  margin-bottom: 30px;
  font-weight: 300;
  text-align: center; /* 新增：副标题居中 */
  font-size: 1.1rem; /* 微调字号 */
}

.form-group {
  margin-bottom: 25px;
  position: relative;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--dark);
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

/* 输入框聚焦时标签变色 */
.form-group:focus-within label {
  color: var(--primary);
}

input {
  padding: 15px 20px;
  border: 2px solid #e9ecef;
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: var(--transition);
  background-color: #f8f9fa;
  width: 100%; /* 确保输入框100%宽度 */
}

input:focus {
  outline: none;
  border-color: var(--primary);
  background-color: white;
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
  transform: translateY(-1px); /* 新增：聚焦微上移 */
}

/* 提交按钮优化 */
button[type="submit"] {
  width: 100%;
  padding: 15px;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 10px;
  box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
  position: relative;
  overflow: hidden;
}

/* 按钮点击波纹效果（新增） */
button[type="submit"]::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

button[type="submit"]:active::after {
  width: 300px;
  height: 300px;
  opacity: 0;
}

button[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(67, 97, 238, 0.4);
}

/* 错误提示优化 */
.error-message {
  color: var(--danger);
  margin-top: 8px;
  font-size: 0.85rem;
  opacity: 0;
  height: 0;
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  align-items: center;
}

.error-message::before {
  content: "!";
  display: inline-block;
  width: 18px;
  height: 18px;
  background-color: var(--danger);
  color: white;
  border-radius: 50%;
  text-align: center;
  line-height: 18px;
  font-size: 0.8rem;
  margin-right: 8px;
  flex-shrink: 0;
}

.error-message.show {
  opacity: 1;
  height: auto;
  animation: fadeIn 0.3s ease; /* 新增：淡入动画 */
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.error-input {
  border-color: var(--danger) !important;
  animation: pulse 0.5s;
  background-color: rgba(247, 37, 133, 0.05) !important;
}

@keyframes pulse {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

/* Toast提示优化 */
.toast-container {
  position: fixed;
  top: 30px;
  right: 30px;
  z-index: 1000;
  max-width: 350px;
  width: 100%;
}

.toast {
  background-color: white;
  color: var(--dark);
  padding: 18px 25px;
  margin-bottom: 15px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  transform: translateX(150%);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  animation: toastSlideIn 0.4s ease forwards; /* 优化动画 */
}

@keyframes toastSlideIn {
  from { transform: translateX(150%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
}

.toast.error::before {
  background-color: var(--danger);
}

.toast.success::before {
  background-color: var(--success);
}

.toast.show {
  transform: translateX(0);
}

.toast-icon {
  margin-right: 15px;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.toast.error .toast-icon {
  color: var(--danger);
}

.toast.success .toast-icon {
  color: var(--success);
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  margin-bottom: 3px;
}

.toast-message {
  font-size: 0.9rem;
  opacity: 0.8;
}

.close-btn {
  margin-left: 15px;
  cursor: pointer;
  opacity: 0.6;
  transition: var(--transition);
  flex-shrink: 0;
}

.close-btn:hover {
  opacity: 1;
}

/* 密码强度条优化 */
.password-strength {
  margin-top: 8px;
  height: 6px; /* 增高1点，更易识别 */
  background-color: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.strength-meter {
  height: 100%;
  width: 0;
  transition: var(--transition);
  border-radius: 3px;
}

.strength-weak {
  background-color: var(--danger);
  width: 30%;
}

.strength-medium {
  background-color: #ffbe0b;
  width: 60%;
}

.strength-strong {
  background-color: var(--success);
  width: 100%;
}

.strength-text {
  font-size: 0.75rem;
  margin-top: 6px; /* 增加间距 */
  text-align: right;
  color: var(--gray);
  transition: color 0.2s ease;
}

/* 密码强度文字变色 */
.strength-text.weak { color: var(--danger); }
.strength-text.medium { color: #ffbe0b; }
.strength-text.strong { color: var(--success); }

/* 验证码按钮优化 */
.send-code-btn {
  padding: 0 15px;
  height: 52px;
  margin-top: 0;
  background: var(--gradient-primary); /* 改为主色渐变，更统一 */
  color: white; /* 文字白色 */
  box-shadow: 0 2px 8px rgba(67, 97, 238, 0.2);
  font-size: 0.9rem;
  border-radius: var(--border-radius);
  width: auto; /* 自适应宽度 */
  transition: var(--transition);
}

.send-code-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #3a56e0 0%, #3f86e0 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.send-code-btn:disabled {
  background: #f1f3f5;
  color: var(--gray);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 手机号输入框样式 */
#phone {
  width: 100%;
}

/* Footer优化 */
.footer {
  width: 100%;
  text-align: center;
  padding: 20px 0;
  margin-top: auto; /* 新增：footer固定在底部 */
  background: white; /* 新增：背景色，防止透明 */
  border-top: 1px solid #e9ecef; /* 新增：顶部边框 */
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.02); /* 新增：底部阴影 */
}

.footer-links {
  display: inline-block;
  font-size: 14px;
  color: #555;
}

.footer-links a {
  color: var(--primary); /* 改为主色，更统一 */
  text-decoration: none;
  padding: 0 8px;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--primary-light);
  text-decoration: underline;
}

.footer .divider {
  padding: 0 5px;
  color: #777;
}

.footer-copy {
  margin-top: 10px;
  font-size: 13px;
  color: #777;
}

/* 响应式优化 */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  
  .container {
    flex-direction: column;
    max-width: 100%;
    margin: 20px auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
  }

  .illustration {
    display: none;
  }

  .form-container {
    padding: 30px 20px;
    width: 100%;
  }

  .toast-container {
    max-width: calc(100% - 40px);
    right: 20px;
    top: 20px;
  }

  /* 移动端验证码按钮适配 */
  .form-group div[style*="display:flex"] {
    flex-direction: column;
    gap: 10px !important;
  }
  
  .send-code-btn {
    width: 100%;
    height: 50px;
  }
}

/* 修复容器垂直居中 */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  flex: 1;
  display: flex;
  align-items: center; /* 垂直居中 */
  justify-content: center;
  padding: 40px 20px;
}