/* 红尘灵境 - 智能助手样式 */
/* 版本: 1.0.0 */

/* 浮动按钮样式 */
#smart-assistant-button {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
    font-size: 24px !important;
    cursor: pointer !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
    z-index: 1000 !important;
    transition: all 0.3s ease !important;
}

#smart-assistant-button:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3) !important;
}

/* 聊天窗口样式 */
#smart-assistant-chat {
    position: fixed !important;
    bottom: 90px !important;
    right: 20px !important;
    width: 350px !important;
    height: 500px !important;
    background: white !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: 999 !important;
    overflow: hidden !important;
    transition: all 0.3s ease !important;
}

/* 聊天窗口头部 */
#smart-assistant-chat > div:first-child {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    padding: 15px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

#smart-assistant-chat > div:first-child strong {
    font-size: 16px !important;
}

#smart-assistant-chat > div:first-child button {
    background: none !important;
    border: none !important;
    color: white !important;
    font-size: 24px !important;
    cursor: pointer !important;
    padding: 0 !important;
    width: 30px !important;
    height: 30px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#smart-assistant-chat > div:first-child button:hover {
    opacity: 0.8 !important;
}

/* 消息容器 */
#chat-messages {
    flex: 1 !important;
    padding: 15px !important;
    overflow-y: auto !important;
    background: #f8f9fa !important;
}

/* 消息样式 */
.message {
    margin-bottom: 15px !important;
    max-width: 80% !important;
    animation: messageAppear 0.3s ease !important;
}

.message.user {
    margin-left: auto !important;
}

.message-bubble {
    padding: 10px 15px !important;
    border-radius: 18px !important;
    word-wrap: break-word !important;
    line-height: 1.5 !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) !important;
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border-bottom-right-radius: 4px !important;
}

.message.assistant .message-bubble {
    background: white !important;
    color: #333 !important;
    border-bottom-left-radius: 4px !important;
}

/* 消息内容格式化 */
.message-bubble strong {
    font-weight: 600 !important;
}

.message-bubble em {
    font-style: italic !important;
}

.message-bubble code {
    background: #f1f3f5 !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    font-family: 'Courier New', monospace !important;
    font-size: 0.9em !important;
}

.message-bubble a {
    color: #667eea !important;
    text-decoration: none !important;
}

.message-bubble a:hover {
    text-decoration: underline !important;
}

/* 加载动画 */
.loading-dots {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    height: 20px !important;
}

.loading-dots span {
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    background: #667eea !important;
    animation: dotPulse 1.4s infinite ease-in-out !important;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s !important;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s !important;
}

/* 助手选择器 */
#smart-assistant-chat > div:nth-child(3) {
    padding: 10px !important;
    background: #f8f9fa !important;
    border-top: 1px solid #eee !important;
    display: flex !important;
    gap: 8px !important;
    justify-content: center !important;
}

#smart-assistant-chat > div:nth-child(3) button {
    padding: 5px 10px !important;
    border: 1px solid #ddd !important;
    border-radius: 15px !important;
    background: white !important;
    font-size: 12px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    color: #333 !important;
}

#smart-assistant-chat > div:nth-child(3) button:hover {
    background: #667eea !important;
    color: white !important;
    border-color: #667eea !important;
}

/* 输入区域 */
#smart-assistant-chat > div:last-child {
    border-top: 1px solid #eee !important;
    padding: 10px !important;
    background: white !important;
}

#smart-assistant-chat > div:last-child > div {
    display: flex !important;
    gap: 8px !important;
}

#smart-assistant-chat input[type="text"] {
    flex: 1 !important;
    padding: 10px 15px !important;
    border: 1px solid #ddd !important;
    border-radius: 20px !important;
    outline: none !important;
    font-size: 14px !important;
    transition: border-color 0.3s ease !important;
}

#smart-assistant-chat input[type="text"]:focus {
    border-color: #667eea !important;
}

#smart-assistant-chat > div:last-child button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 20px !important;
    padding: 10px 20px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: bold !important;
    transition: transform 0.2s ease !important;
}

#smart-assistant-chat > div:last-child button:hover {
    transform: scale(1.05) !important;
}

/* 动画效果 */
@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes dotPulse {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* 滚动条样式 */
#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* 响应式调整 */
@media (max-width: 768px) {
    #smart-assistant-chat {
        width: calc(100vw - 40px) !important;
        height: 60vh !important;
        right: 20px !important;
        left: 20px !important;
        bottom: 80px !important;
    }
    
    #smart-assistant-button {
        bottom: 10px !important;
        right: 10px !important;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    #smart-assistant-chat {
        background: #1a1a1a !important;
        color: #fff !important;
    }
    
    #smart-assistant-chat > div:first-child {
        background: linear-gradient(135deg, #3a416f 0%, #5d417d 100%) !important;
    }
    
    #chat-messages {
        background: #2d2d2d !important;
    }
    
    .message.assistant .message-bubble {
        background: #333 !important;
        color: #fff !important;
    }
    
    #smart-assistant-chat > div:nth-child(3) {
        background: #2d2d2d !important;
        border-top-color: #444 !important;
    }
    
    #smart-assistant-chat > div:nth-child(3) button {
        background: #333 !important;
        border-color: #444 !important;
        color: #fff !important;
    }
    
    #smart-assistant-chat > div:last-child {
        background: #1a1a1a !important;
        border-top-color: #444 !important;
    }
    
    #smart-assistant-chat input[type="text"] {
        background: #333 !important;
        border-color: #444 !important;
        color: #fff !important;
    }
    
    .message-bubble code {
        background: #444 !important;
        color: #fff !important;
    }
}