/* 登录弹窗样式 */
.login-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  width: 380px;
  max-height: 90vh;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 50px 24px 24px 24px;
  border-bottom: none;
  position: relative;
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
  color: #333;
  text-align: left;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  position: absolute;
  top: 20px;
  right: 20px;
}

.close-btn:hover {
  background: #f5f5f5;
  color: #666;
}

.modal-body {
  padding: 0 24px 18px 24px;
}

/* 登录方式切换标签 */
.login-tabs {
  display: flex;
  margin-bottom: 12px;
  border-radius: 8px;
  background: #f8f9fa;
  padding: 2px;
  gap: 4px;
  width: fit-content;
}

.tab-btn {
  padding: 6px 16px;
  height: 28px;
  border: none;
  background: transparent;
  color: #666;
  font-size: 14px;
  font-weight: 400;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  white-space: nowrap;
}

.tab-btn:hover {
  color: #4f46e5;
}

.tab-btn.active {
  background: white;
  color: #4f46e5;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tab-btn i {
  font-size: 16px;
}

/* 登录区域 */
.login-area {
  display: none;
}

.login-area.active {
  display: block;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-group {
  position: relative;
  margin-bottom: 12px;
  transition: margin-bottom 0.2s ease;
}

.form-group.error {
  margin-bottom: 24px;
}

.form-group input {
  width: 100%;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f7f7f9;
  font-size: 14px;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.form-group input:focus {
  outline: none;
  border: 1px solid #6366f1;
  background: #f7f7f9;
}

.form-group.error input {
  border: 1px solid #ef4444;
  background: #fef2f2;
}

/* 错误信息样式 - 使用更具体的选择器避免冲突 */
.login-modal .form-group .error-message {
  position: absolute;
  top: 100%;
  left: 0;
  font-size: 12px;
  color: #ef4444;
  margin-top: 4px;
  opacity: 0;
  transform: translateY(-5px);
  transition: all 0.2s ease;
  pointer-events: none;
  line-height: 1.2;
  background: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  text-align: left !important;
  grid-column: auto !important;
}

.login-modal .form-group.error .error-message {
  opacity: 1;
  transform: translateY(0);
}

.verification-group {
  position: relative;
}

.verification-group input {
  width: 100%;
  padding-right: 80px; /* 为内嵌按钮留出空间 */
}

.send-code-btn-inline {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 12px;
  background: none;
  color: #4f46e5;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.send-code-btn-inline:hover:not(:disabled) {
  background: rgba(79, 70, 229, 0.1);
  color: #4338ca;
}

.send-code-btn-inline:disabled {
  color: #9ca3af;
  cursor: not-allowed;
}

.login-submit-btn {
  width: 100%;
  height: 40px;
  padding: 0;
  background: #4f46e5;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-submit-btn:hover {
  background: #4338ca;
}

.wechat-login-area {
  text-align: center;
}

.qrcode-container {
  margin-bottom: 24px;
  text-align: center;
}

.qrcode-loading {
  padding: 40px 20px;
  color: #666;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #4f46e5;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

.qrcode-wrapper {
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qrcode-wrapper img {
  width: 200px;
  height: 200px;
  border: none;
  margin-bottom: 16px;
}

.status-text {
  font-size: 14px;
  color: #666;
  margin: 0;
}

.qrcode-expired {
  padding: 40px 20px;
  color: #666;
  flex-direction: column;
  align-items: center;
}

.qrcode-expired i {
  font-size: 48px;
  color: #fbbf24;
  margin-bottom: 16px;
}

.qrcode-expired p {
  margin: 0 0 20px 0;
  font-size: 16px;
}

.refresh-qrcode-btn {
  background: #4f46e5;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.refresh-qrcode-btn:hover {
  background: #4338ca;
}

/* 页面内容切换 */
.page-content {
  display: none;
}

.page-content.active {
  display: block;
}

/* 隐私政策同意 */
.privacy-agreement {
  margin-top: 8px;
  text-align: left;
}

.checkbox-container {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  user-select: none;
}

.checkbox-container input[type="checkbox"] {
  width: 12px;
  height: 12px;
  margin: 0;
  cursor: pointer;
}

.privacy-link {
  color: #4f46e5;
  text-decoration: none;
  cursor: pointer;
}

.privacy-link:hover {
  color: #4338ca;
  text-decoration: underline;
}

/* 页面切换按钮 */
.page-switch {
  margin-top: 60px;
  text-align: center;
  font-size: 14px;
  color: #666;
}

.switch-btn {
  background: none;
  border: none;
  color: #4f46e5;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  padding: 0;
  margin-left: 4px;
}

.switch-btn:hover {
  color: #4338ca;
  text-decoration: underline;
}

.qrcode-error {
  padding: 40px 20px;
  text-align: center;
  color: #ef4444;
}

.qrcode-error i {
  font-size: 48px;
  margin-bottom: 16px;
}

.qrcode-error p {
  margin: 0 0 20px 0;
  font-size: 16px;
}

/* 登录成功提示 */
.login-success-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #10b981;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10001;
  animation: slideInRight 0.3s ease;
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 动画 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

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

/* Toast 提示样式 */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  z-index: 10002;
  animation: slideInRight 0.3s ease;
  max-width: 300px;
  word-wrap: break-word;
}

.toast-success {
  background: #10b981;
}

.toast-error {
  background: #ef4444;
}

.toast-info {
  background: #3b82f6;
}

.toast-warning {
  background: #f59e0b;
}

/* 响应式设计 */
@media (max-width: 480px) {
  .modal-content {
    width: 320px;
    margin: 20px;
  }

  .modal-header {
    padding: 40px 16px 20px 16px;
  }

  .modal-body {
    padding: 0 16px 40px 16px;
  }

  .qrcode-wrapper img {
    width: 160px;
    height: 160px;
  }

  .modal-header h3 {
    font-size: 18px;
  }

  .simple-tips {
    font-size: 13px;
  }
}
