/* 基础布局 */
/* 消息列表区域 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 80px;
    /*margin-top: 40px;*/
    padding: 20px;
}

/* 消息气泡样式 */
.message {
    display: flex;
    margin-bottom: 20px;
    position: relative;
}

.message.user {
    justify-content: flex-end;
}

/* 消息内容样式 */
.content {
    padding: 12px 1em;
    border-radius: 4px;
    font-size: 15px;
    line-height: 1.5;
    word-break: break-word;
    position: relative;
    user-select: text;
    -webkit-user-select: text;
    cursor: text;
}

/* 用户消息样式 */
.message.user .content {
    background: #95ec69;
    margin-right: 12px;
}

.message.user .content::before {
    content: '';
    position: absolute;
    right: -10px;
    top: 14px;
    width: 0;
    height: 0;
    border-left: 10px solid #95ec69;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

/* AI消息样式 */
.message.ai .content {
    background: #fff;
}

.message.ai .content::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 14px;
    width: 0;
    height: 0;
    border-right: 10px solid #fff;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

/* 图片样式 */
.content img {
    max-width: 100%;
    border-radius: 3px;
    margin: 4px 0;
    display: block;
}

/* 底部输入区域 */
.chat-input-container {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 80px;
    background: #f7f7f7;
    border-top: 1px solid #e5e7eb;
    padding: 15px;
    z-index: 1000;
}

.input-wrapper {
    max-width: 800px;
    height: 50px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 0 15px;
}

/* 输入框 */
textarea {
    flex: 1;
    height: 36px;
    border: none;
    resize: none;
    font-size: 15px;
    line-height: 36px;
    padding: 0;
    background: transparent;
}

textarea:focus {
    outline: none;
}

/* 按钮组 */
.action-buttons {
    display: flex;
    gap: 8px;
    margin-left: 10px;
}

.upload-btn, .camera-btn, .send-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    border: none;
}

.upload-btn, .camera-btn {
    background: transparent;
    color: #666;
}

.send-btn {
    background: #07c160;
    color: #fff;
}

/* 移动端适配 */
@media screen and (max-width: 768px) {
    .chat-messages {
        padding: 15px;
    }
    .chat-input-container {
        padding: 10px;
    }
    .input-wrapper {
        padding: 0 12px;
    }
}

/* 图片预览区域 */
.image-preview {
    padding: 8px 0;
    max-width: 120px;
}

.preview-container {
    position: relative;
    display: inline-block;
}

#previewImg {
    max-width: 100px;
    max-height: 100px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}

.remove-preview {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
}

.remove-preview:hover {
    background: rgba(0,0,0,0.7);
}

/* 修改复制按钮样式 */
.copy-btn {
    position: absolute;
    right: -30px;  /* 改为气泡外部 */
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: rgba(0,0,0,0.1);
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 1;  /* 始终显示 */
    transition: all 0.2s;
}

.copy-btn:hover {
    background: rgba(0,0,0,0.2);
    transform: translateY(-50%) scale(1.1);
}

.copy-btn.copied {
    background: #07c160;
    color: #fff;
}

/* 移动端适配 */
@media screen and (max-width: 768px) {
    .copy-btn {
        right: 5px;  /* 在移动端时放在气泡内部 */
        top: 10px;
        transform: none;
    }
    .copy-btn:hover {
        transform: scale(1.1);
    }
}

/* 添加思考中动画样式 */
.thinking {
    display: flex;
    align-items: center;
    padding: 20px;
    color: #666;
    font-size: 15px;
}

.thinking-dots {
    display: inline-block;
    margin-left: 4px;
    width: 20px;
}

.thinking-dots::after {
    content: '';
    animation: thinkingDots 1.5s infinite;
}

@keyframes thinkingDots {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
    100% { content: '.'; }
}

/* 模态框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: flex-end;
    z-index: 1000;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: #fff;
    width: 100%;
    max-height: 80vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.close-btn {
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0 8px;
}

.modal-body {
    padding: 16px;
}

.input-group {
    margin-bottom: 16px;
}

.input-group textarea {
    width: 100%;
    height: 120px;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    font-size: 16px;
    resize: none;
}

.button-group {
    text-align: center;
}

.submit-btn {
    background: #07c160;
    color: #fff;
    border: none;
    padding: 12px 32px;
    border-radius: 24px;
    font-size: 16px;
    cursor: pointer;
    width: 100%;
}

.submit-btn:active {
    opacity: 0.9;
}

/* 添加语音输入相关样式 */
.voice-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #07c160;
    cursor: pointer;
    font-size: 20px;
    margin-right: 10px;
    background: rgba(7, 193, 96, 0.1);
    border-radius: 50%;
}

.voice-btn:active {
    background: rgba(7, 193, 96, 0.2);
}

.hold-to-talk {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 10px;
}

.talk-btn {
    width: 100%;
    height: 36px;
    border: none;
    background: #fafafa;
    border-radius: 0;
    color: #333;
    font-size: 15px;
    text-align: center;
    line-height: 36px;
    cursor: pointer;
    padding: 0 15px;
    box-shadow: none;
    border: 1px solid #e5e7eb;
}

.talk-btn.recording {
    background: #f2f2f2;
    color: #07c160;
    border-color: #d1d1d1;
}