/* AI助手聊天界面样式 */

/* AI助手浮动按钮 */
.ai-assistant-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.ai-assistant-button:active {
    transform: scale(0.95);
}

/* AI聊天对话框 */
.ai-chat-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 400px;
    height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 1001;
    overflow: hidden;
    border: 1px solid #e1e5e9;
}

.ai-chat-container.open {
    display: flex;
}

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

.ai-chat-title {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-chat-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ai-chat-mode-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.ai-chat-mode-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.ai-chat-mode-toggle.active {
    background: rgba(255, 255, 255, 0.4);
}

.ai-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.ai-chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 聊天消息区域 */
.ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 消息样式 */
.chat-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.4;
    word-wrap: break-word;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.chat-message.assistant {
    align-self: flex-start;
    background: white;
    color: #333;
    border: 1px solid #e1e5e9;
    border-bottom-left-radius: 4px;
}

.chat-message.system {
    align-self: center;
    background: #e9ecef;
    color: #6c757d;
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 90%;
    text-align: center;
}

/* 流式回答样式 */
.chat-message.streaming {
    position: relative;
}

.chat-message.streaming::after {
    content: '▋';
    animation: cursorBlink 1s infinite;
    color: #667eea;
    margin-left: 2px;
}

@keyframes cursorBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 输入区域 */
.ai-chat-input-area {
    padding: 20px;
    border-top: 1px solid #e1e5e9;
    background: white;
}

.ai-chat-input-container {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.ai-chat-input {
    flex: 1;
    border: 1px solid #e1e5e9;
    border-radius: 24px;
    padding: 12px 16px;
    font-size: 14px;
    resize: none;
    max-height: 120px;
    min-height: 44px;
    outline: none;
    transition: border-color 0.3s ease;
}

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

.ai-chat-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.ai-chat-send:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.ai-chat-send:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* 输入区域底部 */
.ai-chat-input-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
    color: #6c757d;
}

.ai-chat-actions-bottom {
    display: flex;
    gap: 8px;
}

.ai-chat-clear,
.ai-chat-analyze {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.3s ease;
    font-size: 12px;
}

.ai-chat-clear:hover,
.ai-chat-analyze:hover {
    background: #f8f9fa;
}

/* 加载状态 */
.ai-chat-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #6c757d;
    gap: 8px;
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #667eea;
    animation: loadingBounce 1.4s infinite ease-in-out;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes loadingBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 空状态 */
.ai-chat-empty {
    text-align: center;
    color: #6c757d;
    padding: 40px 20px;
}

.ai-chat-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.ai-chat-empty-title {
    font-size: 16px;
    margin-bottom: 8px;
    font-weight: 600;
}

.ai-chat-empty-desc {
    font-size: 14px;
    line-height: 1.4;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .ai-chat-container {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .ai-assistant-button {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

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

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

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

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