* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: #f5f5f5; overflow: hidden; }
.hidden { display: none !important; }
.page { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* ===== 登录页 ===== */
.auth-page { background: linear-gradient(135deg, #12B7F5, #0a8fd4); align-items: center; justify-content: center; }
.auth-box { background: #fff; border-radius: 16px; padding: 32px 28px; width: 88%; max-width: 360px; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.auth-box h1 { text-align: center; font-size: 28px; color: #333; margin-bottom: 20px; }
.tabs { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 2px solid #eee; }
.tab { flex: 1; padding: 12px; border: none; background: none; font-size: 16px; color: #999; cursor: pointer; }
.tab.active { color: #12B7F5; border-bottom: 2px solid #12B7F5; margin-bottom: -2px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form input { padding: 12px 14px; border: 1px solid #ddd; border-radius: 8px; font-size: 15px; outline: none; }
.form input:focus { border-color: #12B7F5; }
.form button { padding: 12px; background: #12B7F5; color: #fff; border: none; border-radius: 8px; font-size: 16px; cursor: pointer; }
.form button:active { background: #0ea0db; }

/* ===== 主界面 ===== */
.topbar { height: 52px; background: #12B7F5; color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; }
.topbar-title { font-size: 18px; font-weight: 600; }
.topbar-actions { display: flex; gap: 12px; }
.icon-btn { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; padding: 4px 8px; }
.sub-tabs { display: flex; background: #fff; border-bottom: 1px solid #eee; }
.sub-tab { flex: 1; padding: 12px; border: none; background: none; font-size: 15px; color: #666; cursor: pointer; }
.sub-tab.active { color: #12B7F5; border-bottom: 2px solid #12B7F5; }
.view { flex: 1; overflow-y: auto; }
.user-list { background: #fff; }
.user-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #f0f0f0; cursor: pointer; }
.user-item:active { background: #f5f5f5; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: #12B7F5; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 600; flex-shrink: 0; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 15px; color: #333; }
.user-status { font-size: 12px; color: #999; }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: #34C759; }
.accept-btn { padding: 6px 14px; background: #12B7F5; color: #fff; border: none; border-radius: 6px; font-size: 13px; cursor: pointer; }

/* ===== 聊天界面 ===== */
.chat-topbar { height: 52px; background: #12B7F5; color: #fff; display: flex; align-items: center; padding: 0 12px; gap: 8px; }
.back-btn { background: none; border: none; color: #fff; font-size: 28px; cursor: pointer; padding: 0 8px; }
.chat-name { flex: 1; font-size: 16px; font-weight: 600; }
.messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: #f0f0f0; }
.msg-row { display: flex; gap: 8px; max-width: 80%; }
.msg-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-bubble { padding: 10px 14px; border-radius: 10px; font-size: 15px; line-height: 1.4; word-break: break-word; }
.msg-row:not(.mine) .msg-bubble { background: #fff; color: #333; border-top-left-radius: 2px; }
.msg-row.mine .msg-bubble { background: #12B7F5; color: #fff; border-top-right-radius: 2px; }
.msg-bubble img, .msg-bubble video { max-width: 200px; border-radius: 6px; display: block; }
.msg-bubble a { color: inherit; text-decoration: underline; }
.chat-input-area { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: #fff; border-top: 1px solid #eee; }
.attach-btn, .emoji-btn { background: none; border: none; font-size: 22px; cursor: pointer; padding: 4px; }
#msgInput { flex: 1; padding: 10px 12px; border: 1px solid #ddd; border-radius: 20px; font-size: 15px; outline: none; }
#sendBtn { padding: 10px 18px; background: #12B7F5; color: #fff; border: none; border-radius: 20px; font-size: 15px; cursor: pointer; }

.emoji-panel { position: absolute; bottom: 60px; left: 0; right: 0; background: #fff; padding: 12px; border-top: 1px solid #eee; max-height: 200px; overflow-y: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.emoji-panel span { font-size: 24px; cursor: pointer; padding: 4px; }

/* ===== 弹窗 ===== */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-content { background: #fff; border-radius: 12px; padding: 20px; width: 88%; max-width: 360px; max-height: 80vh; overflow-y: auto; }
.modal-content h3 { margin-bottom: 16px; }
.modal-content input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 6px; margin-bottom: 10px; font-size: 14px; }
.modal-content button { padding: 10px 16px; background: #12B7F5; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; }
.modal-close { background: #ccc !important; margin-top: 10px; width: 100%; }
.search-results { margin-top: 10px; }
.search-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #eee; }
.search-item .user-info { flex: 1; }
.add-btn { padding: 6px 12px; background: #12B7F5; color: #fff; border: none; border-radius: 4px; font-size: 12px; cursor: pointer; }

/* ===== 通话 ===== */
.call-page { background: linear-gradient(135deg, #1a1a2e, #16213e); align-items: center; justify-content: center; color: #fff; }
.call-info { text-align: center; margin-bottom: 60px; }
.call-avatar { width: 100px; height: 100px; border-radius: 50%; background: #12B7F5; display: flex; align-items: center; justify-content: center; font-size: 40px; margin: 0 auto 20px; }
.call-name { font-size: 24px; margin-bottom: 8px; }
.call-status { font-size: 14px; color: #aaa; }
.call-controls { display: flex; gap: 30px; }
.call-btn-answer, .call-btn-hangup { width: 64px; height: 64px; border-radius: 50%; border: none; font-size: 28px; cursor: pointer; }
.call-btn-answer { background: #34C759; color: #fff; }
.call-btn-hangup { background: #ff3b30; color: #fff; }
.incoming-call { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; z-index: 200; }
.incoming-call .call-avatar { width: 80px; height: 80px; font-size: 32px; }

/* ===== Toast ===== */
.toast { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,.8); color: #fff; padding: 12px 24px; border-radius: 8px; z-index: 999; font-size: 14px; }

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