/* ============================================================
   global.css - 业主当家全站统一样式
   所有尺寸使用 rem 单位，跟随用户字体大小设置
   基准：1rem = 16px（用户可调）
   ============================================================ */

/* ----- 1. 重置 & 基础 ----- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    /* 基准字体大小，用户调整会覆盖这个值 */
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: #333;
    background: #f5f5f5;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ----- 2. 顶部导航栏（通用） ----- */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    background: #1a8c5e;
    color: #fff;
    flex-shrink: 0;
    min-height: 3.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header .title {
    font-size: 1.1rem;
    font-weight: 600;
    flex: 1;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header .title .member-badge {
    font-size: 0.55rem;
    font-weight: normal;
    opacity: 0.85;
    display: inline-block;
    margin-left: 0.3rem;
}

.header .back-btn {
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 0.3rem;
    color: #fff;
    flex-shrink: 0;
}

.header .notify-btn {
    font-size: 1.2rem;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    padding: 0 0.3rem;
}

.header .notify-btn .badge {
    position: absolute;
    top: -0.3rem;
    right: -0.4rem;
    background: #ff4444;
    color: #fff;
    font-size: 0.55rem;
    border-radius: 50%;
    padding: 0.05rem 0.35rem;
    min-width: 1.1rem;
    text-align: center;
    display: none;
}

.header .menu-btn {
    font-size: 1.4rem;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0 0.3rem;
}

/* ----- 3. 底部导航栏（通用） ----- */
.bottom-nav {
    display: flex;
    background: #fff;
    border-top: 1px solid #e8e8e8;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 40;
}

.bottom-nav .tab {
    flex: 1;
    text-align: center;
    padding: 0.35rem 0 0.2rem;
    font-size: 0.65rem;
    color: #999;
    cursor: pointer;
    transition: color 0.2s;
    border: none;
    background: transparent;
}

.bottom-nav .tab .tab-icon {
    font-size: 1.3rem;
    display: block;
    margin-bottom: 0.05rem;
}

.bottom-nav .tab.active {
    color: #1a8c5e;
}

/* ----- 4. 菜单面板（通用） ----- */
.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 100;
}

.menu-overlay.active {
    display: block;
}

.menu-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 80%;
    max-width: 20rem;
    background: #fff;
    padding: 1.2rem 0;
    box-shadow: -0.2rem 0 0.8rem rgba(0, 0, 0, 0.15);
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    color: #333;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

.menu-item:active {
    background: #f0f0f0;
}

.menu-item .icon {
    font-size: 1.2rem;
    margin-right: 0.6rem;
}

.menu-item .arrow {
    margin-left: auto;
    color: #bbb;
    font-size: 1.2rem;
}

/* 字体大小子菜单 */
.font-size-submenu {
    display: none;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding: 0.5rem 0 0.2rem 2rem;
    width: 100%;
}

.font-size-submenu.show {
    display: flex;
}

.font-size-submenu .size-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.2rem 0.6rem;
    border-radius: 0.3rem;
    background: #f5f5f5;
    cursor: pointer;
    width: 45%;
    font-size: 0.85rem;
}

.font-size-submenu .size-item:active {
    background: #e0e0e0;
}

.font-size-submenu .size-item .check {
    color: #1a8c5e;
    display: none;
}

.font-size-submenu .size-item.active .check {
    display: inline;
}

/* ----- 5. 通用组件 ----- */

/* Toast 提示 */
.system-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 0.8rem 1.5rem;
    border-radius: 0.6rem;
    font-size: 1rem;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    max-width: 85%;
    text-align: center;
}

.system-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.system-toast.success {
    background: rgba(26, 140, 94, 0.9);
}

.system-toast.error {
    background: rgba(220, 53, 69, 0.9);
}

.system-toast.warning {
    background: rgba(255, 193, 7, 0.9);
    color: #333;
}

/* 占位页面 */
.placeholder-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #bbb;
    padding: 2rem;
}

.placeholder-page .big-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.placeholder-page h3 {
    font-size: 1.2rem;
    color: #999;
    margin-bottom: 0.5rem;
}

.placeholder-page p {
    font-size: 0.9rem;
}

/* 我的页面 */
.my-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
    background: #f5f5f5;
}

.my-page .avatar-square {
    width: 5rem;
    height: 5rem;
    border-radius: 0.8rem;
    background: #1a8c5e;
    color: #fff;
    font-size: 2.4rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.8rem;
}

.my-page .my-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.my-page .my-role {
    font-size: 0.85rem;
    color: #999;
    margin: 0.2rem 0 1.2rem;
}

.my-page .btn-logout {
    padding: 0.5rem 2rem;
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 2rem;
    font-size: 0.95rem;
    cursor: pointer;
}

.my-page .my-tip {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: #ccc;
}

/* 图片预览遮罩 */
.image-preview-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.image-preview-overlay.active {
    display: flex;
}

.image-preview-overlay img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 0.3rem;
}

/* 消息长按菜单 */
.msg-action-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 150;
    align-items: flex-end;
    justify-content: center;
}

.msg-action-overlay.active {
    display: flex;
}

.msg-action-menu {
    background: #fff;
    border-radius: 0.8rem 0.8rem 0 0;
    padding: 0.5rem 0 1.5rem;
    width: 100%;
    max-width: 30rem;
}

.msg-action-menu .action-item {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}

.msg-action-menu .action-item:active {
    background: #f5f5f5;
}

.msg-action-menu .action-item:last-child {
    border-bottom: none;
    color: #999;
}

/* 投诉弹窗 */
.report-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 160;
    align-items: center;
    justify-content: center;
}

.report-overlay.active {
    display: flex;
}

.report-box {
    background: #fff;
    border-radius: 0.8rem;
    padding: 1.5rem;
    width: 90%;
    max-width: 22rem;
}

.report-box h3 {
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 1rem;
}

.report-box .report-option {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.8rem;
    border-radius: 0.4rem;
    cursor: pointer;
    font-size: 0.95rem;
    border-bottom: 1px solid #f5f5f5;
}

.report-box .report-option:active {
    background: #f0f0f0;
}

.report-box .report-option .icon {
    font-size: 1.2rem;
    margin-right: 0.6rem;
}

.report-box .report-option input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.9rem;
    padding: 0.2rem 0.4rem;
    background: #f5f5f5;
    border-radius: 0.3rem;
    display: none;
}

.report-box .report-option input.show {
    display: inline-block;
}

.report-box .cancel-btn {
    display: block;
    width: 100%;
    padding: 0.6rem;
    margin-top: 0.8rem;
    background: #f0f0f0;
    border: none;
    border-radius: 0.4rem;
    font-size: 0.95rem;
    cursor: pointer;
}

.report-box .cancel-btn:active {
    background: #e0e0e0;
}

/* ----- 6. Tab 页面容器 ----- */
.tab-page {
    display: none;
    flex: 1;
    flex-direction: column;
}

.tab-page.active {
    display: flex;
}

/* ----- 7. 内容区域（flex 撑满） ----- */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ============================================================
   以上为全站通用样式
   以下为 index.php 专用样式（聊天相关）
   ============================================================ */

/* ----- 8. 聊天消息列表 ----- */
#chatView {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.8rem 0.5rem;
}

/* 消息项 */
.chat-messages .message-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}

.chat-messages .message-item.mine {
    flex-direction: row-reverse;
}

.chat-messages .message-item.system {
    justify-content: center;
    opacity: 0.6;
}

/* 头像 */
.chat-messages .message-item .avatar {
    width: 2.8rem;
    height: 2.8rem;
    min-width: 2.8rem;
    min-height: 2.8rem;
    border-radius: 0.4rem;
    background: #1a8c5e;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
    cursor: pointer;
}

.chat-messages .message-item .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 消息主体 */
.chat-messages .message-item .body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.chat-messages .message-item.mine .body {
    align-items: flex-end;
}

/* 用户名 */
.chat-messages .message-item .name-time {
    font-size: 0.75rem;
    font-weight: normal !important;
    color: #999;
    margin-bottom: 0.1rem;
}

.chat-messages .message-item .name-time .muted-tag {
    font-weight: normal;
    color: #dc3545;
    font-size: 0.65rem;
    margin-left: 0.4rem;
}

/* 气泡 */
.chat-messages .message-item .bubble {
    display: inline-block;
    max-width: 80%;
    word-wrap: break-word;
    padding: 0.4rem 0.7rem;
    background: #fff;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    box-shadow: 0 0.05rem 0.2rem rgba(0, 0, 0, 0.06);
}

.chat-messages .message-item.mine .bubble {
    background: #95ec69;
}

/* 消息中的图片 */
.chat-messages .message-item .bubble img {
    border: 0 !important;
    border: none !important;
    border-color: transparent !important;
    outline: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    border-radius: 0.4rem;
    max-width: 100%;
    display: block;
    cursor: pointer;
}

/* 消息中的文件链接 */
.chat-messages .message-item .bubble .file-link {
    border: 0 !important;
    border: none !important;
    border-color: transparent !important;
    text-decoration: none !important;
    outline: none !important;
    color: #1a8c5e;
}

/* 消息时间 */
.chat-messages .message-time {
    font-size: 0.6rem;
    color: #bbb;
    margin-top: 0.15rem;
    text-align: center;
    clear: both;
    display: block;
    width: 100%;
}

.chat-messages .message-time.hidden {
    display: none;
}

/* ----- 9. 聊天输入区域 ----- */
.chat-input {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.6rem;
    padding-bottom: 3.5rem;  /* 为底部导航留空间 */
    background: #f7f7f7;
    border-top: 1px solid #e0e0e0;
    gap: 0.4rem;
    flex-shrink: 0;
    position: relative;
}

.chat-input #msgInput {
    flex: 1;
    min-width: 3rem;
    height: 2.4rem;
    border: 1px solid #ddd;
    border-radius: 1.2rem;
    padding: 0 0.7rem;
    font-size: 0.95rem;
    outline: none;
    background: #fff;
}

.chat-input .btn-emoji {
    width: 2.2rem;
    height: 2.2rem;
    border: none;
    background: transparent;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    color: #333;
}

.chat-input .btn-emoji:active {
    background: rgba(0, 0, 0, 0.08);
}

.chat-input .btn-action {
    width: 2.2rem;
    height: 2.2rem;
    border: none;
    background: transparent;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    color: #333;
}

.chat-input .btn-action:active {
    background: rgba(0, 0, 0, 0.08);
}

/* 发送按钮（绿色） */
.chat-input .btn-action.send-mode {
    background: #1a8c5e !important;
    color: #fff !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    width: 4.5rem !important;
    height: 2.4rem !important;
    border-radius: 2rem !important;
    white-space: nowrap !important;
}

.chat-input .btn-action.send-mode:active {
    background: #147a4f !important;
}

/* 表情面板 */
.emoji-panel {
    display: none;
    position: absolute;
    bottom: 4rem;
    left: 0.3rem;
    right: 0.3rem;
    background: #fff;
    border-radius: 0.6rem;
    box-shadow: 0 -0.1rem 0.6rem rgba(0, 0, 0, 0.12);
    padding: 0.6rem;
    max-height: 16rem;
    overflow-y: auto;
    z-index: 60;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 0.1rem;
    border: 1px solid #e8e8e8;
}

.emoji-panel.show {
    display: flex;
}

.emoji-panel .emoji-item {
    font-size: 1.6rem;
    padding: 0.05rem 0.3rem;
    cursor: pointer;
    border-radius: 0.3rem;
    user-select: none;
    flex-shrink: 0;
}

.emoji-panel .emoji-item:active {
    background: #e8e8e8;
}

/* 更多面板 */
.more-panel {
    display: none;
    position: absolute;
    bottom: 4rem;
    left: 0.3rem;
    right: 0.3rem;
    background: #fff;
    border-radius: 0.6rem;
    box-shadow: 0 -0.1rem 0.6rem rgba(0, 0, 0, 0.12);
    padding: 0.6rem;
    z-index: 55;
    border: 1px solid #e8e8e8;
}

.more-panel.show {
    display: block;
}

.more-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
}

.more-grid .item {
    text-align: center;
    padding: 0.4rem 0;
    font-size: 0.75rem;
    color: #333;
    border-radius: 0.4rem;
    background: #f5f5f5;
    cursor: pointer;
}

.more-grid .item:active {
    background: #e0e0e0;
}

.more-grid .item .icon {
    display: block;
    font-size: 1.4rem;
    margin-bottom: 0.1rem;
}