/* ---- 智能客服 Chatbot ---- */
#ctji-chat-container {
    position: fixed;
    bottom: 6rem;
    right: 2rem;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

#ctji-chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(37,99,235,0.4);
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    animation: ctji-chat-pulse 2s infinite;
}

#ctji-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37,99,235,0.5);
}

#ctji-chat-toggle.hidden {
    display: none;
}

@keyframes ctji-chat-pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(37,99,235,0.4); }
    50% { box-shadow: 0 4px 25px rgba(37,99,235,0.6); }
}

#ctji-chat-panel {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 370px;
    height: 520px;
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

#ctji-chat-panel.show {
    display: flex;
    animation: ctji-slide-up 0.3s ease;
}

@keyframes ctji-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

#ctji-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1rem;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: #fff;
    flex-shrink: 0;
}

.chat-avatar { font-size: 1.5rem; }

.chat-status {
    font-size: 0.7rem;
    color: #22c55e;
}

.chat-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 0.3rem;
    transition: color 0.2s;
}

.chat-btn:hover { color: #fff; }

#ctji-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #f8fafc;
    scroll-behavior: smooth;
}

#ctji-chat-messages.hidden {
    display: none;
}

.chat-msg {
    margin-bottom: 0.75rem;
    max-width: 85%;
    animation: ctji-msg-in 0.25s ease;
}

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

.chat-msg-user {
    margin-left: auto;
}

.chat-msg-bot {
    margin-right: auto;
}

.chat-msg-content {
    padding: 0.65rem 0.9rem;
    border-radius: 1rem;
    font-size: 0.88rem;
    line-height: 1.5;
    color: #1e293b;
}

.chat-msg-user .chat-msg-content {
    background: #2563eb;
    color: #fff;
    border-bottom-right-radius: 0.25rem;
}

.chat-msg-bot .chat-msg-content {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 0.25rem;
}

.chat-msg-time {
    font-size: 0.68rem;
    color: #94a3b8;
    margin-top: 0.2rem;
    padding: 0 0.4rem;
}

.chat-msg-user .chat-msg-time { text-align: right; }

.typing-dots {
    animation: ctji-blink 1.4s infinite;
    letter-spacing: 3px;
}

@keyframes ctji-blink {
    0%, 20% { color: #94a3b8; }
    50% { color: #2563eb; }
    80%, 100% { color: #94a3b8; }
}

.chat-quick-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.chat-quick-btn {
    padding: 0.4rem 0.75rem;
    border: 1px solid #2563eb;
    background: #fff;
    color: #2563eb;
    border-radius: 1rem;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.chat-quick-btn:hover {
    background: #2563eb;
    color: #fff;
}

#ctji-chat-input-area {
    display: flex;
    align-items: center;
    padding: 0.7rem;
    border-top: 1px solid #e2e8f0;
    background: #fff;
    flex-shrink: 0;
}

#ctji-chat-input-area.hidden {
    display: none;
}

#ctji-chat-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 2rem;
    padding: 0.6rem 1rem;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
}

#ctji-chat-input:focus {
    border-color: #2563eb;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: #2563eb;
    color: #fff;
    border-radius: 50%;
    margin-left: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-send-btn:hover {
    background: #1d4ed8;
    transform: scale(1.05);
}

@media (max-width: 480px) {
    #ctji-chat-panel {
        width: calc(100vw - 2rem);
        height: 70vh;
        right: 1rem;
    }
    #ctji-chat-container {
        right: 1rem;
        bottom: 5rem;
    }
}
