/* ========== AI 智能客服聊天机器人样式 ========== */

/* 聊天按钮 */
.chatbot-toggle {
    position: fixed;
    bottom: 90px;
    right: 25px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c9a96e, #a88b4a);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(201, 169, 110, 0.4);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
    animation: chatbot-pulse 2s infinite;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(201, 169, 110, 0.6);
}

.chatbot-toggle.active {
    animation: none;
    background: linear-gradient(135deg, #a88b4a, #8a7040);
}

.chatbot-toggle .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: #ef4444;
    border-radius: 50%;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    display: none;
}

.chatbot-toggle .badge.show {
    display: flex;
}

@keyframes chatbot-pulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(201, 169, 110, 0.4); }
    50% { box-shadow: 0 4px 30px rgba(201, 169, 110, 0.7), 0 0 0 10px rgba(201, 169, 110, 0.1); }
}

/* 聊天窗口 */
.chatbot-window {
    position: fixed;
    bottom: 160px;
    right: 25px;
    width: 380px;
    height: 520px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(201, 169, 110, 0.1);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* 聊天头部 */
.chatbot-header {
    background: linear-gradient(135deg, #1a1a2e, #2d2d44);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c9a96e, #d4bc8a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.chatbot-header-text h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
}

.chatbot-header-text span {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    gap: 4px;
}

.chatbot-header-text span::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
}

.chatbot-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    transition: color 0.3s;
}

.chatbot-close:hover {
    color: #fff;
}

/* 消息区域 */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #faf8f5;
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #d4bc8a;
    border-radius: 2px;
}

/* 消息气泡 */
.chat-message {
    display: flex;
    gap: 8px;
    max-width: 85%;
    animation: msg-in 0.3s ease;
}

.chat-message.bot {
    align-self: flex-start;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

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

.chat-message.bot .msg-avatar {
    background: linear-gradient(135deg, #c9a96e, #d4bc8a);
    color: #fff;
}

.chat-message.user .msg-avatar {
    background: #e8e4de;
    color: #4a4a4a;
}

.chat-message .msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.6;
    word-break: break-word;
}

.chat-message.bot .msg-bubble {
    background: #fff;
    color: #1a1a1a;
    border: 1px solid #e8e4de;
    border-bottom-left-radius: 4px;
}

.chat-message.user .msg-bubble {
    background: linear-gradient(135deg, #1a1a2e, #2d2d44);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.msg-bubble a {
    color: #c9a96e;
    text-decoration: underline;
    font-weight: 500;
}

.chat-message.user .msg-bubble a {
    color: #d4bc8a;
}

@keyframes msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 打字动画 */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #c9a96e;
    animation: typing-dot 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-dot {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1); }
}

/* 快捷问题按钮 */
.chatbot-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.quick-btn {
    display: inline-block;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #c9a96e;
    border-radius: 20px;
    font-size: 12px;
    color: #c9a96e;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.quick-btn:hover {
    background: #c9a96e;
    color: #fff;
}

/* 输入区域 */
.chatbot-input {
    padding: 12px 16px;
    border-top: 1px solid #e8e4de;
    display: flex;
    gap: 8px;
    align-items: center;
    background: #fff;
    flex-shrink: 0;
}

.chatbot-input input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e8e4de;
    border-radius: 24px;
    font-size: 13.5px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.3s;
    background: #faf8f5;
}

.chatbot-input input:focus {
    border-color: #c9a96e;
}

.chatbot-input input::placeholder {
    color: #aaa;
}

.chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c9a96e, #a88b4a);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s;
    flex-shrink: 0;
}

.chatbot-send:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 10px rgba(201, 169, 110, 0.4);
}

/* 欢迎提示 */
.chatbot-welcome-tip {
    position: fixed;
    bottom: 155px;
    right: 25px;
    background: #fff;
    padding: 12px 18px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    font-size: 13px;
    color: #1a1a1a;
    z-index: 9997;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
    pointer-events: none;
    max-width: 220px;
}

.chatbot-welcome-tip.show {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.chatbot-welcome-tip::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 30px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #fff;
}

.chatbot-welcome-tip .tip-close {
    position: absolute;
    top: 4px;
    right: 8px;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 14px;
}

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

    .chatbot-toggle {
        bottom: 80px;
        right: 16px;
        width: 54px;
        height: 54px;
        font-size: 22px;
    }

    .chatbot-welcome-tip {
        bottom: 140px;
        right: 16px;
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    .chatbot-window {
        width: 340px;
        height: 480px;
        bottom: 155px;
        right: 16px;
    }

    .chatbot-toggle {
        bottom: 85px;
        right: 16px;
    }
}
