/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* 客服应用容器 */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
}

/* 客服头部样式 */
.header {
    position: sticky;
    top: 0;
    z-index: 101;
    background-color: #1e88e5;
    padding: 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #1976d2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-right: 15px;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.header-text {
    flex: 1;
}

.header-text h2 {
    font-size: 18px;
    color: #ffffff;
    margin-bottom: 8px;
}

.status-info {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
}

.online-time {
    margin-top: 4px;
}

/* 内容容器 */
.content-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 140px; /* 为底部区域预留空间 */
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

/* 常见问题区块 */
.faq-section {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.faq-section h3 {
    font-size: 16px;
    color: #1e88e5;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.faq-section h3::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    background-color: #1e88e5;
    border-radius: 2px;
}

/* 常见问题列表 */
.faq-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-item {
    background-color: #f8f9fa;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    position: relative;
    padding-right: 40px;
    font-size: 14px;
    line-height: 1.4;
}

.faq-item::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-right: 2px solid #999;
    border-bottom: 2px solid #999;
    transform: translateY(-50%) rotate(-45deg);
    transition: all 0.3s ease;
}

.faq-item:hover {
    background-color: #f0f7ff;
    border-color: #1e88e5;
}

.faq-item.active {
    background-color: #e3f2fd;
    border-color: #1e88e5;
    color: #1e88e5;
}

.faq-item.active::after {
    border-color: #1e88e5;
    transform: translateY(-50%) rotate(45deg);
}

/* 空状态提示 */
.faq-empty {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 14px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px dashed #ddd;
}

/* 消息气泡样式 */
.message-bubble {
    display: flex;
    align-items: start;
    gap: 12px;
    animation: fadeInUp 0.5s ease forwards;
    margin-bottom: 15px;
    position: relative;
}

/* 头像样式 */
.bubble-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-top: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    object-fit: cover;
    background-color: #fff;
}

/* 用户消息样式 */
.message-bubble.user-message {
    flex-direction: row-reverse;
}

.message-bubble.user-message .bubble-avatar {
    display: none; /* 用户消息不显示头像 */
}

.message-bubble.user-message .bubble-content {
    background-color: #007AFF;
    color: white;
    margin-left: auto; /* 确保用户消息靠右对齐 */
}

.message-bubble.user-message .bubble-content::before {
    left: auto;
    right: -8px;
    border-width: 8px 0 8px 8px;
    border-color: transparent transparent transparent #007AFF;
}

.message-bubble.user-message .bubble-timestamp {
    text-align: left;
}

/* 机器人消息样式 */
.message-bubble:not(.user-message) .bubble-content {
    background-color: #f0f0f0;
    color: #333;
}

.message-bubble:not(.user-message) .bubble-content::before {
    content: '';
    position: absolute;
    top: 12px;
    left: -8px;
    border-width: 8px 8px 8px 0;
    border-style: solid;
    border-color: transparent #f0f0f0 transparent transparent;
}

/* 气泡内容基础样式 */
.bubble-content {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 70%;
    position: relative;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 答案气泡容器 */
.bubbles-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 10px;
}

.bubble-timestamp {
    font-size: 10px;
    color: #999;
    margin-top: 4px;
}

/* 底部交互区域 */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #ffffff;
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.03);
    z-index: 100;
}

/* 快捷操作按钮 */
.quick-actions {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 15px;
    gap: 8px;
}

.action-btn {
    flex: none;
    padding: 4px 8px;
    border: 1px solid #333;
    border-radius: 3px;
    font-size: 12px;
    font-weight: normal;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background-color: #ffffff;
    color: #333;
    min-width: 60px;
}

.action-btn:hover {
    background-color: #f5f5f5;
}

/* 移除之前的颜色样式 */
.contact-btn, .auth-btn, .refund-btn {
    background-color: #ffffff;
    color: #333;
}

/* 消息输入区域 */
.message-input {
    display: flex;
    gap: 8px;
}

.message-input input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
    outline: none;
}

.message-input input:focus {
    border-color: #1e88e5;
    box-shadow: 0 0 0 2px rgba(30, 136, 229, 0.1);
}

.send-btn {
    background-color: #1e88e5;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 3px;
    font-size: 14px;
    font-weight: normal;
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-btn:hover {
    background-color: #1976d2;
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 骨架屏样式 */
.skeleton {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f5f5f5;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.skeleton-header {
    width: 100%;
    height: 60px;
    background: #e0e0e0;
    border-radius: 8px;
    margin-bottom: 15px;
}

.skeleton-faq {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skeleton-item {
    height: 40px;
    background: #e0e0e0;
    border-radius: 8px;
}

/* 错误提示 */
.error-message {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffebee;
    color: #c62828;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    text-align: center;
}

.error-message button {
    margin-top: 15px;
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-radius: 25px;
    background-color: #c62828;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.error-message button:hover {
    background-color: #b71c1c;
}

/* 移动端适配 */
@media (max-width: 600px) {
    .header {
        padding: 15px;
    }
    
    .avatar {
        width: 50px;
        height: 50px;
        margin-right: 12px;
    }
    
    .header-text h2 {
        font-size: 16px;
    }
    
    .content-container {
        padding: 15px;
        padding-bottom: 130px; /* 移动端底部预留空间稍小 */
    }
    
    .bottom-bar {
        padding: 12px 15px;
    }
    
    .faq-section {
        padding: 15px;
    }
    
    .faq-item {
        padding: 8px 10px;
        padding-right: 35px;
        font-size: 13px;
    }
    
    .faq-item::after {
        right: 14px;
    }
    
    .bubble-content {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .error-message {
        padding: 15px;
    }
    
    .faq-empty {
        padding: 15px;
    }
}
/* 后台管理入口 */
.admin-link {
    position: absolute;
    right: 15px;
    bottom: 140px;
    z-index: 100;
}

.admin-link a {
    display: inline-block;
    font-size: 12px;
    color: #999;
    text-decoration: none;
    padding: 5px 10px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 15px;
    transition: all 0.3s;
}

.admin-link a:hover {
    color: #1e88e5;
    background-color: #fff;
    border-color: #1e88e5;
}

@media (max-width: 600px) {
    .admin-link {
        bottom: 130px;
        right: 10px;
    }
    
    .admin-link a {
        font-size: 11px;
        padding: 4px 8px;
    }
}
