* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    height: 100%;
    position: relative;
}

/* 简聊主应用 */
.wechat-app {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100%;
    background: #f5f5f5;
    position: relative;
}

/* 顶部导航 */
.app-header {
    background: #2c2c2c;
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.app-header h1 {
    font-size: 20px;
    font-weight: 500;
}

.header-actions {
    display: flex;
    gap: 15px;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.icon-btn:active {
    background: rgba(255,255,255,0.2);
}

/* 内容区域 */
.app-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 0;  /* 确保 flex 子元素可以正确收缩 */
}

.page {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    background: #f5f5f5;
    -webkit-overflow-scrolling: touch;  /* 移动端平滑滚动 */
}

.page.active {
    transform: translateX(0);
}

/* 聊天列表 */
.chat-list, .contact-list {
    background: white;
}

.chat-item, .contact-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-item:active, .contact-item:active {
    background: #f8f8f8;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
    flex-shrink: 0;
}

.chat-info, .contact-info {
    flex: 1;
    min-width: 0;  /* 防止文字溢出 */
}

.chat-name, .contact-name {
    font-weight: 500;
    margin-bottom: 4px;
    font-size: 16px;
}

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

.chat-meta {
    text-align: right;
    flex-shrink: 0;
}

.unread-badge {
    background: #fa5151;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    display: inline-block;
    margin-bottom: 4px;
}

.chat-time {
    font-size: 10px;
    color: #bbb;
}

/* 底部导航栏 - 移动端优化 */
.app-tabbar {
    background: white;
    display: flex;
    border-top: 1px solid #e0e0e0;
    padding: 8px 0 12px;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
    /* 安全区域适配 */
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

.tabbar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: color 0.2s;
}

.tabbar-item:active {
    opacity: 0.7;
}

.tabbar-icon {
    font-size: 24px;
}

.tabbar-label {
    font-size: 11px;
    color: #999;
}

.tabbar-item.active .tabbar-icon,
.tabbar-item.active .tabbar-label {
    color: #07c160;
}

/* 聊天窗口 */
.chat-window {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100%;  /* 使用动态视口高度，解决移动端地址栏问题 */
    background: #f5f5f5;
    position: relative;
    overflow: hidden;
}

.chat-header {
    background: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.back-btn, .menu-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
}

.back-btn:active, .menu-btn:active {
    opacity: 0.6;
}

.chat-title h3 {
    font-size: 17px;
    font-weight: 500;
}

/* 消息区域 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    -webkit-overflow-scrolling: touch;
    /* 重要：确保内容区域可以滚动到底部 */
    min-height: 0;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    display: flex;
    gap: 10px;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.message-content {
    max-width: 70%;
    min-width: 0;
}

.message-name {
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
}

.message-info {
    margin-bottom: 4px;
    font-size: 11px;
    color: #bbb;
}

.message-own .message-info {
    text-align: right;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    word-wrap: break-word;
    position: relative;
}

.message-other .message-bubble {
    background: white;
    color: #333;
}

.message-own .message-bubble {
    background: #95ec69;
    color: #333;
}

.message-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    cursor: pointer;
}

/* 输入区域 */
.chat-input-area {
    background: white;
    border-top: 1px solid #e0e0e0;
    padding: 8px 12px;
    flex-shrink: 0;
    /* 关键：安全区域适配 - 解决 iPhone 底部被遮挡问题 */
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    position: relative;
    z-index: 100;
    background: white;
}
.input-tools {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
}

.tool-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

.tool-btn:active {
    opacity: 0.6;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.input-wrapper textarea {
    flex: 1;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
}

.send-btn {
    padding: 8px 20px;
    background: #07c160;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

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

/* 侧边菜单 - 移动端优化 */
.side-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    visibility: hidden;
}

.side-menu.active {
    visibility: visible;
}

.menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.3s;
}

.side-menu.active .menu-overlay {
    opacity: 1;
}

.menu-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 85%;
    max-width: 320px;
    background: white;
    transform: translateX(100%);
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
}

.side-menu.active .menu-panel {
    transform: translateX(0);
}

.menu-header {
    padding: 20px 16px 12px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.menu-header h3 {
    font-size: 18px;
    font-weight: 500;
    flex: 1;
}

.menu-back-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    color: #07c160;
}

.menu-content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
    -webkit-overflow-scrolling: touch;
}

.menu-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    font-size: 16px;
    background: white;
}

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

.delete-item {
    color: #fa5151;
}

/* 弹窗 - 移动端优化 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    max-height: 80%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-header {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0 8px;
}

.modal-body {
    padding: 20px;
}

/* 个人主页 */
.profile-header {
    background: white;
    padding: 30px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 10px;
}

.profile-avatar img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-info h3 {
    font-size: 18px;
    margin-bottom: 5px;
}

.profile-info p {
    color: #999;
    font-size: 13px;
}

.profile-menu {
    background: white;
}

.arrow {
    color: #ccc;
    font-size: 18px;
}

/* 新建好友按钮 */
.new-friend-btn {
    background: white;
    margin-top: 10px;
    padding: 15px;
    text-align: center;
    color: #07c160;
    cursor: pointer;
    border-top: 1px solid #e0e0e0;
}

.new-friend-btn:active {
    background: #f5f5f5;
}

/* 其他样式 */
.avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.member-select-item {
    padding: 8px 0;
}

.member-select-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.members-list {
    max-height: 300px;
    overflow-y: auto;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.badge {
    background: #07c160;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-left: auto;
}

.btn-danger {
    width: 100%;
    padding: 12px;
    background: #fa5151;
    color: white;
    border: none;
    border-radius: 8px;
    margin-top: 15px;
    cursor: pointer;
}

.btn-danger:active {
    background: #e04545;
}

.info-field {
    margin-bottom: 15px;
}

.info-field label {
    font-weight: 500;
    color: #666;
    display: block;
    margin-bottom: 5px;
}

/* 搜索弹窗样式 */
.search-input-wrapper {
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border-radius: 20px;
    padding: 8px 15px;
    margin-bottom: 15px;
}

.search-icon {
    font-size: 16px;
    margin-right: 10px;
    color: #999;
}

.search-input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    outline: none;
}

.search-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
}

.search-tab {
    flex: 1;
    padding: 8px;
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    color: #666;
    border-radius: 20px;
    transition: all 0.2s;
}

.search-tab:active {
    background: #e0e0e0;
}

.search-tab.active {
    background: #07c160;
    color: white;
}

.search-result-list {
    max-height: 400px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.result-info {
    flex: 1;
}

.result-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.result-username {
    font-size: 12px;
    color: #999;
}

.btn-chat, .btn-add {
    padding: 6px 12px;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    font-size: 12px;
}

.btn-chat {
    background: #07c160;
    color: white;
}

.btn-add {
    background: #f0f0f0;
    color: #07c160;
}

.btn-primary {
    width: 100%;
    padding: 10px;
    background: #07c160;
    color: white;
    border: none;
    border-radius: 8px;
    margin-top: 10px;
    cursor: pointer;
}

.btn-primary:active {
    background: #06ad56;
}

.empty-tip {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 14px;
}

.username {
    font-size: 11px;
    color: #bbb;
}

/* 响应式 - 小屏幕适配 */
@media (max-width: 768px) {
    .message-content {
        max-width: 85%;
    }
    
    .avatar {
        width: 44px;
        height: 44px;
    }
    
    .menu-panel {
        width: 85%;
    }
    
    .profile-header {
        padding: 20px 15px;
    }
    
    .profile-avatar img {
        width: 60px;
        height: 60px;
    }
}

/* 群成员网格 */
.group-members-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    padding: 15px;
    background: white;
    text-align: center;
}

.group-member-item {
    cursor: pointer;
}

.group-member-item:active {
    opacity: 0.7;
}

.group-member-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-bottom: 5px;
    object-fit: cover;
}

.invite-avatar {
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #07c160;
}

.group-member-name {
    font-size: 11px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.view-all-members {
    text-align: center;
    padding: 12px;
    color: #07c160;
    font-size: 14px;
    border-top: 1px solid #f0f0f0;
    background: white;
    cursor: pointer;
}

.view-all-members:active {
    background: #f0f0f0;
}

/* 菜单分割线 */
.menu-divider {
    height: 8px;
    background: #f5f5f5;
}

/* 开关样式 */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #07c160;
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* 遮罩层 */
.menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.menu-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* 好友申请入口 */
.friend-request-entry {
    background: white;
    margin-bottom: 10px;
}

.friend-request-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

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

.request-icon {
    font-size: 28px;
    margin-right: 12px;
}

.request-info {
    flex: 1;
}

.request-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
}

.request-desc {
    font-size: 12px;
    color: #999;
}

.request-badge {
    background: #fa5151;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    margin-right: 8px;
}


/* 红点样式 */
.red-dot {
    position: absolute;
    top: -2px;
    right: -8px;
    width: 8px;
    height: 8px;
    background: #fa5151;
    border-radius: 50%;
    display: none;
}

.tabbar-icon {
    position: relative;
}

/* 好友申请卡片样式 */
.friend-request-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.request-content {
    flex: 1;
}

.request-nickname {
    font-weight: 500;
    margin-bottom: 4px;
}

.request-message {
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
}

.request-buttons {
    display: flex;
    gap: 10px;
}

.btn-accept {
    padding: 6px 16px;
    background: #07c160;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.btn-reject {
    padding: 6px 16px;
    background: #f0f0f0;
    color: #666;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.btn-accept:active, .btn-reject:active {
    opacity: 0.7;
}

/* 通讯录页面样式 */
.contacts-list {
    background: white;
}

.contact-section {
    background: white;
    border-bottom: 1px solid #f0f0f0;
}

.section-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
}

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

.section-icon {
    font-size: 24px;
    width: 40px;
    text-align: center;
    margin-right: 12px;
}

.section-info {
    flex: 1;
}

.section-title {
    font-size: 16px;
    font-weight: 500;
}

.section-desc {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

.contact-section-title {
    padding: 10px 15px;
    background: #f5f5f5;
    color: #999;
    font-size: 13px;
    border-bottom: 1px solid #e0e0e0;
}

/* 好友列表分组 */
.contact-group {
    background: white;
}

.contact-group-title {
    padding: 8px 15px;
    background: #f5f5f5;
    color: #999;
    font-size: 13px;
    font-weight: 500;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}

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

.contact-item .avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
}

.contact-info {
    flex: 1;
}

.contact-name {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 2px;
}

.contact-username {
    font-size: 12px;
    color: #999;
}

/* 请求红点 */
.request-badge {
    background: #fa5151;
    color: white;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 12px;
    margin-right: 8px;
    min-width: 18px;
    text-align: center;
}

/* 搜索框样式 */
.page-contacts .search-bar {
    background: white;
    padding: 8px 12px;
    border-bottom: 1px solid #e0e0e0;
}

.page-contacts .search-bar input {
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    background: #f5f5f5;
}

/* 好友申请弹窗 - 修复遮挡 */
#infoModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000 !important;
}

#infoModal .modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 350px;
    max-height: 70%;
    overflow-y: auto;
    position: relative;
}

#infoModal .modal-header {
    padding: 15px;
    text-align: center;
    font-weight: 500;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

/* 好友申请卡片 */
.friend-request-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.friend-request-card .avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
}

.request-content {
    flex: 1;
}

.request-nickname {
    font-weight: 500;
    font-size: 15px;
    margin-bottom: 4px;
}

.request-message {
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
}

.request-buttons {
    display: flex;
    gap: 10px;
}

.btn-accept {
    padding: 5px 16px;
    background: #07c160;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.btn-reject {
    padding: 5px 16px;
    background: #f0f0f0;
    color: #666;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.btn-accept:active, .btn-reject:active {
    opacity: 0.7;
}

/* 通讯录页面样式 */
.contacts-list {
    background: white;
}

.contact-section {
    background: white;
    border-bottom: 1px solid #f0f0f0;
}

.section-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
}

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

.section-icon {
    font-size: 24px;
    width: 40px;
    text-align: center;
    margin-right: 12px;
}

.section-info {
    flex: 1;
}

.section-title {
    font-size: 16px;
    font-weight: 500;
}

.contact-section-title {
    padding: 10px 15px;
    background: #f5f5f5;
    color: #999;
    font-size: 13px;
    border-bottom: 1px solid #e0e0e0;
}

/* 搜索框样式 */
.page-contacts .search-bar {
    background: white;
    padding: 8px 12px;
    border-bottom: 1px solid #e0e0e0;
}

.page-contacts .search-bar input {
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    background: #f5f5f5;
    outline: none;
}

/* 请求红点 */
.request-badge {
    background: #fa5151;
    color: white;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 12px;
    margin-right: 8px;
    min-width: 18px;
    text-align: center;
}

/* 好友申请弹窗 - 独立弹窗，不会被遮挡 */
#friendRequestModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

#friendRequestModal .modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 350px;
    max-height: 70%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#friendRequestModal .modal-header {
    padding: 15px;
    text-align: center;
    font-weight: 500;
    border-bottom: 1px solid #e0e0e0;
    background: white;
    flex-shrink: 0;
}

#friendRequestModal .modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

/* 好友申请卡片 */
.friend-request-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.friend-request-card .avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.request-content {
    flex: 1;
}

.request-nickname {
    font-weight: 500;
    font-size: 15px;
    margin-bottom: 4px;
}

.request-message {
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
    word-break: break-all;
}

.request-buttons {
    display: flex;
    gap: 10px;
}

.btn-accept {
    padding: 5px 16px;
    background: #07c160;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.btn-reject {
    padding: 5px 16px;
    background: #f0f0f0;
    color: #666;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.btn-accept:active, .btn-reject:active {
    opacity: 0.7;
}

/* 好友列表分组样式 */
.contact-group {
    background: white;
}

.contact-group-title {
    padding: 8px 15px;
    background: #f5f5f5;
    color: #999;
    font-size: 13px;
    font-weight: 500;
}

/* 聊天输入区域 - 移动端适配 */
.chat-input-area {
    background: white;
    border-top: 1px solid #e0e0e0;
    padding: 10px 15px;
    flex-shrink: 0;
    /* 安全区域适配 - 解决 iPhone 底部被遮挡问题 */
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    position: relative;
    z-index: 100;
}

/* 消息区域 - 确保不被输入框遮挡 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 20px;
}

/* 消息气泡区域确保可见 */
.messages {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-bottom: 10px;
}

/* 表情面板位置调整 */
    .emoji-panel {
        position: fixed;
        bottom: calc(80px + env(safe-area-inset-bottom, 0px));
        left: 0;
        right: 0;
        background: white;
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 1000;
        border-top: 1px solid #e0e0e0;
        overflow: hidden;
        max-height: 280px;
    }
    .mention-panel {
        position: fixed;
        bottom: calc(100px + env(safe-area-inset-bottom, 0px));
        left: 10px;
        background: white;
        border-radius: 12px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.15);
        width: 250px;
        max-height: 300px;
        overflow-y: auto;
        z-index: 1001;
        display: none;
    }
    
/* 输入框工具栏 */
.input-tools {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
}

.tool-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
}

/* 输入框区域 */
.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.input-wrapper textarea {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    resize: none;
    font-family: inherit;
    font-size: 16px;
    max-height: 100px;
    line-height: 1.4;
}

.send-btn {
    padding: 8px 20px;
    background: #07c160;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    height: 38px;
}

/* 手机端适配 */
@media (max-width: 768px) {
	    .chat-window {
        height: 100%;  /* 使用动态视口高度 */
    }
    
    .chat-header {
        padding: 10px 12px;
    }
    
    .chat-messages {
        padding: 12px;
    }
    
    .chat-input-area {
        padding: 8px 12px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }
    
    .message-bubble {
        padding: 8px 12px;
        font-size: 15px;
    }
    
    .avatar {
        width: 40px;
        height: 40px;
    }
    
    .tool-btn {
        padding: 6px;
        font-size: 22px;
    }
    
    .input-wrapper textarea {
        font-size: 15px;
        padding: 8px 12px;
    }
    
    .send-btn {
        padding: 6px 16px;
        height: 36px;
    }
}
/* 滚动到底部时自动显示最新消息 */
.chat-messages::-webkit-scrollbar {
    width: 0;
    background: transparent;
}
/* ========== 移动端全局适配 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f5f5f5;
    height: 100vh;
    height: 100%; /* 动态视口高度 */
    overflow: hidden;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
}

/* 聊天主容器 */
.chat-window {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100%;
    background: #f5f5f5;
    overflow: hidden;
}

/* 聊天头部 - 固定 */
.chat-header {
    background: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

/* 消息区域 - 可滚动 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    -webkit-overflow-scrolling: touch;
    min-height: 0;  /* flex 子元素滚动关键 */
}

/* 输入区域 - 底部固定 */
.chat-input-area {
    background: white;
    border-top: 1px solid #e0e0e0;
    padding: 8px 12px;
    flex-shrink: 0;
    /* 安全区域适配 - 解决 iPhone 底部小黑条遮挡 */
    padding-bottom: calc(8px + constant(safe-area-inset-bottom, 0px));
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}

/* 手机端小屏幕 */
@media (max-width: 768px) {
    .chat-header {
        padding: 10px 12px;
    }
    
    .chat-messages {
        padding: 10px;
    }
    
    .chat-input-area {
        padding: 6px 10px;
        padding-bottom: calc(6px + constant(safe-area-inset-bottom, 0px));
        padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    }
    
    .input-wrapper textarea {
        font-size: 15px;
        padding: 8px 12px;
    }
    
    .send-btn {
        padding: 6px 16px;
        height: 38px;
        font-size: 13px;
    }
    
    .tool-btn {
        font-size: 22px;
        padding: 4px;
    }
    
    .message-bubble {
        padding: 8px 12px;
        font-size: 15px;
    }
    
    .avatar {
        width: 38px;
        height: 38px;
    }
}

/* 键盘弹出时保持输入框可见 */
@media (max-height: 500px) {
    .chat-header {
        padding: 6px 12px;
    }
    
    .chat-messages {
        padding: 8px;
    }
    
    .message-bubble {
        padding: 6px 10px;
        font-size: 13px;
    }
}