/* 登录态顶栏与提示 */

.header-user {
  position: relative;
}

.header-user::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 10px;
}

.header-user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  padding: 6px 10px 6px 14px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  cursor: default;
  outline: none;
  transition: background 0.2s, color 0.2s;
  box-sizing: border-box;
}

.header-user-trigger:hover,
.header-user.is-open .header-user-trigger {
  background: var(--primary);
  color: #fff;
}

.header-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--primary-bg);
}

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

.drawer-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--primary-bg);
}

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

.header-user.is-open .header-user-avatar,
.header-user-trigger:hover .header-user-avatar {
  background: #fff;
}

.header-user-phone {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.header-user-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 10050;
  min-width: 180px;
  padding: 8px 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.header-user:hover .header-user-menu,
.header-user.is-open .header-user-menu,
.header-user:focus-within .header-user-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.header-user-menu-phone {
  margin: 0;
  padding: 8px 16px 10px;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.header-user-menu a,
.header-user-menu button {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
}

.header-user-menu a:hover,
.header-user-menu button:hover {
  background: var(--primary-bg);
  color: var(--primary);
}

.drawer-user {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.drawer-user-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 8px;
  text-decoration: none;
  color: inherit;
}

.drawer-user-head:hover .drawer-user-phone {
  color: var(--primary);
}

.drawer-user .btn-primary,
.drawer-user .btn-outline {
  display: block;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
}

.drawer-user-phone {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.drawer-user .btn-outline {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.huijia-toast {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 10001;
  max-width: min(90vw, 360px);
  padding: 12px 20px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, calc(-50% + 10px));
  transition: opacity 0.2s, transform 0.2s;
}

.huijia-toast.is-show {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.login-form-error {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 6px;
  background: #fff2f0;
  color: #d4380d;
  font-size: 13px;
  line-height: 1.5;
}

.login-form-error[hidden] {
  display: none !important;
}

@media (max-width: 768px) {
  .header-user-trigger {
    max-width: 108px;
    padding: 4px 8px;
    gap: 6px;
    cursor: pointer;
  }

  .header-user-phone {
    max-width: 56px;
    font-size: 12px;
  }

  .header-user-avatar {
    width: 26px;
    height: 26px;
  }

  .header-user-menu {
    right: 0;
    min-width: 160px;
  }
}
