/* =========================================================
   user-center.css — 用户中心弹窗（修改头像 / 裁剪头像 / 修改密码）
   全部类名以 .uc- 前缀，复用 style.css 的主题变量，避免与既有样式冲突。
   ========================================================= */

/* ---------- 遮罩与卡片 ---------- */

.uc-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(12, 16, 28, .5);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.uc-card {
  position: relative;
  width: 480px;
  max-width: 92vw;
  max-height: 92vh;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: uc-pop .18s ease;
}

@keyframes uc-pop {
  from { transform: scale(.97); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* ---------- 头部 ---------- */

.uc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.uc-head-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex: none;
}

.uc-head-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.uc-close {
  margin-left: auto;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-faint);
  font-size: 22px;
  line-height: 1;
}
.uc-close:hover { background: var(--bg-hover); color: var(--text); }

/* ---------- 底部按钮 ---------- */

.uc-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.uc-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: var(--transition);
}
.uc-btn:hover { background: var(--bg-hover); }
.uc-btn:disabled { opacity: .5; cursor: not-allowed; }

.uc-btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-dim);
}
.uc-btn--ghost:hover { background: var(--bg-hover); color: var(--text); }

.uc-btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.uc-btn--primary:hover:not(:disabled) { filter: brightness(1.08); }

/* ---------- 内联错误提示 ---------- */

.uc-error {
  margin-top: 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--danger);
}

/* =========================================================
   弹窗一：修改头像
   ========================================================= */

.uc-avatar-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.uc-avatar-preview {
  width: 88px;
  height: 88px;
  flex: none;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--border);
}

.uc-avatar-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.uc-avatar-letter {
  font-size: 34px;
  font-weight: 600;
  line-height: 1;
  color: var(--accent);
}

.uc-avatar-right {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.uc-pick-btn { padding: 8px 14px; }

.uc-hint {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-faint);
}

.uc-file-input { display: none; }

/* =========================================================
   弹窗二：裁剪头像
   ========================================================= */

/* 深色取景台：正方形，尺寸 = min(320px, 80vw) */
.uc-crop-stage {
  position: relative;
  width: min(320px, 80vw);
  height: min(320px, 80vw);
  margin: 0 auto;
  background: #0b0d12;
  border-radius: 10px;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.uc-crop-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* 取景框覆盖层：暗化遮罩 + 网格 + 四角把手；覆盖层本身指针穿透，仅把手可交互 */
.uc-crop-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* 正方形取景框：位置 / 尺寸由 JS 写入；可整体拖动平移，四角把手等比调整大小 */
.uc-crop-frame {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: auto;   /* 覆盖层穿透，仅取景框与四角把手可交互 */
  cursor: move;
  touch-action: none;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .55),
    0 0 0 9999px rgba(0, 0, 0, .55);
}

.uc-grid {
  position: absolute;
  background: rgba(255, 255, 255, .35);
}
.uc-grid-v { top: 0; bottom: 0; width: 1px; }
.uc-grid-h { left: 0; right: 0; height: 1px; }
.uc-grid-v1 { left: 33.333%; }
.uc-grid-v2 { left: 66.667%; }
.uc-grid-h1 { top: 33.333%; }
.uc-grid-h2 { top: 66.667%; }

.uc-handle {
  position: absolute;
  width: 20px;
  height: 20px;
  pointer-events: auto;   /* 覆盖层穿透，仅把手可交互 */
  touch-action: none;
}
.uc-handle-tl {
  top: -1px; left: -1px;
  cursor: nwse-resize;
  border-top: 3px solid #fff;
  border-left: 3px solid #fff;
  border-top-left-radius: 2px;
}
.uc-handle-tr {
  top: -1px; right: -1px;
  cursor: nesw-resize;
  border-top: 3px solid #fff;
  border-right: 3px solid #fff;
  border-top-right-radius: 2px;
}
.uc-handle-bl {
  bottom: -1px; left: -1px;
  cursor: nesw-resize;
  border-bottom: 3px solid #fff;
  border-left: 3px solid #fff;
  border-bottom-left-radius: 2px;
}
.uc-handle-br {
  bottom: -1px; right: -1px;
  cursor: nwse-resize;
  border-bottom: 3px solid #fff;
  border-right: 3px solid #fff;
  border-bottom-right-radius: 2px;
}

/* 工具条：四个圆形图标按钮 + 分隔线 + 右侧比例文字 */
.uc-crop-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.uc-tool {
  width: 36px;
  height: 36px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-elev);
  color: var(--text-dim);
  transition: var(--transition);
}
.uc-tool:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.uc-divider {
  width: 1px;
  height: 22px;
  margin: 0 4px;
  background: var(--border-strong);
}

.uc-ratio {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-faint);
  white-space: nowrap;
}

/* 角度矫正行 */
.uc-angle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.uc-angle-label {
  flex: none;
  font-size: 12.5px;
  color: var(--text-dim);
}

.uc-angle-val {
  min-width: 44px;
  text-align: right;
  font-size: 12.5px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.uc-zero {
  flex: none;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-elev);
  color: var(--text-dim);
  font-size: 12px;
}
.uc-zero:hover { color: var(--accent); border-color: var(--accent); }

/* 角度滑杆：沿用项目内 range 的观感（进度由 --p 控制） */
.uc-angle-range {
  flex: 1;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
  height: 18px;
  background: transparent;
  cursor: pointer;
}
.uc-angle-range:focus { outline: none; }

.uc-angle-range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: linear-gradient(to right,
    var(--accent) 0, var(--accent) var(--p, 50%),
    var(--bg-sunken) var(--p, 50%), var(--bg-sunken) 100%);
}
.uc-angle-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 3px solid var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .28);
}
.uc-angle-range::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-sunken);
}
.uc-angle-range::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
}
.uc-angle-range::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 3px solid var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .28);
}

/* 说明行 */
.uc-info {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  padding: 10px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-dim);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.uc-info-icon {
  flex: none;
  margin-top: 1px;
  color: var(--text-faint);
  display: inline-flex;
}

.uc-info-text { min-width: 0; }

/* =========================================================
   弹窗三：修改密码
   ========================================================= */

.uc-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.uc-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.uc-field-label {
  font-size: 12.5px;
  color: var(--text-dim);
}

.uc-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-sunken);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}
.uc-input::placeholder { color: var(--text-faint); }
.uc-input:focus {
  border-color: var(--accent);
  background: var(--bg-elev);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* =========================================================
   Toast（顶部居中）
   ========================================================= */

.uc-toast-wrap {
  position: fixed;
  left: 50%;
  top: 24px;
  transform: translateX(-50%);
  z-index: 400;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.uc-toast {
  max-width: 80vw;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  color: #fff;
  background: var(--accent);
  box-shadow: var(--shadow-lg);
  animation: uc-toast-in .2s ease;
}
.uc-toast--ok { background: var(--ok); }
.uc-toast--error { background: var(--danger); }
.uc-toast--info { background: var(--accent); }
.uc-toast.is-out { animation: uc-toast-out .3s ease forwards; }

@keyframes uc-toast-in {
  from { transform: translateY(-8px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes uc-toast-out {
  from { transform: none; opacity: 1; }
  to { transform: translateY(-8px); opacity: 0; }
}
