/* 聊天悬浮按钮 */
.chat-float-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-float-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
}

.chat-float-btn.hidden {
    display: none;
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 22px;
    height: 22px;
    background: #ef4444;
    color: white;
    font-size: 12px;
    font-weight: 600;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 聊天窗口 */
.chat-widget {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 1600;
    overflow: hidden;
    transform: scale(0);
    opacity: 0;
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.chat-widget.active {
    transform: scale(1);
    opacity: 1;
}

/* 聊天头部 */
.chat-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.chat-title i {
    font-size: 20px;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 聊天主体 */
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 消息样式 */
.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
}

.message.system {
    justify-content: center;
    max-width: 100%;
}

.message.system .message-content {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    font-size: 13px;
    padding: 8px 16px;
    border-radius: 20px;
}

.message.received {
    align-self: flex-start;
}

.message.sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

.message.sent .message-avatar {
    background: var(--accent-color);
}

.message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
}

.message.received .message-content {
    border-bottom-left-radius: 4px;
}

.message.sent .message-content {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-bottom-right-radius: 4px;
}

.message-content p {
    margin: 0;
    line-height: 1.5;
    font-size: 14px;
}

.message-time {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
    text-align: right;
}

.message.sent .message-time {
    color: rgba(255, 255, 255, 0.8);
}

/* 聊天底部 */
.chat-footer {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid var(--border-color);
}

.chat-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-light);
    border-radius: 25px;
    padding: 8px 16px;
}

.chat-tool {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 18px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.chat-tool:hover {
    background: var(--border-color);
    color: var(--primary-color);
}

.chat-input-area input {
    flex: 1;
    border: none;
    background: none;
    padding: 8px;
    font-size: 14px;
    outline: none;
}

.chat-send {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.chat-send:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* 输入中动画 */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-light);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* 快捷回复 */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    padding: 0 4px;
}

.quick-reply {
    background: white;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.quick-reply:hover {
    background: var(--primary-color);
    color: white;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .chat-widget {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .chat-float-btn {
        bottom: 20px;
        right: 20px;
    }
}

/* 滚动条样式 */
.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-track {
    background: transparent;
}

.chat-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.chat-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}
