/**
 * 搜地365 AI智能助手 - 聊天窗口样式
 * 配合 chatbot.js 使用
 * 版本：v1.0
 */

/* ============================================================
   浮动按钮
   ============================================================ */
#chatbot-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99998;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #1a73e8, #1557b0);
    color: #fff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(26,115,232,0.35);
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
#chatbot-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(26,115,232,0.45);
}
.chatbot-btn-icon { font-size: 22px; }
.chatbot-btn-text { font-size: 14px; font-weight: 500; }

/* ============================================================
   聊天窗口
   ============================================================ */
#chatbot-window {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    width: 400px;
    max-height: 600px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    animation: chatbotSlideUp 0.3s ease;
}
@keyframes chatbotSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   头部
   ============================================================ */
.chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: linear-gradient(135deg, #1a73e8, #1557b0);
    color: #fff;
    flex-shrink: 0;
}
.chatbot-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.chatbot-avatar {
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.chatbot-header-info { display: flex; flex-direction: column; }
.chatbot-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
}
.chatbot-subtitle {
    font-size: 11px;
    opacity: 0.8;
    line-height: 1.3;
}
.chatbot-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.chatbot-close:hover { background: rgba(255,255,255,0.3); }

/* ============================================================
   消息区域
   ============================================================ */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    background: #f5f7fa;
    min-height: 160px;
    max-height: 380px;
}
/* 滚动条 */
.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb { 
    background: #d0d5dd; 
    border-radius: 4px; 
}

/* 消息通用 */
.chatbot-msg {
    display: flex;
    margin-bottom: 12px;
    animation: msgFadeIn 0.3s ease;
}
@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
.chatbot-msg.bot { justify-content: flex-start; }
.chatbot-msg.user { justify-content: flex-end; }

/* 气泡 */
.chatbot-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
}
.chatbot-msg.bot .chatbot-bubble {
    background: #fff;
    color: #333;
    border: 1px solid #e8ecf1;
    border-radius: 14px 14px 14px 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.chatbot-msg.user .chatbot-bubble {
    background: linear-gradient(135deg, #1a73e8, #1557b0);
    color: #fff;
    border-radius: 14px 14px 14px 14px;
}
.chatbot-bubble strong { color: #1a73e8; }
.chatbot-msg.user .chatbot-bubble strong { color: #fff; }
.chatbot-bubble code {
    background: #f0f2f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #e74c3c;
}

/* ============================================================
   打字动画
   ============================================================ */
.chatbot-typing .chatbot-bubble {
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.chatbot-typing .dot {
    width: 7px;
    height: 7px;
    background: #a0aab4;
    border-radius: 50%;
    display: inline-block;
    animation: typingDot 1.4s infinite ease-in-out both;
}
.chatbot-typing .dot:nth-child(1) { animation-delay: 0s; }
.chatbot-typing .dot:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ============================================================
   快捷问题
   ============================================================ */
.chatbot-quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.chatbot-quick-btn {
    background: #fff;
    border: 1px solid #d0d5dd;
    color: #1a73e8;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 12.5px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.chatbot-quick-btn:hover {
    background: #e8f0fe;
    border-color: #1a73e8;
}

/* ============================================================
   输入区域
   ============================================================ */
.chatbot-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e8ecf1;
    background: #fff;
    flex-shrink: 0;
}
#chatbot-input {
    flex: 1;
    border: 1px solid #d0d5dd;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 13.5px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 120px;
    line-height: 1.5;
    transition: border-color 0.2s;
}
#chatbot-input:focus { border-color: #1a73e8; }
#chatbot-send {
    width: 36px;
    height: 36px;
    background: #1a73e8;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.2s;
}
#chatbot-send:hover { background: #1557b0; transform: scale(1.05); }
#chatbot-send:active { transform: scale(0.95); }

/* ============================================================
   底部标识
   ============================================================ */
.chatbot-footer {
    text-align: center;
    padding: 6px 0 10px;
    background: #fff;
    flex-shrink: 0;
}
.chatbot-footer span {
    font-size: 11px;
    color: #9aa0a6;
}

/* ============================================================
   响应式 - 移动端
   ============================================================ */
@media (max-width: 480px) {
    #chatbot-window {
        width: calc(100vw - 32px);
        right: 16px;
        bottom: 16px;
        max-height: 520px;
    }
    #chatbot-btn {
        right: 16px;
        bottom: 16px;
        padding: 10px 16px;
    }
}
