/* ============================================
   AI 聊天面板样式
   ============================================ */

.ai-chat-wrapper {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 900;
}

.ai-chat-toggle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--color-brand);
    box-shadow: 0 4px 16px rgba(0,122,255,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    position: absolute;
    bottom: 0;
    right: 0;
}

.ai-chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0,122,255,0.45);
}

.ai-chat-toggle.active {
    display: none;
}

.ai-chat-panel {
    position: absolute;
    bottom: 64px;
    right: 0;
    width: 380px;
    height: 520px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

[data-theme="light"] .ai-chat-panel {
    background: rgba(255,255,255,0.92);
}

[data-theme="dark"] .ai-chat-panel {
    background: rgba(44,44,46,0.92);
}

.ai-chat-panel.open {
    display: flex;
    animation: slideUp 0.25s ease;
}

.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.ai-chat-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.ai-chat-header-actions {
    display: flex;
    gap: 4px;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-message {
    max-width: 90%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.6;
    word-break: break-word;
    animation: fadeIn 0.2s ease;
}

.ai-message-user {
    align-self: flex-end;
    background: var(--color-brand);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ai-message-assistant {
    align-self: flex-start;
    background: var(--bg-primary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.ai-message-system {
    align-self: center;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    text-align: center;
}

.ai-message.typing::after {
    content: '...';
    animation: typingDots 1.4s infinite;
}

@keyframes typingDots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.ai-chat-input {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.ai-chat-input textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    resize: none;
    outline: none;
    max-height: 80px;
    line-height: 1.4;
}

.ai-chat-input textarea:focus {
    border-color: var(--color-brand);
}

#aiSendBtn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition);
}

#aiSendBtn:hover {
    background: #0066d6;
}

#aiSendBtn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ai-message code {
    background: rgba(0,0,0,0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 12px;
}

.ai-message pre {
    background: rgba(0,0,0,0.04);
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 6px 0;
    font-size: 12px;
}

[data-theme="dark"] .ai-message code,
[data-theme="dark"] .ai-message pre {
    background: rgba(255,255,255,0.06);
}
