/* 微信风格聊天系统样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

:root {
    /* 微信主题色 */
    --wx-green: #07C160;
    --wx-green-dark: #06AD56;
    --wx-blue: #10AEFF;
    --wx-orange: #FA9D3B;
    --wx-red: #FA5151;
    --wx-yellow: #FFC300;
    
    /* 微信灰度 */
    --wx-black: #000000;
    --wx-dark: #191919;
    --wx-gray-1: #333333;
    --wx-gray-2: #666666;
    --wx-gray-3: #999999;
    --wx-gray-4: #B2B2B2;
    --wx-gray-5: #CCCCCC;
    --wx-gray-6: #E5E5E5;
    --wx-gray-7: #F2F2F2;
    --wx-gray-8: #F7F7F7;
    --wx-white: #FFFFFF;
    
    /* 聊天气泡 */
    --bubble-me: #95EC69;
    --bubble-me-text: #000000;
    --bubble-other: #FFFFFF;
    --bubble-other-text: #000000;
    --bubble-border: #E5E5E5;
    
    /* 尺寸 */
    --header-height: 44px;
    --tabbar-height: 56px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    
    /* 动画 */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.35s ease;
}

html, body {
    height: 100%;
    background: var(--wx-gray-8);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

#app {
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* ========== 页面基础 ========== */
.page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--wx-gray-8);
    display: flex;
    flex-direction: column;
    transform: translateX(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.page.hidden {
    display: none;
}

.page.slide-in {
    animation: slideIn 0.3s ease;
}

.page.slide-out {
    animation: slideOut 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes slideOut {
    from { transform: translateX(0); }
    to { transform: translateX(100%); }
}

/* ========== 微信风格头部导航 ========== */
.app-header {
    height: var(--header-height);
    background: var(--wx-gray-8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    position: relative;
    border-bottom: 0.5px solid var(--wx-gray-6);
    z-index: 100;
}

.app-header h1 {
    font-size: 17px;
    font-weight: 600;
    color: var(--wx-black);
    letter-spacing: -0.3px;
}

.header-btn {
    position: absolute;
    right: 16px;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    font-size: 24px;
    color: var(--wx-black);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 子页面头部 */
.sub-header {
    height: var(--header-height);
    background: var(--wx-gray-8);
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 0.5px solid var(--wx-gray-6);
    position: relative;
}

.back-btn {
    font-size: 17px;
    color: var(--wx-gray-1);
    background: none;
    border: none;
    padding: 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 400;
}

.back-btn::before {
    content: '';
    width: 10px;
    height: 10px;
    border-left: 2px solid var(--wx-gray-1);
    border-bottom: 2px solid var(--wx-gray-1);
    transform: rotate(45deg);
    margin-right: 4px;
}

.sub-header h2 {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 17px;
    font-weight: 600;
    color: var(--wx-black);
}

.save-btn {
    position: absolute;
    right: 16px;
    font-size: 15px;
    color: var(--wx-green);
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
}

/* ========== 登录注册页面 ========== */
.auth-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 40px 40px;
    background: var(--wx-white);
}

.logo {
    text-align: center;
    margin-bottom: 50px;
}

.logo-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--wx-green), var(--wx-green-dark));
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 16px;
    box-shadow: 0 8px 24px rgba(7, 193, 96, 0.3);
}

.logo h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--wx-black);
    letter-spacing: 1px;
}

.auth-tabs {
    display: flex;
    gap: 40px;
    margin-bottom: 40px;
}

.tab-btn {
    padding: 8px 4px;
    border: none;
    background: transparent;
    font-size: 16px;
    color: var(--wx-gray-3);
    cursor: pointer;
    position: relative;
    font-weight: 500;
    transition: color 0.2s;
}

.tab-btn.active {
    color: var(--wx-black);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--wx-green);
    border-radius: 2px;
}

.auth-form {
    width: 100%;
    max-width: 300px;
    display: none;
}

.auth-form.active {
    display: block;
}

.input-group {
    margin-bottom: 20px;
    position: relative;
}

.input-group input {
    width: 100%;
    padding: 16px 0;
    border: none;
    border-bottom: 1px solid var(--wx-gray-6);
    font-size: 16px;
    background: transparent;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-bottom-color: var(--wx-green);
}

.input-group input::placeholder {
    color: var(--wx-gray-4);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--wx-green);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.2s;
}

.btn-primary:active {
    background: var(--wx-green-dark);
    transform: scale(0.98);
}

.btn-primary:disabled {
    background: var(--wx-gray-5);
    cursor: not-allowed;
}

.divider {
    display: flex;
    align-items: center;
    margin: 30px 0;
    color: var(--wx-gray-4);
    font-size: 13px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--wx-gray-6);
}

.divider span {
    padding: 0 16px;
}

.btn-auto-register {
    width: 100%;
    padding: 14px;
    background: var(--wx-white);
    color: var(--wx-green);
    border: 1px solid var(--wx-green);
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-auto-register:active {
    background: rgba(7, 193, 96, 0.05);
}

.auto-reg-hint {
    margin-top: 12px;
    font-size: 12px;
    color: var(--wx-gray-4);
    text-align: center;
}

/* ========== 底部导航栏 ========== */
.tab-bar {
    height: calc(var(--tabbar-height) + var(--safe-bottom));
    background: var(--wx-gray-8);
    border-top: 0.5px solid var(--wx-gray-6);
    display: flex;
    padding-bottom: var(--safe-bottom);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.tab-item .tab-icon {
    font-size: 24px;
    opacity: 0.6;
    transition: all 0.2s;
}

.tab-item .tab-text {
    font-size: 10px;
    color: var(--wx-gray-3);
    transition: all 0.2s;
}

.tab-item.active .tab-icon {
    opacity: 1;
    color: var(--wx-green);
}

.tab-item.active .tab-text {
    color: var(--wx-green);
}

.tab-item .badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 18px);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--wx-red);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--wx-gray-8);
}

/* ========== 页面内容区 ========== */
.app-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    padding-bottom: var(--tabbar-height);
}

.content-page {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    display: none;
    background: var(--wx-gray-8);
}

.content-page.active {
    display: block;
}

/* ========== 聊天列表 ========== */
.chat-list {
    background: var(--wx-white);
    min-height: 100%;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--wx-white);
    border-bottom: 0.5px solid var(--wx-gray-7);
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}

.chat-item:active {
    background: var(--wx-gray-7);
}

.chat-avatar,
.chat-avatar-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    flex-shrink: 0;
    margin-right: 12px;
    object-fit: cover;
}

.chat-avatar-placeholder {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    font-weight: 500;
}

.chat-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--wx-black);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}

.service-tag {
    font-size: 10px;
    color: var(--wx-green);
    border: 0.5px solid var(--wx-green);
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 400;
}

.chat-preview {
    font-size: 14px;
    color: var(--wx-gray-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    margin-left: 8px;
}

.chat-time {
    font-size: 12px;
    color: var(--wx-gray-4);
}

.chat-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--wx-red);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== 聊天页面 ========== */
.chat-header {
    height: var(--header-height);
    background: var(--wx-gray-8);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 0.5px solid var(--wx-gray-6);
    position: relative;
}

.chat-header .back-btn {
    font-size: 17px;
    padding: 8px 0;
}

.chat-header h2 {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 17px;
    font-weight: 600;
    color: var(--wx-black);
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.call-btn {
    font-size: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    background: var(--wx-gray-7);
    -webkit-overflow-scrolling: touch;
}

/* 时间分隔线 */
.time-divider {
    text-align: center;
    margin: 20px 0;
}

.time-divider span {
    font-size: 12px;
    color: var(--wx-white);
    background: var(--wx-gray-4);
    padding: 3px 8px;
    border-radius: 4px;
}

/* 消息气泡 */
.message {
    display: flex;
    margin-bottom: 16px;
    align-items: flex-start;
    animation: messageAppear 0.3s ease;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.me {
    flex-direction: row-reverse;
}

.message-avatar,
.message-avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    flex-shrink: 0;
    object-fit: cover;
}

.message.me .message-avatar,
.message.me .message-avatar-placeholder {
    margin-left: 10px;
}

.message.other .message-avatar,
.message.other .message-avatar-placeholder {
    margin-right: 10px;
}

.message-avatar-placeholder {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 500;
}

.message.me .message-avatar-placeholder {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.message-content {
    max-width: calc(100% - 100px);
    display: flex;
    flex-direction: column;
}

.message.me .message-content {
    align-items: flex-end;
}

.message.other .message-content {
    align-items: flex-start;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 16px;
    line-height: 1.5;
    word-wrap: break-word;
    word-break: break-word;
    position: relative;
    min-height: 36px;
}

.message.other .message-bubble {
    background: var(--bubble-other);
    color: var(--bubble-other-text);
    border: 0.5px solid var(--bubble-border);
    border-top-left-radius: 2px;
}

.message.me .message-bubble {
    background: var(--bubble-me);
    color: var(--bubble-me-text);
    border-top-right-radius: 2px;
}

/* 消息类型样式 */
.message-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 4px;
    cursor: pointer;
    display: block;
}

.message-voice {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 80px;
    cursor: pointer;
}

.message-voice::before {
    content: '🔊';
    font-size: 14px;
}

.message-gif img {
    max-width: 150px;
    max-height: 150px;
    border-radius: 4px;
}

.message-recalled {
    color: var(--wx-gray-4);
    font-size: 14px;
    font-style: italic;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--wx-gray-4);
}

.message-status {
    font-size: 12px;
}

.status-sending {
    color: var(--wx-gray-4);
    animation: pulse 1s infinite;
}

.status-sent {
    color: var(--wx-gray-4);
}

.status-failed {
    color: var(--wx-red);
    cursor: pointer;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* 聊天输入区 */
.chat-input-area {
    background: var(--wx-gray-7);
    border-top: 0.5px solid var(--wx-gray-6);
    padding: 8px 12px;
    padding-bottom: calc(8px + var(--safe-bottom));
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.voice-btn,
.emoji-btn,
.more-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.input-wrapper {
    flex: 1;
    min-height: 36px;
    max-height: 120px;
}

#message-input {
    width: 100%;
    min-height: 36px;
    max-height: 120px;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    background: var(--wx-white);
    font-size: 16px;
    line-height: 1.4;
    resize: none;
    outline: none;
}

.voice-record-btn {
    width: 100%;
    height: 36px;
    background: var(--wx-white);
    border: none;
    border-radius: 4px;
    font-size: 15px;
    color: var(--wx-black);
    cursor: pointer;
    transition: all 0.1s;
}

.voice-record-btn:active,
.voice-record-btn.recording {
    background: var(--wx-gray-6);
}

.send-btn {
    width: 50px;
    height: 32px;
    background: var(--wx-green);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
}

.send-btn:active {
    background: var(--wx-green-dark);
}

/* 更多选项面板 */
.more-options,
.gif-picker {
    background: var(--wx-gray-7);
    border-top: 0.5px solid var(--wx-gray-6);
    padding: 20px;
    padding-bottom: calc(20px + var(--safe-bottom));
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.option-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.option-icon {
    width: 56px;
    height: 56px;
    background: var(--wx-white);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.option-item span:last-child {
    font-size: 12px;
    color: var(--wx-gray-2);
}

.gif-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.gif-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
}

.gif-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 图片预览 */
.image-preview {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* ========== 通讯录 ========== */
.search-bar {
    padding: 8px 16px;
    background: var(--wx-gray-8);
}

.search-bar input {
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    background: var(--wx-white);
    font-size: 15px;
    text-align: center;
    outline: none;
}

.search-bar input::placeholder {
    color: var(--wx-gray-4);
}

.contacts-actions {
    background: var(--wx-white);
    margin-bottom: 8px;
}

.contact-action-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.15s;
}

.contact-action-item:active {
    background: var(--wx-gray-7);
}

.action-icon {
    width: 36px;
    height: 36px;
    background: var(--wx-orange);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 12px;
}

.action-text {
    font-size: 16px;
    color: var(--wx-black);
}

.contacts-list {
    background: var(--wx-white);
}

.contact-group {
    background: var(--wx-gray-8);
}

.contact-group-title {
    padding: 6px 16px;
    font-size: 14px;
    color: var(--wx-gray-3);
    font-weight: 500;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: var(--wx-white);
    cursor: pointer;
    transition: background 0.15s;
}

.contact-item:active {
    background: var(--wx-gray-7);
}

.contact-item img,
.contact-item .contact-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    margin-right: 12px;
    object-fit: cover;
}

.contact-avatar-placeholder {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    font-weight: 500;
}

.contact-name {
    font-size: 16px;
    color: var(--wx-black);
}

/* 字母索引 */
.letter-index {
    position: fixed;
    right: 4px;
    top: 100px;
    bottom: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.letter-index span {
    font-size: 11px;
    color: var(--wx-gray-2);
    padding: 1px 4px;
    cursor: pointer;
}

/* ========== 朋友圈 ========== */
.moments-header {
    position: relative;
    height: 280px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
}

.moments-cover {
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><rect fill="%23667eea" width="100" height="100"/><circle fill="%23764ba2" cx="80" cy="20" r="40"/></svg>');
    background-size: cover;
}

.moments-user {
    position: absolute;
    bottom: -20px;
    right: 16px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.moments-user span {
    font-size: 18px;
    color: white;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    margin-bottom: 30px;
}

.moments-user img {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    border: 2px solid var(--wx-white);
    background: var(--wx-gray-7);
}

.moments-list {
    padding-top: 30px;
    background: var(--wx-white);
    min-height: calc(100% - 260px);
}

.moment-item {
    padding: 16px;
    border-bottom: 0.5px solid var(--wx-gray-7);
}

.moment-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.moment-avatar,
.moment-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    margin-right: 10px;
    object-fit: cover;
}

.moment-avatar-placeholder {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    font-weight: 500;
}

.moment-user {
    font-size: 15px;
    color: #576B95;
    font-weight: 500;
}

.moment-content {
    margin-left: 50px;
}

.moment-text {
    font-size: 15px;
    color: var(--wx-black);
    line-height: 1.5;
    margin-bottom: 10px;
}

.moment-images {
    display: grid;
    gap: 4px;
    margin-bottom: 10px;
}

.moment-images img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 4px;
}

.moment-images.single img {
    max-width: 200px;
    aspect-ratio: auto;
}

.moment-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: 50px;
    padding-top: 8px;
}

.moment-action {
    font-size: 14px;
    color: var(--wx-gray-3);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.moment-action.active {
    color: var(--wx-red);
}

/* 发布朋友圈按钮 */
.fab-btn {
    position: fixed;
    right: 20px;
    bottom: calc(80px + var(--safe-bottom));
    width: 56px;
    height: 56px;
    background: var(--wx-green);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(7, 193, 96, 0.4);
    transition: all 0.2s;
    z-index: 50;
}

.fab-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(7, 193, 96, 0.3);
}

/* 发布朋友圈页面 */
.post-moment-content {
    flex: 1;
    background: var(--wx-white);
    padding: 16px;
}

.post-moment-content textarea {
    width: 100%;
    min-height: 120px;
    border: none;
    font-size: 16px;
    resize: none;
    outline: none;
    margin-bottom: 16px;
}

.post-moment-content textarea::placeholder {
    color: var(--wx-gray-4);
}

.moment-images-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.moment-image-preview {
    aspect-ratio: 1;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.moment-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(0,0,0,0.5);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
}

.add-image-btn {
    aspect-ratio: 1;
    border: 1px dashed var(--wx-gray-5);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--wx-gray-4);
    cursor: pointer;
}

/* ========== 个人中心 ========== */
.profile-header {
    background: var(--wx-white);
    margin-bottom: 10px;
}

.profile-info {
    display: flex;
    align-items: center;
    padding: 20px 16px;
    cursor: pointer;
    transition: background 0.15s;
}

.profile-info:active {
    background: var(--wx-gray-7);
}

.profile-info img,
.profile-avatar-placeholder {
    width: 64px;
    height: 64px;
    border-radius: 6px;
    margin-right: 16px;
    object-fit: cover;
}

.profile-avatar-placeholder {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: 500;
}

.profile-text {
    flex: 1;
}

.profile-text h3 {
    font-size: 18px;
    font-weight: 500;
    color: var(--wx-black);
    margin-bottom: 4px;
}

.profile-text p {
    font-size: 14px;
    color: var(--wx-gray-3);
}

.profile-info .arrow {
    font-size: 20px;
    color: var(--wx-gray-4);
}

.menu-list {
    background: var(--wx-white);
    margin-bottom: 10px;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 0.5px solid var(--wx-gray-7);
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:active {
    background: var(--wx-gray-7);
}

.menu-icon {
    font-size: 22px;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.menu-text {
    flex: 1;
    font-size: 16px;
    color: var(--wx-black);
}

.menu-item .arrow {
    font-size: 18px;
    color: var(--wx-gray-4);
}

/* ========== 编辑资料 ========== */
.edit-profile-content {
    flex: 1;
    background: var(--wx-white);
    padding: 20px 16px;
}

.avatar-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
    cursor: pointer;
}

.avatar-upload img,
.avatar-upload-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    margin-bottom: 10px;
    object-fit: cover;
}

.avatar-upload-placeholder {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    font-weight: 500;
}

.avatar-upload span {
    font-size: 14px;
    color: var(--wx-gray-3);
}

.edit-form {
    border-top: 0.5px solid var(--wx-gray-6);
    padding-top: 20px;
}

.edit-item {
    display: flex;
    align-items: center;
    padding: 14px 0;
    border-bottom: 0.5px solid var(--wx-gray-6);
}

.edit-item label {
    width: 80px;
    font-size: 16px;
    color: var(--wx-black);
}

.edit-item input {
    flex: 1;
    border: none;
    font-size: 16px;
    outline: none;
}

/* ========== 通话界面 ========== */
.call-container {
    flex: 1;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.call-user {
    text-align: center;
    color: white;
}

.call-user img {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    margin-bottom: 20px;
    object-fit: cover;
}

.call-user h2 {
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 10px;
}

.call-user p {
    font-size: 16px;
    opacity: 0.8;
}

#call-timer {
    font-size: 18px;
    margin-top: 10px;
    font-variant-numeric: tabular-nums;
}

.call-actions {
    margin-top: 60px;
}

.call-btn-end {
    width: 72px;
    height: 72px;
    background: var(--wx-red);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 32px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-shadow: 0 4px 16px rgba(250, 81, 81, 0.4);
}

.call-btn-end span {
    font-size: 24px;
}

/* ========== 收藏和通话记录 ========== */
.favorites-list,
.call-history-list {
    flex: 1;
    overflow-y: auto;
    background: var(--wx-white);
}

.favorite-item,
.call-item {
    padding: 14px 16px;
    border-bottom: 0.5px solid var(--wx-gray-7);
    cursor: pointer;
    transition: background 0.15s;
}

.favorite-item:active,
.call-item:active {
    background: var(--wx-gray-7);
}

.favorite-content {
    font-size: 15px;
    color: var(--wx-black);
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.favorite-time,
.call-time {
    font-size: 12px;
    color: var(--wx-gray-4);
}

.call-item {
    display: flex;
    align-items: center;
}

.call-item img {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    margin-right: 12px;
    object-fit: cover;
}

.call-info {
    flex: 1;
}

.call-name {
    font-size: 16px;
    color: var(--wx-black);
    margin-bottom: 4px;
}

.call-detail {
    font-size: 13px;
    color: var(--wx-gray-3);
}

.call-detail.missed {
    color: var(--wx-red);
}

/* ========== 消息菜单 ========== */
.message-menu {
    background: rgba(0,0,0,0.8);
    border-radius: 6px;
    overflow: hidden;
    animation: menuAppear 0.15s ease;
}

@keyframes menuAppear {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.message-menu .menu-item {
    padding: 12px 20px;
    color: white;
    font-size: 15px;
    cursor: pointer;
    border-bottom: 0.5px solid rgba(255,255,255,0.1);
}

.message-menu .menu-item:last-child {
    border-bottom: none;
}

.message-menu .menu-item:active {
    background: rgba(255,255,255,0.1);
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--wx-gray-4);
    font-size: 14px;
    line-height: 1.6;
}

/* ========== 加载和提示 ========== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========== 录音遮罩 ========== */
#recording-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.recording-box {
    background: rgba(0,0,0,0.7);
    padding: 30px 50px;
    border-radius: 12px;
    text-align: center;
}

.recording-icon {
    font-size: 60px;
    margin-bottom: 15px;
}

.recording-text {
    color: white;
    font-size: 14px;
    margin-bottom: 15px;
}

.recording-waves {
    display: flex;
    justify-content: center;
    gap: 4px;
    height: 30px;
    align-items: center;
}

.recording-waves span {
    width: 4px;
    background: var(--wx-green);
    border-radius: 2px;
    animation: wave 0.5s ease-in-out infinite;
}

.recording-waves span:nth-child(1) { height: 10px; animation-delay: 0s; }
.recording-waves span:nth-child(2) { height: 20px; animation-delay: 0.1s; }
.recording-waves span:nth-child(3) { height: 30px; animation-delay: 0.2s; }
.recording-waves span:nth-child(4) { height: 20px; animation-delay: 0.3s; }
.recording-waves span:nth-child(5) { height: 10px; animation-delay: 0.4s; }

@keyframes wave {
    0%, 100% { transform: scaleY(0.5); }
    50% { transform: scaleY(1); }
}

/* ========== 表情包选择器 ========== */
.emoji-picker-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--wx-gray-7);
    border-top: 0.5px solid var(--wx-gray-6);
    height: 300px;
    display: flex;
    flex-direction: column;
    z-index: 100;
    padding-bottom: var(--safe-bottom);
}

.emoji-categories {
    display: flex;
    border-bottom: 0.5px solid var(--wx-gray-6);
    overflow-x: auto;
    padding: 10px;
    gap: 15px;
    background: var(--wx-gray-8);
}

.emoji-category {
    font-size: 24px;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 8px;
    opacity: 0.5;
    transition: all 0.2s;
    flex-shrink: 0;
}

.emoji-category.active {
    opacity: 1;
    background: var(--wx-white);
}

.emoji-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
}

.emoji-item {
    font-size: 28px;
    padding: 8px;
    text-align: center;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s;
}

.emoji-item:active {
    background: var(--wx-gray-6);
}

/* ========== 添加好友弹窗 ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--wx-white);
    border-radius: 12px;
    width: 90%;
    max-width: 350px;
    overflow: hidden;
    animation: scaleIn 0.2s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 0.5px solid var(--wx-gray-6);
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--wx-black);
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--wx-gray-3);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 20px;
}

.modal-body input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--wx-gray-5);
    border-radius: 6px;
    font-size: 15px;
    margin-bottom: 16px;
    outline: none;
}

.modal-body input:focus {
    border-color: var(--wx-green);
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 0.5px solid var(--wx-gray-7);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item img,
.search-result-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    margin-right: 12px;
    object-fit: cover;
}

.search-result-placeholder {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: 500;
}

.search-result-item .info {
    flex: 1;
}

.search-result-item .name {
    font-size: 16px;
    color: var(--wx-black);
    font-weight: 500;
}

.btn-add {
    padding: 6px 16px;
    background: var(--wx-green);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.btn-add:active {
    background: var(--wx-green-dark);
}

/* ========== 通话选项 ========== */
.call-options-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.call-options-content {
    background: var(--wx-white);
    border-radius: 16px;
    padding: 24px;
    width: 280px;
    text-align: center;
}

.call-options-content h3 {
    margin-bottom: 24px;
    font-size: 17px;
    color: var(--wx-black);
}

.call-option {
    display: flex;
    align-items: center;
    padding: 16px;
    margin-bottom: 12px;
    background: var(--wx-gray-8);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.call-option:active {
    background: var(--wx-gray-7);
}

.call-option .icon {
    font-size: 24px;
    margin-right: 12px;
}

.call-option span:last-child {
    font-size: 16px;
    color: var(--wx-black);
}

.btn-cancel {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    border: none;
    background: var(--wx-gray-7);
    border-radius: 10px;
    font-size: 16px;
    color: var(--wx-black);
    cursor: pointer;
}

/* ========== 响应式适配 ========== */
@media (min-width: 768px) {
    #app {
        max-width: 414px;
        margin: 0 auto;
        box-shadow: 0 0 40px rgba(0,0,0,0.1);
    }
    
    .page {
        max-width: 414px;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* ========== 深色模式支持 ========== */
@media (prefers-color-scheme: dark) {
    :root {
        --wx-black: #FFFFFF;
        --wx-dark: #FFFFFF;
        --wx-gray-1: #D1D1D1;
        --wx-gray-2: #A1A1A1;
        --wx-gray-3: #8E8E93;
        --wx-gray-4: #636366;
        --wx-gray-5: #48484A;
        --wx-gray-6: #3A3A3C;
        --wx-gray-7: #2C2C2E;
        --wx-gray-8: #1C1C1E;
        --wx-white: #000000;
        
        --bubble-other: #262628;
        --bubble-other-text: #FFFFFF;
        --bubble-border: #3A3A3C;
    }
}

/* ========== 滚动条美化 ========== */
::-webkit-scrollbar {
    width: 0;
    height: 0;
}

/* ========== 隐藏类 ========== */
.hidden {
    display: none !important;
}
