/*
 * [Whale-LLT]
 * Copyright (C) [2025] [Xuan Jing]
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */
 /* 全局重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background-color: #ededed;
    /* 移除 height: 100vh; 和 overflow: hidden; */
    position: relative;
}

html, body {
    height: 100%; /* 让 html 和 body 占满整个浏览器窗口 */
}

/* 主容器 - 用于页面堆叠和过渡 */
.main-container {
    position: relative;
    height: 100vh;
    padding-bottom: 50px; /* 留出底部导航空间 */
}

/* 页面通用样式 */
.contact-list-page,
.chat-page,
.moments-page,
.profile-page,
.weibo-page,
.data-management-page,
.interactive-page,
.debug-log-page,
.wallet-page,
#offlineModePage {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    /* height: 100%; */  /* 注释掉这一行 */
    bottom: 50px;       /* 新增这一行 */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease-in-out;
    background-color: #f5f5f5; /* 统一背景色 */
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* 允许页面内容滚动 */
    -webkit-overflow-scrolling: touch;
}

/* 当前激活的页面 */
.contact-list-page.active,
.chat-page.active,
.moments-page.active,
.profile-page.active,
.weibo-page.active,
.data-management-page.active,
.interactive-page.active,
.debug-log-page.active,
.wallet-page.active,
#offlineModePage.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 10; /* 确保活动页面在最上层 */
}

/* 聊天页面特定样式（移除旧的过渡） */
.chat-page {
    bottom: 50px; /* 保持在导航栏之上 */
    height: auto; /* 覆盖上面的 height: 100% */
    z-index: 50; /* 聊天页面层级稍高 */
}

/* 联系人列表页面特定样式 */
/* 联系人列表页面特定样式 */
.contact-list-page {
    background-color: #fff;
}

/* 
 * ===============================================
 * 新增：为不同页面设置不同的顶部间距
 * ===============================================
 */

/* 1. 为联系人列表页面设置 60px 间距 (因为它有2个顶栏) */
.contact-list-page {
    padding-top: 60px;
}

/* 2. 为其他主要页面设置 30px 间距 (因为它们只有1个全局顶栏) */
.chat-page,
.moments-page,
.profile-page,
.weibo-page,
.interactive-page,
#offlineModePage {
    padding-top: 30px;
}

.wechat-header {
    background-color: #ededed;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e5e5e5;
}

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

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

.header-icon {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* 联系人项目 */
.contact-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background-color: #fff;
    border-bottom: 0.5px solid #e5e5e5;
    cursor: pointer;
    position: relative;
}

.contact-item:active {
    background-color: #d9d9d9;
}

/* 为置顶的联系人项目设置特殊背景色 */
.contact-item.pinned {
    background-color: #f7f7f7;
}

.contact-avatar {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    margin-right: 12px;
    background-color: #07c160;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
    overflow: hidden;
}

.contact-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.contact-name {
    font-size: 17px;
    color: #000;
    margin-bottom: 4px;
}

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

.contact-time {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 12px;
    color: #b2b2b2;
}

/* 聊天页面 */
.chat-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 50px; /* 保持在导航栏之上 */
    background-color: #ededed;
    display: flex;
    flex-direction: column;
    z-index: 100;
    /* 移除 overflow: hidden; */
}

.chat-page.active {
    /* This is now handled by the global .active class */
}

.chat-header {
    background-color: #ededed;
    padding: 10px 15px; /* 调整了padding-top */
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 0.5px solid #d9d9d9;
    flex-shrink: 0;
    position: relative;
    z-index: 3; /* 提高header层级 */
}

/* 调整聊天页面和相关页面的顶部内边距 */
.chat-header, .moments-header, .weibo-header, .profile-page .chat-header {
     padding-top: 10px;
}

.memory-panel-header {
    padding-top: 10px;
}


.back-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 17px;
    color: #576b95;
    cursor: pointer;
}

.chat-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 17px;
    font-weight: 500;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-more, .memory-btn {
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
}

/* 聊天消息区域 */
.chat-messages {
    flex: 1; /* 核心！这会让消息区占据所有剩余的垂直空间 */
    overflow-y: auto;
    padding: 15px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 1;
}

.message-timestamp {
    text-align: center;
    color: #999;
    font-size: 12px;
    margin: 0 auto 15px;
    padding: 2px 8px;
    background-color: rgba(0,0,0,0.05);
    border-radius: 4px;
    display: inline-block;
    left: 50%;
    position: relative;
    transform: translateX(-50%);
}

.message {
    display: flex;
    margin-bottom: 15px;
    align-items: flex-start;
}

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    margin: 0 10px;
    background-color: #07c160;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-bubble {
    max-width: 70%;
    position: relative;
}

.message-content {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 16px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
}

.message.received .message-content {
    background-color: #fff;
    color: #000;
}

.message.sent .message-content {
    background-color: #95ec69;
    color: #000;
}

.message-content::before {
    content: '';
    position: absolute;
    top: 10px;
    width: 0;
    height: 0;
    border-style: solid;
}

.message.received .message-content::before {
    left: -5px;
    border-width: 6px 6px 6px 0;
    border-color: transparent #fff transparent transparent;
}

.message.sent .message-content::before {
    right: -5px;
    border-width: 6px 0 6px 6px;
    border-color: transparent transparent transparent #95ec69;
}

.message-emoji {
    max-width: 100px;
    max-height: 100px;
    border-radius: 8px;
    display: block;
}

/* 移除原有的固定颜色，并为收到的红包设置默认样式 */
.message.received .message-content.red-packet {
    background-color: #fa9d3b; /* 橙色，表示收到的红包 */
    color: white;
    padding: 0;
    width: 240px;
    border-radius: 8px;
    overflow: hidden;
}

/* 为收到的红包设置小箭头颜色 */
.message.received .message-content.red-packet::before {
    border-color: transparent #fa9d3b transparent transparent;
}

/* 【新增】为自己发出的红包设置新样式 */
.message.sent .message-content.red-packet {
    background-color: #f5b84c; /* 一种稍有区别的橙黄色 */
    color: white;
    padding: 0;
    width: 240px;
    border-radius: 8px;
    overflow: hidden;
}

/* 【新增】为发出的红包设置小箭头颜色 */
.message.sent .message-content.red-packet::before {
    border-color: transparent transparent transparent #f5b84c;
}

/* 【新增】为已打开的红包设置一个"失效"样式 */
.message-content.red-packet.opened {
    /* 使用 !important 确保覆盖原有颜色 */
    background-color: #fbdca7 !important; 
    filter: grayscale(60%); /* 变为灰色调 */
    opacity: 0.8;
}

/* 【新增】为已打开的红包同步更新小箭头的颜色 */
.message.received .message-content.red-packet.opened::before {
    border-color: transparent #fbdca7 transparent transparent !important;
}
.message.sent .message-content.red-packet.opened::before {
    border-color: transparent transparent transparent #fbdca7 !important;
}

.red-packet-body {
    display: flex;
    align-items: center;
    padding: 12px;
}

.red-packet-icon {
    width: 40px;
    height: 40px;
    margin-right: 10px;
}

.red-packet-text {
    flex: 1;
}

.red-packet-text div:first-child {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 2px;
}

.red-packet-text div:last-child {
    font-size: 14px;
}

.red-packet-footer {
    background-color: white;
    color: #999;
    font-size: 12px;
    padding: 4px 12px;
    border-top: 0.5px solid rgba(0,0,0,0.05);
}

/* 输入区域 */
.chat-input-area {
    background-color: #f7f7f7;
    border-top: 0.5px solid #d9d9d9;
    padding: 8px 10px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0; /* 防止输入区域被压缩 */
    position: relative;
    z-index: 2;
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    background-color: #fff;
    font-size: 20px;
}

.action-btn:active {
    background-color: #e5e5e5;
}

.chat-input {
    flex: 1;
    min-height: 36px;
    max-height: 120px;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    background-color: #fff;
    font-size: 16px;
    resize: none;
    outline: none;
}

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

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

.send-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* 记忆表格面板 */
.memory-panel {
    /* 【核心修复1】: 将定位方式从 absolute 改为 fixed */
    /* 这会让面板相对于整个浏览器窗口定位，而不是聊天页面，从而成为一个独立的浮层 */
    position: fixed; 
    
    top: 30px; /* 面板的顶部与主标题栏底部对齐 */
    left: 0;
    right: 0;
    bottom: 0; /* 面板延伸到屏幕底部 */
    background-color: #f7f7f7;

    /* 【核心修复2】: 提高 z-index 的层级 */
    /* 确保它能覆盖在聊天页面(z-index: 100)之上 */
    z-index: 105; 
    
    transform: translateY(100%); /* 默认通过 transform 将其完全移出屏幕下方 */
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: 0; /* 确保没有内边距 */
}

.memory-panel.active {
    transform: translateY(0);
}

.memory-panel-header {
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #ededed;
    border-bottom: 0.5px solid #d9d9d9;
    position: sticky;
    top: 0;
    z-index: 1;
}

.memory-panel-title {
    font-size: 17px;
    font-weight: 500;
}

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

.memory-panel-btn {
    font-size: 16px;
    color: #576b95;
    cursor: pointer;
    background: none;
    border: none;
    padding: 5px;
}

.memory-panel-btn:active {
    color: #07c160;
}

.memory-panel-content {
    padding: 15px;
    background-color: #f7f7f7;
}

.memory-textarea {
    width: 100%;
    height: calc(100vh - 150px);
    border: 1px solid #ddd;
    border-radius: 4px;
    outline: none;
    resize: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    background-color: #fff;
    color: #333;
    padding: 10px;
}

/* --- 简洁现代风格记忆表格 --- */
.memory-table-view {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #333;
    line-height: 1.6;
}

.memory-table-view h1,
.memory-table-view h2,
.memory-table-view h3,
.memory-table-view h4 {
    font-weight: 600;
    color: #111;
    margin-top: 24px;
    margin-bottom: 16px;
}

.memory-table-view h1 { font-size: 1.5em; }
.memory-table-view h2 { font-size: 1.3em; }
.memory-table-view h3 { font-size: 1.1em; }
.memory-table-view h4 { font-size: 1em; }

.memory-table-view p {
    margin-bottom: 16px;
}

.memory-table-view ul {
    padding-left: 20px;
    margin-bottom: 16px;
}

.memory-table-view table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
    background-color: #ffffff;
    border-radius: 8px;
    overflow: hidden; /* 确保圆角生效 */
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.memory-table-view th,
.memory-table-view td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0; /* 水平分割线 */
}

.memory-table-view th {
    background-color: #fafafa;
    font-weight: 600;
    color: #555;
}

.memory-table-view tr:last-child th,
.memory-table-view tr:last-child td {
    border-bottom: none;
}

.memory-table-view hr {
    border: none;
    border-top: 1px solid #e5e5e5;
    margin: 24px 0;
}

/* 底部导航栏 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background-color: #f7f7f7;
    border-top: 0.5px solid #d9d9d9;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 200;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    position: relative;
}

.nav-icon {
    width: 24px;
    height: 24px;
}

.nav-text {
    font-size: 10px;
    color: #999;
}

.nav-item.active .nav-text {
    color: #07c160;
}

/* 朋友圈页面 */
.moments-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 50px;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
    z-index: 120;
}

.moments-page.active {
    /* This is now handled by the global .active class */
}

.moments-header {
    background-color: #ededed;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 0.5px solid #d9d9d9;
    flex-shrink: 0;
}

.moments-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.moments-empty {
    text-align: center;
    padding: 50px 20px;
    color: #999;
}

.moments-empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.moments-empty-text {
    font-size: 16px;
    margin-bottom: 20px;
}

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

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

.moment-item {
    background-color: #fff;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.moment-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.moment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    margin-right: 10px;
    background-color: #07c160;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    overflow: hidden;
}

.moment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.moment-info {
    flex: 1;
}

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

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

.moment-content {
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 10px;
}

.moment-image {
    width: 100%;
    max-width: 300px;
    border-radius: 8px;
    margin-bottom: 10px;
}

/* 发布朋友圈模态框 */
.publish-moment-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    z-index: 2000;
}

.publish-moment-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    border-radius: 12px 12px 0 0;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.publish-moment-header {
    padding: 15px;
    border-bottom: 0.5px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.publish-moment-title {
    font-size: 17px;
    font-weight: 500;
}

.publish-moment-close {
    font-size: 14px;
    color: #576b95;
    cursor: pointer;
}

.publish-moment-body {
    padding: 15px;
}

.generate-moment-section {
    text-align: center;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.generate-moment-btn {
    background-color: #07c160;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 16px;
    cursor: pointer;
    margin-bottom: 10px;
}

.generate-moment-hint {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.moment-preview {
    display: none;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    background-color: #f8f9fa;
}

.moment-preview-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
    color: #333;
}

.moment-preview-content {
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 10px;
}

.moment-preview-image {
    width: 100%;
    max-width: 200px;
    border-radius: 8px;
}

.unsplash-key-section {
    margin-bottom: 20px;
}

.unsplash-key-label {
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
    display: block;
}

.unsplash-key-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    font-size: 16px;
    outline: none;
}

.unsplash-key-input:focus {
    border-color: #07c160;
}

.publish-moment-submit {
    width: 100%;
    padding: 12px;
    background-color: #07c160;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
}

.publish-moment-submit:active {
    background-color: #06a652;
}

.publish-moment-submit:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    z-index: 2000;
}

.modal-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    border-radius: 12px 12px 0 0;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

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

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

.modal-close {
    font-size: 14px;
    color: #576b95;
    cursor: pointer;
}

.modal-body {
    padding: 15px;
}

.modal-footer {
    padding: 15px;
    text-align: right;
    border-top: 1px solid #eee;
}

/* Specific styles for the Update Modal to make it scrollable */
#updateModal .modal-body {
    max-height: 60vh; /* Limit height to 60% of the viewport height */
    overflow-y: auto; /* Enable vertical scrolling */
    padding-right: 20px; /* Add some space for the scrollbar */
}

#updateModal .modal-footer {
    display: none; /* Initially hide the footer */
}

#updateModal .modal-footer.visible {
    display: block; /* Show the footer when it has the 'visible' class */
}

.form-group {
    margin-bottom: 15px;
}

.form-label {
    font-size: 14px;
    color: #000;
    margin-bottom: 8px;
    display: block;
}

.form-input, .form-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    font-size: 16px;
    outline: none;
}

.form-input:focus, .form-textarea:focus {
    border-color: #07c160;
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
}

.api-key-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.api-key-input {
    flex: 1;
}

.timeout-group {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.timeout-label {
    font-size: 12px;
    color: #666;
}

.timeout-input {
    width: 50px;
    padding: 8px 4px;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    text-align: center;
}

.timeout-input:focus {
    border-color: #07c160;
}

.timeout-unit {
    font-size: 12px;
    color: #666;
}

.form-submit {
    width: 100%;
    padding: 12px;
    background-color: #07c160;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
}

.form-submit:active {
    background-color: #06a652;
}

/* 表情面板 */
.emoji-panel {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background-color: #f7f7f7;
    border-top: 0.5px solid #e5e5e5;
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 8px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 10px;
}

.emoji-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.emoji-item:active {
    background-color: #e5e5e5;
}

.emoji-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.emoji-delete-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background-color: rgba(255, 0, 0, 0.8);
    color: white;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
}

.emoji-item:hover .emoji-delete-btn {
    display: flex;
}

.add-emoji-btn {
    grid-column: span 4;
    padding: 10px;
    background-color: #fff;
    border: 1px dashed #07c160;
    border-radius: 8px;
    color: #07c160;
    text-align: center;
    cursor: pointer;
}

/* 设置菜单 */
.settings-menu {
    display: none;
    position: fixed;
    top: 50px; /* 调整位置 */
    right: 10px;
    background-color: #4c4c4c;
    border-radius: 4px;
    padding: 8px 0;
    min-width: 120px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1500;
}

.settings-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #4c4c4c;
}

.menu-item {
    padding: 10px 20px;
    color: white;
    font-size: 14px;
    cursor: pointer;
}

.menu-item:active {
    background-color: #3c3c3c;
}

/* 新增删除选项的样式 */
.menu-item.delete-item {
    color: #ff4444; /* 红色字体 */
}

.menu-item.delete-item:active {
    background-color: #8b0000; /* 深红色背景 */
}

/* 加载动画 */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
    }
    30% {
        opacity: 1;
    }
}

/* Toast提示 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0,0,0,0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 3000;
    display: none;
}

.toast.show {
    display: block;
    animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    10%, 90% { opacity: 1; }
}

/* 顶部提示 */
.top-notification {
    position: fixed;
    top: 20px; /* 调整位置 */
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0,0,0,0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 3000;
    display: none;
}

.top-notification.show {
    display: block;
    animation: slideDown 1.5s ease;
}

@keyframes slideDown {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    20% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    80% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
}

/* 模型列表 */
.model-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    margin-top: 10px;
}

.model-item {
    padding: 12px;
    border-bottom: 0.5px solid #e5e5e5;
    cursor: pointer;
    font-size: 14px;
}

.model-item:last-child {
    border-bottom: none;
}

.model-item:active {
    background-color: #f5f5f5;
}

.model-item.selected {
    background-color: #e8f5e9;
    color: #07c160;
}


.loading-text {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 14px;
}

/* 提示词管理 */
.prompt-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
}

.prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.prompt-title {
    font-size: 14px;
    font-weight: 500;
}

.prompt-actions {
    display: flex;
    gap: 10px;
}

.prompt-btn {
    padding: 5px 10px;
    background-color: #f5f5f5;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.prompt-btn:active {
    background-color: #e5e5e5;
}

.file-input {
    display: none;
}

/* 个人信息页面 */
.profile-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 50px;
    background-color: #f5f5f5;
    z-index: 150;
    overflow-y: auto;
}

.profile-page.active {
    /* This is now handled by the global .active class */
}

.profile-header {
    background-color: #fff;
    padding: 20px 15px; /* 调整内边距 */
    text-align: center;
    border-bottom: 10px solid #f5f5f5;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    margin: 0 auto 15px;
    background-color: #07c160;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    overflow: hidden;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-name {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 5px;
}

.profile-id {
    font-size: 14px;
    color: #999;
}

.profile-section {
    background-color: #fff;
    margin-bottom: 10px;
}

.profile-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 0.5px solid #e5e5e5;
    cursor: pointer;
}

.profile-item:last-child {
    border-bottom: none;
}

.profile-item:active {
    background-color: #f5f5f5;
}

.profile-item-label {
    flex: 1;
    font-size: 16px;
}

.profile-item-value {
    color: #999;
    font-size: 14px;
    margin-right: 5px;
}

.profile-item-arrow {
    color: #c7c7c7;
}

.feature-hint {
    position: absolute;
    bottom: 60px;
    right: 15px;
    background: #07c160;
    color: white;
    padding: 8px 12px;
    border-radius: 18px;
    font-size: 12px;
    z-index: 150;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.context-control {
    background-color: #fff;
    padding: 12px 15px;
    border-radius: 8px;
    margin-top: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: relative;
}

.context-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.context-title {
    font-size: 15px;
    font-weight: 500;
    color: #333;
}

.context-value {
    font-size: 14px;
    color: #07c160;
    font-weight: bold;
    min-width: 40px;
    text-align: right;
}

.context-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    background: #e0e0e0;
    border-radius: 3px;
    outline: none;
    margin-top: 10px;
}

.context-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #07c160;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.context-info {
    font-size: 12px;
    color: #666;
    margin-top: 10px;
    line-height: 1.4;
}

.context-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(7, 193, 96, 0.1);
    color: #07c160;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.music-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
}

.music-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px;
    border-radius: 10px;
    max-height: 80vh;
    overflow-y: auto;
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-btn:hover {
    color: #000;
}

.playlist-container {
    margin: 20px 0;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.song-item {
    padding: 10px;
    margin: 5px 0;
    background: #f0f0f0;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.song-item:hover {
    background: #e0e0e0;
}

.song-item.active {
    background: #07c160;
    color: white;
}

.delete-song {
    color: #ff4444;
    cursor: pointer;
    padding: 0 10px;
}

.player-controls {
    margin: 20px 0;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 5px;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    margin: 10px 0;
    cursor: pointer;
}

.progress-fill {
    height: 100%;
    background: #07c160;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s;
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
}

.floating-lyrics {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 16px;
    z-index: 999;
    transition: all 0.3s ease;
    max-width: 80%;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.debug-info {
    position: fixed;
    top: 20px; /* 调整位置 */
    right: 10px;
    background: rgba(255,255,255,0.9);
    padding: 10px;
    border-radius: 5px;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.group-avatar {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    margin-right: 12px;
    background-color: #4a90e2;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.group-avatar-inner {
    position: absolute;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.group-avatar-item {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    overflow: hidden;
    border: 1px solid white;
    background-color: #07c160;
}

.group-avatar-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.create-group-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
}

.group-member-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    margin-top: 10px;
    padding: 10px;
}

.group-member-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-bottom: 0.5px solid #eee;
    cursor: pointer;
}

.group-member-item:last-child {
    border-bottom: none;
}

.group-member-item.selected {
    background-color: #e6f7ff;
}

.group-member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    margin-right: 10px;
    background-color: #07c160;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    overflow: hidden;
}

.group-member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.group-member-name {
    flex: 1;
    font-size: 14px;
}

.group-member-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
}

.group-member-checkbox.selected {
    background-color: #07c160;
    color: white;
    border-color: #07c160;
}

.group-message-header {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.group-message-name {
    font-size: 12px;
    font-weight: bold;
    color: #576b95;
}

.group-message-time {
    font-size: 10px;
    color: #999;
    margin-left: 8px;
}

.group-info-hint {
    background-color: #f0f0f0;
    color: #666;
    font-size: 12px;
    text-align: center;
    padding: 8px;
    border-radius: 4px;
    margin: 10px 0;
}

.weibo-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 50px;
    background-color: #f7f8fa;
    z-index: 130;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.weibo-page.active {
    /* This is now handled by the global .active class */
}

.weibo-header {
    background-color: #ededed;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 0.5px solid #d9d9d9;
    flex-shrink: 0;
}

.weibo-container {
    max-width: 600px;
    margin: 0 auto;
    background: #f7f8fa;
    min-height: 100%;
    padding-bottom: 50px;
}

.post {
    background: white;
    margin-bottom: 8px;
    padding: 16px;
}

.post-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    position: relative; /* For menu positioning */
}

.post-menu {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    border-radius: 50%;
}

.post-menu:hover {
    background-color: #f0f0f0;
}

.post-menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 10;
    min-width: 80px;
    padding: 4px 0;
}

.post-menu-dropdown .menu-item {
    padding: 8px 12px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
}

.post-menu-dropdown .menu-item:hover {
    background-color: #f5f5f5;
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(45deg, #ff8a80, #ff5722);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    margin-right: 12px;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
}
.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-info {
    flex: 1;
}

.user-name {
    font-size: 16px;
    color: #333;
    font-weight: 500;
    margin-bottom: 4px;
}

.vip-badge {
    display: inline-block;
    background: linear-gradient(45deg, #ffb74d, #ff9800);
    color: white;
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 10px;
    margin-left: 4px;
    vertical-align: middle;
}

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

.post-source {
    font-size: 12px;
    color: #999;
}

.post-content {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 12px;
    color: #333;
    word-wrap: break-word;
}

.hashtag, .mention {
    color: #4a90e2;
    text-decoration: none;
}

.post-image-desc {
    width: 100px;
    height: 100px;
    background: #f0f2f5;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    margin: 12px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #666;
    text-align: center;
    padding: 8px;
    line-height: 1.3;
}

.post-actions {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
    margin-top: 12px;
}

.action-btn-weibo {
    display: flex;
    align-items: center;
    color: #666;
    font-size: 13px;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.action-btn-weibo:hover {
    background-color: #f5f5f5;
}

.action-icon {
    margin-right: 4px;
    font-size: 16px;
}

.comments-section {
    background: #f8f9fa;
    margin: 12px -16px -16px -16px;
    padding: 12px 16px;
}

.comment {
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.comment:last-child {
    margin-bottom: 0;
}

.comment-user {
    color: #4a90e2;
    font-weight: 500;
    margin-right: 4px;
}

.comment-content {
    color: #333;
}

.comment-time {
    color: #999;
    font-size: 12px;
    margin-left: 8px;
}

/* 新增：加载更多消息按钮 */
.load-more-messages {
    text-align: center;
    padding: 10px;
    color: #576b95;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 10px;
}
.load-more-messages:hover {
    text-decoration: underline;
}

/* 确认对话框样式 */
.confirm-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 4000;
}

/* Update Modal Specifics */
#updateModalBody {
    max-height: 60vh; /* Limit height for long content */
    overflow-y: auto;
    padding-bottom: 15px;
}

#updateModalBody h2 {
    font-size: 1.2em;
    margin-top: 1em;
    margin-bottom: 0.5em;
    text-align: center;
}

#updateModalBody h3 {
    font-size: 1.1em;
    margin-top: 1em;
    margin-bottom: 0.5em;
    color: #07c160;
}

#updateModalBody ul {
    padding-left: 20px;
    margin-bottom: 1em;
}

#updateModalBody li {
    margin-bottom: 0.5em;
    line-height: 1.6;
}

.modal-footer {
    padding: 15px;
    border-top: 0.5px solid #e5e5e5;
}

/* 新增：回复框样式 */
.reply-box {
    margin-top: 12px;
    padding-top: 12px;
    padding-bottom: 60px; /* 为底部导航栏留出空间 */
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 8px;
}

.reply-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e1e8ed;
    border-radius: 18px;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}

.reply-input:focus {
    border-color: #4a90e2;
}

.reply-button {
    padding: 8px 16px;
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 18px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.reply-button:hover {
    background-color: #357bd8;
}

.reply-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.confirm-dialog {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 80%;
    max-width: 300px;
    text-align: center;
}

.confirm-dialog-title {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 10px;
}

.confirm-dialog-message {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
}

.confirm-dialog-buttons {
    display: flex;
    justify-content: space-between;
}

.confirm-dialog-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
}

.confirm-dialog-btn.cancel {
    background-color: #f0f0f0;
    color: #333;
    margin-right: 10px;
}

.confirm-dialog-btn.confirm {
    background-color: #ff4444;
    color: white;
}

/* 帖子选择对话框样式 */
.post-choice-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.choice-option {
    padding: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    background-color: #fff;
}

.choice-option:hover {
    border-color: #007aff;
    background-color: #f8f9ff;
}

.choice-option:active {
    transform: scale(0.98);
}

.choice-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.choice-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.choice-description {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

/* 手动发帖表单样式 */
#manualPostModal .form-input {
    width: 100%;
}

#manualPostModal textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

#manualPostAuthor {
    background-color: #f5f5f5;
    color: #666;
}

/* 批量删除消息样式 */
.message-selected {
    background-color: rgba(255, 99, 99, 0.2) !important;
    border-left: 4px solid #ff6b6b !important;
}

.message-selected .message-bubble {
    background-color: rgba(255, 99, 99, 0.15) !important;
}

.multi-select-buttons {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: none;
    justify-content: space-around;
    align-items: center;
    z-index: 1001;
    height: 80px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.multi-select-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    height: 45px;
}

.multi-select-btn.cancel-btn {
    background-color: #6c757d;
    color: white;
}

.multi-select-btn.cancel-btn:hover {
    background-color: #5a6268;
}

.multi-select-btn.delete-btn {
    background-color: #dc3545;
    color: white;
}

.multi-select-btn.delete-btn:hover {
    background-color: #c82333;
}

/* 语音播放器样式 */
.voice-player {
    display: flex;
    align-items: center;
    background-color: #f0f0f0;
    border-radius: 18px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-bottom: 8px;
}
.message.sent .voice-player {
    background-color: #8be061; /* 适配发送气泡的颜色 */
}
.voice-player:hover {
    background-color: #e0e0e0;
}
.message.sent .voice-player:hover {
    background-color: #7dce55;
}

.play-button {
    font-size: 16px;
    width: 20px;
    text-align: center;
    margin-right: 8px;
    color: #555;
}
.message.sent .play-button {
    color: #333;
}

.waveform {
    flex: 1;
    height: 20px;
    display: flex;
    align-items: center;
    gap: 2px;
}
.waveform-bar {
    width: 2px;
    background-color: #aaa;
    border-radius: 1px;
}
.message.sent .waveform-bar {
     background-color: #666;
}
.waveform-bar:nth-child(1) { height: 40%; }
.waveform-bar:nth-child(2) { height: 70%; }
.waveform-bar:nth-child(3) { height: 100%; }
.waveform-bar:nth-child(4) { height: 80%; }
.waveform-bar:nth-child(5) { height: 50%; }
.waveform-bar:nth-child(6) { height: 90%; }
.waveform-bar:nth-child(7) { height: 60%; }
.waveform-bar:nth-child(8) { height: 30%; }
.waveform-bar:nth-child(9) { height: 75%; }

.voice-player.playing .waveform-bar {
    animation: wave 1.2s infinite ease-in-out;
}
@keyframes wave {
    0%, 100% { transform: scaleY(0.4); }
    50% { transform: scaleY(1); }
}
.voice-player.playing .waveform-bar:nth-child(2) { animation-delay: 0.1s; }
.voice-player.playing .waveform-bar:nth-child(3) { animation-delay: 0.2s; }
.voice-player.playing .waveform-bar:nth-child(4) { animation-delay: 0.3s; }
.voice-player.playing .waveform-bar:nth-child(5) { animation-delay: 0.4s; }

.duration {
    font-size: 12px;
    color: #666;
    margin-left: 8px;
    min-width: 35px;
    text-align: right;
}
.message.sent .duration {
    color: #333;
}

/* 如果有播放器，给下面的文本消息增加一点间距 */
.message-content.has-voice-player {
    border-top: 1px solid rgba(0,0,0,0.05);
    padding-top: 8px;
    margin-top: 8px;
}
.message.sent .message-content.has-voice-player {
     border-top: 1px solid rgba(0,0,0,0.1);
}

/* === 调试日志页面样式 === */
.debug-log-page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease-in-out;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.debug-log-page.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 10;
}

.debug-log-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 15px;
    padding-bottom: 70px; /* 给底部导航留出空间 */
}

.debug-log-info {
    margin-bottom: 15px;
}

.debug-log-stats {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.debug-log-hint {
    font-size: 12px;
    color: #999;
    line-height: 1.4;
}

.debug-log-content {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 10px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

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

.debug-log-item {
    margin-bottom: 8px;
    padding: 8px;
    border-radius: 4px;
    border-left: 3px solid #ddd;
    font-size: 13px;
    word-break: break-all;
}

.debug-log-item.debug-log-error {
    background: #fff5f5;
    border-left-color: #e53e3e;
}

.debug-log-item.debug-log-warn {
    background: #fffbf0;
    border-left-color: #dd6b20;
}

.debug-log-item.debug-log-info {
    background: #f0f8ff;
    border-left-color: #3182ce;
}

.debug-log-item.debug-log-log {
    background: #f7fafc;
    border-left-color: #718096;
}

.debug-log-item.debug-log-debug {
    background: #f0fff4;
    border-left-color: #38a169;
}

.debug-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.debug-log-time {
    color: #666;
    font-size: 11px;
}

.debug-log-level {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
}

.debug-log-error .debug-log-level {
    background: #e53e3e;
    color: white;
}

.debug-log-warn .debug-log-level {
    background: #dd6b20;
    color: white;
}

.debug-log-info .debug-log-level {
    background: #3182ce;
    color: white;
}

.debug-log-log .debug-log-level {
    background: #718096;
    color: white;
}

.debug-log-debug .debug-log-level {
    background: #38a169;
    color: white;
}

.debug-log-message {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    line-height: 1.4;
    white-space: pre-wrap;
    color: #333;
}

.header-btn {
    background: #07c160;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 8px;
}

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

.header-actions {
    display: flex;
    align-items: center;
}

/* 当使用自定义气泡时，移除默认的小箭头 */
.message.received .message-bubble.custom-bubble::before {
    content: none !important;
    display: none !important;
}

/* === 钱包页面样式 === */
.wallet-page {
    background-color: #f5f5f5;
}

.wallet-container {
    padding: 15px;
}

.wallet-balance-card {
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    color: white;
    padding: 25px 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 8px 15px rgba(253, 160, 133, 0.4);
}

.wallet-balance-label {
    font-size: 14px;
    opacity: 0.8;
    margin-bottom: 8px;
}

.wallet-balance-amount {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 1px;
}

.transaction-list-title {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin-bottom: 15px;
}

.transaction-list {
    background: white;
    border-radius: 8px;
    padding: 0 15px;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-details {
    display: flex;
    flex-direction: column;
}

.transaction-description {
    font-size: 15px;
    color: #333;
    margin-bottom: 4px;
}

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

.transaction-amount {
    font-size: 16px;
    font-weight: 500;
}

.transaction-amount.income {
    color: #28a745; /* 绿色代表收入 */
}

.transaction-amount.expense {
    color: #dc3545; /* 红色代表支出 */
}

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

/* === 电话通讯界面样式 === */
.phone-call-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5000;
    display: none; /* 默认隐藏 */
    justify-content: center;
    align-items: center;
    color: white;
}

.phone-call-modal.active {
    display: flex; /* 激活时显示 */
}

.call-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.call-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    width: 100%;
    padding: 80px 20px;
    box-sizing: border-box;
}

.contact-info-call {
    text-align: center;
}

.contact-avatar-call {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 20px;
    background-color: #07c160;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 50px;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.5);
}

.contact-avatar-call img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.contact-name-call {
    font-size: 24px;
    font-weight: 500;
}

.call-status {
    font-size: 18px;
    color: #ccc;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    min-width: 120px;
    text-align: center;
}

.call-status.listening {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.call-actions {
    width: 100%;
    display: flex;
    justify-content: center;
}

.end-call-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background-color: #dc3545;
    color: white;
    border: none;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
/* ================================================================= */
/* 新增：新的顶部栏、侧边栏和遮罩层样式 */
/* ================================================================= */

/* 新的顶部栏 - 标题 */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    background-color: #ededed;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border-bottom: 1px solid #e5e5e5;
    z-index: 201; /* 确保在最上层 */
    padding-top: env(safe-area-inset-top); /* 适配刘海屏 */
    padding-left: 15px;
    box-sizing: border-box;
}

.main-header-title {
    font-size: 18px;
    font-weight: 500;
}

/* 新的顶部栏 - 汉堡按钮 */
.secondary-header {
    position: fixed;
    top: 30px; /* 位于主标题栏下方 */
    left: 0;
    right: 0;
    height: 30px;
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 15px;
    z-index: 201;
    padding-top: calc(env(safe-area-inset-top) / 2); /* 适配刘海屏 */
}

.hamburger-button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
}

.hamburger-button:active {
    background-color: #e0e0e0;
}


/* 侧边栏主体 */
.sidebar-menu {
    position: fixed;
    top: 0;
    left: -300px; /* 默认隐藏在左侧屏幕外 */
    width: 280px;
    height: 100%;
    background-color: #ffffff;
    box-shadow: 2px 0 12px rgba(0,0,0,0.1);
    z-index: 1001; /* 比遮罩层更高 */
    transition: left 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}

/* 侧边栏打开时的状态 */
.sidebar-menu.open {
    left: 0;
}

/* 侧边栏头部 */
.sidebar-header {
    padding: 20px 15px;
    padding-top: calc(20px + env(safe-area-inset-top)); /* 适配刘海屏 */
    border-bottom: 1px solid #f0f0f0;
}

.sidebar-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

/* 侧边栏内容区 */
.sidebar-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px 0;
}

/* 侧边栏项目 */
.sidebar-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    font-size: 16px;
    gap: 15px; /* 图标和文字的间距 */
}

.sidebar-item:active {
    background-color: #f5f5f5;
}

.sidebar-item span {
    font-size: 20px;
}

/* 遮罩层 */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    opacity: 0;
    visibility: hidden; /* 使用visibility确保元素不可点击 */
    transition: opacity 0.3s ease-in-out, visibility 0.3s;
}

/* 遮罩层激活时的状态 */
.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ================================================================= */
/* 新增：气泡样式管理器样式 */
/* ================================================================= */

.bubble-manager-actions {
    margin-bottom: 25px;
}

.bubble-manager-list-title {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.bubble-manager-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bubble-manager-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.bubble-manager-item-name {
    font-size: 15px;
    font-weight: 500;
    color: #495057;
}

.bubble-manager-item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bubble-manager-btn {
    padding: 6px 12px;
    font-size: 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: opacity 0.2s;
}

.bubble-manager-btn:hover {
    opacity: 0.8;
}

.bubble-manager-btn.export-btn {
    background-color: #007bff;
    color: white;
}

.bubble-manager-btn.delete-btn {
    background-color: #dc3545;
    color: white;
}

.bubble-manager-empty {
    text-align: center;
    color: #999;
    padding: 30px 15px;
    font-size: 14px;
    line-height: 1.6;
}

/* ================================================================= */
/* 【新增修复】: 修正白色背景模态框中菜单项的样式                */
/* ================================================================= */

/* 为所有在白色modal弹窗里的菜单项设置一个清晰的颜色和样式 */
.modal-content .menu-item {
    color: #007aff; /* 使用一个清晰的蓝色作为操作项的颜色，比黑色更醒目 */
    text-align: center; /* 居中显示，更美观 */
    padding: 15px 20px; /* 增大垂直内边距，让选项之间更宽松 */
    border-bottom: 0.5px solid #f0f0f0; /* 添加一个细微的分割线 */
}

/* 确保最后一个菜单项没有分割线 */
/* === To-Do List Styles === */
.todo-list-container {
    margin-top: 20px;
    max-height: 40vh;
    overflow-y: auto;
}

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

.todo-item:last-child {
    border-bottom: none;
}

.todo-checkbox {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.todo-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.todo-text {
    font-size: 16px;
    color: #333;
}

.todo-item.completed .todo-text {
    text-decoration: line-through;
    color: #999;
}

.todo-due-date {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.todo-reminder {
    font-size: 13px;
    color: #07c160;
    margin-top: 6px;
    padding-left: 10px;
    border-left: 2px solid #a7e7c5;
    font-style: italic;
}

.todo-delete-btn {
    background: none;
    border: none;
    color: #ff4d4d;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
}

.modal-content .menu-item:last-of-type {
    border-bottom: none;
}

/* 确保删除项的红色警告样式依然生效 */
.modal-content .menu-item.delete-item {
    color: #ff4444;
}

/* 当菜单项被点击时的反馈效果 */
.modal-content .menu-item:active {
    background-color: #f5f5f5;
}

/* ==================== VVVVVV 在这里粘贴下面的新代码 VVVVVV ==================== */

/* 免责声明弹窗内容样式 */
#disclaimer-body {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

#disclaimer-body h3 {
    font-size: 16px;
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #f0f0f0;
}

#disclaimer-body p {
    margin-bottom: 12px;
}

#disclaimer-body ol,
#disclaimer-body ul {
    padding-left: 20px;
    margin-bottom: 12px;
}

#disclaimer-body li {
    margin-bottom: 8px;
}

/* 同意按钮禁用时的样式 */
#disclaimerAgreeBtn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* ==================== ^^^^^^ 粘贴到这里结束 ^^^^^^ ==================== */

/* === 世界书功能样式 === */
.memory-panel-header {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    gap: 0;
}

.memory-panel-tabs {
    display: flex;
    border-bottom: 1px solid #d9d9d9;
}

.memory-tab {
    flex: 1;
    padding: 12px 10px;
    background: none;
    border: none;
    font-size: 15px;
    color: #888;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.memory-tab.active {
    color: #07c160;
    border-bottom-color: #07c160;
    font-weight: 500;
}

.memory-panel-actions {
    padding: 5px 15px;
    align-self: flex-end;
}

.world-book-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
    margin-bottom: 15px;
}

.world-book-item {
    background: #fff;
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.world-book-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.world-book-item-keywords {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 4px;
    flex: 1;
    margin-right: 10px;
}

.world-book-item-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    padding: 5px;
    color: #576b95;
}
.world-book-item-actions button.delete {
    color: #e53e3e;
}

.world-book-item-entry {
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    white-space: pre-wrap;
}

.world-book-form {
    padding: 15px;
    border-top: 1px solid #e5e5e5;
    background: #fff;
}

/* ================================================================= */
/* 新增：加载（进场）动画样式 */
/* ================================================================= */

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f5f5f5; /* 与应用背景色一致 */
    /* 必须高于所有其他内容，包括免责声明弹窗(9999) */
    z-index: 10000; 
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    /* 默认可见，我们将用JS在加载完成后将其设为透明 */
    opacity: 1;
    transition: opacity 0.5s ease-out; /* 用于平滑隐藏 */
}

.loading-content {
    text-align: center;
    padding: 20px;
}

.loading-icon {
    font-size: 64px;
    animation: bounce 2s infinite ease-in-out;
}

/* 一个简单的跳动动画 */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

.loading-text {
    font-size: 16px;
    color: #666;
    margin-top: 20px;
    margin-bottom: 15px;
}

.progress-bar-container {
    width: 250px;
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    width: 0%; /* 初始宽度为0 */
    height: 100%;
    background-color: #07c160; /* 使用主题绿色 */
    border-radius: 4px;
    transition: width 0.3s ease-in-out; /* 进度条动画 */
}

/* 隐藏空的消息气泡内容 */
.message-content:empty {
    display: none !important;
}

/* 如果气泡本身因为内容为空而塌陷，也把气泡背景隐藏掉 */
.message-bubble:has(.message-content:empty) {
    display: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* 顶部内联账单样式 */
.usage-stats-inline {
    font-size: 10px;
    color: #bbb; /* 比免责声明的颜色更淡一点，减少干扰 */
    cursor: pointer;
    padding-left: 5px;
    border-left: 1px solid #eee; /* 加一个小竖线分隔 */
    margin-left: 5px;
    white-space: nowrap;
    transition: color 0.2s;
}

.usage-stats-inline:hover {
    color: #888; /* 鼠标悬停稍微变深，提示可点击 */
}