/* AI Agent 前台对话窗口样式 */
#ai-agent-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
}

#ai-agent-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 24px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#ai-agent-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.6);
}

#ai-agent-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 420px;
    height: 580px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 60px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: ai-slide-up 0.3s ease;
}

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

.ai-agent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
}

.ai-agent-actions button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    margin-left: 8px;
    transition: background 0.2s;
}

.ai-agent-actions button:hover {
    background: rgba(255, 255, 255, 0.3);
}

#ai-agent-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
}

.ai-msg {
    margin-bottom: 16px;
    animation: ai-fade-in 0.3s;
}

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

.ai-msg-label {
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
}

.ai-msg-content {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}

.ai-msg-user .ai-msg-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    margin-left: 40px;
    border-bottom-right-radius: 4px;
}

.ai-msg-assistant .ai-msg-content {
    background: #fff;
    color: #333;
    margin-right: 40px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.ai-msg-loading .ai-msg-content {
    background: #fff;
    color: #999;
    margin-right: 40px;
}

.ai-msg-error .ai-msg-content {
    background: #fee;
    color: #c00;
    margin-right: 40px;
}

.ai-msg-status .ai-msg-content {
    background: #f0f0f0;
    color: #666;
    font-size: 12px;
    margin-right: 40px;
}

.ai-agent-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #eee;
}

#ai-agent-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

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

#ai-agent-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

#ai-agent-send:hover {
    opacity: 0.9;
}

#ai-agent-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 移动端适配 */
@media (max-width: 768px) {
    #ai-agent-panel {
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
        right: -8px;
    }

    #ai-agent-widget {
        bottom: 16px;
        right: 16px;
    }
}

/* 代码块样式 */
.ai-msg-content pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: 13px;
}

.ai-msg-content code {
    font-family: "Fira Code", "Consolas", monospace;
    font-size: 13px;
}

.ai-msg-content h1, .ai-msg-content h2, .ai-msg-content h3 {
    margin: 12px 0 8px;
    font-weight: 600;
}

.ai-msg-content ul, .ai-msg-content ol {
    padding-left: 20px;
    margin: 8px 0;
}

.ai-msg-content blockquote {
    border-left: 3px solid #667eea;
    padding-left: 12px;
    margin: 8px 0;
    color: #666;
}

/* 图片预览 */
.ai-img-preview {
    margin: 8px 0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
}

.ai-img-preview img {
    max-width: 100%;
    border-radius: 8px;
}

.ai-img-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    cursor: pointer;
}

.ai-img-lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
}
