/* =========================================================
   77Bot AI 统一头像按钮组件
   ---------------------------------------------------------
   前后台所有页面的头像按钮 / 下拉菜单统一样式集中在此文件。
   依赖 CSS 变量（--bg-active / --bg-panel / --border / --radius
   / --shadow 等），需在 style.css（或 admin.css）之后加载。
   ---------------------------------------------------------
   覆盖范围：
     - 前台公共顶栏头像：.tb-user / .tb-chip / .tb-avatar / .tb-pop
     - 后台顶栏头像：    .admin-tb-user / .admin-tb-chip / .admin-tb-avatar / .admin-tb-pop
     - 聊天页移动端头像：.mb-user / .mb-avatar-btn / .mb-user-pop
     - 聊天页头部头像：  .header-user / .header-avatar-btn / .header-user-pop
     - 个人资料页大头像：.acct-avatar / .pf-avatar-preview
   同一套选择器分组统一视觉，各页面类名保持兼容，改动样式只需维护本文件。
   ========================================================= */

/* ---------- 头像圆形（通用） ---------- */
.tb-avatar,
.admin-tb-avatar,
.mb-avatar-btn .tb-avatar,
.header-avatar-btn .tb-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg-active);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
}
.tb-avatar img,
.admin-tb-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.tb-avatar-lg,
.admin-tb-avatar-lg {
    width: 44px;
    height: 44px;
    font-size: 20px;
}

/* ---------- 顶栏用户胶囊（前台 + 后台） ---------- */
.tb-user,
.admin-tb-user {
    position: relative;
}
.tb-chip,
.admin-tb-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    background: transparent;
    transition: background 0.15s;
    max-width: 160px;
}
.admin-tb-chip { max-width: 180px; }
.tb-chip:hover,
.admin-tb-chip:hover { background: var(--bg-hover); }
.tb-name,
.admin-tb-name {
    font-size: 13px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- 聊天气泡 / 移动端 / 头部 独立头像按钮 ---------- */
.mb-user { position: relative; display: inline-flex; align-items: center; }
.header-user { position: relative; }
.mb-avatar-btn,
.header-avatar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-panel-2);
    border: 1px solid var(--border);
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    color: var(--text);
    box-sizing: border-box;
    flex-shrink: 0;
}
/* 按钮内的头像元素撑满整个圆：避免 30px 头像在 32px 按钮里露出边缘、看起来偏移 */
.mb-avatar-btn > span,
.mb-avatar-btn > .tb-avatar,
.header-avatar-btn > span,
.header-avatar-btn > .tb-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--bg-active);
    font-size: 14px;
    line-height: 1;
}
.mb-avatar-btn > span img,
.mb-avatar-btn > .tb-avatar img,
.header-avatar-btn > span img,
.header-avatar-btn > .tb-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.mb-avatar-btn:hover,
.header-avatar-btn:hover { border-color: var(--accent); }

/* ---------- 用户下拉菜单（统一） ---------- */
.tb-pop,
.admin-tb-pop,
.mb-user-pop,
.header-user-pop {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 230px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    z-index: 300;
}
.mb-user-pop,
.header-user-pop { width: 230px; padding: 0; }

.tb-pop-head,
.admin-tb-pop-head,
.mb-pop-head,
.header-pop-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-bottom: 1px solid var(--border);
}
.tb-pop-id b,
.admin-tb-pop-id b,
.mb-pop-id b,
.header-pop-id b { display: block; font-size: 14px; }
.tb-pop-id small,
.admin-tb-pop-id small,
.mb-pop-id small,
.header-pop-id small { color: var(--text-dim); font-size: 12px; }

.tb-pop-list,
.admin-tb-pop-list,
.mb-pop-list,
.header-pop-list {
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.tb-pop-list a,
.admin-tb-pop-list a,
.mb-pop-list a,
.header-pop-list a,
.mb-user-pop a,
.header-user-pop a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    white-space: nowrap;
}
.tb-pop-list a:hover,
.admin-tb-pop-list a:hover,
.mb-pop-list a:hover,
.header-pop-list a:hover,
.mb-user-pop a:hover,
.header-user-pop a:hover { background: var(--bg-hover); }

.tb-pop-foot,
.admin-tb-pop-foot,
.mb-pop-foot,
.header-pop-foot { border-top: 1px solid var(--border); }
.tb-pop-foot a,
.admin-tb-pop-foot a,
a.tb-danger,
.mb-user-pop a.mb-logout,
.mb-user-pop #mb-logout,
.header-user-pop a.header-logout { color: var(--danger) !important; }

/* ---------- 聊天页侧栏底部用户卡片头像 ---------- */
.user-avatar {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 50%;
    background: var(--bg-active);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 14px;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-avatar .ic { width: 16px; height: 16px; }

/* ---------- 个人资料页头像 ---------- */
.acct-avatar {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--bg-active);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    overflow: hidden;
    flex-shrink: 0;
}
.acct-avatar img { width: 100%; height: 100%; object-fit: cover; }

.pf-avatar-preview {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    overflow: hidden;
    display: none;
    flex-shrink: 0;
}
.pf-avatar-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- 移动端下拉头部容器与头像 ---------- */
.mb-pop-id { min-width: 0; overflow: hidden; }
.mb-pop-id b, .mb-pop-id small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-pop-avatar { display: inline-flex; flex: none; }
.mb-pop-avatar .tb-avatar { width: 34px; height: 34px; font-size: 15px; }
