/* AI Chat Popup Styles */

.ai-chat-popup {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    max-width: 90vw;
    max-height: 600px;
    background: rgba(31, 41, 55, 0.98);
    border: 1px solid rgba(75, 85, 99, 0.8);
    border-radius: 0.75rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

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

/* Chat Header */
.ai-chat-header {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(59, 130, 246, 0.2) 100%);
    border-bottom: 1px solid rgba(75, 85, 99, 0.5);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.ai-chat-title {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: #E5E7EB;
    font-size: 0.875rem;
}

.ai-chat-title i {
    color: #A78BFA;
    animation: sparkle 2s ease-in-out infinite;
}

.ai-chat-controls {
    display: flex;
    gap: 0.5rem;
}

.ai-chat-control {
    background: none;
    border: none;
    color: #9CA3AF;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-chat-control:hover {
    background: rgba(55, 65, 81, 0.8);
    color: #E5E7EB;
}

/* Chat Body */
.ai-chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Messages Container */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    min-height: 200px;
}

.ai-message {
    margin-bottom: 1rem;
    animation: fadeIn 0.3s ease-out;
}

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

.message-header {
    font-size: 0.75rem;
    color: #9CA3AF;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
}

.message-header i {
    font-size: 0.625rem;
}

.message-content {
    background: rgba(55, 65, 81, 0.5);
    padding: 0.75rem;
    border-radius: 0.5rem;
    color: #E5E7EB;
    font-size: 0.875rem;
    line-height: 1.5;
}

.user-selection .message-content {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.ai-response .message-content {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.user-message .message-content {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Input Area */
.ai-chat-input-area {
    padding: 1rem;
    border-top: 1px solid rgba(75, 85, 99, 0.5);
    background: rgba(17, 24, 39, 0.8);
}

.ai-chat-input {
    width: 100%;
    background: rgba(31, 41, 55, 0.8);
    border: 1px solid rgba(75, 85, 99, 0.5);
    color: #E5E7EB;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    resize: none;
    outline: none;
    margin-bottom: 0.75rem;
}

.ai-chat-input:focus {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.ai-chat-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Chat Buttons */
.ai-chat-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.ai-chat-btn.primary {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.9) 0%, rgba(59, 130, 246, 0.9) 100%);
    color: white;
}

.ai-chat-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.ai-chat-btn.secondary {
    background: rgba(75, 85, 99, 0.5);
    color: #D1D5DB;
}

.ai-chat-btn.secondary:hover {
    background: rgba(75, 85, 99, 0.7);
}

.ai-chat-btn.success {
    background: rgba(34, 197, 94, 0.9);
    color: white;
}

.ai-chat-btn.success:hover {
    background: rgba(34, 197, 94, 1);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.ai-chat-btn.danger {
    background: rgba(239, 68, 68, 0.9);
    color: white;
}

.ai-chat-btn.danger:hover {
    background: rgba(239, 68, 68, 1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Result Actions */
.ai-chat-result-actions {
    padding: 1rem;
    border-top: 1px solid rgba(75, 85, 99, 0.5);
    background: rgba(17, 24, 39, 0.9);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Loading state */
.ai-typing {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    color: #9CA3AF;
    font-size: 0.75rem;
}

.ai-typing-dot {
    width: 6px;
    height: 6px;
    background: #9CA3AF;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Scrollbar styling */
.ai-chat-messages::-webkit-scrollbar {
    width: 8px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: rgba(31, 41, 55, 0.5);
    border-radius: 4px;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(75, 85, 99, 0.8);
    border-radius: 4px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(107, 114, 128, 0.8);
}

/* Firefox scrollbar */
.ai-chat-messages {
    scrollbar-width: thin;
    scrollbar-color: rgba(75, 85, 99, 0.8) rgba(31, 41, 55, 0.5);
}

/* Minimized state */
.ai-chat-popup.minimized {
    height: auto;
    max-height: none;
}

.ai-chat-popup.minimized .ai-chat-body,
.ai-chat-popup.minimized .ai-chat-result-actions {
    display: none;
}

/* Mobile responsive */
@media (max-width: 640px) {
    .ai-chat-popup {
        width: calc(100vw - 40px);
        bottom: 10px;
        right: 10px;
        max-height: 80vh;
    }
}