/* AI Chat Widget - Bubble */
#ai-chat-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: #6366f1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    color: #fff;
}

#ai-chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

#ai-chat-bubble:focus {
    outline: 2px solid #6366f1;
    outline-offset: 3px;
}

/* AI Chat Widget - Panel */
#ai-chat-panel {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 380px;
    max-height: 520px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.ai-chat-header {
    background: #6366f1;
    color: #fff;
    padding: 14px 18px;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 600;
}

.ai-chat-header button {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.ai-chat-header button:hover {
    opacity: 1;
}

/* Messages Area */
.ai-chat-messages {
    padding: 16px;
    min-height: 300px;
    max-height: 380px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Message Bubbles */
.ai-chat-message {
    max-width: 85%;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.ai-chat-message--user {
    background: #e8f0fe;
    color: #1a1a1a;
    border-radius: 12px 12px 0 12px;
    align-self: flex-end;
    margin-left: 40px;
}

.ai-chat-message--ai {
    background: #f3f4f6;
    color: #333;
    border-radius: 12px 12px 12px 0;
    align-self: flex-start;
    margin-right: 40px;
}

/* Input Area */
.ai-chat-footer {
    border-top: 1px solid #eee;
    display: flex;
    padding: 10px;
    gap: 8px;
    align-items: center;
}

.ai-chat-footer input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.ai-chat-footer input:focus {
    border-color: #6366f1;
}

.ai-chat-footer input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

#ai-chat-send {
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

#ai-chat-send:hover {
    background: #4f46e5;
}

#ai-chat-send:disabled {
    background: #c7c7c7;
    cursor: not-allowed;
}

/* Typing Indicator */
.ai-chat-typing .typing-dots {
    display: inline-flex;
    gap: 3px;
}

.ai-chat-typing .typing-dots span {
    animation: typingBounce 1.4s infinite;
    font-size: 20px;
    line-height: 1;
}

.ai-chat-typing .typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-chat-typing .typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #ai-chat-panel {
        width: 100%;
        right: 0;
        bottom: 0;
        border-radius: 12px 12px 0 0;
        max-height: 80vh;
    }

    .ai-chat-header {
        border-radius: 12px 12px 0 0;
    }
}
