/* 客服聊天页面样式 */
.chat-container {
    display: flex;
    height: calc(100vh - 120px);
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 左侧会话列表 */
.chat-sidebar {
    width: 320px;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    background: #f9fafb;
}

.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.chat-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #374151;
}

.session-list {
    flex: 1;
    overflow-y: auto;
}

.session-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: all 0.2s ease;
    position: relative;
}

.session-item:hover {
    background: #f3f4f6;
}

.session-item.active {
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
}

.session-avatar {
    position: relative;
    margin-right: 12px;
}

.session-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e5e7eb;
}

.default-avatar-svg {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #e5e7eb;
}

.default-avatar-svg svg {
    width: 32px;
    height: 32px;
}

.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
}

.online-indicator.online {
    background: #10b981;
}

.online-indicator.offline {
    background: #6b7280;
}

.session-info {
    flex: 1;
    min-width: 0;
}

.session-name {
    font-weight: 600;
    color: #374151;
    font-size: 14px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.platform-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
}

.platform-badge.platform-web {
    background: #dbeafe;
    border-color: #3b82f6;
}

.platform-badge.platform-app,
.platform-badge.platform-ios,
.platform-badge.platform-android {
    background: #dcfce7;
    border-color: #10b981;
}

.platform-badge.platform-weixin {
    background: #fef3c7;
    border-color: #f59e0b;
}

.session-id {
    font-size: 11px;
    color: #9ca3af;
    margin-bottom: 4px;
}

.last-message {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.session-time {
    font-size: 11px;
    color: #9ca3af;
}

.unread-badge {
    position: absolute;
    top: 8px;
    right: 12px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #6b7280;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-text {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
}

.empty-desc {
    font-size: 14px;
    opacity: 0.8;
}

/* 右侧聊天区域 */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    height: 100%;
    position: relative;
}

.welcome-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #6b7280;
}

.welcome-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.welcome-message h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: #374151;
}

.welcome-message p {
    font-size: 14px;
    opacity: 0.8;
}

/* 聊天头部信息 */
.chat-header-info {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fafb;
    z-index: 5;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.user-avatar.default-avatar-svg {
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #e5e7eb;
}

.user-avatar.default-avatar-svg svg {
    width: 28px;
    height: 28px;
}

.user-name {
    font-weight: 600;
    color: #374151;
    font-size: 16px;
}

.user-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #6b7280;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.online {
    background: #10b981;
}

.status-dot.offline {
    background: #6b7280;
}

/* 消息容器 */
.messages-container {
    position: absolute;
    top: 80px;
    bottom: 140px;
    left: 0;
    right: 0;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
}

.message {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.message.user {
    align-items: flex-end;
}

.message.service {
    align-items: flex-start;
}

.message.system {
    align-items: center;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    position: relative;
}

.message.user .message-content {
    background: #3b82f6;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.service .message-content {
    background: white;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.message.system .message-content {
    background: #f3f4f6;
    color: #6b7280;
    font-size: 12px;
    border-radius: 12px;
    max-width: 50%;
}

.message-text {
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message-time {
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.7;
}

.message-sender {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
}

.message.user .message-sender {
    text-align: right;
}

.message.service .message-sender {
    text-align: left;
}

.message.system .message-sender {
    text-align: center;
}

/* 回复输入区域 */
.reply-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    background: white;
    z-index: 10;
}

.reply-input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#replyInput {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

#replyInput:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.reply-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.media-buttons {
    display: flex;
    gap: 8px;
}

.send-buttons {
    display: flex;
    gap: 8px;
}

.btn-media {
    padding: 6px 12px;
    font-size: 12px;
}

/* 媒体消息样式 */
.media-message {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.media-message img,
.media-message video {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.media-message img:hover {
    opacity: 0.9;
    transform: scale(1.02);
    transition: all 0.2s ease;
}

.media-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
    color: #6b7280;
}

.filename {
    font-weight: 500;
}

.filesize {
    opacity: 0.8;
}

/* 图片预览模态框 */
.image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    cursor: pointer;
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.close-btn {
    position: absolute;
    top: -40px;
    right: -40px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: white;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .chat-container {
        flex-direction: column;
        height: calc(100vh - 80px);
    }
    
    .chat-sidebar {
        width: 100%;
        height: 200px;
    }
    
    .session-list {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
    }
    
    .session-item {
        min-width: 200px;
        flex-shrink: 0;
    }
}

/* 按钮样式 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-outline {
    background: transparent;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.btn-outline:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* 滚动条样式 */
.session-list::-webkit-scrollbar,
.messages-container::-webkit-scrollbar {
    width: 6px;
}

.session-list::-webkit-scrollbar-track,
.messages-container::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.session-list::-webkit-scrollbar-thumb,
.messages-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.session-list::-webkit-scrollbar-thumb:hover,
.messages-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
