/*!
 * 星海音乐 Web - 登录/注册/找回弹窗样式 + 顶栏用户菜单
 * 配合 js/ui/auth-modal.js 使用。
 * 与现有 css/overlays.css 中 .modal 结构兼容，复用 .modal-mask / .modal-card 基础样式。
 */

/* ============ 顶栏：用户区域 ============ */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  position: relative;
  flex-shrink: 0;
}

.user-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text, #e8eaf0);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.user-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}
.user-btn .user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #b06bff);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.user-btn.login-btn .user-avatar {
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
}

.user-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: rgba(20, 24, 38, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  padding: 6px;
  z-index: 1000;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  /* 默认隐藏，点击 .user-btn 切换 */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.16s, transform 0.16s, visibility 0.16s;
}
.user-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.user-menu-head {
  padding: 8px 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 4px;
}
.user-menu-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #e8eaf0);
}
.user-menu-email {
  font-size: 12px;
  color: var(--text-dim, #8a92a6);
  margin-top: 2px;
  word-break: break-all;
}
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--text, #e8eaf0);
  font-size: 13px;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.16s;
}
.user-menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
}
.user-menu-item.danger {
  color: #ff7676;
}
.user-menu-item .icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.user-menu-sep {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 4px 0;
}

/* ============ 弹窗：登录/注册/找回 ============ */
.auth-card {
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  overflow-y: auto;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.auth-tab {
  flex: 1;
  padding: 10px 0;
  background: transparent;
  border: 0;
  color: var(--text-dim, #8a92a6);
  font-size: 13px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.16s, border-color 0.16s;
}
.auth-tab:hover {
  color: var(--text, #e8eaf0);
}
.auth-tab.active {
  color: var(--accent, var(--accent));
  border-bottom-color: var(--accent, var(--accent));
  font-weight: 600;
}

.auth-form {
  padding: 16px 20px 20px;
}
.auth-field {
  margin-bottom: 12px;
}
.auth-field > label {
  display: block;
  font-size: 12px;
  color: var(--text-dim, #8a92a6);
  margin-bottom: 6px;
}
.auth-field input[type="text"],
.auth-field input[type="email"],
.auth-field input[type="password"] {
  width: 100%;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text, #e8eaf0);
  font-size: 13px;
  outline: none;
  transition: border-color 0.16s, background 0.16s;
  box-sizing: border-box;
}
.auth-field input:focus {
  border-color: var(--accent, var(--accent));
  background: rgba(var(--accent-rgb), 0.06);
}

/* 验证码输入行：input + 发送按钮 */
.auth-code-input,
.auth-captcha-input {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.auth-code-input input,
.auth-captcha-input input {
  flex: 1;
  min-width: 0;
}
.auth-code-input .btn-ghost,
.auth-captcha-input .btn-ghost {
  padding: 0 12px;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}
.auth-captcha-img {
  height: 38px;
  width: 110px;
  border-radius: 6px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  object-fit: cover;
}

/* 错误提示 */
.auth-error {
  font-size: 12px;
  color: #ff7676;
  min-height: 16px;
  margin-bottom: 8px;
  line-height: 1.4;
  opacity: 0;
  transition: opacity 0.16s;
}
.auth-error.show {
  opacity: 1;
}

/* 提交按钮 */
.auth-submit {
  width: 100%;
  padding: 11px;
  font-size: 14px;
  margin-top: 4px;
}

/* 提示文案 */
.auth-tips {
  font-size: 12px;
  color: var(--text-dim, #8a92a6);
  margin-top: 10px;
  text-align: center;
  line-height: 1.5;
}

/* 底部链接 */
.auth-foot {
  padding: 10px 20px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim, #8a92a6);
}
.auth-ext-link {
  color: var(--accent, var(--accent));
  text-decoration: none;
}
.auth-ext-link:hover {
  text-decoration: underline;
}
.auth-sep {
  margin: 0 6px;
  opacity: 0.5;
}

/* ============ 手机端：弹窗优化 ============ */
@media (max-width: 640px) {
  .auth-card {
    width: calc(100vw - 24px);
    max-width: none;
  }
  .auth-tabs {
    padding: 0 12px;
  }
  .auth-form {
    padding: 12px;
  }
  .auth-foot {
    padding: 8px 12px 12px;
  }
}

/* 收藏页同步状态徽章 */
.fav-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent, var(--accent));
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  margin-left: 8px;
  vertical-align: middle;
}
.fav-sync-badge.cloud-off {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim, #8a92a6);
  border-color: rgba(255, 255, 255, 0.06);
}
.fav-sync-badge.syncing {
  opacity: 0.7;
}
.fav-sync-badge.syncing::after {
  content: '…';
  margin-left: 2px;
}
