/* ===== 手机外壳 ===== */
.phone-frame {
    width: 375px;
    height: 667px;
    background: #fff;
    border-radius: 44px;
    box-shadow:
        0 0 0 8px #1a1a2e,
        0 0 0 10px #2d2d44,
        0 30px 80px rgba(0,0,0,0.4);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    flex-shrink: 0;
}

/* iPhone 刘海 */
.phone-frame::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 28px;
    background: #1a1a2e;
    border-radius: 0 0 20px 20px;
    z-index: 100;
}

/* Android 模式 */
.phone-frame.android {
    border-radius: 20px;
}

.phone-frame.android::before {
    display: none;
}

/* ===== 状态栏 ===== */
.status-bar {
    height: 44px;
    background: #0068ff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 0 28px;
    flex-shrink: 0;
    padding-top: 8px;
}

.phone-frame.android .status-bar {
    height: 24px;
    padding: 0 10px;
}

.phone-frame.android .time-display {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0;
}

/* 默认隐藏 Android 图标（用父级选择器提高优先级，避免被 .status-icons 覆盖） */
.phone-frame:not(.android) .android-status-icons { display: none !important; }

/* Android 模式：切换图标组 */
.phone-frame.android .ios-status-icons     { display: none !important; }
.phone-frame.android .android-status-icons { display: flex; gap: 4px; }

.time-display {
    font-size: 13px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.3px;
}

.status-icons {
    display: flex;
    align-items: center;
    gap: 3px;
}

/* ===== 顶部导航栏 ===== */
.zalo-navbar {
    height: 52px;
    background: #0068ff;
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 10px;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.nav-back {
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-contact {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.nav-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.4);
}

.nav-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nav-info {
    display: flex;
    flex-direction: column;
}

.nav-name {
    font-size: 15px;
    font-weight: 700;
    color: white;
    line-height: 1.2;
}

.nav-status {
    font-size: 11px;
    color: rgba(255,255,255,0.85);
    margin-top: 1px;
}

.nav-status.typing {
    color: #a0d8ff;
}

.nav-status.offline {
    color: rgba(255,255,255,0.5);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.nav-actions svg {
    cursor: pointer;
    opacity: 0.9;
}

/* ===== 聊天内容区 ===== */
.chat-body {
    flex: 1;
    background: #e9ebee;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 0;
}

.chat-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    font-size: 13px;
}

/* ===== 时间标签 ===== */
.time-label {
    text-align: center;
    margin: 10px 0 6px;
}

.time-label span {
    background: rgba(0,0,0,0.12);
    color: #555;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 10px;
    display: inline-block;
}

/* ===== 消息气泡基础 ===== */
.message-row {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    margin-bottom: 2px;
}

.message-row.me {
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #0068ff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
    align-self: flex-end;
    margin-bottom: 2px;
}

.msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 连续消息隐藏头像 */
.message-row.consecutive .msg-avatar {
    visibility: hidden;
}

.msg-content-wrap {
    display: flex;
    flex-direction: column;
    max-width: 72%;
    gap: 1px;
}

.message-row.me .msg-content-wrap {
    align-items: flex-end;
}

/* ===== 文字气泡 ===== */
.bubble {
    padding: 9px 12px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    position: relative;
    max-width: 100%;
}

/* 对方消息 */
.message-row.other .bubble {
    background: #ffffff;
    color: #1a1a1a;
    border-bottom-left-radius: 5px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* 我的消息 — 浅蓝色（与真实 Zalo 一致） */
.message-row.me .bubble {
    background: #d4eeff;
    color: #1a1a1a;
    border-bottom-right-radius: 5px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* ===== 图片消息 ===== */
.bubble-image {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    max-width: 210px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    display: inline-block;
}

.bubble-image img {
    display: block;
    width: 100%;
    max-height: 260px;
    object-fit: cover;
}

/* 图片覆盖按钮（转发 / 爱心） */
.img-btn {
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,0.38);
    border: none;
    cursor: default;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.img-forward {
    top: 8px;
    right: 8px;
}

.img-heart {
    bottom: 8px;
    right: 8px;
}

/* ===== 语音消息 ===== */
.bubble-voice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    min-width: 120px;
}

.voice-play-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-row.other .voice-play-btn {
    background: #0068ff;
}

.message-row.me .voice-play-btn {
    background: #0068ff;
}

.voice-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 24px;
}

.voice-waveform span {
    display: inline-block;
    width: 3px;
    border-radius: 2px;
    flex-shrink: 0;
}

.message-row.other .voice-waveform span {
    background: #0068ff;
}

.message-row.me .voice-waveform span {
    background: #0068ff;
}

.voice-duration {
    font-size: 12px;
    flex-shrink: 0;
}

.message-row.other .voice-duration { color: #666; }
.message-row.me .voice-duration { color: #444; }

/* ===== 表情贴纸 ===== */
.bubble-sticker {
    width: auto !important;
    height: auto !important;
    background: none !important;
    box-shadow: none !important;
    padding: 2px 4px !important;
    display: inline-block !important;
    font-size: 40px;
    line-height: 1.15;
    overflow: hidden;
    max-width: 160px;
    word-break: break-all;
}

/* ===== 已撤回消息 ===== */
.bubble-recall {
    background: transparent !important;
    box-shadow: none !important;
    color: #888 !important;
    font-size: 12px !important;
    font-style: italic;
    padding: 6px 0 !important;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===== 消息状态 ===== */
.msg-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.message-row.me .msg-meta {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.msg-time {
    font-size: 10px;
    color: #999;
}

.msg-tick {
    display: flex;
    align-items: center;
}

.tick-sent { color: #aaa; }
.tick-delivered { color: #aaa; }
.tick-read { color: #0068ff; }

/* ===== Emoji 表情支持 ===== */
.bubble-text {
    white-space: pre-wrap;
}

/* 纯 emoji 消息放大 */
.bubble-text.emoji-only {
    font-size: 32px;
    background: transparent !important;
    box-shadow: none !important;
    padding: 4px 0 !important;
}

/* ===== 底部输入栏 ===== */
.zalo-input-bar {
    height: 56px;
    background: #fff;
    border-top: 1px solid #e8eaed;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 10px;
    flex-shrink: 0;
}

.input-icons-left svg { opacity: 0.7; }
.input-icons-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.input-icons-right svg { opacity: 0.7; }

.input-field-fake {
    flex: 1;
    height: 36px;
    background: #f0f2f5;
    border-radius: 18px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    color: #999;
    font-size: 14px;
}

/* ===== iPhone 底部 ===== */
.home-indicator {
    height: 20px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.home-indicator::after {
    content: '';
    width: 120px;
    height: 4px;
    background: #1a1a2e;
    border-radius: 2px;
    opacity: 0.2;
}

.phone-frame.android .home-indicator {
    height: 40px;
    background: #f5f5f5;
    border-top: 1px solid #e0e0e0;
}

.phone-frame.android .home-indicator::after {
    display: none;
}

/* Android 三键导航栏 */
.android-navbar {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    padding: 0 40px;
}

/* ===== 截图模式 ===== */
.export-mode .phone-frame {
    border-radius: 0;
    box-shadow: none;
}

.export-mode .phone-frame::before {
    display: none;
}
