/* ======================================
   用户入口 UI（基于 uView Avatar 设计规范）
   BOX3 数字工坊 - 2026-08-23 重新设计版

   设计参考：ui-library/components/card/uView-abf68969
   规范来源：uView 官方设计系统
   ====================================== */

/* 用户入口容器 */
.user-entry {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 10001; /* 高于客服弹窗，防止被遮挡 */
  display: flex;
  align-items: center;
  gap: 8px; /* uView 规范：头像与文字间距 8px */
  padding: 4px 12px 4px 4px;
  background: var(--surface-1, #161b22);
  border: 1px solid var(--border-default, #30363d);
  border-radius: 100px; /* 胶囊形状 */
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  user-select: none;
  -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮 */
}

.user-entry:hover {
  background: var(--surface-2, #1c2128);
  border-color: var(--accent, #0ea5e9);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
  transform: translateY(-1px);
}

.user-entry:active {
  transform: translateY(0) scale(0.97);
}

/* 头像（uView 规范：48×48px 圆形，移动端 32×32px） */
.user-entry__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%; /* uView 规范：圆形 = 50% */
  background: linear-gradient(135deg, var(--accent, #0ea5e9) 0%, #3b82f6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.user-entry__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 在线状态指示器（uView 规范：右下角 2px 偏移） */
.user-entry__avatar::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 8px;
  height: 8px;
  background: #22c55e;
  border: 2px solid var(--surface-1, #161b22);
  border-radius: 50%;
}

.user-entry--offline .user-entry__avatar::after {
  background: #64748b;
}

/* 积分信息容器 */
.user-entry__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 52px;
  line-height: 1.2;
}

/* 积分标签（uView 规范：10px 小字号） */
.user-entry__label {
  font-size: 10px;
  color: var(--text-muted, #8b949e);
  font-weight: 400;
}

/* 积分数值（uView 规范：14px 主字号） */
.user-entry__value {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent, #0ea5e9);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

/* 未登录游客状态 */
.user-entry--guest .user-entry__avatar {
  background: var(--surface-3, #2d333b);
  color: var(--text-muted, #8b949e);
}

.user-entry--guest .user-entry__avatar::after {
  display: none; /* 游客不显示在线状态 */
}

/* 积分不足警告（≤5） */
.user-entry--low-credits .user-entry__value {
  color: #f59e0b;
}

/* 积分耗尽（=0） */
.user-entry--no-credits .user-entry__value {
  color: #ef4444;
}

/* PC 端适配（uView 规范：默认 48×48px） */
@media (min-width: 769px) {
  .user-entry {
    padding: 6px 12px 6px 6px;
  }

  .user-entry__avatar {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .user-entry__label {
    font-size: 11px;
  }

  .user-entry__value {
    font-size: 16px;
  }
}

/* 移动端安全区适配 */
@media (max-width: 768px) {
  .user-entry {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
  }
}

/* 深色主题下的边框增强 */
@media (prefers-color-scheme: dark) {
  .user-entry {
    border-color: rgba(255, 255, 255, 0.1);
  }
}

/* 触控区优化（移动端最小 44×44px） */
@media (pointer: coarse) {
  .user-entry {
    min-height: 44px;
    padding: 6px 12px 6px 6px;
  }
}

/* 动画：入场效果 */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.user-entry {
  animation: slideInRight 0.3s ease 0.2s both;
}
