/* ===== 消息应用 — 微信风格 ===== */

/* 全屏容器 — 微信暗色背景 #111214 */
#scene-messages {
    background: #111214;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

/* 导航栏 — 液态玻璃 */
.msg-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(14px + var(--safe-top)) 60px 8px;
    background: rgba(28, 28, 30, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.msg-nav-back {
    position: absolute;
    left: 2px;
    top: calc(14px + var(--safe-top));
    width: 40px;
    height: 36px;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.15s;
}
.msg-nav-back:active { background: rgba(255,255,255,0.06); }
.msg-nav-back svg {
    width: 22px;
    height: 22px;
    stroke: rgba(255, 255, 255, 0.8);
    stroke-width: 2.5;
}

.msg-nav-title {
    font-size: 17px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    letter-spacing: 0.3px;
}

/* ── 聊天列表 — 半透明玻璃背景 ── */
.msg-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    background: rgba(17, 18, 20, 0.25);
}
.msg-list::-webkit-scrollbar { display: none; }

/* 时间标签 */
.msg-time-tag {
    text-align: center;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.2);
    padding: 10px 0 8px;
    font-weight: 500;
    align-self: center;
    letter-spacing: 0.5px;
}

/* ── 聊天气泡行 ── */
.msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 4px;
    animation: msgFadeIn 0.25s ease both;
}

.msg-row.received { justify-content: flex-start; }
.msg-row.sent { justify-content: flex-end; }

/* 头像 — 微信正圆 + 微光边框 */
.msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    background: #2c2c2e;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.msg-avatar img {
    width: 100%;
    height: 100%;
    display: block;
}

.msg-row.sent .msg-avatar { display: none; }

/* 气泡容器 */
.msg-bubble-wrap {
    max-width: 72%;
    display: flex;
    flex-direction: column;
}

/* 气泡本体 — 微玻璃效果 */
.msg-bubble {
    padding: 10px 14px;
    font-size: 15px;
    line-height: 1.5;
    word-break: break-word;
    position: relative;
    transition: transform 0.1s ease;
}

/* 接收气泡 — 暗色玻璃 */
.msg-row.received .msg-bubble {
    background: rgba(30, 30, 35, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.92);
    border-radius: 3px 12px 12px 12px;
    border: 0.5px solid rgba(255, 255, 255, 0.06);
}

/* 发送气泡 — 绿色玻璃 */
.msg-row.sent .msg-bubble {
    background: rgba(7, 193, 96, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: white;
    border-radius: 12px 3px 12px 12px;
    border: 0.5px solid rgba(255, 255, 255, 0.12);
}

/* 输入栏 — 液态玻璃底部 */
.msg-input-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px calc(7px + var(--safe-bottom));
    background: rgba(28, 28, 30, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 0.5px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

/* 语音按钮 */
.msg-input-voice {
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 50%;
    transition: background 0.15s;
}
.msg-input-voice:active { background: rgba(255,255,255,0.06); }
.msg-input-voice svg {
    width: 22px;
    height: 22px;
    fill: rgba(255, 255, 255, 0.45);
}

/* 输入框 — 玻璃 pill */
.msg-input-field {
    flex: 1;
    height: 36px;
    border-radius: 18px;
    border: 0.5px solid rgba(255, 255, 255, 0.08);
    background: rgba(44, 44, 46, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0 14px;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.9);
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}
.msg-input-field:focus {
    border-color: rgba(255, 255, 255, 0.18);
}
.msg-input-field::placeholder {
    color: rgba(255, 255, 255, 0.18);
}

/* 表情按钮 */
.msg-input-emoji {
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 50%;
    transition: background 0.15s;
}
.msg-input-emoji:active { background: rgba(255,255,255,0.06); }
.msg-input-emoji svg {
    width: 22px;
    height: 22px;
    fill: rgba(255, 255, 255, 0.45);
}

/* 发送按钮 — 绿色玻璃 */
.msg-input-send {
    display: none;
    height: 34px;
    padding: 0 15px;
    border: none;
    background: linear-gradient(135deg, #07C160, #06AD56);
    color: white;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    border-radius: 17px;
    cursor: pointer;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(7, 193, 96, 0.25);
}
.msg-input-send.active { display: flex; }
.msg-input-send:active {
    opacity: 0.8;
    transform: scale(0.96);
}

/* 正在输入指示器 — 玻璃气泡 */
.msg-typing {
    align-self: flex-start;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 4px;
    animation: msgFadeIn 0.2s ease both;
}

.msg-typing-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    background: #2c2c2e;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.msg-typing-avatar img {
    width: 100%;
    height: 100%;
    display: block;
}

.msg-typing-dots {
    padding: 13px 16px 11px;
    border-radius: 3px 12px 12px 12px;
    background: rgba(30, 30, 35, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 0.5px solid rgba(255, 255, 255, 0.06);
    display: flex;
    gap: 5px;
    align-items: center;
}

.msg-typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    animation: typingDot 1s infinite;
}
.msg-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.msg-typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingDot {
    0%, 60%, 100% { opacity: 0.2; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1.1); }
}

/* 入场动画 — 轻快 */
@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(4px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 跳转按钮气泡 — 金色玻璃 */
.msg-bubble-btn {
    background: linear-gradient(135deg, #ffd700, #e6a800) !important;
    color: #1a0e2e !important;
    font-weight: 700 !important;
    text-align: center;
    cursor: pointer;
    padding: 12px 22px !important;
    border-radius: 12px !important;
    transition: all 0.2s ease;
    animation: btnPulse 2s ease-in-out infinite;
    box-shadow: 0 2px 16px rgba(255, 215, 0, 0.2);
}
.msg-bubble-btn:active {
    transform: scale(0.94);
    box-shadow: 0 1px 8px rgba(255, 215, 0, 0.3);
}
@keyframes btnPulse {
    0%, 100% { box-shadow: 0 0 12px rgba(255, 215, 0, 0.25); }
    50% { box-shadow: 0 0 28px rgba(255, 215, 0, 0.5); }
}
