/* ============================================================
   auth.css  ·  登录 / 注册 / 账号组件
   复用主页的暖色变量（--accent 等），所有类名加 wb- 前缀避免冲突
   ============================================================ */

.wb-auth-btn {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, .6);
  background: rgba(255, 255, 255, .4);
  color: var(--text, #33302C);
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 2px 8px -6px rgba(120, 85, 60, .35);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transition: background .2s ease;
}
.wb-auth-btn:hover { background: rgba(255, 255, 255, .6); }
.wb-auth-btn .wb-auth-avatar {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent-soft, #F8E7DC);
  color: var(--accent, #C25A38);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.wb-auth-btn .wb-auth-name {
  display: none;   /* 仅留头像圆点，昵称不显示 */
}

/* 登录后的下拉菜单 */
.wb-auth-menu {
  position: fixed;
  top: 46px;
  right: 12px;
  z-index: 51;
  min-width: 132px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #F0E4D8);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 16px 34px -18px rgba(120, 85, 60, .5);
  display: flex; flex-direction: column; gap: 2px;
}
.wb-auth-menu[hidden] { display: none; }
.wb-auth-menu button {
  border: 0; background: transparent; text-align: left;
  padding: 9px 12px; border-radius: 9px; font: inherit; font-size: 13.5px;
  color: var(--text, #333); cursor: pointer;
}
.wb-auth-menu button:hover { background: var(--accent-soft, #F8E7DC); color: var(--accent, #D97757); }

/* 手机触控优化：保证头像点的命中区域，但整体仍小巧 */
@media (pointer: coarse) {
  .wb-auth-btn {
    top: 10px; right: 10px;
    padding: 6px;
  }
  .wb-auth-btn .wb-auth-avatar { width: 24px; height: 24px; font-size: 13px; }
  .wb-auth-menu { top: 50px; right: 10px; min-width: 160px; }
  .wb-auth-menu button { padding: 14px 16px; font-size: 15px; }
  .wb-auth-close { width: 34px; height: 34px; font-size: 19px; }
}

/* 弹窗遮罩 */
.wb-auth-modal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(51, 48, 44, .35);
  backdrop-filter: blur(2px);
  padding: 20px;
}
.wb-auth-modal[hidden] { display: none; }

.wb-auth-card {
  width: min(340px, 100%);
  background: var(--surface, #fff);
  border-radius: 20px;
  padding: 22px 22px 20px;
  position: relative;
  box-shadow: 0 30px 60px -20px rgba(80, 50, 30, .5);
  animation: wb-auth-rise .35s ease both;
}
@keyframes wb-auth-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.wb-auth-close {
  position: absolute; top: 12px; right: 14px;
  width: 26px; height: 26px; border: 0; border-radius: 50%;
  background: #F6EFE7; color: #9C8B7C; font-size: 16px; line-height: 1;
  cursor: pointer;
}
.wb-auth-close:hover { color: var(--accent, #D97757); }

.wb-auth-title { margin: 0 0 14px; font-size: 17px; font-weight: 600; }

.wb-auth-tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.wb-auth-tabs button {
  flex: 1; border: 0; background: transparent; padding: 8px;
  border-radius: 999px; font: inherit; font-size: 13.5px;
  color: #A99787; cursor: pointer;
}
.wb-auth-tabs button.active { background: var(--accent-soft, #F8E7DC); color: var(--accent, #C25A38); }

.wb-auth-form { display: flex; flex-direction: column; gap: 10px; }
.wb-auth-form[hidden] { display: none; }

.wb-auth-field { display: flex; flex-direction: column; gap: 4px; }
.wb-auth-field label { font-size: 12px; color: var(--text-soft, #857A70); padding-left: 2px; }
.wb-auth-field input {
  height: 42px; padding: 0 14px;
  border: 1px solid var(--border, #F0E4D8);
  border-radius: 12px; background: #FBF4EC;
  font: inherit; font-size: 14px; color: var(--text, #333);
  outline: none; transition: border-color .2s ease, background .2s ease;
}
.wb-auth-field input:focus { background: #fff; border-color: #EED9C7; }

.wb-auth-submit {
  height: 44px; margin-top: 4px; border: 0; border-radius: 12px;
  background: var(--accent, #D97757); color: #fff;
  font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer;
  transition: filter .2s ease, transform .1s ease;
}
.wb-auth-submit:hover { filter: brightness(1.04); }
.wb-auth-submit:active { transform: translateY(1px); }

.wb-auth-msg { margin: 12px 0 0; min-height: 16px; font-size: 12.5px; color: #C0492F; text-align: center; }
.wb-auth-msg.ok { color: #4F8A4F; }

/* 用户管理（管理员）：列表 + 重置密码 */
.wb-auth-users-hint { margin: 0; font-size: 12px; color: var(--text-soft, #857A70); line-height: 1.6; }
.wb-auth-users { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; margin-top: 4px; }
.wb-auth-urow {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border: 1px solid var(--border, #F0E4D8); border-radius: 12px;
  background: #FBF4EC;
}
.wb-auth-uname { flex: 1; min-width: 0; font-size: 13.5px; color: var(--text, #333); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-auth-uname small { color: #A99787; font-size: 11.5px; }
.wb-auth-utag {
  flex: 0 0 auto; padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft, #F8E7DC); color: var(--accent, #C25A38);
  font-size: 11px; font-weight: 600;
}
.wb-auth-ubtn {
  flex: 0 0 auto; border: 1px solid var(--border, #F0E4D8); border-radius: 9px;
  background: var(--surface, #fff); color: var(--accent, #C25A38);
  padding: 5px 10px; font: inherit; font-size: 12.5px; cursor: pointer;
  transition: background .15s ease;
}
.wb-auth-ubtn:hover { background: var(--accent-soft, #F8E7DC); }

.wb-auth-toast {
  position: fixed; left: 50%; bottom: 32px; z-index: 70;
  transform: translate(-50%, 14px);
  padding: 10px 18px; border-radius: 999px;
  background: rgba(51, 48, 44, .92); color: #fff; font-size: 13px;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  max-width: calc(100vw - 40px); text-align: center;
}
.wb-auth-toast.show { opacity: 1; transform: translate(-50%, 0); }
