/* AI客服聊天组件样式 */

/* 浮动按钮 */
.ai-chat-btn {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10a37f, #0d8a6a);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(16, 163, 127, 0.4);
    transition: all 0.3s ease;
    z-index: 9999;
    font-size: 24px;
}

.ai-chat-btn:hover {
    transform: translateY(-4px) scale(1.1);
    box-shadow: 0 8px 30px rgba(16, 163, 127, 0.6);
}

.ai-chat-btn.open {
    background: #6e6e73;
}

.ai-chat-btn-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #f59e0b;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

/* 聊天窗口 */
.ai-chat-window {
    position: fixed;
    right: 24px;
    bottom: 100px;
    width: 380px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 9998;
    overflow: hidden;
    animation: chatWindowSlideUp 0.3s ease;
}

.ai-chat-window.open {
    display: flex;
}

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

/* 聊天头部 */
.ai-chat-header {
    background: linear-gradient(135deg, #10a37f, #0d8a6a);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.ai-chat-title {
    flex: 1;
}

.ai-chat-title h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.ai-chat-title p {
    font-size: 12px;
    margin: 2px 0 0;
    opacity: 0.9;
}

.ai-chat-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s;
}

.ai-chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 聊天内容区域 */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f5f5f7;
}

.ai-chat-message {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    animation: messageFadeIn 0.3s ease;
}

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

.ai-chat-message.user {
    flex-direction: row-reverse;
}

.ai-chat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.ai-chat-message.ai .ai-chat-message-avatar {
    background: linear-gradient(135deg, #10a37f, #0d8a6a);
    color: #fff;
}

.ai-chat-message.user .ai-chat-message-avatar {
    background: #6e6e73;
    color: #fff;
}

.ai-chat-message-content {
    max-width: 280px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
}

.ai-chat-message.ai .ai-chat-message-content {
    background: #fff;
    color: #202223;
    border: 1px solid #e5e5e5;
}

.ai-chat-message.user .ai-chat-message-content {
    background: linear-gradient(135deg, #10a37f, #0d8a6a);
    color: #fff;
}

/* 聊天输入区域 */
.ai-chat-input {
    padding: 16px;
    background: #fff;
    border-top: 1px solid #e5e5e5;
}

.ai-chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.ai-chat-input-box {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    padding: 10px 14px;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}

.ai-chat-input-box:focus {
    border-color: #10a37f;
}

.ai-chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #10a37f, #0d8a6a);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 18px;
}

.ai-chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(16, 163, 127, 0.3);
}

.ai-chat-send-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

/* 加载动画 */
.ai-chat-loading {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.ai-chat-loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10a37f;
    animation: loadingPulse 1.4s ease-in-out infinite;
}

.ai-chat-loading-dot:nth-child(1) {
    animation-delay: 0s;
}

.ai-chat-loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-chat-loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loadingPulse {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* 快捷问题 */
.ai-chat-quick-questions {
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #e5e5e5;
}

.ai-chat-quick-title {
    font-size: 12px;
    color: #6e6e73;
    margin-bottom: 8px;
}

.ai-chat-quick-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-chat-quick-item {
    padding: 6px 12px;
    background: #f5f5f7;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font-size: 13px;
    color: #202223;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-chat-quick-item:hover {
    background: #10a37f;
    color: #fff;
    border-color: #10a37f;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .ai-chat-window {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .ai-chat-btn {
        right: 16px;
        bottom: 80px;
        width: 56px;
        height: 56px;
    }

    .ai-chat-messages {
        padding: 12px;
    }

    .ai-chat-input {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .ai-chat-btn {
        right: 12px;
        bottom: 70px;
        width: 52px;
        height: 52px;
        font-size: 22px;
    }

    .ai-chat-message-content {
        max-width: 85%;
        font-size: 14px;
    }
}