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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f7f7f7;
    color: #333;
    overflow-x: hidden;
    height: 100vh;
}

#app {
    display: flex;
    height: 100vh;
    max-width: 480px;
    margin: 0 auto;
    position: relative;
    background: #fff;
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
}

/* 侧边栏 */
.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 260px;
    height: 100%;
    background: #2e3238;
    color: #fff;
    transition: left 0.3s ease;
    z-index: 1000;
    padding: 0;
}
.sidebar.open { left: 0; }
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 15px;
    background: #07c160;
}
.user-info-mini { display: flex; align-items: center; gap: 10px; }
.avatar-mini { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.sidebar-header .username { font-size: 16px; font-weight: 600; }
.sidebar-header button { background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; }
.sidebar-nav { padding: 15px 0; }
.sidebar-nav a {
    display: block;
    padding: 12px 20px;
    color: #ccc;
    text-decoration: none;
    font-size: 15px;
    transition: 0.2s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-nav a i { margin-right: 12px; width: 20px; text-align: center; }

/* 主界面 */
.main { flex: 1; display: flex; flex-direction: column; height: 100vh; width: 100%; }

/* 顶部栏 */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: #07c160;
    color: #fff;
    min-height: 56px;
    flex-shrink: 0;
}
.topbar h1 { font-size: 18px; font-weight: 600; }
.top-actions { display: flex; gap: 8px; }
.icon-btn { background: none; border: none; color: #fff; font-size: 18px; cursor: pointer; padding: 4px; }
#menuBtn { background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; }

/* 页面容器 */
.page-container { flex: 1; overflow-y: auto; position: relative; }

.page { display: none; padding: 0; height: 100%; }
.page.active { display: block; }

/* 底部导航 */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: #fff;
    border-top: 1px solid #eee;
    padding: 6px 0 8px;
    flex-shrink: 0;
}
.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 11px;
    color: #999;
    cursor: pointer;
    gap: 2px;
}
.nav-item i { font-size: 20px; }
.nav-item.active { color: #07c160; }
.nav-item span { font-size: 10px; }

/* 聊天页面 */
.chat-list { padding: 8px; }
.chat-item {
    display: flex;
    align-items: center;
    padding: 12px 10px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: 0.15s;
}
.chat-item:hover { background: #f5f5f5; }
.chat-item img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; margin-right: 12px; }
.chat-item-info { flex: 1; }
.chat-item-name { font-weight: 500; font-size: 15px; }
.chat-item-preview { font-size: 12px; color: #999; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.chat-item-time { font-size: 11px; color: #bbb; }

.chat-window {
    display: flex;
    flex-direction: column;
    height: calc(100% - 56px);
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f5f5f5;
    z-index: 10;
}
.chat-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: #07c160;
    color: #fff;
}
.chat-header button { background: none; border: none; color: #fff; font-size: 18px; cursor: pointer; margin-right: 12px; }
.chat-header h3 { font-size: 16px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 15px; display: flex; flex-direction: column; gap: 10px; }
.message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
}
.message.sent { align-self: flex-end; background: #95ec69; border-bottom-right-radius: 4px; }
.message.received { align-self: flex-start; background: #fff; border-bottom-left-radius: 4px; }
.message img { max-width: 180px; border-radius: 8px; display: block; }
.message.voice { background: #e8f5e9; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.chat-input-area {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #fff;
    border-top: 1px solid #eee;
    gap: 6px;
}
.chat-input-area button { background: none; border: none; font-size: 20px; color: #666; cursor: pointer; padding: 4px; }
.chat-input-area input { flex: 1; border: none; outline: none; padding: 8px 12px; font-size: 14px; background: #f0f0f0; border-radius: 20px; }
#sendBtn { color: #07c160; }

/* 朋友圈 */
.moments-header { position: relative; height: 180px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); overflow: hidden; }
.moments-bg { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: url('https://images.unsplash.com/photo-1579546929518-9e396f3cc809?w=400') center/cover; opacity: 0.3; }
.moments-profile { position: absolute; bottom: 15px; left: 15px; display: flex; align-items: center; gap: 12px; }
.moments-avatar { width: 60px; height: 60px; border-radius: 50%; border: 3px solid #fff; object-fit: cover; }
.moments-name { color: #fff; font-size: 18px; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.moments-editor { padding: 12px; background: #fff; border-bottom: 1px solid #eee; }
.moments-editor textarea { width: 100%; border: 1px solid #ddd; border-radius: 8px; padding: 8px; resize: none; font-size: 14px; }
.moment-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.moment-actions button { padding: 6px 14px; border: none; border-radius: 20px; cursor: pointer; font-size: 13px; }
#momentSubmit { background: #07c160; color: #fff; }
#momentImageBtn { background: #f0f0f0; color: #333; }
.moments-feed { padding: 10px; }
.moment-item { background: #fff; border-radius: 10px; padding: 12px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.moment-user { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.moment-user img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.moment-user span { font-weight: 500; font-size: 14px; }
.moment-text { font-size: 14px; margin-bottom: 8px; }
.moment-image { width: 100%; max-height: 200px; object-fit: cover; border-radius: 8px; margin-bottom: 8px; }
.moment-time { font-size: 11px; color: #aaa; }
.moment-actions-row { display: flex; gap: 15px; margin-top: 8px; color: #666; font-size: 13px; }
.moment-actions-row i { cursor: pointer; }
.moment-actions-row i:hover { color: #07c160; }

/* 通讯录 */
.contacts-toolbar { display: flex; gap: 8px; padding: 10px; background: #fff; border-bottom: 1px solid #eee; align-items: center; }
.contacts-toolbar input { flex: 1; padding: 8px 12px; border: 1px solid #ddd; border-radius: 20px; font-size: 14px; }
#addContactBtn { background: #07c160; color: #fff; border: none; padding: 8px 14px; border-radius: 20px; cursor: pointer; font-size: 13px; }
.contacts-groups { padding: 8px 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.group-tag { background: #e8f5e9; color: #07c160; padding: 4px 12px; border-radius: 12px; font-size: 12px; cursor: pointer; }
.group-tag.active { background: #07c160; color: #fff; }
.contacts-list { padding: 8px; }
.contact-item { display: flex; align-items: center; padding: 10px; cursor: pointer; border-bottom: 1px solid #f0f0f0; }
.contact-item img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; margin-right: 12px; }
.contact-info { flex: 1; }
.contact-name { font-weight: 500; font-size: 15px; }
.contact-phone { font-size: 12px; color: #999; }
.contact-actions button { background: none; border: none; color: #999; font-size: 16px; cursor: pointer; padding: 4px 8px; }
.contact-actions button:hover { color: #fa5151; }

/* 二维码 */
.qrcode-card { margin: 30px 20px; background: #fff; border-radius: 16px; padding: 30px 20px; text-align: center; box-shadow: 0 4px 20px rgba(0,0,0,0.06); }
.qrcode-header { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 25px; }
.qrcode-avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.qrcode-header h3 { font-size: 18px; }
.qrcode-header p { font-size: 13px; color: #999; }
.qrcode-image { margin: 20px auto; width: 200px; height: 200px; background: #f5f5f5; display: flex; align-items: center; justify-content: center; border-radius: 12px; }
.qrcode-hint { font-size: 13px; color: #999; margin-top: 15px; }

/* 表情包 */
.emoji-toolbar { padding: 10px; background: #fff; border-bottom: 1px solid #eee; }
#addEmojiBtn { background: #07c160; color: #fff; border: none; padding: 8px 16px; border-radius: 20px; cursor: pointer; font-size: 13px; }
.emoji-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 15px; }
.emoji-item { aspect-ratio: 1; background: #f0f0f0; border-radius: 10px; display: flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; border: 2px solid transparent; transition: 0.2s; }
.emoji-item:hover { border-color: #07c160; }
.emoji-item img { width: 100%; height: 100%; object-fit: cover; }
.emoji-item .delete-emoji { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,0.5); color: #fff; border: none; border-radius: 50%; width: 20px; height: 20px; font-size: 10px; cursor: pointer; display: none; }
.emoji-item:hover .delete-emoji { display: block; }

/* 语音通话 */
.call-container { display: flex; flex-direction: column; align-items: center; padding: 40px 20px; }
.call-status { text-align: center; margin-bottom: 30px; }
.call-icon { font-size: 60px; color: #07c160; }
.call-status h3 { font-size: 20px; margin: 10px 0; }
.call-status p { color: #999; font-size: 14px; }
.call-contact-select { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
.call-contact-select select { padding: 8px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; }
#startCallBtn { background: #07c160; color: #fff; border: none; padding: 10px 20px; border-radius: 30px; cursor: pointer; font-size: 15px; }
#endCallBtn { background: #fa5151; color: #fff; border: none; padding: 10px 20px; border-radius: 30px; cursor: pointer; font-size: 15px; }
.call-timer { font-size: 28px; font-weight: 300; color: #333; margin-top: 20px; }

/* 响应式 */
@media (max-width: 480px) {
    #app { max-width: 100%; }
}

/* 滚动条 */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }