/* 更新后的前端聊天样式 */
#chat-system-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

#chat-toggle-button {
    background: #4a6ee0;
    color: white;
    padding: 12px 18px;
    border-radius: 25px;
    cursor: pointer;
    text-align: center;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    font-size: 14px;
    border: none;
}

#chat-toggle-button:hover {
    background: #3a5bd0;
    transform: translateY(-2px);
}

#chat-toggle-button.has-unread::after {
    content: '';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 12px;
    height: 12px;
    background: #ff4757;
    border-radius: 50%;
    border: 2px solid white;
}

.chat-icon {
    font-size: 18px;
}

.chat-text {
    font-weight: 500;
}

#chat-window {
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    margin-top: 10px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.chat-header {
    background: #4a6ee0;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.close-chat {
    font-size: 20px;
    cursor: pointer;
    font-weight: bold;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.close-chat:hover {
    opacity: 1;
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f8f9fa;
    scroll-behavior: smooth;
}

/* 自定义滚动条 */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 80%;
    position: relative;
    animation: fadeIn 0.3s ease;
    line-height: 1.4;
    font-size: 14px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-message {
    background: #4a6ee0;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 5px;
}

.admin-message {
    background: #f1f1f1;
    border-bottom-left-radius: 5px;
    margin-right: auto;
}

.system-message {
    background: #fff8e1;
    text-align: center;
    margin: 0 auto 15px auto;
    max-width: 90%;
    font-size: 13px;
    color: #666;
}

.message p {
    margin: 0 0 5px 0;
    word-break: break-word;
}

.message-time {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    display: block;
    text-align: right;
}

.admin-message .message-time {
    color: #999;
}

.chat-input {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    background: white;
    align-items: center;
}

#chat-message-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 24px;
    resize: none;
    min-height: 50px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#chat-message-input:focus {
    border-color: #4a6ee0;
}

#send-message-btn {
    margin-left: 10px;
    background: #4a6ee0;
    color: white;
    border: none;
    border-radius: 24px;
    padding: 0 20px;
    cursor: pointer;
    font-weight: 500;
    height: 44px;
    transition: background 0.3s;
    font-size: 14px;
}

#send-message-btn:hover {
    background: #3a5bd0;
}

/* 输入框占位符样式 */
#chat-message-input::placeholder {
    color: #aaa;
}

/* 消息输入时的打字指示器 */
.typing-indicator {
    display: flex;
    padding: 8px 15px;
    background: #f1f1f1;
    border-radius: 18px;
    margin-bottom: 10px;
    width: fit-content;
    font-size: 13px;
    color: #666;
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    margin: 0 2px;
    animation: typing 1.4s infinite both;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0% { opacity: 0.4; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-3px); }
    100% { opacity: 0.4; transform: translateY(0); }
}
/* 未读消息气泡 */
.unread-count-bubble {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid white;
}

/* 客服状态指示 */
.chat-status {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #666;
    margin-top: 3px;
}

.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-indicator.online {
    background: #4CAF50;
}

.status-indicator.offline {
    background: #ccc;
}

/* 聊天头部信息 */
.chat-header-info {
    flex: 1;
}

.chat-header {
    display: flex;
    align-items: center;
}

/* 发送按钮样式 */
#send-message-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: #4a6ee0;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: background 0.3s;
}

#send-message-btn:hover {
    background: #3a5bd0;
}

#send-message-btn svg {
    width: 20px;
    height: 20px;
}