/* ========================================
   登录弹窗样式 - 完全基于原登录页面
   ======================================== */

/* 弹窗遮罩层 */
.login-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  animation: fadeIn 0.3s;
}

.login-modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* 弹窗包装器 */
.login-modal-wrapper {
  position: relative;
  width: 100%;
  max-width: 550px;
  max-height: 90vh;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.3s;
  animation: slideIn 0.3s;
}

.login-modal-overlay.show .login-modal-wrapper {
  transform: scale(1);
}

/* 关闭按钮 */
.login-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 20px;
  font-weight: normal;
  color: #86909c;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
  z-index: 10;
  background: none;
  border: none;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-modal-close:hover {
  color: #1d2129;
}

/* 内容区域 */
.login-modal-content {
  max-height: calc(90vh - 40px);
  overflow-y: auto;
  overflow-x: hidden;
}

/* 滚动条样式 */
.login-modal-content::-webkit-scrollbar {
  width: 6px;
}

.login-modal-content::-webkit-scrollbar-track {
  background: #f7f8fa;
}

.login-modal-content::-webkit-scrollbar-thumb {
  background: #c9cdd4;
  border-radius: 3px;
}

.login-modal-content::-webkit-scrollbar-thumb:hover {
  background: #a9aeb8;
}

/* 防止body滚动 */
body.login-modal-open {
  overflow: hidden;
}

/* ========================================
   表单样式 - 完全照搬原登录页面
   ======================================== */

.login-modal-overlay .login-form-wrapper {
  width: 100%;
  background: #fff;
  border-radius: 0;
  padding: 40px 32px 32px;
  box-shadow: none;
}

.login-modal-overlay .login-form-title {
  color: #1d2129;
  font-weight: 600;
  font-size: 24px;
  line-height: 32px;
  margin-bottom: 8px;
  text-align: center;
}

/* Tabs */
.login-modal-overlay .tabs {
  display: flex;
  border-bottom: 1px solid #e5e6eb;
  margin-bottom: 24px;
}

.login-modal-overlay .tab {
  flex: 1;
  padding: 8px 16px 12px;
  text-align: center;
  cursor: pointer;
  color: #4e5969;
  font-size: 14px;
  transition: all 0.2s cubic-bezier(0.34, 0.69, 0.1, 1);
  border-bottom: 1px solid transparent;
  position: relative;
  font-weight: 400;
}

.login-modal-overlay .tab:hover {
  color: #165dff;
}

.login-modal-overlay .tab.active {
  color: #165dff;
  font-weight: 400;
  border-bottom-color: #165dff;
}

.login-modal-overlay .tab-content {
  display: none;
}

.login-modal-overlay .tab-content.active {
  display: block;
}

/* Form Items */
.login-modal-overlay form {
  display: flex;
  flex-direction: column;
}

.login-modal-overlay .form-item {
  margin-bottom: 16px;
}

.login-modal-overlay .form-label {
  color: #86909c;
  font-size: 12px;
  margin-bottom: 8px;
  display: block;
  font-weight: 400;
}

.login-modal-overlay input[type="text"],
.login-modal-overlay input[type="password"],
.login-modal-overlay input[type="tel"] {
  width: 100%;
  height: 32px;
  padding: 0 12px;
  border: 1px solid #e5e6eb;
  border-radius: 2px;
  font-size: 14px;
  transition: all 0.1s linear;
  background: #f7f8fa;
  color: #1d2129;
}

.login-modal-overlay input:hover {
  background-color: #e5e6eb;
  border-color: transparent;
}

.login-modal-overlay input:focus {
  outline: none;
  border-color: #165dff;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(22, 93, 255, 0.1);
}

.login-modal-overlay input::placeholder {
  color: #c9cdd4;
}

/* Input Error State */
.login-modal-overlay input.error {
  background-color: #ffece8;
  border-color: #f53f3f;
}

.login-modal-overlay input.error:hover {
  background-color: #ffece8;
  border-color: #f53f3f;
}

.login-modal-overlay input.error:focus {
  background-color: #fff;
  border-color: #f53f3f;
  box-shadow: 0 0 0 2px rgba(245, 63, 63, 0.1);
}

.login-modal-overlay .form-item-error {
  color: #f53f3f;
  font-size: 12px;
  line-height: 1.5;
  margin-top: 4px;
  display: none;
}

.login-modal-overlay .form-item-error.show {
  display: block;
}

/* Password Input */
.login-modal-overlay .password-input {
  position: relative;
  display: flex;
  align-items: center;
}

.login-modal-overlay .password-input input {
  padding-right: 40px;
}

.login-modal-overlay .toggle-password {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  user-select: none;
  padding: 4px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.1s linear;
}

.login-modal-overlay .toggle-password:hover {
  background-color: #f2f3f5;
}

.login-modal-overlay .toggle-password svg {
  width: 16px;
  height: 16px;
  display: block;
  color: #86909c;
  transition: color 0.1s linear;
}

.login-modal-overlay .toggle-password:hover svg {
  color: #165dff;
}

/* Code Input */
.login-modal-overlay .code-input {
  display: flex;
  gap: 8px;
}

.login-modal-overlay .code-input input {
  flex: 1;
}

.login-modal-overlay .btn-code {
  padding: 0 16px;
  height: 32px;
  min-width: 88px;
  border: 1px solid #165dff;
  background: #165dff;
  color: #fff;
  border-radius: 2px;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
  transition: all 0.1s linear;
  font-weight: 400;
}

.login-modal-overlay .btn-code:hover:not(:disabled) {
  background: #4080ff;
  border-color: #4080ff;
  color: #fff;
}

.login-modal-overlay .btn-code:disabled {
  cursor: not-allowed;
  background: #f7f8fa;
  border-color: #e5e6eb;
  color: #c9cdd4;
}

.login-modal-overlay .btn-code.loading {
  background: #e8f3ff;
  border-color: #bedaff;
  color: #4080ff;
  cursor: not-allowed;
}

.login-modal-overlay .btn-code.countdown {
  background: #94bfff;
  border-color: #94bfff;
  color: #fff;
  cursor: not-allowed;
}

/* Checkbox - 完全照搬原样式 */
.login-modal-overlay .checkbox-item {
  margin-bottom: 16px;
}

.login-modal-overlay .checkbox-item label {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  user-select: none;
  position: relative;
}

.login-modal-overlay .checkbox-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0;
  position: absolute;
  left: 0;
  top: 4px;
  z-index: 1;
}

.login-modal-overlay .checkbox-item input[type="checkbox"] + span::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid #c9cdd4;
  border-radius: 2px;
  margin-right: 8px;
  vertical-align: middle;
  transition: all 0.1s linear;
  flex-shrink: 0;
  position: absolute;
  left: 0;
  top: 4px;
}

.login-modal-overlay .checkbox-item input[type="checkbox"]:hover + span::before {
  border-color: #165dff;
}

.login-modal-overlay .checkbox-item input[type="checkbox"]:checked + span::before {
  background: #165dff;
  border-color: #165dff;
}

.login-modal-overlay .checkbox-item input[type="checkbox"]:checked + span::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 1024 1024" fill="white" xmlns="http://www.w3.org/2000/svg"><path d="M877.44815445 206.10060629a64.72691371 64.72691371 0 0 0-95.14856334 4.01306852L380.73381888 685.46812814 235.22771741 533.48933518a64.72691371 64.72691371 0 0 0-92.43003222-1.03563036l-45.82665557 45.82665443a64.72691371 64.72691371 0 0 0-0.90617629 90.61767965l239.61903446 250.10479331a64.72691371 64.72691371 0 0 0 71.19960405 15.14609778 64.33855261 64.33855261 0 0 0 35.08198741-21.23042702l36.24707186-42.71976334 40.5190474-40.77795556-3.36579926-3.49525333 411.40426297-486.74638962a64.72691371 64.72691371 0 0 0-3.88361443-87.64024149l-45.3088404-45.43829334z"/></svg>');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  border: none;
}

.login-modal-overlay .checkbox-item span {
  color: #4e5969;
  font-size: 14px;
  line-height: 22px;
  padding-left: 22px;
  position: relative;
}

.login-modal-overlay .checkbox-item span a {
  color: #1d2129;
  text-decoration: underline;
  border-bottom: none;
}

.login-modal-overlay .checkbox-item span a:hover {
  color: #165dff;
}

/* Buttons */
.login-modal-overlay .btn-primary {
  width: 100%;
  height: 36px;
  padding: 0 20px;
  background: #165dff;
  color: #fff;
  border: none;
  border-radius: 18px;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 0.69, 0.1, 1);
  margin-top: 20px;
  margin-bottom: 12px;
  position: relative;
}

.login-modal-overlay .btn-primary:hover:not(:disabled) {
  background: #4080ff;
}

.login-modal-overlay .btn-primary:active:not(:disabled) {
  background: #0e42d2;
}

.login-modal-overlay .btn-primary:disabled {
  cursor: not-allowed;
  background: #94bfff;
}

.login-modal-overlay .btn-primary .btn-loading {
  display: none;
  color: #fff;
}

.login-modal-overlay .btn-primary.loading {
  background: #94bfff;
  cursor: not-allowed;
}

.login-modal-overlay .btn-primary.loading .btn-text {
  display: none;
}

.login-modal-overlay .btn-primary.loading .btn-loading {
  display: inline;
  color: #fff;
}

.btn-refresh-qr {
  padding: 0 15px;
  height: 32px;
  background: #fff;
  color: #165dff;
  border: 1px solid #165dff;
  border-radius: 2px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 0.69, 0.1, 1);
  font-weight: 400;
  margin-top: 15px;
}

.btn-refresh-qr:hover {
  background: #f2f6ff;
  border-color: #4080ff;
  color: #4080ff;
}

.btn-refresh-qr:active {
  background: #e8f3ff;
}

/* Divider */
.login-modal-overlay .divider {
  position: relative;
  text-align: center;
  margin: 24px 0 16px;
  color: #86909c;
  font-size: 13px;
}

.login-modal-overlay .divider::before,
.login-modal-overlay .divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: #e5e6eb;
}

.login-modal-overlay .divider::before {
  left: 0;
}

.login-modal-overlay .divider::after {
  right: 0;
}

.login-modal-overlay .divider-text {
  color: #1d2129;
  font-size: 14px;
  padding: 5px 15px;
  background: #fff;
  position: relative;
  z-index: 1;
}

/* Social Login */
.login-modal-overlay .social-login {
  display: flex;
  justify-content: center;
}

.login-modal-overlay .social-login img {
  width: 40px;
  height: 40px;
  cursor: pointer;
  transition: transform 0.3s;
}

.login-modal-overlay .social-login img:hover {
  transform: scale(1.1);
}

/* Text Center */
.login-modal-overlay .text-center {
  text-align: center;
  margin-top: 12px;
  color: #4e5969;
  font-size: 14px;
  line-height: 22px;
}

.login-modal-overlay .text-center a {
  color: #1d2129;
  text-decoration: underline;
  border-bottom: none;
}

.login-modal-overlay .text-center a:hover {
  color: #165dff;
}

/* 微信登录模态框 */
.modal {
  display: none;
  position: fixed;
  z-index: 10001;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s;
}

.modal.show {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.modal .modal-content {
  background-color: #fff;
  padding: 24px 32px 32px;
  border-radius: 4px;
  max-width: 420px;
  width: 90%;
  position: relative;
  animation: slideIn 0.3s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.modal .modal-content h2 {
  margin-bottom: 24px;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  color: #1d2129;
}

.modal .close {
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 20px;
  font-weight: normal;
  color: #86909c;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.modal .close:hover {
  color: #1d2129;
}

#modalQrcodeContainer {
  display: flex;
  justify-content: center;
  min-height: 200px;
  align-items: center;
}

#modalQrcodeContainer img {
  max-width: 100%;
  height: auto;
}

/* 绑定手机号模态框特殊样式 */
#modalBindMobileModal .modal-content,
#modalConfirmBindModal .modal-content {
  max-width: 420px;
  width: 90%;
}

#modalBindMobileModal .form-item {
  margin-bottom: 16px;
}

#modalBindMobileModal .form-item:last-of-type {
  margin-bottom: 20px;
}

#modalBindMobileModal .form-label {
  color: #86909c;
  font-size: 12px;
  margin-bottom: 8px;
  font-weight: 400;
}

#modalBindMobileModal .btn-primary {
  width: 100%;
  height: 36px;
  padding: 0 20px;
  background: #165dff;
  color: #fff;
  border: none;
  border-radius: 18px;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 0.69, 0.1, 1);
  margin-top: 0;
  margin-bottom: 0;
}

#modalBindMobileModal .btn-primary:hover:not(:disabled) {
  background: #4080ff;
}

#modalBindMobileModal .btn-primary:active:not(:disabled) {
  background: #0e42d2;
}

#modalBindMobileModal .btn-primary:disabled {
  cursor: not-allowed;
  background: #94bfff;
}

#modalBindMobileModal .btn-primary .btn-loading {
  display: none;
  color: #fff;
}

#modalBindMobileModal .btn-primary.loading {
  background: #94bfff;
  cursor: not-allowed;
}

#modalBindMobileModal .btn-primary.loading .btn-loading {
  display: inline;
  color: #fff;
}

/* 确保绑定手机号弹窗内的输入框和按钮继承正确样式 */
#modalBindMobileModal input[type="tel"],
#modalBindMobileModal input[type="text"] {
  width: 100%;
  height: 32px;
  padding: 0 12px;
  border: 1px solid #e5e6eb;
  border-radius: 2px;
  font-size: 14px;
  outline: none;
  transition: all 0.1s linear;
  color: #1d2129;
  background: #fff;
}

#modalBindMobileModal input[type="tel"]:hover,
#modalBindMobileModal input[type="text"]:hover {
  border-color: #bedaff;
}

#modalBindMobileModal input[type="tel"]:focus,
#modalBindMobileModal input[type="text"]:focus {
  border-color: #165dff;
  box-shadow: 0 0 0 2px rgba(22, 93, 255, 0.1);
}

#modalBindMobileModal input[type="tel"].error,
#modalBindMobileModal input[type="text"].error {
  border-color: #f53f3f;
}

#modalBindMobileModal input[type="tel"]::placeholder,
#modalBindMobileModal input[type="text"]::placeholder {
  color: #c9cdd4;
}

#modalBindMobileModal .code-input {
  display: flex;
  gap: 8px;
}

#modalBindMobileModal .code-input input {
  flex: 1;
}

#modalBindMobileModal .btn-code {
  padding: 0 16px;
  height: 32px;
  min-width: 88px;
  border: 1px solid #165dff;
  background: #165dff;
  color: #fff;
  border-radius: 2px;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
  transition: all 0.1s linear;
  font-weight: 400;
}

#modalBindMobileModal .btn-code:hover:not(:disabled) {
  background: #4080ff;
  border-color: #4080ff;
}

#modalBindMobileModal .btn-code:disabled {
  cursor: not-allowed;
  background: #f7f8fa;
  border-color: #e5e6eb;
  color: #c9cdd4;
}

#modalBindMobileModal .btn-code.loading {
  background: #e8f3ff;
  border-color: #bedaff;
  color: #4080ff;
  cursor: not-allowed;
}

#modalBindMobileModal .btn-code.countdown {
  background: #94bfff;
  border-color: #94bfff;
  color: #fff;
  cursor: not-allowed;
}

/* Modal Actions */
.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.modal-actions button {
  flex: 1;
  margin-top: 0;
}

.modal-actions .btn-secondary {
  padding: 0 20px;
  height: 36px;
  background: #fff;
  color: #86909c;
  border: 1px solid #e5e6eb;
  border-radius: 2px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 0.69, 0.1, 1);
  font-weight: 400;
}

.modal-actions .btn-secondary:hover {
  border-color: #165dff;
  color: #165dff;
  background: #f2f3f5;
}

.modal-actions .btn-secondary:active {
  background: #e8f3ff;
}

.modal-actions .btn-primary {
  padding: 0 20px;
  height: 36px;
  background: #165dff;
  color: #fff;
  border: none;
  border-radius: 2px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 0.69, 0.1, 1);
  font-weight: 400;
}

.modal-actions .btn-primary:hover {
  background: #4080ff;
}

.modal-actions .btn-primary:active {
  background: #0e42d2;
}

#modalConfirmBindModal .modal-content {
  padding: 24px 32px 32px;
}

#modalConfirmBindModal h2 {
  margin-bottom: 16px;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  color: #1d2129;
  line-height: 26px;
}

#modalConfirmBindMessage {
  text-align: center;
  color: #4e5969;
  font-size: 14px;
  line-height: 22px;
  margin: 0 0 8px 0;
}

/* Toast */
#modalToast {
  position: fixed;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  color: #1d2129;
  padding: 10px 20px;
  border-radius: 4px;
  font-size: 14px;
  z-index: 10010;
  display: none;
  animation: slideDown 0.3s;
  max-width: 80%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e6eb;
  align-items: center;
  gap: 8px;
}

#modalToast.show {
  display: flex;
}

.toast-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

#modalToast.success .toast-icon {
  color: #00b42a;
}

#modalToast.error .toast-icon {
  color: #f53f3f;
}

#modalToast.warning .toast-icon {
  color: #ff7d00;
}

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

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Utility Classes */
.login-modal-overlay .mt-10 {
  margin-top: 10px;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .login-modal-overlay {
    padding: 0;
  }

  .login-modal-wrapper {
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    height: 100%;
  }

  .login-modal-content {
    max-height: calc(100vh - 40px);
  }

  .login-modal-close {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    width: 32px;
    height: 32px;
  }

  .login-modal-overlay .login-form-wrapper {
    padding: 32px 20px 24px;
  }

  .login-modal-overlay .login-form-title {
    font-size: 20px;
    line-height: 28px;
  }

  .login-modal-overlay input[type="text"],
  .login-modal-overlay input[type="password"],
  .login-modal-overlay input[type="tel"],
  .login-modal-overlay .btn-primary,
  .login-modal-overlay .btn-code {
    height: 32px;
  }

  .login-modal-overlay .modal-content {
    padding: 24px;
  }

  #modalBindMobileModal .modal-content,
  #modalConfirmBindModal .modal-content {
    width: 95%;
    padding: 20px;
  }
}
