/* ============================================================
   base.css — 公共基础样式（全端共享）
   结构说明：
   - 本文件：重置、登录页、列表页组件、聊天页组件、弹窗、默认布局
   - pc.css：仅桌面端（≥769px）覆盖
   - mobile.css：仅移动端（≤768px）覆盖
   加载顺序固定：base.css → pc.css → mobile.css（后者可覆盖前者）
   ============================================================ */

/* ========== 1. 公共基础与全局重置 ========== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮蓝框 */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    background-color: #2b2b2b; /* PC 端背景色，突出中间应用卡片 */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    height: 100dvh; /* 适配移动端动态地址栏 */
    overflow: hidden;
}


/* ========== 2. 登录页（login.html） ========== */
body.login-page {
    background: #f3f3f3;
}

.login-card {
    background: #fff;
    padding: 30px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    width: 320px;
    max-width: 90vw;
    text-align: center;
}

.login-card input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    outline: none;
}

.login-card button {
    width: 100%;
    padding: 12px;
    background: #07c160;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
}

/* ========== 2.1 注册 / 忘记密码页（邮箱验证码流程） ========== */
/* 验证码输入 + 获取按钮 一行 */
.verify-code-group {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.verify-code-group input {
    flex: 1;
    width: auto; /* 覆盖 .login-card input 的 width:100%，交由 flex 分配 */
    min-width: 0;
    margin-bottom: 0;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    outline: none;
    letter-spacing: 2px;
}

.verify-code-group button {
    width: auto;
    flex-shrink: 0;
    margin-bottom: 0;
    padding: 0 14px;
    background: #fff;
    color: #07c160;
    border: 1px solid #07c160;
    border-radius: 6px;
    font-size: 14px;
    font-weight: normal;
    cursor: pointer;
    white-space: nowrap;
}

.verify-code-group button:disabled {
    color: #999;
    border-color: #ddd;
    cursor: not-allowed;
}

/* 错误提示行（占位固定高度，避免报错时页面跳动） */
.auth-error {
    color: #ff4d4f;
    font-size: 13px;
    text-align: center;
    min-height: 19px;
    margin-bottom: 8px;
    word-break: break-all;
}

/* 底部"注册 / 忘记密码 / 前往登录"链接 */
.auth-links {
    display: flex;
    justify-content: space-between;
    margin-top: 14px;
    font-size: 13px;
}

.auth-links a {
    color: #07c160;
    text-decoration: none;
}

.auth-links a:active {
    opacity: 0.7;
}


/* ========== 3. 房间列表页（list.html & 左滑抽屉/置顶） ========== */
body.list-page {
    background: #2b2b2b;
}

.container {
    width: 100%;
    max-width: 480px;
    background: #fff;
    height: 92vh;
    max-height: 840px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: row; /* 功能栏(rail) + 列表列 横向排布 */
    overflow: hidden;
    position: relative;
}

.header {
    background: #f5f5f5;
    padding: 12px 15px;
    text-align: center;
    font-weight: bold;
    border-bottom: 1px solid #e7e7e7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.header button {
    padding: 6px 12px;
    background: #07c160;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
}

/* ========== 3.1 最左侧功能栏（微信式 rail，全端显示） ========== */
.app-rail {
    width: 56px;
    flex-shrink: 0;
    background: #f0f0f0;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 0 12px;
    gap: 6px;
}

.rail-avatar {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    background-color: #ddd;
    cursor: pointer;
    margin-bottom: 12px;
}

.rail-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color 0.15s;
}

.rail-btn:hover {
    background: #e2e2e2;
}

.rail-btn.active {
    background: #dcdcdc;
    color: #07c160;
}

.rail-spacer {
    flex: 1;
}

/* 第二列顶部搜索框 */
.list-search {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    outline: none;
    font-size: 14px;
    background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'><circle cx='11' cy='11' r='7' fill='none' stroke='%23999' stroke-width='2'/><line x1='16.5' y1='16.5' x2='21' y2='21' stroke='%23999' stroke-width='2' stroke-linecap='round'/></svg>") 10px center no-repeat;
    text-indent: 18px;
}

/* ========== 3.2 通讯录面板（好友功能收拢于此） ========== */
.contacts-panel {
    background: #fff;
}

.contacts-actions {
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
}

.add-friend-btn {
    width: 100%;
    padding: 11px 0;
    background: #fff;
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
}

.add-friend-btn:hover {
    background: #f2f2f2;
}

/* 列表页可滚动区：好友 / 房间列表 / 好友申请 三个分区统一纵向滚动 */
.list-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.chat-list {
    background: #fff;
}

/* 好友 / 好友申请 分区标题 */
.section-title {
    padding: 6px 15px;
    font-size: 12px;
    color: #999;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
}


/* 列表项外层容器（抽屉舞台） */
.list-item-wrapper {
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid #f0f0f0;
    background-color: #fff;
    user-select: none;
}

/* 置顶会话高亮背景 */
.list-item-wrapper.pinned {
    background-color: #f7f7f7;
}

/* 列表主内容层 */
.list-item-content {
    position: relative;
    z-index: 2;
    display: flex;
    padding: 12px 15px;
    align-items: flex-start; /* 顶对齐：昵称/时间与头像顶部齐平，时间悬在右上角（微信式） */
    background-color: inherit;
    transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1);
    cursor: pointer;
}

/* 左滑展开操作菜单 */
.list-item-wrapper.swiped .list-item-content {
    transform: translateX(-140px);
}


.avatar {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    background: #4a90e2;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    font-weight: bold;
    margin-right: 12px;
    flex-shrink: 0;
}

.info {
    flex: 1;
    overflow: hidden;
}

.room-name {
    font-size: 16px;
    line-height: 1.2;
    margin-top: -2px; /* 视觉修正：抵消行盒半行距，让字形顶部与头像顶边齐平 */
    color: #333;
    margin-bottom: 4px;
}

.last-msg {
    font-size: 13px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.right-action {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    /* 时间钉在条目右上角：不再限高垂直居中（未读红点是绝对定位，不受影响） */
    margin-left: 10px;
}

.time {
    font-size: 12px;
    color: #b2b2b2;
}

/* 右侧抽屉动作按钮区 */
.list-item-actions {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 140px;
    display: flex;
    z-index: 1;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.action-btn:active {
    opacity: 0.8;
}

.action-btn.pin-btn {
    background-color: #2ba245; /* 微信绿 */
}

.action-btn.del-btn {
    background-color: #ff4d4f; /* 警告红 */
}


/* ========== 4. 聊天界面（chat.html） ========== */
body.chat-page {
    background: #2b2b2b;
}

.chat-container {
    width: 100%;
    max-width: 480px;
    height: 92vh;
    max-height: 840px;
    background: #f5f5f5;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chat-header {
    background: #f5f5f5;
    padding: 15px;
    text-align: center;
    font-weight: bold;
    border-bottom: 1px solid #e7e7e7;
    position: relative;
    flex-shrink: 0;
}

.back-btn {
    position: absolute;
    left: 15px;
    top: 15px;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    font-weight: normal;
}

/* list.html 内嵌聊天面板的"返回"按钮（移动端全屏会话时显示） */
.inline-back {
    display: none;
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    color: #333;
    cursor: pointer;
    padding: 4px 6px;
}

.messages-box {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    width: 100%;
}

.message-row.self {
    flex-direction: row-reverse;
}

.message-row.other {
    flex-direction: row;
}

.msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background-color: #ddd;
}

.msg-content {
    display: flex;
    flex-direction: column;
    max-width: 72%;
}

.message-row.self .msg-content {
    align-items: flex-end;
}

.message-row.other .msg-content {
    align-items: flex-start;
}

.bubble {
    /* 单行气泡高度 = 21(1.4×15 行盒) + 14(上下内边距) + 1(边框) = 36px，
       与 36px 的 .msg-avatar 头像顶底齐平（此前 10px 内边距时气泡 41px，比头像高出 5px） */
    padding: 7px 14px;
    font-size: 15px;
    line-height: 1.4;
    word-break: break-all;
    border-radius: 6px;
    position: relative;
}

.message-row.self .bubble {
    background-color: #95ec69;
    color: #000;
    padding-top: 7.5px;    /* 自己的气泡无边框，上下各补 0.5px，与对方气泡同为 36px */
    padding-bottom: 7.5px;
}

.message-row.other .bubble {
    background-color: #ffffff;
    color: #000;
    border: 1px solid #e5e5e5;
}

.bubble img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 4px;
    display: block;
    cursor: pointer;
}

.bubble audio {
    max-width: 200px;
    display: block;
}

/* 图片与语音气泡：去背景、去内边距、去边框 */
.bubble.media-bubble {
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
}

/* 撤回消息：微信样式——隐藏头像与气泡，提示文字整行居中 */
.message-row.recalled-row {
    flex-direction: row;             /* 覆盖 self 的 row-reverse，保证文字居中 */
    justify-content: center;
}

.message-row.recalled-row .msg-avatar {
    display: none;                   /* 不显示头像 */
}

.message-row.recalled-row .msg-content {
    align-items: center;
    max-width: none;
}

.bubble.recalled {
    background: transparent !important;
    border: none !important;
    padding: 4px 0 !important;
    color: #9b9b9b;
    font-size: 13px;
    cursor: default;
}

/* ========== 消息撤回菜单（右键/长按弹出的自定义菜单） ========== */
#msg-context-menu {
    position: fixed;
    z-index: 2500;               /* 高于灯箱(2000)与移动端全屏会话(100) */
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    padding: 4px 0;
    min-width: 96px;
    overflow: hidden;
}

#msg-context-menu .ctx-item {
    padding: 10px 20px;
    font-size: 15px;
    color: #333;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

#msg-context-menu .ctx-item:hover {
    background: #f5f5f5;
}

/* 移动端：长按气泡弹菜单时屏蔽系统文本选中/长按弹出层（桌面端保留可选中复制） */
@media (hover: none) {
    .bubble {
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }
}

/* ========== 微信风格语音气泡：[时长 5″ | 声波图标]，点击播放 ========== */
.voice-bubble {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* 对方语音：图标在左、时长在右（微信样式）；自己的保持 时长在左、图标在右 */
.message-row.other .voice-bubble {
    flex-direction: row-reverse;
}

.voice-time {
    font-size: 15px;
    line-height: 1.4;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.voice-icon {
    width: 21px;
    height: 21px;
    flex-shrink: 0;
}

.voice-icon path {
    fill: currentColor;
}

/* 声波默认半透明，播放时两段声波依次闪烁 */
.voice-icon .w1,
.voice-icon .w2 {
    opacity: 0.3;
}

.voice-bubble.playing .w1 {
    animation: voiceWave 0.9s ease-in-out infinite;
}

.voice-bubble.playing .w2 {
    animation: voiceWave 0.9s ease-in-out 0.45s infinite;
}

@keyframes voiceWave {
    0%, 100% { opacity: 0.3; }
    50%      { opacity: 1; }
}

/* ========== 聊天页：点击图片的页内灯箱预览 ========== */
.img-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;              /* 高于移动端全屏会话(z-index:100)与各弹窗 */
    background: rgba(0, 0, 0, 0.88);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    -webkit-tap-highlight-color: transparent;
}

.img-lightbox.open {
    display: flex;
}

.img-lightbox img {
    max-width: 94vw;
    max-height: 92vh;           /* 移动端小屏也能整图可见 */
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.img-lightbox .lightbox-close {
    position: absolute;
    top: calc(10px + env(safe-area-inset-top)); /* 避让刘海屏 */
    right: 16px;
    font-size: 30px;
    line-height: 1;
    color: #fff;
    opacity: 0.8;
    user-select: none;
}

/* ========== 聊天页：点击头像弹出的用户信息卡片 ========== */
.card-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1100;
}

.user-card {
    background: #ededed;
    border-radius: 10px;
    width: 280px;
    max-width: 85vw;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.user-card-header {
    display: flex;
    gap: 12px;
    padding: 20px 16px;
    background: #fff;
    align-items: center;
}

.user-card-avatar {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    background: #ddd;
    flex-shrink: 0;
}

.user-card-name {
    font-size: 17px;
    font-weight: bold;
    color: #000;
    word-break: break-all;
}

.user-card-account {
    font-size: 13px;
    color: #8a8a8a;
}

.input-area {
    display: flex;
    padding: 10px 12px;
    background: #f7f7f7;
    border-top: 1px solid #eaeaea;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.input-area input[type="text"] {
    flex: 1;
    min-width: 0; /* 关键：允许输入框收缩，否则窄屏（≤360px）会把"发送"按钮挤出屏幕 */
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    outline: none;
    font-size: 15px;
    background: #fff;
}

.tool-btn {
    background: #fff;
    border: 1px solid #ddd;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    flex-shrink: 0;
}

/* 工具按钮位图图标（assets/file.png / voice.png，白底已转透明） */
.tool-btn .tool-icon {
    width: 18px;
    height: 18px;
    display: block;
    pointer-events: none; /* 点击穿透到按钮 */
}

.tool-btn:hover {
    background: #f0f0f0;
}

.tool-btn.recording {
    background: #ff4d4f;
    color: white;
    border-color: #ff4d4f;
}

/* ========== 录音条：录音/预听期间替换输入区（麦克风按钮保留，录音中可再点完成） ========== */
.input-area.recording-active > :not(#record-bar):not(#mic-btn) {
    display: none !important;
}

#record-bar {
    display: none;               /* 录音开始时由 JS 置为 flex */
    flex: 1;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

/* 预听态：波形隐藏，显示播放按钮 */
#record-bar.preview .record-wave {
    display: none;
}

.voice-play-btn {
    display: none;               /* 仅预听态显示 */
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: #07c160;
    color: #fff;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    padding: 0 0 0 2px;          /* 视觉上让 ▶ 居中 */
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#record-bar.preview .voice-play-btn {
    display: inline-flex;
}

.record-btn {
    padding: 10px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    flex-shrink: 0;
}

.record-btn.cancel {
    background: #fff;
    border: 1px solid #ddd;
    color: #333;
}

.record-btn.cancel:hover {
    background: #f0f0f0;
}

.record-btn.send {
    background: #07c160;
    border: none;
    color: #fff;
}

.record-btn.send:hover {
    background: #06ad56;
}

.record-status {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ff4d4f;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
    min-width: 0;
}

.record-wave {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 24px;
    flex-shrink: 0;
}

/* 五根跳动的声波柱 */
.record-wave i {
    width: 3px;
    border-radius: 2px;
    background: #ff4d4f;
    transform-origin: center;
    animation: recWave 0.9s ease-in-out infinite;
}

.record-wave i:nth-child(1) { height: 7px;  animation-delay: 0s;    }
.record-wave i:nth-child(2) { height: 13px; animation-delay: 0.15s; }
.record-wave i:nth-child(3) { height: 19px; animation-delay: 0.3s;  }
.record-wave i:nth-child(4) { height: 13px; animation-delay: 0.45s; }
.record-wave i:nth-child(5) { height: 7px;  animation-delay: 0.6s;  }

@keyframes recWave {
    0%, 100% { transform: scaleY(0.45); opacity: 0.7; }
    50%      { transform: scaleY(1);    opacity: 1; }
}

/* ========== 全局轻提示 toast ========== */
#app-toast {
    position: fixed;
    left: 50%;
    bottom: 18%;
    transform: translateX(-50%) translateY(8px);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 14px;
    padding: 9px 18px;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 3000;               /* 高于灯箱与各弹窗 */
    max-width: 80vw;
}

#app-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.input-area button.send-btn {
    padding: 10px 14px;
    background: #07c160;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
}


/* ========== 5. 个人信息修改弹窗 ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    width: 280px;
    max-width: 85vw;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    text-align: center;
}

.modal-item {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: #666;
}

.modal-item input[type="text"] {
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    outline: none;
}

.modal-item input[disabled] {
    background-color: #f2f2f2;
    color: #777;
    cursor: not-allowed;
    border: 1px solid #ddd;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 15px;
}

.modal-actions button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    background: #07c160;
    color: white;
    cursor: pointer;
}

.modal-actions button.cancel-btn {
    background: #ccc;
}


/* ========== 6. 默认布局与显隐（两端的差异由 pc/mobile 文件覆盖） ========== */

/* 移动端底部 TabBar 默认隐藏，仅移动端开启（见 mobile.css） */
.mobile-tabbar {
    display: none;
}

/* chat.html 左侧会话栏默认隐藏，仅 PC 端开启（见 pc.css） */
.chat-sidebar {
    display: none;
}

.chat-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0; /* 允许消息区在纵向 flex 中收缩，否则会把输入栏挤出屏幕 */
}

/* 列表页右侧详情面板默认隐藏，仅 PC 端开启（见 pc.css） */
.list-right {
    display: none;
}

/* 内嵌聊天面板：纵向三段式（头部 / 消息 / 输入栏），PC 与移动端通用 */
.inline-chat {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.list-left {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

/* 列宽拖拽分隔条：仅 PC 端显示（pc.css ≥769px 启用），移动端隐藏 */
.col-resizer {
    display: none;
}

/* ========== 轻量 toast 提示（好友申请/通过等服务端实时通知） ========== */
.toast {
    position: fixed;
    top: 18%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    max-width: 80%;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ========== Tab 图标（SVG 线性图标，颜色跟随按钮 currentColor：默认灰、激活绿） ========== */
.tab-svg {
    width: 22px;
    height: 22px;
    display: block;
}

/* 退出登录图标（assets/logout.png，白底已转透明）：尺寸与其余 Tab 图标一致 */
.rail-logout {
    width: 22px;
    height: 22px;
    display: block;
    opacity: 0.85; /* 与线性图标灰度接近 */
}

/* ========== Tab 红点（未读消息 / 待处理好友申请） ========== */
.rail-btn,
.tabbar-icon {
    position: relative;
}

.badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #fa5151;
    color: #fff;
    border-radius: 8px;
    font-size: 10px;
    line-height: 16px;
    text-align: center;
    font-weight: bold;
    box-sizing: border-box;
    pointer-events: none;
}

/* ========== 会话条目未读小红点（头像右上角） ========== */
.list-item-content .avatar {
    position: relative;
}

.item-unread {
    position: absolute;
    right: 15px;
    bottom: 10px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #fa5151;
    color: #fff;
    border-radius: 9px;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    font-weight: bold;
    box-sizing: border-box;
}

/* 好友会话头像：好友头像图片（尺寸/圆角复用 .avatar，补充图片细节） */
.avatar-img {
    object-fit: cover;
    background: #ddd;
    flex-shrink: 0;
}

/* 好友头像容器：div 复用 .avatar 尺寸圆角，内嵌 img 填满（便于挂未读红点） */
.avatar-img-wrap {
    padding: 0;
    overflow: hidden;
}

.avatar-img-inner {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ========== 通讯录：微信式分组下拉列表 ========== */
.contact-row {
    display: flex;
    align-items: center;
    padding: 11px 15px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    font-size: 15px;
    color: #333;
    user-select: none;
}

.contact-row:hover {
    background: #f5f5f5;
}

.contact-row .chevron {
    color: #b8b8b8;
    font-size: 13px;
    margin-right: 10px;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.contact-row-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 分组行右侧：数量（灰）/ 待处理红点 */
.row-count {
    color: #999;
    font-size: 13px;
    flex-shrink: 0;
}

.row-badge {
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #fa5151;
    color: #fff;
    border-radius: 8px;
    font-size: 10px;
    line-height: 16px;
    text-align: center;
    font-weight: bold;
    box-sizing: border-box;
    flex-shrink: 0;
}

.contact-row .chevron.open {
    transform: rotate(90deg);
}

/* 分组展开后的内容区 */
.group-section {
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
}

.group-empty {
    padding: 14px 15px 14px 38px;
    font-size: 13px;
    color: #999;
}

/* ========== 联系人（好友）条目：头像 + 昵称同行，两者垂直居中 ==========
   居中做了双路径兜底，两条路径下文字都与头像中线对齐：
   1) 父级 flex（当前 JS 路径）：由 align-items:center 负责垂直居中；
   2) 行内流（旧缓存 JS 未给条目 display:flex 时）：img 与 span 都是行内元素，
      默认按基线对齐，字形会贴到头像底部往下坠；此时靠
      「昵称 inline-block + 高度与头像等高 + vertical-align:middle」与同样设了
      vertical-align:middle 的头像按中线对齐来修正。
   注意：行内布局下 line-height 只改变行盒高度、不改变字形相对基线的位置，
   单锁 line-height 无法把文字提上来（这就是先前只改 line-height 无效的原因）。 */
.friend-item {
    display: flex;
    align-items: center;
    box-sizing: border-box;
    min-height: 50px;              /* 9(上下内边距) + 32(头像) + 1(下边框) */
    padding: 9px 15px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}

.friend-item:active {
    background: #f5f5f5;
}

.friend-item .friend-avatar {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
    background: #ddd;
    flex-shrink: 0;
    vertical-align: middle;        /* 行内布局兜底：与昵称按中线对齐 */
}

.friend-item .friend-name {
    flex: 1;
    min-width: 0;
    height: 32px;                  /* 与头像等高，配合 vertical-align 居中 */
    line-height: 32px;
    display: inline-block;         /* 行内布局下才可设高度；flex 布局下由父级接管 */
    vertical-align: middle;
    margin-left: 0.5em;            /* 距头像半个汉字宽 */
    font-size: 14px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
