/* === 聊天APP 内部样式 === */

/* 布局容器：撑满 APP 窗口 */
.chat-layout-container {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #ededed;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* 修复：移除负边距，因为 global.css 已经去掉了父容器 padding */
    margin: 0;     
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

.moments-fullscreen .app-header {
    display: none;
}

/* 中间舞台：自动伸缩，可滚动 */
.chat-content-stage {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

/* 底部导航栏 - 关键修复：确保它始终显示在底部 */
.chat-bottom-bar {
    height: 55px;
    background: #f7f7f7;
    border-top: 1px solid #dcdcdc;
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-shrink: 0; /* 禁止被压缩 */
    position: relative; /* 确保层级正确 */
    z-index: 10; /* 确保在其他内容之上 */
}

.chat-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #1a1a1a;
    font-size: 10px;
    cursor: pointer;
    padding: 5px;
}

.chat-nav-btn i {
    font-size: 20px;
    margin-bottom: 2px;
}

/* 选中状态变黑 */
.chat-nav-btn.active { 
    color: #1a1a1a; 
}

/* -- 页面内容样式 -- */
.chat-tab-page { 
    padding-bottom: 0;
    height: 100%;
}

/* 消息列表项 */
.chat-list-item {
    display: flex;
    background: #fff;
    padding: 12px 15px; /* 调整左右内边距，使其在手机上更自然 */
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
    cursor: pointer;
}

.chat-list-item:active {
    background: #f5f5f5;
}

.avatar-circle {
    width: 40px; 
    height: 40px;
    background: #07c160;
    border-radius: 6px;
    color: #fff;
    display: flex; 
    justify-content: center; 
    align-items: center;
    margin-right: 15px; /* 增加到15px，让文字离头像更远，更透气 */
    flex-shrink: 0;
}

.chat-text-col { 
    flex: 1;
    min-width: 0; /* 防止文字溢出 */
}

.chat-name { 
    font-weight: bold; 
    font-size: 15px; 
    color: #000; 
}

.chat-preview { 
    font-size: 12px; 
    color: #999; 
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-time { 
    font-size: 10px; 
    color: #b2b2b2;
    flex-shrink: 0;
}

.chat-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    margin-left: 4px;
    padding: 0 4px;
    border-radius: 8px;
    background-color: #f44;
    color: #fff;
    font-size: 10px;
}

/* === 新增：聊天界面时间戳样式 === */
.chat-time-label {
    text-align: center;
    font-size: 12px;
    color: #b2b2b2; /* 浅灰色 */
    margin: 20px 0 10px 0; /* 上下留点空隙 */
    width: 100%;
    clear: both; /* 防止和浮动元素打架 */
}

/* 通讯录 & 更多样式 */
.section-title { 
    padding: 8px 12px; 
    background: #111111; 
    color: #666; 
    font-size: 12px; 
}

.contact-item, .menu-item {
    padding: 12px; 
    background: #fff; 
    border-bottom: 1px solid #f0f0f0; 
    display: flex; 
    align-items: center; 
    gap: 10px;
}

.more-header {
    background: #fff; 
    padding: 30px 20px; 
    display: flex; 
    align-items: center; 
    margin-bottom: 10px;
}

.moment-cover { 
    height: 150px; 
    background: #333; 
    margin-bottom: 20px; 
}

/* ==============================================
   === AI 角色创建器 (终极修复版) ===
   ============================================== */

/* 1. 核心容器：让弹窗浮在最上面，覆盖全屏 */
#ai-creator-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #111;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    color: white;
}

/* 2. 头部：只留标题 */
.creator-header {
    height: 50px;
    background-color: #1f1f1f;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    font-size: 16px;
    font-weight: bold;
}

/* 3. 中间身体：负责滚动 */
.creator-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 40px;
}

/* --- 内部小组件 --- */

/* 头像上传区 */
.avatar-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
    margin-top: 10px;
    cursor: pointer;
}

.avatar-upload-zone img {
    width: 90px; 
    height: 90px;
    border-radius: 50%;
    background: #333;
    object-fit: cover;
    border: 3px solid #444;
}

.avatar-upload-zone p { 
    color: #888; 
    font-size: 12px; 
    margin-top: 10px; 
}

/* 输入框组 */
.input-group { 
    margin-bottom: 25px; 
}

.input-group label {
    display: block;
    color: #888;
    font-size: 13px;
    margin-bottom: 8px;
    margin-left: 5px;
}

.input-group input, 
.input-group textarea, 
.input-group select {
    width: 100%;
    background-color: #2c2c2e;
    border: none;
    border-radius: 12px;
    padding: 15px;
    color: white;
    font-size: 15px;
    box-sizing: border-box; 
    outline: none;
    font-family: inherit;
}

.input-group textarea {
    height: 100px;
    resize: none;
}

/* 选中高亮 */
.input-group input:focus,
.input-group textarea:focus {
    background-color: #3a3a3c;
    box-shadow: 0 0 0 1px #07c160;
}

/* --- 底部双按钮 --- */
.creator-footer-btns {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 20px;
}

.cancel-btn-large, .save-btn-large {
    flex: 1;
    height: 50px;
    border-radius: 12px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.cancel-btn-large { 
    background-color: #333; 
    color: #fff; 
}

.save-btn-large { 
    background-color: #07c160; 
    color: #fff; 
}
/* ==============================================
   === 朋友圈 (Moments) 高保真样式 ===
   === 请粘贴到 weixin.css 的最底部 ===
   ============================================== */

/* 1. 朋友圈容器：白色背景，允许滚动 */
#moments-view {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: #ffffff;
    position: relative;
    padding: 0;
    margin: 0;
}

/* 顶部导航栏：标题 + 相机图标，悬浮在封面上，不再占用高度 */
.moments-navbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: calc(54px + env(safe-area-inset-top, 20px));
    padding-top: calc(10px + env(safe-area-inset-top, 20px));
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: transparent;
    color: #fff;
    z-index: 5;
    font-size: 17px;
    font-weight: 600;
    box-sizing: border-box;
}

.moments-navbar.scrolled {
    background: transparent;
}

.moments-nav-left {
    position: absolute;
    left: 12px;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.moments-nav-left i,
.moments-nav-camera i {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.moments-nav-title {
    text-align: center;
}

.moments-nav-camera {
    position: absolute;
    right: 12px;
    width: 40px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    font-size: 20px;
    cursor: pointer;
}

/* --- 2. 顶部封面区域 --- */
.moments-header {
    position: relative;
    margin-top: 0;
    padding-top: 0;
    margin-bottom: 40px; /* 留出头像的一半高度，让它悬浮 */
    background: transparent;
}

.moments-cover {
    width: 100%;
    height: 320px; /* 封面高度 */
    background-color: #333;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

/* 用户信息悬浮 */
.moments-user-float {
    position: absolute;
    bottom: -24px; /* 稍微再往下，让头像更多悬浮在封面外 */
    right: 12px;
    display: flex;
    align-items: flex-end; /* 底部对齐 */
    gap: 12px;
    z-index: 2;
}

.moments-user-name {
    color: white;
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 8px; /* 把名字稍微抬高一点 */
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.moments-user-avatar {
    width: 68px;
    height: 68px;
    border-radius: 6px; /* 微信风格圆角 */
    object-fit: cover;
    background: #eee;
    border: 2px solid transparent; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: pointer;
}

/* --- 3. 单条动态 (Post) --- */
.moment-post {
    display: flex;
    padding: 15px;
    border-bottom: 1px solid #f2f2f2; /* 极淡的分割线 */
    background: #fff;
}

/* 左侧头像 */
.post-avatar {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    background: #eee;
    margin-right: 10px;
    flex-shrink: 0;
    cursor: pointer;
}
.post-avatar img {
    width: 100%; height: 100%; object-fit: cover; border-radius: 6px;
}

/* 右侧主体 */
.post-content {
    flex: 1;
    min-width: 0; /* 防止溢出 */
}

/* 昵称 (微信蓝) */
.post-nickname {
    color: #576b95;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 6px;
    cursor: pointer;
    line-height: 1.4;
}

/* 正文 */
.post-text {
    font-size: 15px;
    color: #333;
    line-height: 1.5;
    margin-bottom: 10px;
    word-break: break-all;
}

/* --- 4. 九宫格图片布局 (核心) --- */
.post-images-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    max-width: 80%;
    margin-bottom: 10px;
}

.post-images-grid.one-img {
    grid-template-columns: 1fr;
    max-width: 70%;
}

.post-images-grid.two-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.post-images-grid.three-cols {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.post-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background-color: #f0f0f0;
    cursor: zoom-in;
}

.post-images-grid.one-img .post-img {
    aspect-ratio: auto;
    width: 100%;
    height: auto;
    max-height: 320px;
}

/* --- 5. 底部元数据栏 (时间、操作) --- */
.post-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    height: 24px;
    position: relative;
}

.post-meta-left {
    display: flex;
    align-items: center;
}

.post-time {
    font-size: 12px;
    color: #b2b2b2;
}

.post-visibility-flag {
    margin-left: 6px;
    font-size: 12px;
    color: #b2b2b2;
    display: inline-flex;
    align-items: center;
}
.post-visibility-flag i {
    font-size: 12px;
}

.post-delete-btn {
    font-size: 12px;
    color: #576b95;
    margin-left: 10px;
    cursor: pointer;
}

/* 那个“两个点”的操作按钮 */
.post-action-btn {
    width: 32px;
    height: 20px;
    background: #f7f7f7;
    border-radius: 4px;
    color: #576b95;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    font-size: 14px;
    letter-spacing: 1px;
}

/* --- 6. 点赞/评论 弹出菜单 (黑条) --- */
.action-menu {
    position: absolute;
    right: 38px; /* 在按钮左边 */
    top: -6px;
    background: #4c4c4c;
    border-radius: 4px;
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 5px;
    /* 动画初始状态 */
    width: 0;
    overflow: hidden;
    opacity: 0;
    transition: width 0.2s ease-out, opacity 0.2s;
    z-index: 10;
}

.action-menu.show {
    width: 180px; /* 展开宽度 */
    opacity: 1;
}

.menu-item-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.menu-item-btn:first-child {
    border-right: 1px solid #333;
}
.menu-item-btn i {
    margin-right: 4px;
}

/* --- 7. 评论点赞区 (灰色盒子) --- */
.post-comments-area {
    background: #f7f7f7;
    margin-top: 8px;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
    position: relative;
    display: none; /* 默认隐藏，有内容才显示 */
}
/* 必须有内容才显示 */
.post-comments-area.has-content {
    display: block;
}

/* 小三角箭头 */
.post-comments-area::before {
    content: "";
    position: absolute;
    top: -6px;
    left: 12px;
    width: 0; 
    height: 0; 
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #f7f7f7;
}

.like-list {
    color: #576b95;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 1px solid #ededed;
    padding-bottom: 4px;
    margin-bottom: 4px;
    line-height: 1.4;
}
.like-list i {
    font-size: 12px;
    margin-right: 4px;
    color: #576b95;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.comment-row {
    color: #333;
    line-height: 1.4;
    font-size: 13px;
}
.comment-user {
    color: #576b95;
    font-weight: 500;
    cursor: pointer;
}

/* 底部输入框 (模拟) */
#moments-input-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(56px + var(--safe-bottom-compact, env(safe-area-inset-bottom, 0px)));
    background: rgba(247, 247, 247, 0.98);
    padding: 10px 12px;
    box-sizing: border-box;
    display: none;
    align-items: center;
    gap: 10px;
    border-top: 1px solid #dcdcdc;
    z-index: 10001;
}
#moments-input-bar input {
    flex: 1;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0 10px;
    font-size: 14px;
    box-sizing: border-box;
}
#moments-input-bar button {
    height: 36px;
    padding: 0 14px;
    border: none;
    border-radius: 8px;
    background: #07c160;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.comment-row {
    cursor: pointer;
}

/* 补充：防止头像图片变形（仅聊天头像占满容器，不影响朋友圈头像尺寸） */
.post-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.moments-publish-modal {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background-color: #ffffff;
    display: none;
    flex-direction: column;
    z-index: 9999;
}

.moments-publish-nav {
    height: calc(44px + env(safe-area-inset-top, 0px));
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: env(safe-area-inset-top, 0px) 12px 0 12px;
    border-bottom: 1px solid #e5e5e5;
    font-size: 16px;
    box-sizing: border-box;
}

.moments-publish-cancel {
    border: none;
    background: none;
    color: #576b95;
    font-size: 16px;
    padding: 4px 8px;
}

.moments-publish-title {
    flex: 1;
    text-align: center;
    font-size: 16px;
}

.moments-publish-submit {
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 15px;
    background-color: #07c160;
    color: #ffffff;
}

.moments-publish-submit.disabled {
    background-color: #c7c7c7;
    color: #f5f5f5;
}

.moments-publish-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    overflow-y: auto;
}

.moments-publish-text {
    width: 100%;
    min-height: 90px;
    max-height: 200px;
    border: none;
    resize: none;
    font-size: 16px;
    outline: none;
    margin-bottom: 10px;
}

.moments-publish-images {
    margin-bottom: 15px;
}

.moments-publish-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.publish-img-item {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    overflow: hidden;
    border-radius: 6px;
    background-color: #f0f0f0;
}

.publish-img-item img {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.publish-img-remove {
    position: absolute;
    right: 4px;
    top: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.publish-img-add {
    width: 100%;
    padding-bottom: 0;
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    border: 1px dashed #d0d0d0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    line-height: 1;
    color: #c0c0c0;
}

.moments-publish-options {
    margin-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.publish-option-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 15px;
}

.option-icon {
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #8e8e93;
}

.option-text {
    flex: 1;
}

.option-extra {
    margin-right: 6px;
    font-size: 13px;
    color: #8e8e93;
    max-width: 50%;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.option-arrow {
    color: #c7c7c7;
}

.moments-visibility-sheet {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 20001;
}

.moments-visibility-mask {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
}

.moments-visibility-panel {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: #f7f7f7;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    padding-bottom: var(--safe-bottom-compact, env(safe-area-inset-bottom));
}

.moments-visibility-option {
    background: #ffffff;
    padding: 14px 16px;
    text-align: center;
    font-size: 16px;
    color: #000;
    border-bottom: 1px solid #f0f0f0;
}

.moments-visibility-option:active {
    background: #e5e5e5;
}

.moments-visibility-cancel {
    margin-top: 8px;
    background: #ffffff;
    padding: 14px 16px;
    text-align: center;
    font-size: 16px;
    color: #007aff;
}

.moments-visibility-cancel:active {
    background: #e5e5e5;
}
