/**
 * File: client/css/auth-modal.css
 * 认证弹窗样式 - Apple风格黑白主题
 * 作用: 登录和注册弹窗的样式定义
 * @modification 全部改为黑白灰配色，去除所有彩色
 * @date 2025-12-09
 */

/* 弹窗遮罩层 */
.auth-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.auth-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

/* 弹窗内容 */
.auth-modal-content {
  position: relative;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 450px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalFadeIn 0.3s ease-out;
}

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

/* 弹窗头部 */
.auth-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e5e5;
}

.auth-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #000000;
  margin: 0;
}

.auth-modal-close {
  background: none;
  border: none;
  font-size: 32px;
  color: #999999;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.auth-modal-close:hover {
  background: #f5f5f5;
  color: #333333;
}

/* 弹窗主体 */
.auth-modal-body {
  padding: 16px 20px;
}

/* 表单样式 */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: #333333;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  border: 1.5px solid #d0d0d0;
  border-radius: 6px;
  outline: none;
  transition: all 0.2s;
  background: #ffffff;
  box-sizing: border-box;
}

/**
 * @description 输入框聚焦时改为黑色边框
 * @date 2025-12-09
 */
.form-control:focus {
  border-color: #000000;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.form-control::placeholder {
  color: #999999;
}

.form-error {
  display: none;
  position: relative;
  margin-top: 5px;
  padding: 5px 8px 5px 20px;
  border: 1px solid #fecdd3;
  border-radius: 7px;
  background: #fff1f2;
  color: #c81e1e;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

.form-error::before {
  content: '!';
  position: absolute;
  left: 7px;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ef4444;
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  line-height: 12px;
  text-align: center;
  transform: translateY(-50%);
}

.sms-login-hint {
  padding: 8px 10px;
  border: 1px solid #dbe4ff;
  border-radius: 8px;
  background: #f4f7ff;
  color: #42526e;
  font-size: 12px;
  line-height: 1.5;
}

.password-rule-hint {
  display: block;
  margin-top: 4px;
  color: #667085;
  font-size: 12px;
  line-height: 1.45;
}

.password-realtime-panel {
  margin-top: 7px;
  padding: 9px 10px;
  border: 1px solid #e3e7f5;
  border-radius: 9px;
  background: #f8faff;
}

.password-strength-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.password-strength-meter {
  position: relative;
  flex: 1;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6eaf5;
}

.password-strength-bar {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #d92d20;
  transition: width 0.2s ease, background 0.2s ease;
}

.password-realtime-panel[data-level="medium"] .password-strength-bar {
  background: #f79009;
}

.password-realtime-panel[data-level="strong"] .password-strength-bar {
  background: #12b76a;
}

.password-strength-label {
  min-width: 58px;
  color: #475467;
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.password-check-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.password-check-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef2ff;
  color: #667085;
  font-size: 11px;
  line-height: 1.35;
}

.password-check-item::before {
  content: '○';
  font-size: 10px;
}

.password-check-item.valid {
  background: #ecfdf3;
  color: #067647;
}

.password-check-item.valid::before {
  content: '✓';
}

.password-check-item.invalid {
  background: #fff1f3;
  color: #b42318;
}

.password-check-item.invalid::before {
  content: '×';
}

.password-check-item.neutral {
  background: #f2f4f7;
  color: #667085;
}

.password-confirm-hint {
  display: block;
  min-height: 17px;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.4;
}

.password-confirm-hint.valid {
  color: #067647;
}

.password-confirm-hint.invalid {
  color: #b42318;
}

.password-upgrade-modal .auth-modal-content {
  max-width: 480px;
  border: 1px solid #e6e9f5;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.password-upgrade-modal .auth-modal-header {
  background: linear-gradient(135deg, #f5f7ff, #ffffff);
}

.password-upgrade-desc {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #dbe3ff;
  border-radius: 10px;
  background: #f6f8ff;
  color: #3a4668;
  font-size: 13px;
  line-height: 1.65;
}

.sms-code-status {
  display: none;
  margin-top: 6px;
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.45;
  border: 1px solid transparent;
}

.sms-code-status-success {
  color: #176a3a;
  background: #eefaf3;
  border-color: #bfe8cf;
}

.sms-code-status-warning {
  color: #8a5a00;
  background: #fff8e6;
  border-color: #f2d692;
}

.sms-code-status-error {
  color: #9a1f1f;
  background: #fff0f0;
  border-color: #f0b8b8;
}

.captcha-valid-status {
  display: none;
  margin-top: 6px;
  color: #067647;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.captcha-valid-status-ready {
  color: #475467;
}

.captcha-valid-status-valid {
  color: #067647;
}

.captcha-verified-input {
  cursor: not-allowed;
  background: #f6fef9;
  border-color: #75e0a7;
}

.captcha-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.captcha-slider-image {
  width: 100%;
  max-width: 260px;
  height: 54px;
  border-radius: 10px;
  border: 1px solid #d7ddff;
  background: #f7f8ff;
  object-fit: cover;
}

.captcha-slider-track {
  position: relative;
  width: 260px;
  max-width: 100%;
  height: 38px;
  border-radius: 999px;
  border: 1px solid #d7ddff;
  background: linear-gradient(90deg, #f2f5ff, #f8f4ff);
  overflow: hidden;
  touch-action: none;
}

.captcha-slider-thumb {
  position: absolute;
  top: 3px;
  left: 0;
  width: 42px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: #4f6bff;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  cursor: grab;
  box-shadow: 0 6px 14px rgba(79, 107, 255, 0.28);
}

.captcha-slider-thumb:active {
  cursor: grabbing;
}

.captcha-slider-refresh {
  width: fit-content;
}

.legal-agreement-field {
  margin-top: 2px;
}

.legal-agreement-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #5f6f95;
  font-size: 13px;
  line-height: 1.65;
}

.legal-agreement-label input {
  width: 16px;
  height: 16px;
  margin-top: 3px;
  flex-shrink: 0;
}

.legal-document-link {
  border: 0;
  padding: 0 1px;
  background: transparent;
  color: #4f6bff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.legal-document-link:hover {
  text-decoration: underline;
}

.legal-document-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.legal-document-modal.show {
  display: flex;
}

.legal-document-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(5px);
}

.legal-document-content {
  position: relative;
  width: min(720px, 92vw);
  max-height: 84vh;
  overflow: hidden;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
}

.legal-document-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid #e7ecff;
}

.legal-document-header h3 {
  margin: 0;
  color: #17214a;
  font-size: 20px;
  font-weight: 800;
}

.legal-document-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: #f2f5ff;
  color: #5f6f95;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.legal-document-body {
  max-height: calc(84vh - 78px);
  overflow: auto;
  padding: 24px;
  color: #3a4668;
  font-size: 14px;
  line-height: 1.9;
}

.forgot-old-password-row {
  margin-bottom: 2px;
}

.forgot-old-password-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid #dbe3ff;
  border-radius: 9px;
  background: #f6f8ff;
  color: #344054;
  font-size: 13px;
  cursor: pointer;
}

.forgot-old-password-label input {
  width: 15px;
  height: 15px;
  margin: 0;
  flex-shrink: 0;
}

.profile-info-modal .auth-modal-content {
  max-width: 520px;
}

.profile-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.profile-info-grid > div {
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid #e4e8f5;
  border-radius: 10px;
  background: #f8faff;
}

.profile-info-grid span {
  display: block;
  margin-bottom: 5px;
  color: #667085;
  font-size: 12px;
}

.profile-info-grid strong {
  color: #17214a;
  font-size: 14px;
  word-break: break-all;
}

.profile-info-loading,
.profile-info-error {
  grid-column: 1 / -1;
  color: #667085;
  font-size: 13px;
}

.profile-info-error {
  color: #b42318;
}

.bind-phone-panel {
  margin-top: 12px;
  padding: 13px;
  border: 1px solid #dbe3ff;
  border-radius: 12px;
  background: #fbfcff;
}

.bind-phone-panel h3 {
  margin: 0 0 4px;
  color: #17214a;
  font-size: 15px;
}

.bind-phone-panel p {
  margin: 0 0 12px;
  color: #667085;
  font-size: 12px;
  line-height: 1.6;
}

.membership-purchase-panel {
  margin-top: 12px;
  padding: 13px;
  border: 1px solid #dbe3ff;
  border-radius: 12px;
  background: #fbfcff;
}

.membership-purchase-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.membership-purchase-header h3 {
  margin: 0 0 4px;
  color: #17214a;
  font-size: 15px;
}

.membership-purchase-header p {
  margin: 0;
  color: #667085;
  font-size: 12px;
  line-height: 1.6;
}

.membership-plan-list {
  display: grid;
  gap: 8px;
}

.membership-plan-card {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(0, 1.4fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid #e4e8f5;
  border-radius: 10px;
  background: #fff;
}

.membership-plan-main strong,
.membership-plan-main span {
  display: block;
}

.membership-plan-main strong {
  color: #17214a;
  font-size: 14px;
}

.membership-plan-main span {
  margin-top: 4px;
  color: #667085;
  font-size: 12px;
}

.membership-plan-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.membership-plan-meta span {
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4f5f9f;
  font-size: 12px;
  line-height: 1.4;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

@media (max-width: 560px) {
  .profile-info-grid {
    grid-template-columns: 1fr;
  }

  .membership-plan-card {
    grid-template-columns: 1fr;
  }
}

/* 按钮样式 */
.btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  outline: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/**
 * @description 主按钮改为纯黑色
 * @date 2025-12-09
 */
.btn-primary {
  background: #000000;
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: #333333;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

/**
 * @description 次要按钮样式（用于发送验证码）
 * @date 2026-04-01
 */
.btn-secondary {
  background: #ffffff;
  color: #000000;
  border: 1.5px solid #000000;
  padding: 7px 14px;
  font-size: 12px;
  white-space: nowrap;
}

.btn-secondary:hover:not(:disabled) {
  background: #000000;
  color: #ffffff;
}

.btn-secondary:disabled {
  background: #f5f5f5;
  color: #999999;
  border-color: #d0d0d0;
}

.btn-block {
  width: 100%;
  margin-top: 4px;
}

.btn-loading {
  display: none;
}

/* 小型加载动画 */
.spinner-small {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 弹窗底部 */
.auth-modal-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e5e5;
  text-align: center;
}

.auth-modal-footer p {
  font-size: 12px;
  color: #666666;
  margin: 0;
}

/**
 * @description 链接改为黑色
 * @date 2025-12-09
 */
.link-primary {
  color: #000000;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.link-primary:hover {
  color: #333333;
  text-decoration: underline;
}

/**
 * @description Toast提示改为黑白灰
 * @date 2025-12-09
 * @modification 改为右上角用户名下方显示
 * @date 2026-04-01
 */
.toast {
  position: fixed;
  top: 70px;
  right: 30px;
  width: 320px;
  max-width: min(360px, calc(100vw - 32px));
  max-height: 160px;
  overflow-y: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  color: #ffffff;
  z-index: 10000;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  animation: toastSlideIn 0.3s ease-out;
}

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

.toast-success {
  background: #333333;
}

.toast-error {
  background: #000000;
}

.toast-info {
  background: #666666;
}

.toast-warning {
  background: #8a5a00;
}

.auth-toast-container {
  position: fixed;
  top: 74px;
  right: 24px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.auth-toast {
  width: fit-content;
  max-width: 100%;
  max-height: 160px;
  overflow-y: auto;
  padding: 11px 15px;
  border-radius: 12px;
  background: #20243f;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.24);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: auto;
}

.auth-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.auth-toast-success {
  background: #18a66f;
}

.auth-toast-error {
  background: #cf3a4f;
}

.auth-toast-warning {
  background: #de8b18;
}

.auth-toast-info {
  background: #20243f;
}

/* 用户信息区域 */
.user-info {
  display: none;
  align-items: center;
  gap: 12px;
}

/**
 * @description 用户头像改为黑色
 * @date 2025-12-09
 */
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
  color: #000000;
}

.user-dropdown {
  position: relative;
}

.user-dropdown-btn {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: #666666;
  font-size: 18px;
  border-radius: 6px;
  transition: all 0.2s;
}

.user-dropdown-btn:hover {
  background: #f5f5f5;
  color: #333333;
}

.user-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  min-width: 180px;
  /**
   * @description 提高z-index确保下拉菜单在所有内容之上
   * @date 2025-12-09
   */
  z-index: 1001;
}

.user-dropdown-menu.show {
  display: block;
  animation: dropdownFadeIn 0.2s ease-out;
}

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

.user-dropdown-item {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: none;
  text-align: left;
  font-size: 14px;
  color: #333333;
  cursor: pointer;
  transition: all 0.2s;
}

.user-dropdown-item:hover {
  background: #f5f5f5;
}

.user-dropdown-item:first-child {
  border-radius: 8px 8px 0 0;
}

.user-dropdown-item:last-child {
  border-radius: 0 0 8px 8px;
  color: #000000;
}

/**
 * @description 未登录遮罩提示改为黑色
 * @date 2025-12-09
 */
.auth-required-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(5px);
  z-index: 9998;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.auth-required-overlay.show {
  display: flex;
}

.auth-required-overlay:hover {
  background: rgba(0, 0, 0, 0.4);
}

.auth-required-message {
  background: #000000;
  color: #ffffff;
  padding: 30px 40px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  text-align: center;
  max-width: 400px;
  animation: messageSlideIn 0.5s ease-out;
  transition: transform 0.3s ease;
  pointer-events: none;
}

.auth-required-overlay:hover .auth-required-message {
  transform: scale(1.05);
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-required-message h2 {
  font-size: 24px;
  margin: 0 0 15px 0;
  font-weight: 600;
}

.auth-required-message p {
  font-size: 16px;
  margin: 0;
  opacity: 0.95;
  line-height: 1.6;
}

/* 响应式设计 */
@media (max-width: 640px) {
  .auth-modal-content {
    width: 95%;
    max-width: none;
  }

  .auth-modal-header {
    padding: 20px;
  }

  .auth-modal-body {
    padding: 20px;
  }

  .auth-modal-title {
    font-size: 20px;
  }

  .auth-required-message {
    margin: 0 20px;
    padding: 25px 30px;
  }

  .auth-required-message h2 {
    font-size: 20px;
  }

  .auth-required-message p {
    font-size: 14px;
  }
}
