/* ── User Bar Component ───────────────────────────
   User bar, popup menu, bottom nav, footer.
   ──────────────────────────────────────────────────── */

/* Footer — 用户身份条（点击弹出菜单） */
.drawer-footer {
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
  position: relative;
  padding-bottom: var(--safe-bottom);
}
.drawer-user-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 64px;
  padding: var(--space-2) var(--space-4);
  width: 100%;
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: background var(--duration-fast);
}
.drawer-user-bar:hover { background: var(--color-surface-hover); }
.drawer-user-bar:active { opacity: 0.85; }
.drawer-user-chevron {
  width: 18px;
  height: 18px;
  color: var(--ink-2);
  flex-shrink: 0;
  transition: transform var(--duration-fast);
}
.drawer-user-bar.open .drawer-user-chevron {
  transform: rotate(180deg);
}

/* Popup menu — popover top layer needs fixed positioning */
.drawer-popup-menu {
  position: fixed;
  bottom: 80px;
  left: var(--space-3);
  width: 240px;
  max-width: 80vw;
  top: auto;
  right: auto;
  margin: 0;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-1) 0;
  opacity: 0;
  transform: translateY(8px) scale(0.97);
  pointer-events: none;
  transition: opacity var(--duration-fast) var(--easing-standard),
              transform var(--duration-fast) var(--easing-standard);
  z-index: 10;
}
.drawer-popup-menu.open,
.drawer-popup-menu:popover-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.drawer-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 56px;
  padding: 0 var(--space-4);
  color: var(--ink-1);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  transition: background var(--duration-fast);
  touch-action: manipulation;
}
.drawer-menu-item:hover { background: var(--color-surface-secondary); }
.drawer-menu-item:active { opacity: 0.8; }
.drawer-menu-item svg { color: var(--color-brand); flex-shrink: 0; }
.drawer-menu-divider {
  height: 1px;
  background: var(--color-border-light);
  margin: var(--space-1) var(--space-4);
}
.drawer-menu-logout {
  color: var(--ink-4);
}
.drawer-menu-logout svg { color: var(--ink-4); }

/* Bottom nav bar (dynamic: ≥3 items shown, ≤2 folded into avatar menu) */
.drawer-bottom-nav {
  display: flex;
  border-top: 1px solid var(--color-border-light);
  padding-bottom: var(--safe-bottom);
}
.drawer-bottom-nav:empty { display: none; }
.drawer-bottom-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: var(--space-2) 0;
  min-height: 64px;
  border: none;
  background: none;
  color: var(--color-brand-dark);
  cursor: pointer;
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  touch-action: manipulation;
  transition: color var(--duration-fast);
}
.drawer-bottom-item:active { opacity: 0.7; transform: scale(0.95); }
.drawer-bottom-item:hover { color: var(--color-brand); }
.drawer-bottom-item svg {
  width: 22px;
  height: 22px;
}

.drawer-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--color-surface-secondary);
  color: var(--color-brand-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-family-serif);
  font-size: 17px;
  font-weight: 700;
  flex-shrink: 0;
  position: relative;
}

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

.drawer-avatar::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 9px;
  height: 9px;
  background: #27864A;
  border-radius: 50%;
  border: 2px solid var(--color-surface);
}

.drawer-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.drawer-user-name {
  font-size: var(--font-size-md);
  color: var(--ink-1);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-user-roles {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 1px;
}
