/* AI Chat Assistant Styles */

/* Chat Button - Floating in bottom right */
#ai-chat-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 9998;
    border: none;
}

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

#ai-chat-button svg {
    width: 30px;
    height: 30px;
    color: white;
}

/* Pulsing animation when not opened */
#ai-chat-button.pulsing {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.8);
    }
    100% {
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    }
}

/* Chat Window Container */
#ai-chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 400px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    transition: all 0.3s ease;
}

#ai-chat-window.open {
    display: flex;
    animation: slideUp 0.3s ease;
}

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

/* Dark mode support */
.dark #ai-chat-window {
    background: #1F2937;
    border: 1px solid #374151;
}

/* Chat Header */
#ai-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#ai-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

#ai-chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

#ai-chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

#ai-chat-close svg {
    width: 18px;
    height: 18px;
    color: white;
}

/* Chat Messages Area */
#ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dark #ai-chat-messages {
    background: #111827;
}

/* Individual Message */
.ai-message {
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

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

.ai-message.user {
    flex-direction: row-reverse;
}

.ai-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-message.assistant .ai-message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.ai-message.user .ai-message-avatar {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.ai-message-avatar svg {
    width: 20px;
    height: 20px;
    color: white;
}

.ai-message-content {
    flex: 1;
    max-width: 75%;
}

.ai-message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 14px;
    word-wrap: break-word;
}

.ai-message.assistant .ai-message-bubble {
    background: #F3F4F6;
    color: #1F2937;
    border-bottom-left-radius: 4px;
}

.dark .ai-message.assistant .ai-message-bubble {
    background: #374151;
    color: #F3F4F6;
}

.ai-message.user .ai-message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message-time {
    font-size: 11px;
    color: #9CA3AF;
    margin-top: 4px;
}

.ai-message.user .ai-message-time {
    text-align: right;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9CA3AF;
    animation: typing 1.4s infinite;
}

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

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

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

/* Chat Input Area */
#ai-chat-input-area {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #E5E7EB;
}

.dark #ai-chat-input-area {
    background: #1F2937;
    border-top-color: #374151;
}

#ai-chat-input-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#ai-chat-input {
    flex: 1;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    resize: none;
    max-height: 120px;
    font-family: inherit;
    transition: border-color 0.2s;
}

#ai-chat-input:focus {
    outline: none;
    border-color: #667eea;
}

.dark #ai-chat-input {
    background: #374151;
    border-color: #4B5563;
    color: #F3F4F6;
}

.dark #ai-chat-input:focus {
    border-color: #667eea;
}

#ai-chat-send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

#ai-chat-send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

#ai-chat-send-btn svg {
    width: 20px;
    height: 20px;
    color: white;
}

/* Quick Reply Buttons (Demo Mode) */
.quick-replies-container {
    padding: 12px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-top: 1px solid #E5E7EB;
}

.dark .quick-replies-container {
    border-top-color: #374151;
}

.quick-reply-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.quick-reply-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.quick-reply-btn:active {
    transform: translateY(0);
}

.dark .quick-replies-container {
    background: #111827;
}

/* Demo Mode Chat Button Enhancement */
#ai-chat-button.demo-mode {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
}

#ai-chat-button.demo-mode.pulsing {
    animation: pulseDemo 2s infinite;
}

@keyframes pulseDemo {
    0% {
        box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(245, 87, 108, 0.8);
    }
    100% {
        box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
    }
}

/* Mobile Responsive */
@media (max-width: 640px) {
    #ai-chat-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 140px);
        right: 16px;
        bottom: 92px;
    }
    
    #ai-chat-button {
        right: 16px;
        bottom: 16px;
    }
    
    .quick-replies-container {
        padding: 8px 12px;
    }
    
    .quick-reply-btn {
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* Markdown Support in Messages */
.ai-message-bubble p {
    margin: 0 0 8px 0;
}

.ai-message-bubble p:last-child {
    margin-bottom: 0;
}

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

.ai-message-bubble li {
    margin: 4px 0;
}

.ai-message-bubble code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.dark .ai-message-bubble code {
    background: rgba(255, 255, 255, 0.1);
}

.ai-message-bubble pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.dark .ai-message-bubble pre {
    background: rgba(255, 255, 255, 0.05);
}

.ai-message-bubble pre code {
    background: none;
    padding: 0;
}

/* Scrollbar Styling */
#ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

#ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#ai-chat-messages::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 3px;
}

.dark #ai-chat-messages::-webkit-scrollbar-thumb {
    background: #4B5563;
}

#ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

