/* 聊天机器人样式 */
/* 作者：李磊 */

/* 聊天机器人切换按钮 */
.chatbot-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 99999;
    animation: float 3s ease-in-out infinite;
    border: none;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.chatbot-toggle i {
    color: white;
    font-size: 24px;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* 聊天窗口 */
.chatbot-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 99998;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.chatbot-window.show {
    display: flex;
    transform: translateY(0);
    opacity: 1;
}

/* 聊天窗口头部 */
.chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.chatbot-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

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

.chatbot-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 10px;
    word-wrap: break-word;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.chatbot-message.visible {
    opacity: 1;
    transform: translateY(0);
}

.chatbot-message.user {
    background: #e3f2fd;
    color: #1976d2;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.chatbot-message.bot {
    background: #f5f5f5;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    white-space: pre-line;
}

/* 打字指示器 */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
    background: #f5f5f5;
    border-radius: 18px;
    border-bottom-left-radius: 5px;
    max-width: 80px;
    margin-left: 20px;
    margin-bottom: 10px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* 输入区域 */
.chatbot-input {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    background: white;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

.chatbot-input input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

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

.chatbot-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.chatbot-send:hover {
    transform: scale(1.05);
}

/* 响应式设计 */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 40px);
        right: 20px;
        left: 20px;
        height: 400px;
    }
    
    .chatbot-toggle {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
    }
    
    .chatbot-toggle i {
        font-size: 20px;
    }
}

/* 滚动条样式 */
.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

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

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 聊天机器人状态指示 */
.chatbot-status {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 16px;
    height: 16px;
    background: #4caf50;
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
    .chatbot-window {
        background: #2d2d2d;
        color: white;
    }
    
    .chatbot-message.bot {
        background: #404040;
        color: #e0e0e0;
    }
    
    .chatbot-input {
        background: #2d2d2d;
        border-top-color: #404040;
    }
    
    .chatbot-input input {
        background: #404040;
        border-color: #555;
        color: white;
    }
    
    .typing-indicator {
        background: #404040;
    }
}

