/* AI Assistant Chat Widget */
#ai-chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #0076f1;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
}
#ai-chat-toggle:hover {
    transform: scale(1.1);
    background: #005bb5;
}

#ai-chat-panel {
    position: fixed;
    bottom: 92px;
    right: 24px;
    width: 420px;
    height: 560px;
    background: #1e1e2e;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 10000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
#ai-chat-panel.open {
    display: flex;
}

/* Header */
#ai-chat-header {
    background: #0076f1;
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
#ai-chat-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}
#ai-chat-header select {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
    cursor: pointer;
}
#ai-chat-header select option {
    background: #1e1e2e;
    color: white;
}
#ai-chat-new-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 12px;
    cursor: pointer;
}
#ai-chat-new-btn:hover {
    background: rgba(255,255,255,0.35);
}

/* Messages area */
#ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ai-msg {
    max-width: 90%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.ai-msg.user {
    align-self: flex-end;
    background: #0076f1;
    color: white;
    border-bottom-right-radius: 4px;
}
.ai-msg.assistant {
    align-self: flex-start;
    background: #2d2d3f;
    color: #e0e0e0;
    border-bottom-left-radius: 4px;
}
.ai-msg.assistant code {
    background: #383850;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 12px;
}
.ai-msg.assistant pre {
    background: #383850;
    padding: 8px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 12px;
}

/* Typing indicator */
.ai-typing {
    align-self: flex-start;
    color: #888;
    font-size: 12px;
    padding: 8px 12px;
}
.ai-typing::after {
    content: '...';
    animation: dots 1.5s infinite;
}
@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Input area */
#ai-chat-input-area {
    padding: 12px;
    border-top: 1px solid #333;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    background: #1a1a2a;
}
#ai-chat-input {
    flex: 1;
    background: #2d2d3f;
    border: 1px solid #444;
    border-radius: 8px;
    color: #e0e0e0;
    padding: 8px 12px;
    font-size: 13px;
    resize: none;
    outline: none;
    font-family: inherit;
    max-height: 80px;
}
#ai-chat-input:focus {
    border-color: #0076f1;
}
#ai-chat-input::placeholder {
    color: #666;
}
#ai-chat-send {
    background: #0076f1;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
}
#ai-chat-send:hover {
    background: #005bb5;
}
#ai-chat-send:disabled {
    background: #444;
    cursor: not-allowed;
}

/* Agent badge */
.ai-agent-badge {
    font-size: 10px;
    background: rgba(255,255,255,0.15);
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 8px;
}
