/* Chat System Styling */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

/* Root Variables */
:root {
    --chat-primary-color: #4285f4;
    --chat-secondary-color: #f1f3f4;
    --chat-error-color: #ea4335;
    --chat-success-color: #34a853;
    --chat-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
    --chat-warning-color: #fbbc05;
    --chat-offline-color: #dadce0;
    --chat-scroll-transition: transform 0.3s cubic-bezier(0.33, 1, 0.68, 1);
    --chat-elastic-factor: 0.4; /* 增加弹性系数，让弹性效果更明显 */
    --chat-bottom-elastic-factor: 0.5; /* 底部特有的弹性系数，更接近微信的效果 */
}

/* Base styles */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
    color: #343a40;
    background-color: #f8f9fa;
}

/* 防止滚动穿透 - 强化版 */
html.no-scroll,
body.no-scroll {
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    touch-action: none !important;
    -webkit-overflow-scrolling: none !important;
    overscroll-behavior: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    max-height: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 键盘准备状态，防止iOS键盘弹出导致闪烁 */
body.keyboard-prepared .chat-window {
    position: fixed !important;
    height: -webkit-fill-available !important;
    max-height: -webkit-fill-available !important;
    bottom: 0 !important;
    transform: translate3d(0,0,0) !important;
    -webkit-transform: translate3d(0,0,0) !important;
    will-change: transform !important;
    z-index: 10000 !important;
}

/* iOS键盘预备状态 */
body.ios-keyboard-ready .chat-window {
    /* 确保聊天窗口在iOS设备上始终正确显示 */
    position: fixed !important;
    height: -webkit-fill-available !important;
    min-height: -webkit-fill-available !important;
    transform: translate3d(0,0,0) !important;
    -webkit-transform: translate3d(0,0,0) !important;
    transition: none !important;
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Chat Window Structure */
.chat-window {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    background: #fff;
    z-index: 10000;
    overflow: hidden;
}

.chat-window {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.chat-window.hidden {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
}

/* 全屏遮罩层样式 */
.chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, var(--overlay-opacity, 0));
    z-index: 9999;
    touch-action: none;
    pointer-events: all;
    overscroll-behavior: none;
    -webkit-overscroll-behavior: none;
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    will-change: transform, opacity;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    opacity: var(--overlay-opacity, 0);
    transition: opacity 0.3s ease, background-color 0.3s ease;
}

.chat-overlay.visible {
    --overlay-opacity: 0.2;
    opacity: var(--overlay-opacity);
    background-color: rgba(0, 0, 0, var(--overlay-opacity));
}

/* Messages Area */
.chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px;
    padding-top: 100px !important; /* 补偿固定头部的100px高度，强制覆盖其他padding */
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* iOS Safari specific fixes */
@supports (-webkit-overflow-scrolling: touch) {
    .chat-messages {
        -webkit-overflow-scrolling: touch;
        /* 增强iOS滚动顺滑度 */
        -webkit-momentum-scrolling: touch;
        -webkit-scroll-snap-type: proximity;
        overscroll-behavior-y: auto;
        scroll-snap-type: proximity;
    }
    
    /* Fix for iOS scroll issues */
    .chat-messages::-webkit-scrollbar {
        width: 0px;
        background: transparent;
    }
    
    /* 允许iOS更自然的弹性效果 */
    .chat-messages {
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
    }
    
    body.ios-keyboard-ready .chat-messages,
    body.keyboard-prepared .chat-messages {
        /* 确保消息区域在键盘弹出时仍可滚动 */
        overflow-y: scroll !important;
        -webkit-overflow-scrolling: touch !important;
        pointer-events: auto !important;
    }
    
    /* Fix for iOS input focus */
    #message-input {
        -webkit-user-select: text;
        user-select: text;
    }
}

/* 防止iOS输入框闪烁问题的特殊处理 */
@supports (-webkit-touch-callout: none) {
    .chat-window {
        height: -webkit-fill-available;
    }
    
    .chat-messages {
        -webkit-overflow-scrolling: touch;
        /* 增强iOS滚动顺滑度 */
        -webkit-momentum-scrolling: touch;
        -webkit-scroll-snap-type: proximity;
        overscroll-behavior-y: auto;
        scroll-snap-type: proximity;
        /* 支持更精细的触摸控制 */
        touch-action: manipulation;
    }
    
    /* Fix for iOS scroll issues */
    .chat-messages::-webkit-scrollbar {
        width: 0px;
        background: transparent;
    }
    
    /* 允许iOS更自然的弹性效果 */
    .chat-messages {
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 增强iOS上的弹性滚动触感 */
    .chat-messages.elastic-scrolling {
        transition: transform 0.2s cubic-bezier(0.1, 0.7, 0.1, 1);
    }
    
    body.ios-keyboard-ready .chat-messages,
    body.keyboard-prepared .chat-messages {
        /* 确保消息区域在键盘弹出时仍可滚动 */
        overflow-y: scroll !important;
        -webkit-overflow-scrolling: touch !important;
        pointer-events: auto !important;
    }
    
    /* 避免键盘弹出时的布局抖动 */
    body.ios-keyboard-ready .chat-input-area,
    body.keyboard-prepared .chat-input-area {
        transform: translateZ(0) !important;
        -webkit-transform: translateZ(0) !important;
        will-change: transform !important;
    }
}

/* Chat Header */
.chat-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: rgba(248, 249, 250, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-bottom: 1px solid rgba(233, 236, 239, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    padding-top: max(15px, env(safe-area-inset-top));
    z-index: 1003;
    transform: none !important;
    will-change: auto;
    border-radius: 0 !important;
}
/* Search Button in Header */
.header-search-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 122, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    z-index: 2;
}

.header-search-btn:hover {
    background: rgba(0, 122, 255, 0.15);
    transform: translateY(-50%) scale(1.05);
}

.header-search-btn:active {
    background: rgba(0, 122, 255, 0.2);
    transform: translateY(-50%) scale(0.95);
}

.header-search-btn svg {
    width: 18px;
    height: 18px;
    color: #007AFF;
}

@media (max-width: 768px) {
    .header-search-btn {
        width: 44px;
        height: 44px;
    }
    .header-search-btn svg {
        width: 20px;
        height: 20px;
    }
}

.chat-user-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50% !important;
    object-fit: cover;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chat-username {
    font-weight: 500;
    color: #212529;
    font-size: 14px;
    margin-top: 5px;
    text-align: center;
}

.close-chat {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;  /* 增大宽度 */
    height: 60px; /* 增大高度 */
    border-radius: 0 !important; /* 移除圆角 */
    position: absolute;
    left: 0;      /* 移到左边缘 */
    top: 0;       /* 移到顶部边缘 */
    z-index: 1004; /* 确保按钮在最上层 */
    padding-top: max(5px, env(safe-area-inset-top)); /* 适配刘海屏 */
    padding-left: max(5px, env(safe-area-inset-left)); /* 适配左侧安全区域 */
    pointer-events: auto; /* 确保只在按钮区域捕获点击事件 */
}

/* 按钮内部图标居中 */
.close-chat svg {
    position: absolute;
    left: max(20px, calc(10px + env(safe-area-inset-left)));
    top: max(30px, calc(20px + env(safe-area-inset-top)));
}

.close-chat:hover {
    color: #666;
    background: rgba(0, 0, 0, 0.05);
}

/* 添加触摸态反馈 */
.close-chat::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(0,0,0,0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.close-chat:active::after {
    opacity: 1;
}

/* 移动设备上使用更大的触摸区域 */
@media (max-width: 768px) {
    .close-chat {
        width: 80px;  /* 更宽的点击区域 */
        height: 80px; /* 更高的点击区域 */
    }
    
    /* 确保返回图标在合适位置 */
    .close-chat svg {
        left: 25px;
        top: 40px;
    }
    
    /* 添加点击反馈效果 */
    .close-chat:active {
        background: rgba(0, 0, 0, 0.05);
    }
}

/* 添加右滑关闭样式 */
.chat-window.sliding-out {
    transition: transform 0.3s ease-out;
    transform: translateX(100%);
}

/* Scrollbar Styles */
.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(193, 193, 193, 0.6);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(168, 168, 168, 0.8);
}

/* Message Styles */
.message {
    max-width: 70%;
    margin: 8px 0;
    position: relative;
    animation: messageAppear 0.3s ease-out;
}

.message-time {
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
    opacity: 0.7;
}

.message-content {
    padding: 10px 12px;
    border-radius: 4px 16px 16px 16px !important;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message.sent {
    align-self: flex-end;
}

.message.sent .message-time {
    text-align: right;
}

.message.sent .message-content {
    border-radius: 18px 18px 4px 18px !important;
    align-self: flex-end;
}

.message.received {
    align-self: flex-start;
}

.message.received .message-time {
    text-align: left;
}

.message.received .message-content {
    border-radius: 18px 18px 18px 4px !important;
    align-self: flex-start;
}

/* 翻译相关样式 */
.message-translated,
.message-translation-info {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.message-translated {
    font-style: italic;
    color: #666;
}

.message-translation-info {
    font-size: 12px;
    color: #666;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.translation-indicator {
    font-style: italic;
    color: #777;
    font-size: 11px;
}

.view-original-btn {
    background: none;
    border: none;
    color: var(--chat-primary-color);
    font-size: 11px;
    padding: 2px 5px;
    border-radius: 4px !important;
    cursor: pointer;
    transition: background-color 0.2s;
}

.view-original-btn:hover {
    background-color: rgba(66, 133, 244, 0.1);
}

.message.received .message-translation-info {
    text-align: left;
    border-top-color: rgba(255, 255, 255, 0.2);
}

.message.sent .message-translation-info {
    text-align: right;
    border-top-color: rgba(0, 0, 0, 0.1);
}

/* 消息状态样式 */
.message-status {
    font-size: 10px;
    color: #999;
    margin-top: 2px;
    text-align: right;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transform: scale(1);
}

.message-status::after {
    content: attr(data-status-text);
}

/* 发送中状态 */
.message-status.sending {
    color: #ffa500;
    animation: statusPulse 1.5s infinite ease-in-out;
}

/* 已发送状态 */
.message-status.sent {
    color: #666;
}

/* 已送达状态 */
.message-status.delivered {
    color: #34a853;
    animation: statusDelivered 0.4s ease-out;
}

/* 已读状态 */
.message-status.read {
    color: #4285f4;
    animation: statusRead 0.4s ease-out;
}

/* 发送失败状态 */
.message-status.failed {
    color: #ff3b30;
    cursor: pointer;
    animation: statusFailed 0.3s ease-out;
}

/* 状态变化时的淡入淡出效果 */
.message-status.updating {
    opacity: 0;
    transform: scale(0.8);
}

.message-status.updated {
    opacity: 1;
    transform: scale(1);
    animation: statusUpdate 0.4s ease-out;
}

/* 状态图标动画 */
@keyframes statusPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

@keyframes statusDelivered {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(2px);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes statusRead {
    0% {
        opacity: 0;
        transform: scale(0.8) rotate(-10deg);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.2) rotate(5deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes statusFailed {
    0% {
        opacity: 0;
        transform: scale(0.8) translateX(-2px);
    }
    25% {
        transform: scale(1.1) translateX(2px);
    }
    50% {
        transform: scale(0.9) translateX(-1px);
    }
    75% {
        transform: scale(1.05) translateX(1px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateX(0);
    }
}

@keyframes statusUpdate {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* 中间的日期分隔线 */
.date-separator {
    align-self: center;
    padding: 5px 10px;
    background: rgba(0,0,0,0.1);
    color: #666;
    font-size: 12px;
    border-radius: 10px;
    margin: 15px 0;
}

/* Input Area */
.chat-input-area {
    width: 100%;
    box-sizing: border-box;
    background: #f5f5f5;
    border-top: none;
    padding: 6px 10px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    transition: background 0.2s, height 0.2s, transform 0.3s cubic-bezier(.4,2,.6,1);
    flex: 0 0 auto; /* 明确禁止它收缩 */
    height: auto !important; /* 让高度根据内容自适应 */
}


.input-container {
    height: auto !important;
    min-height: 44px !important; /* 更贴合按钮高度的最小高度 */
    max-height: 300px !important;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 100%;
    background: #fff;
    border-radius: 22px;
    padding: 6px 8px 6px 12px;
    box-shadow: none; /* 移除输入框阴影 */
    transition: background 0.2s, height 0.2s;
}

.input-container::before,
.input-container::after {
    display: none;
}

#message-input {
    min-height: 28px;
    height: auto;
    flex: 1;
    border: none;
    padding: 2px 0;
    resize: none;
    max-height: 120px;
    font-size: 16px;
    line-height: 22px;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    overflow-y: auto;
    align-self: center;
    caret-color: #2b2f36; /* 更深，更现代 */
    position: relative;
    z-index: 1;
    pointer-events: auto;
    font-variant-ligatures: none;
    /* 去除旧的粗糙阴影，提升文字清晰度 */
    text-shadow: none;
    /* 移动端优化：确保立即弹出键盘 */
    -webkit-user-select: text;
    -webkit-touch-callout: default;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    touch-action: manipulation;
}

#message-input::selection {
    /* Telegram风格：高对比但不刺眼 */
    background: rgba(43, 47, 54, 0.18);
    color: #111;
    /* 选中文本高对比度，提升可读性 */
}

#message-input:focus {
    outline: none;
    /* 轻微提升可见性，不改变布局 */
    text-shadow: 0 0 0 transparent;
}

/* 表情按钮 */
.emoji-btn {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent !important; /* 完全透明背景 */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin: 0 6px 0 8px;
    align-self: center;
    box-shadow: none !important; /* 明确移除阴影 */
    outline: none !important; /* 移除轮廓 */
    border-radius: 50% !important; /* 确保圆形 */
    -webkit-appearance: none !important; /* 移除iOS默认样式 */
    -webkit-tap-highlight-color: transparent !important; /* 移除点击高亮 */
    color: #666 !important; /* 确保SVG图标颜色一致 */
}

.emoji-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important; /* 白色透明背景 */
    box-shadow: none !important; /* 确保hover时也没有阴影 */
    outline: none !important;
    border-radius: 50% !important;
    -webkit-tap-highlight-color: transparent !important;
    transform: scale(1.02); /* 轻微放大 */
}

.emoji-btn:active {
    background: rgba(255, 255, 255, 0.05) !important; /* 更轻的白色透明背景 */
    transform: scale(0.95);
    box-shadow: none !important; /* 确保active时也没有阴影 */
    outline: none !important;
    border-radius: 50% !important;
    -webkit-tap-highlight-color: transparent !important;
}

.emoji-btn.active {
    background: rgba(255, 255, 255, 0.15) !important; /* 更明显的白色透明背景表示激活 */
    box-shadow: none !important; /* 确保激活状态也没有阴影 */
    outline: none !important;
    border-radius: 50% !important;
    -webkit-tap-highlight-color: transparent !important;
    transform: scale(1.05); /* 激活时稍微放大 */
}

/* 表情按钮SVG - 使用独特ID避免污染 */
#chat-emoji-icon {
    width: 20px;
    height: 20px;
    stroke: #666;
    fill: none !important;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.2s ease;
    filter: none !important; /* 确保无任何滤镜效果 */
    box-shadow: none !important; /* 确保无阴影 */
}

.emoji-btn.active #chat-emoji-icon {
    stroke: #666;
}

.emoji-btn:hover #chat-emoji-icon {
    stroke: #666;
}

.action-button {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f8f8f8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: 6px;
    align-self: center;
}

.action-button:hover {
    background: #f0f0f0;
}

.action-button:hover .plus-icon {
    transform: rotate(90deg);
}

.action-button:active {
    transform: scale(0.95);
}

.action-button svg {
    width: 20px;
    height: 20px;
}

.plus-icon-path {
    stroke: #666;
    stroke-width: 2.5;
    stroke-linecap: round;
}

.send-icon svg {
    fill: white;
}

/* 发送状态时的红色背景 */
.action-button.send-active {
    background: #e74c3c;
}

.action-button.send-active:hover {
    background: #d44332;
}

.send-icon {
    opacity: 0;
    transform: scale(0.8) rotate(-45deg);
    transition: all 0.25s ease;
}

.send-icon.show {
    opacity: 1;
    transform: scale(1) rotate(0);
}

.send-icon.animate svg {
    animation: sendFly 0.3s ease-out forwards;
}

/* Animations */
@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes sendFly {
    0% {
        transform: scale(1) translate(0, 0);
        opacity: 1;
    }
    100% {
        transform: scale(0.5) translate(100px, -100px);
        opacity: 0;
    }
}

/* Desktop Styles */
@media (min-width: 768px) {
    .chat-window {
        border-radius: 0 !important;
        box-shadow: none;
        transform: none;
    }
    .chat-header {
        position: absolute;
        border-radius: 0 !important;
        height: 100px;
        background: rgba(248, 249, 250, 0.85);
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
    }
    .chat-input-area {
        border-radius: 0;
        padding-bottom: 8px;
    }
}

/* Safe Area Support */
@supports (padding: max(0px)) {
    .chat-input-area {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
    .chat-header {
        padding-top: max(15px, env(safe-area-inset-top));
    }
}

/* 长按消息的操作菜单 */
.message-action-menu {
    position: fixed;
    z-index: 2000;
    background: rgba(50, 50, 50, 0.9);
    border-radius: 10px;
    padding: 8px 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    gap: 20px;
    min-width: 150px;
    transform: scale(0.95);
    opacity: 0;
    animation: menu-appear 0.2s forwards;
}

@keyframes menu-appear {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.message-action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    font-size: 14px;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
}

.message-action-item:hover,
.message-action-item:active {
    background: rgba(255, 255, 255, 0.1);
}

.action-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.action-name {
    font-size: 12px;
}

/* 消息删除动画 */
.message.deleting {
    animation: message-delete 0.3s forwards;
}

@keyframes message-delete {
    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

/* 消息选中状态 */
.message.selected .message-content {
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.5);
}

/* 提示消息 */
.message-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 2100;
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

.message-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 滚动过度效果 - 类似微信的弹性 */
.chat-messages.elastic-top {
    transition: var(--chat-scroll-transition);
    z-index: 1050 !important; /* 确保弹性滚动时在最上层 */
    pointer-events: auto !important; /* 确保可以接收触摸事件 */
}

.chat-messages.elastic-bottom {
    transition: var(--chat-scroll-transition);
    z-index: 1050 !important; /* 确保弹性滚动时在最上层 */
    pointer-events: auto !important; /* 确保可以接收触摸事件 */
}

/* 增强底部弹性滚动的视觉效果 */
.chat-messages.elastic-bottom::after {
    content: "";
    display: block;
    height: 80px;
    margin-top: 20px;
    opacity: 0.5;
    background: linear-gradient(to bottom, rgba(0,0,0,0.05), rgba(0,0,0,0.02), transparent);
    border-radius: 16px;
}

/* 底部弹性滚动指示器 - 微信风格 */
.chat-messages.elastic-bottom::before {
    content: "";
    display: block;
    width: 36px;
    height: 36px;
    margin: 15px auto 5px;
    border-radius: 50%;
    border: 2px solid rgba(200, 200, 200, 0.3);
    border-top-color: rgba(150, 150, 150, 0.5);
    animation: bottom-elastic-spin 0.8s linear infinite;
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* 当拉动超过一定距离时显示加载指示器 */
.chat-messages.elastic-bottom[style*="translateY(-20px)"]::before,
.chat-messages.elastic-bottom[style*="translateY(-30px)"]::before,
.chat-messages.elastic-bottom[style*="translateY(-40px)"]::before,
.chat-messages.elastic-bottom[style*="translateY(-50px)"]::before {
    opacity: 0.4;
}

.chat-messages.elastic-bottom[style*="translateY(-60px)"]::before,
.chat-messages.elastic-bottom[style*="translateY(-70px)"]::before,
.chat-messages.elastic-bottom[style*="translateY(-80px)"]::before {
    opacity: 0.7;
}

@keyframes bottom-elastic-spin {
    to { transform: rotate(360deg); }
}

/* 微信式工具菜单样式 */
.tools-menu {
    position: absolute;
    left: 0;
    right: 52px;
    bottom: 0;
    top: auto;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-evenly; /* 改为均匀分布 */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    background: transparent;
    z-index: 10;
}

.tools-menu.visible {
    opacity: 1;
    pointer-events: auto;
}

.input-container.tools-mode {
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
}

.input-container.tools-mode #message-input,
.input-container.tools-mode .voice-mic-btn {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    pointer-events: none;
    left: -9999px; /* 移出视图 */
}

/* 确保输入框在正常状态下可点击 */
#message-input {
    min-height: 36px;
    height: auto;
    flex: 1;
    border: none;
    padding: 4px 0;
    resize: none;
    max-height: 120px;
    font-size: 16px;
    line-height: 24px;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    overflow-y: auto;
    align-self: center;
    caret-color: #111;
    position: relative;
    z-index: 1;
    pointer-events: auto;
    /* 自定义光标动画效果 */
    /* 让光标更粗一点，兼容性有限，但体验更现代 */
    font-variant-ligatures: none;
    /* 让输入时光标更明显 */
    text-shadow: 0 0 2px #fff, 0 0 1px #000;
}

.tool-btn {
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    display: flex !important;
    background: #f1f3f4;
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 56px;
    height: 64px;
    margin: 0 12px;
    padding: 0;
    cursor: pointer;
    transition: background 0.2s;
}

.tool-btn .tool-icon {
    margin-bottom: 2px;
    /* 图标整体调高一点 */
}

.tool-label {
    display: block !important;
    font-size: 13px;
    color: #333;
    margin-top: 2px;
    text-align: center;
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: 0.02em;
    pointer-events: none;
    /* 始终显示，不要hover才出现 */
}

/* 工具菜单布局优化 */
.tools-menu.visible {
    display: flex;
    justify-content: space-evenly;
    width: calc(100% - 60px);
}

.tools-menu.visible .tool-btn {
    flex: 0 0 auto;
    margin: 0 5px;
}

/* 确保工具图标在按钮中居中 */
.tool-btn .tool-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* 移除工具按钮之间的间距，使用flex布局控制 */
.tool-btn {
    margin: 0;
    flex: 1;
    max-width: 60px;
}

/* AI助手弹窗样式 */
.ai-assistant-modal {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ai-assistant-modal.visible {
    opacity: 1;
    visibility: visible;
}

.ai-assistant-modal.visible .ai-assistant-container {
    transform: translateY(0);
    opacity: 1;
}

/* 关闭按钮样式 */
.ai-assistant-close {
    background: transparent;
    border: none;
    color: #666;
    font-size: 24px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.ai-assistant-close:hover {
    color: #4285f4;
}

.ai-assistant-container {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    margin: 5vh auto;
    transform: translateY(30px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.ai-assistant-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f5f7fa;
}

.ai-assistant-title {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #4285f4;
}

.ai-assistant-title svg {
    margin-right: 8px;
}

.ai-assistant-content {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.ai-assistant-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 0;
    text-align: center;
}

.ai-assistant-loading p {
    margin-top: 15px;
    color: #666;
    font-size: 15px;
}

.ai-assistant-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(66, 133, 244, 0.2);
    border-radius: 50%;
    border-top-color: #4285f4;
    animation: ai-spinner 1s linear infinite;
}

@keyframes ai-spinner {
    to {
        transform: rotate(360deg);
    }
}

.report-container {
    padding: 15px;
}

.report-section h3 {
    font-size: 18px;
    color: #4285f4;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.sentiment-chart {
    height: 200px;
    margin: 15px 0;
}

.topics-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 15px 0;
}

.topic-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    background: #f5f5f5;
    min-width: 80px;
}

.topic-score {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-bottom: 5px;
    color: white;
}

.topic-score.high {
    background: #34a853;
}

.topic-score.medium {
    background: #fbbc05;
}

.topic-score.low {
    background: #ea4335;
}

.topic-name {
    font-size: 12px;
}

.key-moment {
    padding: 10px;
    border-left: 3px solid #4285f4;
    background: #f5f5f5;
    margin-bottom: 10px;
    border-radius: 0 4px 4px 0;
}

.key-moment-time {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.solutions-list {
    padding-left: 20px;
}

.solutions-list li {
    margin-bottom: 8px;
}

/* MBTI弹窗样式 */
.mbti-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.mbti-modal.visible {
    opacity: 1;
    pointer-events: auto;
}

.mbti-container {
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.mbti-modal.visible .mbti-container {
    transform: translateY(0);
}

.mbti-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.mbti-title {
    font-size: 18px;
    font-weight: 500;
}

.mbti-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    color: #666;
}

.mbti-content {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

/* AI助手通知样式 */
.ai-assistant-notice {
    background-color: #f8f9fa;
    border-left: 3px solid #17a2b8;
    padding: 10px 15px;
    margin: 10px 0;
    font-size: 14px;
    color: #666;
    border-radius: 4px;
}

/* AI助手报告样式增强 */
.report-text {
    line-height: 1.6;
    color: #333;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: pre-wrap;
    background-color: #f5f7fa;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.analysis-heading {
    font-size: 16px;
    color: #4285f4;
    margin: 20px 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
    font-weight: 600;
}

.analysis-subheading {
    font-size: 1.08rem;
    color: #2456a5;
    margin: 22px 0 12px 0;
    font-weight: 600;
    background: linear-gradient(90deg, #eaf1fb 60%, #f8f9fa 100%);
    padding: 12px 18px 12px 18px;
    border-radius: 8px;
    border-left: 5px solid #4285f4;
    border-bottom: 1.5px solid #dbeafe;
    box-shadow: 0 2px 8px rgba(66,133,244,0.06);
    letter-spacing: 0.01em;
    display: block;
}

.analysis-quote {
    padding: 8px 12px;
    margin: 8px 0;
    background-color: #fafafa;
    border-left: 3px solid #ff2442;
    color: #555;
    font-style: italic;
}

.analysis-list-item {
    margin: 5px 0 5px 15px;
    position: relative;
    padding-left: 20px;
}

.analysis-list-item:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #ff2442;
    font-weight: bold;
}

/* Styles for the Messages List in the new Messages tab */
#messages-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    color: #333;
}

#messages-list li {
    padding: 10px 15px;
    border-bottom: 1px solid #ddd;
    transition: background-color 0.3s ease;
}

#messages-list li:hover {
    background-color: #f5f5f5;
}

/* Styles for Messages tab thread items */
#messages-content {
    padding: 12px;
    padding-bottom: 82px;
    background-color: #f5f5f5;
    height: calc(100vh - 150px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.thread-item {
    display: flex;
    padding: 10px 15px;
    margin-bottom: 10px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s;
}

.thread-item:hover {
    background-color: #f9f9f9;
}

.thread-avatar {
    width: 50px;
    height: 50px;
    background-color: #ddd;
    border-radius: 50%;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.thread-content {
    flex: 1;
    overflow: hidden;
}

.thread-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.thread-name {
    font-weight: bold;
    font-size: 16px;
    color: #333;
}

.thread-time {
    font-size: 12px;
    color: #999;
}

.thread-message {
    font-size: 14px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

.unread-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    min-width: 20px;
    height: 20px;
    background-color: #ff3b30;
    color: white;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    padding: 0 6px;
}

.send-icon.show svg {
    opacity: 1;
    transform: scale(1) rotate(0);
    /* Use a color derived from the gradient, like a soft coral pink */
    fill: #FF85A1;
}

/* 性别基于的气泡样式 */
.male-bubble-style {
    background-color: #f1f3f4 !important;
    color: #333 !important;
}

.female-bubble-style {
    background: radial-gradient(circle, #FFD1DC, #E6E6FA) !important;
    color: #333 !important;
}

/* --- 移除所有触摸反馈，但保留必要动画 --- */

/* 全局移除触摸高亮 */
* {
    -webkit-tap-highlight-color: transparent !important;
    tap-highlight-color: transparent !important;
}

/* 特别处理关闭按钮和动作按钮 */
.close-chat,
.action-button {
    -webkit-tap-highlight-color: transparent !important;
    tap-highlight-color: transparent !important;
    background: transparent !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    outline: none !important;
}

/* 移除关闭按钮的所有状态效果 */
.close-chat:hover,
.close-chat:active {
    background: transparent !important;
    color: #666 !important; /* 保持原始颜色 */
    transform: none !important;
}

/* 修改 action-button 的样式，只保留必要的变形动画 */
.action-button {
    z-index: 1006;
    transition: none !important; /* 不在按钮上做旋转动画 */
}

.action-button.active .plus-icon {
    transform: rotate(45deg);
}

/* 保留发送图标的必要动画 */
.send-icon {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.25s ease;
    transform-origin: center;
    transform: scale(0.8) rotate(-45deg);
}

.send-icon.show {
    opacity: 1;
    transform: scale(1) rotate(0);
}

/* 移除其他所有悬停和激活状态的效果 */
.action-button:hover,
.action-button:active {
    background: transparent !important;
}

/* 确保加号图标的过渡效果保持 */
.plus-icon {
    opacity: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    transform-origin: center;
}

.plus-icon.hide {
    opacity: 0;
    transform: scale(0.8) rotate(45deg);
}

/* 系统消息样式 - 超简洁版 */
.system-message {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 10px auto !important;
    padding: 0 !important;
    width: 100% !important;
    position: relative !important;
    z-index: 5 !important;
    opacity: 1 !important;
    visibility: visible !important;
    text-align: center !important;
    background: transparent !important;
    float: none !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    max-width: 100% !important;
}

/* 覆盖received和sent类对系统消息的影响 */
.message.system-message.received,
.message.system-message.sent {
    align-self: center !important;
    float: none !important;
    display: flex !important;
    justify-content: center !important;
    max-width: 100% !important;
    margin: 10px auto !important;
}

/* 覆盖时间戳文字对齐 */
.message.system-message .message-time,
.message.system-message.received .message-time,
.message.system-message.sent .message-time {
    text-align: center !important;
}

.system-message-content {
    background-color: rgba(245, 245, 245, 0.6) !important;
    color: #666 !important;
    padding: 4px 12px !important;
    border-radius: 10px !important;
    font-size: 13px !important;
    max-width: 80% !important;
    text-align: center !important;
    box-shadow: none !important;
    display: inline-block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1) !important;
    margin: 0 auto !important;
    border: none !important;
    float: none !important;
    left: 0 !important;
    right: 0 !important;
}

/* 覆盖类似气泡样式对系统消息的影响 */
.message.system-message .message-content,
.message.system-message.received .message-content,
.message.system-message.sent .message-content,
.message.system-message .male-bubble-style,
.message.system-message .female-bubble-style {
    border-radius: 10px !important;
    background-color: rgba(245, 245, 245, 0.6) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
    text-align: center !important;
    margin: 0 auto !important;
    float: none !important;
    align-self: center !important;
}

/* 匹配消息样式 - 超简洁版 */
.system-message.match-notification {
    margin: 14px auto !important;
    z-index: 10 !important;
    width: 100% !important;
}

.system-message.match-notification .system-message-content {
    color: #555 !important;
    font-weight: normal !important;
    padding: 6px 12px !important;
    min-width: 160px !important;
    border-radius: 12px !important;
}

/* 匹配消息文本样式 */
.match-message-text {
    display: block !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    margin-bottom: 1px !important;
    color: #555 !important;
    font-weight: normal !important;
    word-break: break-word !important;
    white-space: normal !important;
    text-align: center !important;
}

.match-time {
    display: block !important;
    font-size: 11px !important;
    margin-top: 1px !important;
    font-weight: normal !important;
    color: #999 !important;
    line-height: 1.3 !important;
    text-align: center !important;
}

/* 开场白提示和快捷回复样式 */
.chat-start-hints {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto 16px;
    padding: 0 12px;
    max-width: 95%;
    opacity: 0;
    transform: translateY(15px);
    animation: fadeInUp 0.5s forwards;
    animation-delay: 0.5s;
}

.chat-start-hint {
    font-size: 14px;
    color: #777;
    text-align: center;
    margin-bottom: 12px;
    padding: 10px 16px;
    background: rgba(245, 245, 245, 0.8);
    border-radius: 18px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.quick-replies-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-bottom: 5px;
}

.quick-reply-btn {
    padding: 8px 14px;
    background: linear-gradient(135deg, #f2f7ff, #e6eeff);
    border: 1px solid rgba(66, 133, 244, 0.2);
    border-radius: 20px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    animation: quickReplyAppear 0.4s forwards;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
}

.quick-reply-btn:nth-child(1) { animation-delay: 0.6s; }
.quick-reply-btn:nth-child(2) { animation-delay: 0.7s; }
.quick-reply-btn:nth-child(3) { animation-delay: 0.8s; }
.quick-reply-btn:nth-child(4) { animation-delay: 0.9s; }
.quick-reply-btn:nth-child(5) { animation-delay: 1.0s; }

.quick-reply-btn:hover,
.quick-reply-btn:active {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
    background: linear-gradient(135deg, #e6f0ff, #d8e5ff);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes quickReplyAppear {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 替代的炫酷快捷回复按钮样式 */
.quick-reply-btn.style-alt {
    background: linear-gradient(135deg, #ffefef, #ffe4f1);
    border: 1px solid rgba(255, 130, 170, 0.3);
    color: #ff5c8d;
}

.quick-reply-btn.style-alt:hover,
.quick-reply-btn.style-alt:active {
    background: linear-gradient(135deg, #ffe4e4, #ffd9ea);
    box-shadow: 0 3px 8px rgba(255, 92, 141, 0.15);
}

.quick-reply-btn.style-alt2 {
    background: linear-gradient(135deg, #f0fff0, #e4ffe4);
    border: 1px solid rgba(92, 204, 92, 0.3);
    color: #4ca64c;
}

.quick-reply-btn.style-alt2:hover,
.quick-reply-btn.style-alt2:active {
    background: linear-gradient(135deg, #e4ffe4, #d8ffd8);
    box-shadow: 0 3px 8px rgba(76, 166, 76, 0.15);
}

/* 修复输入框上方的空间，防止和快捷回复重叠 */
.chat-messages {
    padding-bottom: 80px;
}

/* 修复闪图在消息区域被压缩的问题 */
.message.flash-message {
    max-width: initial !important; /* 覆盖普通消息的max-width限制 */
    width: 130px !important;
    height: 130px !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
}

.message.flash-message.sent,
.message.flash-message.received {
    min-width: 130px !important;
    min-height: 130px !important;
    width: 130px !important;
    height: 130px !important;
    flex-basis: 130px !important;
}

/* 确保闪图容器不会被压缩 */
.flash-message-container {
    flex-shrink: 0 !important;
    min-width: 100% !important;
    min-height: 100% !important;
}

/* 确保messages-area中的闪图保持尺寸 */
#messages-area .flash-message {
    flex-shrink: 0 !important;
    min-width: 130px !important;
    min-height: 130px !important;
}

/* AI Report Message Styles */
.message.ai_report,
.message.ai_report.loading,
.message.ai_report.done {
    display: block !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
}

.message.ai_report .message-content,
.message.ai_report.loading .message-content,
.message.ai_report.done .message-content {
    display: block !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    padding: 0 !important;
    margin: 0 !important;
}

.ai-report-message.loading {
    display: flex;
    flex-direction: row;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    font-size: 16px;
    color: #888;
    gap: 12px;
    padding: 0 !important;
    margin: 0 !important;
}

.ai-loading-dots {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chat-primary-color, #3b82f6);
    opacity: 0.3;
    animation: ai-dot-fade 1.2s infinite;
}

.ai-loading-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes ai-dot-fade {
    0%, 80%, 100% { opacity: 0.3; }
    40% { opacity: 1; }
}

.ai-loading-text {
    margin-left: 16px;
    font-size: 15px;
    color: #888;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.ai-report-details {
    width: 100%;
}

.ai-report-summary {
    display: flex;
    align-items: center;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    padding: 8px 0;
    user-select: none;
}

.ai-report-icon {
    margin-right: 8px;
    color: var(--chat-primary-color);
}

.ai-report-content {
    margin-top: 10px;
    padding: 10px;
    border-top: 1px solid #eaeaea;
    font-size: 14px;
}

.ai-report-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #eaeaea;
    font-size: 12px;
    color: #888;
}

.ai-report-time {
    font-style: italic;
}

.ai-report-delete {
    background: transparent;
    border: none;
    color: #ff4757;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    transition: background-color 0.2s;
}

.ai-report-delete:hover {
    background-color: rgba(255, 71, 87, 0.1);
}

.ai-report-error {
    display: flex;
    align-items: center;
    color: #ff4757;
    padding: 8px 0;
}

.ai-report-error svg {
    margin-right: 8px;
    flex-shrink: 0;
}

/* 折叠/展开动画 */
.ai-report-details[open] .ai-report-content {
    animation: report-expand 0.3s ease-out;
}

@keyframes report-expand {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 改进details的展开标记样式 */
.ai-report-details summary {
    list-style: none;
}

.ai-report-details summary::-webkit-details-marker {
    display: none;
}

/* 分析内容样式增强 */
.ai-report-content .analysis-heading {
    font-size: 1.2rem;
    color: #2c3e50;
    margin: 20px 0 15px;
    font-weight: 600;
    background: #fafafa;
    padding: 12px 15px;
    border-radius: 6px;
    border-left: 4px solid #ff2442;
    box-shadow: 0 2px 8px rgba(255, 36, 66, 0.08);
}

.ai-report-content .analysis-subheading {
    font-size: 1.1rem;
    color: #2c3e50;
    margin: 15px 0 10px;
    font-weight: 500;
    background: #fafafa;
    padding: 10px 15px;
    border-radius: 6px;
    border-left: 3px solid #ff2442;
}

.ai-report-content .score-highlight {
    background: linear-gradient(90deg, #ff2442 0%, #ff4757 100%);
    color: #fff;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin: 15px 0;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(255, 36, 66, 0.12);
}

.ai-report-content .score-number {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.ai-report-content .score-text {
    font-size: 1.1rem;
    opacity: 0.9;
}

.ai-report-content .key-insight {
    background: #fffbe6;
    border-left: 4px solid #fbbc05;
    color: #333;
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
    font-weight: 500;
}

.ai-report-content .key-insight strong {
    color: #fbbc05;
}

.ai-report-content .highlight-number {
    color: #4285f4;
    font-weight: bold;
}

/* 折叠箭头动画 */
.collapse-indicator svg {
    transition: transform 0.3s cubic-bezier(0.33, 1, 0.68, 1);
}
.collapsible-report .collapse-indicator svg {
    transform: rotate(0deg);
}
.collapsible-report:not(.collapsed) .collapse-indicator svg {
    transform: rotate(180deg);
}

/* 确保所有相关元素都没有圆角 */
#app {
    border-radius: 0 !important;
}

/* 确保chat-window和header完全没有圆角 */
.chat-window {
    border-radius: 0 !important;
}
.chat-header {
    border-radius: 0 !important;
}

/* 修复冲突：先移除通配符选择器以避免影响所有子元素 */
/* .chat-window * {
    border-radius: 0 !important;
} */

/* 保留特定元素的圆角，如头像、按钮等 */
.chat-avatar {
    border-radius: 50% !important;
}
.close-chat {
    border-radius: 50% !important;
}
.view-original-btn {
    border-radius: 4px !important;
}
.chat-messages::-webkit-scrollbar-thumb {
    border-radius: 4px !important;
}

/* 恢复消息气泡的圆角样式 */
.message-content {
    border-radius: 4px 16px 16px 16px !important;
}
.message.sent .message-content {
    border-radius: 18px 18px 4px 18px !important;
}
.message.received .message-content {
    border-radius: 18px 18px 18px 4px !important;
}

/* 确保emoji图片大小与文本一致 */
.message-content img[src*="twemoji"] {
    width: 1em !important;
    height: 1em !important;
    vertical-align: middle !important;
}

/* 同样处理emoji选择器中的emoji */
.emoji-item-btn img {
    width: 1em !important;
    height: 1em !important;
    vertical-align: middle !important;
}

.tool-btn:nth-child(1) {
    animation-delay: 0.05s;
}

.tool-btn:nth-child(2) {
    animation-delay: 0.1s;
}

.tool-btn:nth-child(3) {
    animation-delay: 0.15s;
}

.tool-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    background: #e8eaed;
}

.tool-btn .tool-icon {
    font-size: 20px;
    color: #333;
}

.tool-label {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    transition: all 0.2s;
    pointer-events: none;
}

.tool-btn:hover .tool-label {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 工具菜单布局优化 */
.tools-menu.visible {
    display: flex;
    justify-content: space-evenly;
    width: calc(100% - 60px);
}

.tools-menu.visible .tool-btn {
    flex: 0 0 auto;
    margin: 0 5px;
}

/* 确保工具图标在按钮中居中 */
.tool-btn .tool-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* 移除工具按钮之间的间距，使用flex布局控制 */
.tool-btn {
    margin: 0;
    flex: 1;
    max-width: 60px;
}

.expanded-menu-content {
    display: flex;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    visibility: hidden;
    transition: max-height 0.28s cubic-bezier(0.33, 1, 0.68, 1), opacity 0.22s ease, visibility 0.22s ease, transform 0.28s cubic-bezier(0.33, 1, 0.68, 1);
    background: #f5f5f5;
    width: 100%;
    box-sizing: border-box;
    transform: translateY(8px);
}
.chat-input-area.expanded .expanded-menu-content {
    display: flex;
    max-height: 160px;
    opacity: 1;
    visibility: visible;
    padding: 15px 15px max(15px, env(safe-area-inset-bottom)) 15px;
    flex-direction: row;
    justify-content: space-evenly;
    align-items: stretch;
    gap: 12px;
    transform: translateY(0);
}

.menu-item {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    border-radius: 10px;
    background: #f5f5f5;
    cursor: pointer;
    text-align: center;
    font-size: 13px;
    color: #555;
    transition: background 0.2s;
    margin: 0;
}

.menu-item:hover {
    background: #e0e0e0;
}

.menu-item .icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-bottom: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    color: #333;
    box-shadow: none;
}

.action-button .plus-icon {
    transition: transform 0.3s cubic-bezier(.4,2,.6,1);
}
.chat-input-area.expanded .action-button .plus-icon {
    transform: rotate(135deg);
}

/* 防止 emoji-bar 被压缩塌陷 */
#emoji-bar {
    flex: none !important;
    min-height: 52px !important;
    height: 52px !important;
    box-sizing: border-box !important;
}

.chat-input-area {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    --expanded-menu-height: 160px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
/* 保持原有位置，不通过 padding-bottom 推动容器，避免过度上移 */

.input-container {
    flex: none;
}

/* 确保 chat-input-area 在键盘弹出时保持完整高度，防止内容被裁剪/下移 */
/* 强制其 position: fixed 到视口底部，并固定高度 */
/*
body.keyboard-prepared .chat-input-area,
body.ios-keyboard-ready .chat-input-area {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 140px !important;
    overflow: visible !important;
    box-sizing: border-box !important;
    transform: none !important;
    -webkit-transform: none !important;
    margin: 0 !important;
    padding-top: 8px !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    padding-bottom: max(8px, env(safe-area-inset-bottom)) !important;
    z-index: 10000;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: normal !important;
}
*/

/* AI报告卡片样式 */
.ai-report-card {
    background: linear-gradient(145deg, #fefefe, #faf9f9);
    border-radius: 16px;
    box-shadow: 0 10px 20px rgba(255, 36, 66, 0.08);
    padding: 20px;
    margin: 15px auto;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    position: relative;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 280px;
    overflow: hidden;
}

.ai-report-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff2442, #ff4757);
}

.ai-report-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(255, 36, 66, 0.12);
}

.ai-report-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff2442, #ff4757);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    box-shadow: 0 4px 10px rgba(255, 36, 66, 0.2);
}

.ai-report-card-icon svg {
    width: 28px;
    height: 28px;
    color: white;
}

.ai-report-card-title {
    font-weight: 600;
    font-size: 1.15em;
    color: #2c2c2c;
    margin-bottom: 8px;
}

.ai-report-card-summary {
    color: #666666;
    font-size: 0.95em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-width: 100%;
    line-height: 1.5;
}

/* 全新设计的报告展开状态 - 小红书风格柔和红色系 */
.ai-report-expanded {
    background: white;
    border-radius: 20px;
    box-shadow: 0 12px 30px rgba(255, 36, 66, 0.08);
    margin: 15px auto 25px auto;
    padding: 25px 30px;
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid #f5f5f5;
}

.ai-report-expanded::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    border-radius: 20px 20px 0 0;
    background: linear-gradient(90deg, #ff2442, #ff4757);
}

.ai-report-collapse-button {
    position: absolute;
    top: 18px;
    right: 18px;
    background: #f8f8f8;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 5;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.ai-report-collapse-button:hover {
    background: #eeeeee;
    transform: rotate(90deg);
}

.ai-report-collapse-button svg {
    width: 18px;
    height: 18px;
    color: #ff2442;
}

/* 美化报告内容样式 - 小红书风格柔和红色系 */
.ai-report-expanded .analysis-heading {
    color: #2c2c2c;
    font-weight: 600;
    font-size: 1.2em;
    margin: 20px 0 15px;
    padding: 10px 15px;
    background: #fafafa;
    border-left: 4px solid #ff2442;
    border-radius: 0 6px 6px 0;
}

.ai-report-expanded .analysis-list-item {
    margin: 12px 0;
    line-height: 1.6;
    color: #333333;
}

.ai-report-expanded .analysis-list-item::before {
    background: #ff2442;
}

.ai-report-expanded .ai-report-footer {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.ai-report-expanded .ai-report-time {
    font-size: 0.9em;
    color: #999999;
}

/* 屏蔽AI报告区域的抖动效果，保持专业性 */
.ai-report-card,
.ai-report-card *,
.ai-report-expanded,
.ai-report-expanded *,
.ai-report-collapse-button,
.message.ai_report,
.message.ai_report * {
    /* 禁用点击抖动效果 */
    transform: none !important;
    transition: background-color 0.2s ease, opacity 0.2s ease !important;
}

/* AI报告卡片和按钮的专业交互效果 */
.ai-report-card:active {
    opacity: 0.9;
    transform: none !important;
}

.ai-report-collapse-button:active {
    opacity: 0.8;
    transform: none !important;
}

/* 确保AI报告区域内的所有元素都不会有抖动效果 */
.ai-report-card.clicked,
.ai-report-card .clicked,
.ai-report-expanded.clicked,
.ai-report-expanded .clicked,
.ai-report-collapse-button.clicked {
    transform: none !important;
    animation: none !important;
}
















