/**
 * 原始css代码用于开发/阅读，生成环境请压缩后，替换到index-min.css
 * css压缩网站：https://www.sojson.com/format/css.html
 */

/* 全局样式，重置 html 和 body 高度及 margin */
html,
body {
    height: 100%;
    margin: 0;
}

body {
    font-family: Arial, sans-serif;
    background: #f2f2f2;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 15px 20px;
    box-sizing: border-box;
}

a {
    text-decoration: none;
}

p {
    margin: 5px;
}

/* 聊天容器样式 */
.chat-container {
    width: 100%;
    max-width: 450px;
    height: 100%;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* 聊天头部样式 */
.chat-header {
    background: #4CAF50;
    color: white;
    padding: 15px;
    text-align: center;
    font-size: 18px;
    flex-shrink: 0;
}

/* 聊天消息区域样式 */
.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f1f0f0;
}

/* 消息项基础样式 */
.message {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
}

/* 头像样式 */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ddd;
    flex-shrink: 0;
    margin-right: 10px;
}

/* 消息内容容器样式 */
.content {
    max-width: 80%;
}

/* 消息发送者标签样式 */
.label {
    font-weight: bold;
    margin-bottom: 5px;
    text-align: left;
}

/* 客户消息中的标签样式，设置右对齐 */
.customer .label {
    text-align: right;
}

/* 消息气泡基础样式 */
.bubble {
    background: white;
    padding: 10px 15px;
    border-radius: 10px;
    word-break: break-word;
}

/* 客户消息样式 */
.customer {
    flex-direction: row-reverse;
}

.customer .avatar {
    margin-left: 10px;
    margin-right: 0;
}

.customer .bubble {
    background: #e1ffc7;
}

/* 输入区域样式 */
.chat-input {
    height: 45px;
    display: flex;
    border-top: 1px solid #ccc;
    flex-shrink: 0;
}

.chat-input input {
    flex: 1;
    padding: 12px 10px;
    border: none;
    outline: none;
    font-size: 16px;
}

.chat-input button {
    padding: 0 20px;
    border: none;
    background: #4CAF50;
    color: white;
    cursor: pointer;
    font-size: 16px;
    flex-shrink: 0;
}

.chat-input button:hover {
    background: #45a049;
}

.chat-input input,
.chat-input #send_button,
.chat-input #voice_input {
    height: 100%;
    font-size: 16px;
    box-sizing: border-box;
}

/* 加载状态样式 */
.loading {
    font-style: italic;
    color: #888;
    text-align: center;
    padding: 10px 0;
    background: #f1f0f0;
}

.dots::after {
    content: '';
    animation: dots 1.5s steps(3, end) infinite;
}

@keyframes dots {
    0% {
        content: '';
    }

    33% {
        content: '.';
    }

    66% {
        content: '..';
    }

    100% {
        content: '...';
    }
}

/* 反馈区域样式 */
.feedback {
    margin-top: 10px;
    text-align: center;
}

.feedback p {
    margin: 5px 0;
}

.feedback button {
    margin: 5px;
    padding: 5px 15px;
    border: none;
    background: #4CAF50;
    color: white;
    border-radius: 5px;
    cursor: pointer;
}

.feedback button:hover {
    background: #45a049;
}

/* 语音/文本切换按钮样式 */
.chat-input #toggle_voice {
    width: 50px;
    border: none;
    cursor: pointer;
    padding: 0px;
    font-size: 18px;
    text-align: center;
    border-right: 1px solid #ccc;
}

/* 语音输入按钮样式 */
.chat-input #voice_input {
    flex: 1;
    font-weight: bold;
    color: #000;
    padding: 12px 10px;
    border: none;
    background: #f9f9f9;
    font-size: 16px;
    text-align: center;
    cursor: pointer;
}

/* 录音中状态样式 */
.chat-input #voice_input.recording {
    background: #ff4d4d;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.chat-input #voice_input.recording::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: ripple 1.5s infinite;
}

@keyframes ripple {
    0% {
        width: 0;
        height: 0;
        opacity: 0.7;
    }

    100% {
        width: 200%;
        height: 200%;
        opacity: 0;
    }
}

/* 语音提示样式 */
#voice_tip {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 15px;
    border-radius: 5px;
    font-size: 14px;
    z-index: 1000;
}

/* 录音悬浮框样式 */
#recording_box {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 25px 35px;
    border-radius: 12px;
    text-align: center;
    z-index: 2000;
    width: 180px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s ease, transform 0.3s ease;
    /* 添加过渡效果 */
}

/* 录音悬浮框关闭动画 */
#recording_box.closing {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
}

#recording_box .mic-icon {
    width: 40px;
    height: 60px;
    margin: 0 auto 12px;
    background: url("https://img.icons8.com/ios-filled/50/ffffff/microphone.png") no-repeat center/contain;
}

/* 音量条样式 */
#recording_box .volume-bars {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 45px;
    margin-bottom: 10px;
}

#recording_box .volume-bars span {
    display: inline-block;
    width: 6px;
    margin: 0 2px;
    background: #4CAF50;
    border-radius: 2px;
    transition: height 0.1s ease, background 0.2s;
}

/* 录音提示文本样式 */
#recording_text {
    font-size: 14px;
    margin: 0;
}

#recording_text.cancel {
    color: red;
    font-weight: bold;
}

/* 语音播放按钮样式 */
.voice-play-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    background: transparent;
    color: #4CAF50;
    cursor: pointer;
    padding: 0;
    font-size: 14px;
}

/* 录音时长显示样式 */
.recording-time {
    font-size: 14px;
    margin-top: 8px;
    color: #fff;
}

/* 接近最大时长时的警告样式 */
.recording-time.warning {
    color: #ff9800;
    font-weight: bold;
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from {
        opacity: 1;
    }

    to {
        opacity: 0.7;
    }
}