/* ==========================================================================
   雪线 SnowLine · 用户系统样式
   复用 assets/style.css 的 CSS 变量，保持深蓝雪主题一致。
   ========================================================================== */

/* ---------- 导航栏用户区 ---------- */

#user-bar { display: flex; align-items: center; margin-left: auto; flex-shrink: 0; }   /* 2026-10-26：用户区不参与压缩，防止「管理后台」被挤成两行 */

.u-bar { display: flex; align-items: center; gap: 10px; }
.u-bar-loading {
  display: inline-block; width: 64px; height: 32px;
  border-radius: var(--r-s); background: var(--bg-3);
}

.u-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 5px; border: 0.5px solid var(--line-2);
  background: var(--bg); border-radius: 999px;
  font-family: inherit; font-size: 13.5px; color: var(--ink);
  cursor: pointer; transition: border-color .16s, background .16s;
}
.u-chip:hover { border-color: var(--blue); background: var(--blue-l); }
.u-chip-av {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--blue-d); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 600; flex-shrink: 0;
}
.u-chip-nm { max-width: 108px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.u-link {
  border: 0; background: none; font-family: inherit;
  font-size: 13.5px; color: var(--ink-2); cursor: pointer;
  padding: 6px 4px; transition: color .16s;
  white-space: nowrap;   /* 2026-10-26：「管理后台」等不被挤成两行 */
}
.u-link:hover { color: var(--blue); }

/* 导航栏「私信」入口 + 未读红点。
   为什么放在用户区而不是主导航：只有登录后才有私信，未登录时它只会是个死链接。
   红点是「有人在等我回话」的唯一提示，所以做成绝对定位的小徽标，不挤动其他元素。 */
.u-dm {
  position: relative;
  font-size: 13px; font-weight: 500; color: var(--ink-2);
  padding: 6px 11px; border-radius: 999px;
  border: 0.5px solid var(--line-2); background: var(--bg);
  text-decoration: none; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.u-dm:hover { border-color: var(--blue); background: var(--blue-l); color: var(--blue-d); }
.u-dm-dot {
  position: absolute; top: -6px; right: -6px;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--red); color: #fff;
  font-size: 11px; font-weight: 600; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}

.u-btn-p {
  border: 0; font-family: inherit; font-size: 13.5px;
  padding: 7px 16px; border-radius: var(--r-s);
  background: var(--blue-d); color: #fff; cursor: pointer;
  transition: background .16s, transform .16s;
  white-space: nowrap;   /* 2026-10-26：按钮文字不换行 */
}

/* 2026-10-26：中宽窗口下用户区收窄，给主导航让位（阈值与 style.css 的 1300px 档联动） */
@media (max-width: 1300px) {
  .u-bar { gap: 6px; }
  .u-chip-nm { max-width: 72px; }
}
.u-btn-p:hover { background: var(--blue); }
.u-btn-p:active { transform: translateY(1px); }

/* ---------- 欢迎条 ---------- */

.u-welcome {
  max-width: var(--max); margin: 18px auto 0;
  padding: 12px 18px; border-radius: var(--r-m);
  background: var(--teal-l); border: 0.5px solid rgba(15,110,86,.22);
  font-size: 13.8px; color: var(--teal);
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
}
.u-welcome b { font-weight: 600; }
.u-welcome a { border-bottom: 0.5px solid currentColor; font-weight: 500; }
.u-welcome-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--teal); flex-shrink: 0;
}

/* ---------- 遮罩与弹窗 ---------- */

.u-mask {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(14, 26, 36, .48);
  backdrop-filter: blur(3px);
  /* 内容高于视口时可整体滚动，弹窗永不超出可视区域被裁切 */
  display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto;
  animation: u-fade .18s ease-out;
}
@keyframes u-fade { from { opacity: 0 } to { opacity: 1 } }

.u-modal {
  position: relative; width: 100%; max-width: 420px;
  background: var(--bg); border-radius: var(--r-l);
  padding: 30px 30px 26px;
  box-shadow: 0 18px 60px rgba(8, 22, 36, .28);
  animation: u-rise .22s cubic-bezier(.2,.8,.3,1);
  margin: auto;
  /* 关键：限制高度，让内容在弹窗内部滚动，底部按钮永远可达 */
  max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.u-modal-wide { max-width: 520px; }

/* 弹窗主体：可滚动区域（头部/底部固定） */
.u-modal-body { overflow-y: auto; min-height: 0; flex: 1 1 auto; }
/* 兜底：没有 .u-modal-body 包裹时，直接让弹窗自身滚动 */
.u-modal > form { overflow-y: auto; min-height: 0; }
@keyframes u-rise {
  from { opacity: 0; transform: translateY(12px) scale(.98) }
  to { opacity: 1; transform: none }
}

.u-modal-x {
  position: absolute; top: 14px; right: 16px;
  width: 30px; height: 30px; border: 0; border-radius: 50%;
  background: var(--bg-3); color: var(--ink-2);
  font-size: 19px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .16s, color .16s;
}
.u-modal-x:hover { background: var(--red-l); color: var(--red); }

.u-modal-hd { margin-bottom: 20px; padding-right: 26px; }
.u-modal-hd h2 {
  font-size: 21px; font-weight: 600; letter-spacing: -.3px;
  margin-bottom: 6px;
}
.u-modal-hd p { font-size: 13.2px; color: var(--ink-3); line-height: 1.55; }

/* ---------- 标签页 ---------- */

.u-tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--bg-3); border-radius: var(--r-s);
  margin-bottom: 20px;
}
.u-tabs button {
  flex: 1; border: 0; background: none; font-family: inherit;
  font-size: 13.5px; color: var(--ink-2); cursor: pointer;
  padding: 8px 6px; border-radius: 6px;
  transition: background .16s, color .16s, box-shadow .16s;
}
.u-tabs button.on {
  background: var(--bg); color: var(--blue-d);
  font-weight: 600; box-shadow: 0 1px 3px rgba(8,22,36,.1);
}

/* ---------- 表单 ---------- */

.u-form { display: grid; gap: 15px; }

.u-field { display: block; }
.u-field-top {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 6px;
}
.u-label { font-size: 13.2px; color: var(--ink-2); font-weight: 500; }
.u-hint { font-size: 11.8px; color: var(--ink-3); }

.u-field input {
  width: 100%; padding: 10px 13px;
  border: 0.5px solid var(--line-2); border-radius: var(--r-s);
  font-family: inherit; font-size: 14px; color: var(--ink);
  background: var(--bg); transition: border-color .16s, box-shadow .16s;
}
.u-field input::placeholder { color: #9AAABB; }
.u-field input:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(27, 111, 196, .13);
}

.u-pwd { position: relative; display: block; }
.u-pwd input { padding-right: 62px; }
.u-pwd-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  border: 0; background: none; font-family: inherit;
  font-size: 12.2px; color: var(--ink-3); cursor: pointer;
  padding: 4px 8px; border-radius: 6px; transition: color .16s, background .16s;
}
.u-pwd-toggle:hover { color: var(--blue); background: var(--blue-l); }

.u-err { display: block; font-size: 12.2px; color: var(--red); margin-top: 5px; }

/* ---------- 提示条 ---------- */

.u-alert {
  padding: 10px 13px; border-radius: var(--r-s);
  font-size: 13px; line-height: 1.55;
}
.u-alert-bad { background: var(--red-l); color: var(--red); border: 0.5px solid rgba(163,45,45,.2); }
.u-alert-ok { background: var(--teal-l); color: var(--teal); border: 0.5px solid rgba(15,110,86,.2); }

/* ---------- 提交按钮 ---------- */

.u-submit {
  width: 100%; border: 0; font-family: inherit;
  font-size: 14.5px; font-weight: 500;
  padding: 12px; border-radius: var(--r-s);
  background: var(--blue-d); color: #fff; cursor: pointer;
  transition: background .16s, transform .16s, opacity .16s;
}
.u-submit:hover:not(:disabled) { background: var(--blue); }
.u-submit:active:not(:disabled) { transform: translateY(1px); }
.u-submit:disabled { opacity: .55; cursor: not-allowed; }

.u-danger {
  width: 100%; border: 0.5px solid rgba(163,45,45,.35);
  background: var(--red-l); color: var(--red);
  font-family: inherit; font-size: 14px;
  padding: 11px; border-radius: var(--r-s); cursor: pointer;
  margin-top: 6px; transition: background .16s;
}
.u-danger:hover { background: #F8DEDE; }

.u-modal-ft {
  margin-top: 20px; padding-top: 16px;
  border-top: 0.5px solid var(--line);
  font-size: 13.2px; color: var(--ink-3); text-align: center;
}
.u-modal-ft button {
  border: 0; background: none; font-family: inherit;
  font-size: 13.2px; color: var(--blue); font-weight: 500;
  cursor: pointer; padding: 2px 3px;
}
.u-modal-ft button:hover { text-decoration: underline; }

/* ---------- 个人中心 ---------- */

.u-me-hd {
  display: flex; align-items: center; gap: 15px;
  padding-bottom: 20px; margin-bottom: 20px;
  border-bottom: 0.5px solid var(--line);
}
.u-avatar {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--blue-d); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 600; flex-shrink: 0;
}
.u-me-hd h2 { font-size: 18.5px; font-weight: 600; margin-bottom: 3px; }
.u-me-hd p { font-size: 13px; color: var(--ink-3); }

.u-info { display: grid; gap: 2px; }
.u-info > div {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; padding: 10px 0;
  border-bottom: 0.5px solid var(--line); font-size: 13.5px;
}
.u-info > div:last-of-type { border-bottom: 0; }
.u-info span { color: var(--ink-3); flex-shrink: 0; }
.u-info b { font-weight: 500; text-align: right; word-break: break-all; }
.u-mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }

.u-sync p { font-size: 13.5px; color: var(--ink-2); line-height: 1.7; margin-bottom: 16px; }
.u-sync-out {
  margin-top: 18px; padding: 14px 16px;
  background: var(--bg-2); border-radius: var(--r-s);
  border: 0.5px solid var(--line);
}
.u-sync-k { font-size: 12.5px; color: var(--ink-3); margin-bottom: 5px; }
.u-sync-v { font-size: 13.5px; color: var(--ink); }

/* ---------- 响应式 ---------- */

@media (max-width: 640px) {
  .u-chip-nm { display: none; }
  .u-chip { padding: 4px; }
  .u-modal { padding: 26px 20px 22px; max-height: calc(100vh - 24px); }
  .u-modal-hd h2 { font-size: 19px; }
  /* 小屏：从顶部开始排布，但保留整体滚动，不裁切底部 */
  .u-mask { align-items: flex-start; padding: 12px; }
  .u-welcome { font-size: 13.2px; padding: 11px 14px; }
}

/* 手机上 16px：防 iOS/微信聚焦自动放大整页 */
@media (max-width: 760px) {
  .u-field input,
  .u-field select,
  .u-field textarea,
  .u-pwd input {
    font-size: 16px;
  }
}
