/* 移动设备适配样式 */
.mobile-device {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent; /* 移除点击高亮效果 */
}

/* 为确保全局触摸处理，也应用到body元素 */
.mobile-device body {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none; /* 防止iOS橡皮筋效果 */
}

/* 基础移动端调整 */
@media (max-width: 768px) {
    html, body {
        font-size: 14px;
        width: 100%;
        height: 100%;
        position: relative;
        overflow-x: hidden;
        overscroll-behavior: none; /* 防止整页回弹 */
    }
    
    /* 聊天容器调整 */
    .chat-container {
        display: flex;
        flex-direction: column;
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100); /* 使用自定义vh变量，解决移动浏览器viewport高度问题 */
        max-width: 100%;
        margin: 0;
        padding: 0;
    }
    
    /* 头像区域调整 */
    .avatar-container {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
        padding: 15px 0;
        display: flex;
        justify-content: center;
        will-change: transform; /* 优化动画性能 */
    }
    
    .avatar-wrapper {
        width: 110px;
        height: 110px;
        margin: 0 auto;
        will-change: transform; /* 优化动画性能 */
    }
    
    /* 微信浏览器特殊处理 */
    .wechat-browser .avatar-wrapper {
        width: 120px;
        height: 120px;
    }
    
    .wechat-browser .avatar-image {
        width: 120px;
        height: 120px;
        border-radius: 60px;
        object-fit: cover;
        border: 3px solid var(--primary-color);
        backface-visibility: hidden; /* 优化渲染性能 */
    }
    
    /* 聊天头部调整 */
    .chat-header {
        padding: 10px;
        background-color: rgba(255, 255, 255, 0.1);
        z-index: 10;
        position: relative;
        backdrop-filter: blur(5px); /* 添加毛玻璃效果，提升UI质感 */
        -webkit-backdrop-filter: blur(5px); /* Safari 支持 */
    }
    
    .chat-header h1 {
        font-size: 18px;
        margin: 0; /* 去除默认边距 */
    }
    
    /* 聊天消息区域调整 */
    .chat-messages {
        padding: 10px;
        flex-grow: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth; /* 平滑滚动 */
        overscroll-behavior: contain; /* 防止滚动穿透 */
    }
    
    .message {
        max-width: 90%;
        margin-bottom: 10px;
        transform: translateZ(0); /* 启用GPU加速，提高滚动性能 */
    }
    
    /* 输入区域调整 */
    .chat-input {
        padding: 8px max(10px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-right));
        background-color: rgba(255, 255, 255, 0.9);
        border-radius: 24px;
        margin: 0;
        width: 100%;
        box-sizing: border-box;
        position: relative;
        z-index: 20; /* 确保在其他元素之上 */
    }
    
    .chat-input input {
        font-size: 16px; /* 防止iOS缩放 */
        border: none; /* 移除边框 */
        outline: none; /* 移除轮廓 */
    }
    
    /* 按钮调整 */
    .voice-button,
    .send-button,
    .settings-button {
        min-width: 44px; /* 符合可访问性标准的触摸区域大小 */
        min-height: 44px;
        border-radius: 50%; /* 确保圆形按钮 */
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background-color 0.3s, transform 0.2s; /* 平滑过渡效果 */
    }
    
    .voice-button:active,
    .send-button:active,
    .settings-button:active {
        transform: scale(0.95); /* 按下效果 */
    }
    
    /* 设置面板调整 */
    .settings-panel {
        position: fixed;
        top: 0;
        left: auto;  /* 修改为自动而不是0 */
        right: -100%; /* 默认隐藏在右侧屏幕外 */
        width: 100%;
        height: 100%;
        height: calc(var(--vh, 1vh) * 100); /* 使用自定义vh变量 */
        z-index: 1000;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background-color: rgba(255, 255, 255, 0.98); /* 稍微调亮背景 */
        transform: translateZ(0); /* GPU加速 */
        transition: right 0.3s ease; /* 确保有过渡动画 */
    }
    
    /* 激活状态 */
    .settings-panel.active {
        right: 0;
    }
    
    .settings-header {
        padding: 12px;
        position: sticky; /* 使标题固定在顶部 */
        top: 0;
        background-color: inherit;
        z-index: 10;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1); /* 添加分隔线 */
    }
    
    .settings-content {
        padding: 12px;
        height: calc(100vh - 60px);
        height: calc(var(--vh, 1vh) * 100 - 60px); /* 使用自定义vh变量 */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 角色卡片调整 */
    .role-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 16px; /* 增加底部空间 */
    }
    
    /* 表单元素优化 */
    input, select, textarea {
        font-size: 16px !important; /* 防止iOS缩放 */
        appearance: none; /* 移除原生样式 */
        -webkit-appearance: none;
    }
    
    /* 改善触摸区域 */
    button, .role-card, select, input[type="checkbox"], input[type="radio"] {
        cursor: pointer;
        touch-action: manipulation;
    }
    
    button {
        appearance: none; /* 移除默认按钮样式 */
        -webkit-appearance: none;
    }
    
    /* 横屏模式优化 */
    @media (orientation: landscape) {
        .avatar-container {
            padding: 5px 0;
        }
        
        .avatar-wrapper {
            width: 80px;
            height: 80px;
        }
        
        .wechat-browser .avatar-wrapper {
            width: 90px;
            height: 90px;
        }
        
        .wechat-browser .avatar-image {
            width: 90px;
            height: 90px;
            border-radius: 45px;
        }
        
        .chat-messages {
            max-height: calc(100vh - 100px);
            max-height: calc(var(--vh, 1vh) * 100 - 100px); /* 使用自定义vh变量 */
        }
        
        .role-grid {
            grid-template-columns: repeat(3, 1fr); /* 横屏时显示更多列 */
        }
    }
}

/* 微信浏览器特殊处理 */
.wechat-browser {
    -webkit-text-size-adjust: 100% !important;
}

.wechat-browser .chat-input {
    padding: 8px max(10px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-right));
    background-color: rgba(255, 255, 255, 0.95); /* 增加不透明度 */
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    backdrop-filter: blur(10px); /* 毛玻璃效果 */
    -webkit-backdrop-filter: blur(10px);
}

/* 微信音频样式 */
.wechat-browser .avatar-wrapper.speaking {
    position: relative;
}

.wechat-browser .avatar-wrapper.speaking .avatar-image {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color-translucent);
}

.wechat-browser .message.bot {
    position: relative;
}

.wechat-browser .message.bot .message-content {
    padding-right: 25px; /* 为音频播放按钮留出空间 */
}

/* 特别处理iOS系统 */
.wechat-browser.ios-device .sound-wave-container {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.wechat-browser.ios-device audio {
    visibility: hidden;
    position: absolute;
    top: -9999px;
    left: -9999px;
}

/* 修复iOS中的滚动问题 */
.wechat-browser.ios-device .chat-messages {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

/* 确保微信中的提示在页面上层 */
.wechat-tip {
    z-index: 9999 !important;
}

/* 微信浏览器中的录音按钮样式 */
.wechat-browser .voice-button {
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    transform: translateZ(0); /* 启用GPU加速 */
}

.wechat-browser .voice-button:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: scale(0);
    transition: transform 0.3s ease;
}

.wechat-browser .voice-button:active:before,
.wechat-browser .voice-button.touch-active:before {
    transform: scale(1);
}

.wechat-browser .voice-button.wechat-active {
    background-color: #ff4d4f !important;
    transform: scale(1.1);
    animation: wechat-pulse 1.5s infinite;
    animation-fill-mode: forwards; /* 确保动画结束时保持结束状态 */
}

/* 确保停止录音时立即停止动画 */
.wechat-browser .voice-button:not(.wechat-active) {
    background-color: transparent !important;
    transform: scale(1);
    animation: none;
    box-shadow: none;
}

.wechat-browser .voice-button.wechat-requesting {
    background-color: #ffec3d !important;
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(255, 236, 61, 0.7);
}

@keyframes wechat-pulse {
    0% { transform: scale(1.05); box-shadow: 0 0 0 0 rgba(255, 77, 79, 0.5); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(255, 77, 79, 0); }
    100% { transform: scale(1.05); box-shadow: 0 0 0 0 rgba(255, 77, 79, 0); }
}

/* 微信浏览器中的删除文件确认框 */
.wechat-confirm-box {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: calc(var(--vh, 1vh) * 100); /* 使用自定义vh变量 */
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
    -webkit-animation: fadeIn 0.2s ease; /* Safari 支持 */
    transform: translateZ(0); /* 启用GPU加速 */
}

.wechat-confirm-content {
    width: 80%;
    max-width: 300px;
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: scaleIn 0.2s ease;
    -webkit-animation: scaleIn 0.2s ease; /* Safari 支持 */
    transform: translateZ(0); /* 启用GPU加速 */
}

.wechat-confirm-message {
    padding: 20px 16px;
    text-align: center;
    font-size: 16px;
    color: #333;
    border-bottom: 1px solid #eee;
    word-break: break-word; /* 防止文本溢出 */
}

.wechat-confirm-buttons {
    display: flex;
    height: 44px;
}

.wechat-confirm-buttons button {
    flex: 1;
    border: none;
    background: none;
    font-size: 16px;
    font-weight: 500;
    padding: 12px 0;
    transition: background-color 0.2s;
    height: 100%; /* 确保按钮占满高度 */
    min-height: 44px; /* 确保最小触摸区域 */
}

.wechat-cancel-btn {
    color: #888;
    border-right: 1px solid #eee;
}

.wechat-confirm-btn {
    color: var(--primary-color, #4A90E2);
}

.wechat-confirm-buttons button:active {
    background-color: #f5f5f5;
}

/* 微信浏览器中的加载指示器 */
.wechat-loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: calc(var(--vh, 1vh) * 100); /* 使用自定义vh变量 */
    background-color: rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    color: white;
    font-size: 14px;
    transform: translateZ(0); /* 启用GPU加速 */
}

.wechat-spinner {
    width: 40px;
    height: 40px;
    margin-bottom: 10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: wechat-spin 1s ease-in-out infinite;
    -webkit-animation: wechat-spin 1s ease-in-out infinite; /* Safari 支持 */
}

@keyframes wechat-spin {
    to { transform: rotate(360deg); }
}

@-webkit-keyframes wechat-spin {
    to { -webkit-transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@-webkit-keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.9); }
    to { transform: scale(1); }
}

@-webkit-keyframes scaleIn {
    from { -webkit-transform: scale(0.9); }
    to { -webkit-transform: scale(1); }
}

/* 微信浏览器中的提示样式 */
.wechat-tip {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 2010; /* 确保在所有元素之上 */
    max-width: 80%;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); /* 增加阴影 */
    animation: tipFadeIn 0.3s ease; /* 添加动画 */
    pointer-events: none; /* 防止阻挡下方元素点击 */
    word-break: break-word; /* 防止长文本溢出 */
}

@keyframes tipFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, 10px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* 禁用微信浏览器中的长按选择文本 - 已移除，允许用户复制消息 */
.wechat-browser * {
    -webkit-touch-callout: none; /* 保留这个，防止长按时弹出菜单 */
    /* -webkit-user-select: none; */ /* 移除，允许选择 */
    /* user-select: none; */ /* 移除，允许选择 */
}

.wechat-browser .message {
    -webkit-user-select: text; /* 允许选择消息文本 */
    user-select: text;
}

.wechat-browser input,
.wechat-browser textarea {
    -webkit-user-select: auto; /* 输入框内仍允许正常选择 */
    user-select: auto;
}

/* 解决iOS上的问题 */
@supports (-webkit-touch-callout: none) {
    .chat-input {
        padding-bottom: env(safe-area-inset-bottom, 8px);
    }
    
    .settings-content {
        padding-bottom: env(safe-area-inset-bottom, 20px);
    }
    
    /* 修复iOS Safari中的高度问题 */
    .chat-container, 
    .settings-panel,
    .wechat-confirm-box,
    .wechat-loading-indicator {
        height: -webkit-fill-available; /* 使用可用高度 */
    }
}

/* 录音按钮特效 */
.voice-button.active {
    background-color: #ff4b4b;
    color: white;
    animation: pulse 1.5s infinite;
    -webkit-animation: pulse 1.5s infinite; /* Safari 支持 */
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 75, 75, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 75, 75, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 75, 75, 0);
    }
}

@-webkit-keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 75, 75, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 75, 75, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 75, 75, 0);
    }
}

/* 声波动画适配 */
.sound-wave-container {
    bottom: -5px;
    transform: translateZ(0); /* 启用GPU加速 */
}

.sound-wave {
    height: 16px;
    width: 40px;
}

.sound-wave span {
    width: 2px;
    margin: 0 1px;
    will-change: transform; /* 优化动画性能 */
}

/* 优化键盘显示时的布局 - 保留简化版 */
body.keyboard-visible .chat-messages {
    /* 保持足够的聊天区域空间 */
    max-height: 60vh;
    max-height: calc(var(--vh, 1vh) * 60);
    /* 移除过渡动画 */
    transition: none;
}

/* 简化头像容器在键盘显示时的行为 */
body.keyboard-visible .avatar-container {
    /* 移除缩放效果 */
    transform: none;
    /* 直接隐藏以提供更多聊天空间 */
    display: none;
}

/* 简化输入框在键盘显示时的样式 */
body.keyboard-visible .chat-input {
    /* 保持自然位置 */
    position: relative;
    bottom: 0;
    /* 保留基本阴影区分边界 */
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05);
    /* 移除过渡效果 */
    transition: none;
}

/* 微信浏览器特殊处理 */
.wechat-browser body.keyboard-visible .chat-messages {
    padding-bottom: 10px;
}

.wechat-browser body.keyboard-visible .avatar-container {
    /* 与普通设备保持一致 */
    display: none;
}

/* 适应不同设备的安全区域 */
@supports (padding: max(0px)) {
    .chat-input {
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
}

/* 录音相关样式 */
.audio-message {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.audio-message audio {
    width: 100%;
    height: 36px;
    border-radius: 18px;
    background-color: #f0f0f0;
}

.speech-input-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 5px;
    margin-top: 5px;
    position: relative;
}

.help-text {
    font-size: 13px;
    color: #666;
    margin-bottom: 5px;
}

.speech-input-field {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 18px;
    font-size: 16px; /* 增加字体大小以避免iOS缩放 */
    background-color: #fff;
    min-height: 42px; /* 更高的触摸区域 */
    padding-right: 45px; /* 为按钮腾出更多空间 */
    outline: none;
    transition: all 0.3s ease;
    -webkit-appearance: none; /* 移除iOS默认样式 */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); /* 轻微阴影增强可见性 */
}

.speech-input-field:focus {
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2); /* 聚焦时的光晕效果 */
    transform: translateY(-1px); /* 轻微上移效果 */
}

.speech-input-field:focus {
    /* 简化聚焦效果，只保留边框颜色变化 */
    border-color: #1890ff;
    /* 移除变换和阴影效果 */
    box-shadow: none;
    transform: none;
}

.speech-send-button {
    position: absolute;
    right: 6px;
    bottom: 5px;
    border: none;
    background-color: #1890ff;
    color: white;
    border-radius: 50%;
    width: 36px; /* 更大的触摸区域 */
    height: 36px; /* 更大的触摸区域 */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); /* 增加阴影 */
    z-index: 2; /* 确保按钮在最上层 */
}

.speech-send-button:hover {
    background-color: #40a9ff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.speech-send-button:active {
    transform: scale(0.92);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 微信浏览器中发送按钮的特殊样式 */
.wechat-browser .speech-send-button {
    background-color: #07c160; /* 微信绿色 */
    box-shadow: 0 2px 6px rgba(7, 193, 96, 0.3);
}

.wechat-browser .speech-send-button:active {
    background-color: #06ad56;
    transform: scale(0.9);
}

/* 微信浏览器中的特殊样式 */
.wechat-browser .audio-message audio {
    background-color: rgba(255, 255, 255, 0.8);
}

.wechat-browser .speech-input-field {
    border-color: #e6e6e6;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.wechat-browser .speech-input-field:focus {
    border-color: #40a9ff;
    background-color: #fff;
}

/* 简化微信环境下输入框样式 */
.wechat-browser .speech-input-field {
    border-color: #e6e6e6;
    background-color: #fff;
    box-shadow: none;
    /* 移除模糊效果 */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.wechat-browser .speech-input-field:focus {
    /* 只改变边框颜色，不添加其他效果 */
    border-color: #40a9ff;
}

/* 录音播放提示样式 */
.recording-playback {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 18px;
    margin-bottom: 10px;
}

.recording-playback i {
    color: #1890ff;
    font-size: 16px;
}

.recording-playback span {
    font-size: 14px;
    color: #333;
}

/* 适配深色主题 */
@media (prefers-color-scheme: dark) {
    .audio-message audio {
        background-color: #333;
    }
    
    .speech-input-field {
        background-color: #333;
        border-color: #555;
        color: #fff;
    }
    
    .help-text {
        color: #bbb;
    }
    
    .recording-playback {
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    .recording-playback span {
        color: #ddd;
    }
    
    .wechat-confirm-content {
        background-color: #222;
    }
    
    .wechat-confirm-message {
        color: #eee;
        border-bottom-color: #444;
    }
    
    .wechat-cancel-btn {
        color: #aaa;
        border-right-color: #444;
    }
    
    .wechat-confirm-buttons button:active {
        background-color: #333;
    }
}

/* 微信浏览器中的特殊样式 */
.wechat-browser .avatar-container {
    padding: 10px 0;
    position: relative;
    z-index: 5;
}

.wechat-browser .avatar-image {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    will-change: transform, box-shadow; /* 优化动画性能 */
}

.wechat-browser .avatar-wrapper.speaking .avatar-image {
    border-color: rgba(24, 144, 255, 0.8);
    box-shadow: 0 0 15px rgba(24, 144, 255, 0.4);
}

/* 修复微信浏览器中的聊天区域，防止被输入框遮挡 */
.wechat-browser .chat-messages {
    /* padding-bottom: 70px; */ /* 移除，因为输入框不再fixed */
}

/* 安全区域处理 */
@supports (padding: max(0px)) {
    /* 底部安全区 */
    .chat-input,
    .settings-content,
    .wechat-tip {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
    
    /* 左右安全区 */
    .chat-container,
    .settings-panel {
        padding-left: env(safe-area-inset-left, 0);
        padding-right: env(safe-area-inset-right, 0);
    }
    
    /* 顶部安全区 */
    .settings-header {
        padding-top: max(12px, env(safe-area-inset-top));
    }
}

/* 添加正确的vh变量设置脚本，解决移动端viewport高度问题 */
/* 需要配合JS使用:
document.documentElement.style.setProperty('--vh', `${window.innerHeight * 0.01}px`);
window.addEventListener('resize', () => {
    document.documentElement.style.setProperty('--vh', `${window.innerHeight * 0.01}px`);
});
*/

/* 知识库文件条目优化 */
.knowledge-item {
    border-radius: 8px;
    transition: background-color 0.2s;
    overflow: hidden; /* 确保内容不溢出 */
}

.knowledge-item:active {
    background-color: rgba(0, 0, 0, 0.05); /* 点击反馈 */
}

.wechat-browser .knowledge-item {
    margin-bottom: 8px; /* 增加间距 */
}

/* 知识库删除按钮优化 */
.wechat-browser .action-button.delete {
    background-color: rgba(255, 77, 79, 0.1);
    color: #ff4d4f;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wechat-browser .action-button.delete:active {
    background-color: rgba(255, 77, 79, 0.2);
}

/* 小米浏览器特殊处理 */
.xiaomi-browser .settings-panel {
    right: -100% !important; /* 确保面板默认隐藏 */
    transform: translateX(100%); /* 使用transform作为备用定位方法 */
    transition: transform 0.3s ease, right 0.3s ease; /* 双重过渡 */
}

.xiaomi-browser .settings-panel.active {
    right: 0 !important;
    transform: translateX(0); /* 激活时移回可见区域 */
}

/* 增强小米浏览器中按钮的样式 */
.xiaomi-browser .close-button,
.xiaomi-browser .voice-button,
.xiaomi-browser .send-button {
    width: 44px;
    height: 44px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.05);
    color: #333;
}

/* 小米浏览器中按钮点击状态 */
.xiaomi-browser .voice-button.touch-active,
.xiaomi-browser .send-button.touch-active {
    background-color: rgba(24, 144, 255, 0.2);
    transform: scale(0.95);
}

/* 小米浏览器中录音按钮的激活状态 */
.xiaomi-browser .voice-button.wechat-active {
    background-color: #ff4d4f !important;
    color: white !important;
    transform: scale(1.05);
    animation: xiaomi-pulse 1.5s infinite;
}

@keyframes xiaomi-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 77, 79, 0.5); }
    50% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(255, 77, 79, 0.1); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 77, 79, 0); }
} 