/* ============================================================
 * 登录 / 注册 / 找回密码 弹窗 + 导航用户入口 样式
 * 复用全站 CSS 变量，深浅双主题
 * ============================================================ */

/* ===== 全局登录弹窗遮罩 ===== */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(8, 11, 22, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.24s ease-out, visibility 0.24s ease-out;
}
.auth-overlay.active {
  opacity: 1;
  visibility: visible;
}

.auth-modal {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 36px 32px 28px;
  overflow: hidden;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 90vh;
  overflow-y: auto;
}
.auth-overlay.active .auth-modal {
  transform: translateY(0) scale(1);
}

/* 轻量化动态渐变光斑 —— 不遮挡文字 */
.auth-modal::before,
.auth-modal::after {
  content: '';
  position: absolute;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}
.auth-modal::before {
  top: -90px;
  right: -70px;
  background: radial-gradient(circle, #C41E3A, transparent 70%);
  animation: authFloatA 9s ease-in-out infinite alternate;
}
.auth-modal::after {
  bottom: -100px;
  left: -80px;
  background: radial-gradient(circle, #8B0000, transparent 70%);
  animation: authFloatB 11s ease-in-out infinite alternate;
}
@keyframes authFloatA {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-30px, 30px) scale(1.15); }
}
@keyframes authFloatB {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, -20px) scale(1.1); }
}

.auth-modal > * { position: relative; z-index: 1; }

/* Bottom Sheet 拖拽指示条（仅移动端显示） */
.auth-sheet-handle { display: none; }

.auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.24s ease-out, color 0.24s ease-out;
  z-index: 2;
}
.auth-close:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.auth-brand {
  text-align: center;
  margin-bottom: 22px;
}
.auth-brand-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: contain;
  display: block;
  margin: 0 auto 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  filter: invert(1) hue-rotate(180deg);
}
.auth-brand-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 4px;
}
.auth-brand-sub {
  font-size: 12px;
  color: var(--color-text-muted);
  margin: 0;
}

/* Tab 切换 */
.auth-tabs {
  display: flex;
  background: var(--color-surface-2, var(--color-surface-hover));
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 22px;
}
.auth-tab {
  flex: 1;
  padding: 8px 0;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.24s ease-out;
}
.auth-tab.active {
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* 表单 */
.auth-field {
  margin-bottom: 14px;
}
.auth-field label {
  display: block;
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}
.auth-field input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.24s ease-out, box-shadow 0.24s ease-out;
}
.auth-field input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}
.auth-field input::placeholder {
  color: var(--color-text-muted);
}

.auth-error {
  color: var(--color-danger, #ef4444);
  font-size: 12px;
  margin: -6px 0 10px;
  min-height: 16px;
  display: none;
}
.auth-error.show { display: block; }

.auth-submit {
  width: 100%;
  padding: 11px 0;
  background: linear-gradient(135deg, var(--color-primary), #8B0000);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.24s ease-out, transform 0.24s ease-out;
  margin-top: 4px;
}
.auth-submit:hover { opacity: 0.92; }
.auth-submit:active { transform: scale(0.98); }
.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-extra {
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--color-text-muted);
}
.auth-extra a {
  color: var(--color-primary);
  cursor: pointer;
  text-decoration: none;
}
.auth-extra a:hover { text-decoration: underline; }

.auth-guest {
  margin-top: 10px;
  width: 100%;
  padding: 9px 0;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.24s ease-out, color 0.24s ease-out;
}
.auth-guest:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.auth-form { display: none; }
.auth-form.active { display: block; }

.auth-hint {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 10px;
  line-height: 1.6;
  text-align: center;
}

/* ===== 导航栏用户入口 ===== */
.nav-user-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 8px;
  flex-shrink: 0;
}

.nav-login-btn {
  padding: 7px 18px;
  background: linear-gradient(135deg, var(--color-primary), #8B0000);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.24s ease-out, transform 0.24s ease-out, box-shadow 0.24s ease-out;
  white-space: nowrap;
}
.nav-login-btn:hover {
  opacity: 0.92;
  box-shadow: 0 4px 14px var(--color-primary);
}

.nav-user {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 999px;
  transition: background 0.24s ease-out;
}
.nav-user:hover { background: var(--color-surface-hover); }

.nav-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-primary);
  background: var(--color-surface-hover);
}
.nav-user-nick {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px 0;
  display: none;
  z-index: 100;
}
.nav-user.open .nav-user-dropdown { display: block; }

.nav-user-dropdown a,
.nav-user-dropdown button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 16px;
  background: transparent;
  border: none;
  color: var(--color-text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.24s ease-out;
  box-sizing: border-box;
}
.nav-user-dropdown a:hover,
.nav-user-dropdown button:hover {
  background: var(--color-surface-hover);
  color: var(--color-primary);
}
.nav-user-dropdown .dropdown-divider {
  height: 1px;
  background: var(--color-border);
  margin: 4px 0;
}
.nav-user-dropdown .dropdown-logout {
  color: var(--color-danger, #ef4444);
}

/* ===== Toast 提示 ===== */
.auth-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.24s ease-out, transform 0.24s ease-out;
  pointer-events: none;
  max-width: 90vw;
}
.auth-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.auth-toast.toast-success { border-color: var(--color-success, #10b981); }
.auth-toast.toast-error { border-color: var(--color-danger, #ef4444); }

/* ============================================================
 * 通用确认弹窗（ConfirmModal）
 * ============================================================ */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 10003;
  background: rgba(8, 11, 22, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.24s ease-out, visibility 0.24s ease-out;
}
.confirm-overlay.active {
  opacity: 1;
  visibility: visible;
}

.confirm-modal {
  position: relative;
  width: 100%;
  max-width: 360px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 28px 24px 22px;
  overflow: hidden;
  text-align: center;
  transform: translateY(12px) scale(0.96);
  transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
}
.confirm-overlay.active .confirm-modal {
  transform: translateY(0) scale(1);
}

/* 渐变光斑装饰 */
.confirm-modal::before {
  content: '';
  position: absolute;
  top: -70px; right: -50px;
  width: 180px; height: 180px;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.25;
  pointer-events: none;
  background: radial-gradient(circle, #C41E3A, transparent 70%);
}

.confirm-modal > * { position: relative; z-index: 1; }

.confirm-icon {
  font-size: 36px;
  margin-bottom: 12px;
  line-height: 1;
}
.confirm-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 8px;
}
.confirm-message {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin: 0 0 22px;
  line-height: 1.6;
  word-break: break-word;
}

.confirm-actions {
  display: flex;
  gap: 10px;
}
.confirm-btn {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.24s ease-out, transform 0.24s ease-out;
}
.confirm-btn:active { transform: scale(0.97); }
.confirm-btn.cancel-btn {
  background: var(--color-surface-hover);
  color: var(--color-text);
}
.confirm-btn.cancel-btn:hover { opacity: 0.88; }
.confirm-btn.ok-btn {
  background: linear-gradient(135deg, var(--color-primary), #8B0000);
  color: #fff;
}
.confirm-btn.ok-btn:hover { opacity: 0.92; }
.confirm-modal.danger .confirm-btn.ok-btn {
  background: linear-gradient(135deg, #ef4444, #f97316);
}
.confirm-modal.danger::before {
  background: radial-gradient(circle, #ef4444, transparent 70%);
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  /* ---- 登录弹窗 Bottom Sheet ---- */
  .auth-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .auth-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 32px 22px 28px;
    max-height: 88vh;
    transform: translateY(100%);
    transition: transform 0.24s cubic-bezier(0.32, 0.72, 0, 1);
  }
  .auth-overlay.active .auth-modal {
    transform: translateY(0);
  }

  /* Bottom Sheet 拖拽指示条 */
  .auth-sheet-handle {
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--color-text-muted);
    opacity: 0.4;
    margin: -10px auto 16px;
  }

  /* ---- 确认弹窗也用 Bottom Sheet ---- */
  .confirm-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .confirm-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 70vh;
    padding: 32px 22px 28px;
    transform: translateY(100%);
    transition: transform 0.24s cubic-bezier(0.32, 0.72, 0, 1);
  }
  .confirm-overlay.active .confirm-modal {
    transform: translateY(0);
  }

  .nav-user-nick { display: none; }
  .nav-login-btn { padding: 6px 14px; font-size: 12px; }
  .nav-user-container { margin-left: 4px; }
}


/* ===== 手机号验证码登录子Tab ===== */
.auth-subtabs {
  display: flex;
  gap: 0;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--color-border, #e5e7eb);
}
.auth-subtab {
  flex: 1;
  padding: 10px 0;
  background: none;
  border: none;
  font-size: 14px;
  color: var(--color-text-muted, #9ca3af);
  cursor: pointer;
  position: relative;
  transition: color 0.24s;
}
.auth-subtab:hover { color: var(--color-text, #1f2937); }
.auth-subtab.active {
  color: var(--color-primary, #C41E3A);
  font-weight: 600;
}
.auth-subtab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--color-primary, #C41E3A);
  border-radius: 1px;
}

.auth-subpanel { display: none; }
.auth-subpanel.active { display: block; }

/* 验证码输入行 */
.auth-field-code .auth-code-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.auth-field-code .auth-code-row input {
  flex: 1;
  min-width: 0;
}
.auth-code-btn {
  flex-shrink: 0;
  padding: 0 14px;
  font-size: 13px;
  color: var(--color-primary, #C41E3A);
  background: transparent;
  border: 1px solid var(--color-primary, #C41E3A);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.24s;
}
.auth-code-btn:hover:not(:disabled) {
  background: var(--color-primary, #C41E3A);
  color: #fff;
}
.auth-code-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 深色模式适配 */
[data-theme='dark'] .auth-subtabs {
  border-bottom-color: rgba(255,255,255,0.1);
}
[data-theme='dark'] .auth-subtab {
  color: rgba(255,255,255,0.5);
}
[data-theme='dark'] .auth-subtab:hover {
  color: rgba(255,255,255,0.8);
}
[data-theme='dark'] .auth-code-btn {
  color: #ff6b81;
  border-color: #ff6b81;
}
[data-theme='dark'] .auth-code-btn:hover:not(:disabled) {
  background: #ff6b81;
  color: #1a1a2e;
}
