/* AI Assistant AI Helper Styles */

/* Chat Widget Container */
.ai-chat-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: system-ui, -apple-system, sans-serif;
}

/* Chat Widget Button */
.ai-chat-widget-button {
    position: relative;
}

.ai-chat-widget-button button {
    position: relative;
    overflow: hidden;
}

.ai-chat-widget-button button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* Chat Widget Popup */
.ai-chat-widget-popup {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Chat Header */
.ai-chat-header {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px 16px 0 0;
}

/* Chat Messages Area */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
    max-height: 320px;
}

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

/* Debug Info */
.ai-debug-info {
    position: absolute;
    bottom: 520px;
    right: 0;
    width: 380px;
}

.ai-chat-box {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ai-helper-modal-content {
    min-height: 500px;
    max-height: 80vh;
}

.ai-helper-global {
    position: relative;
}

/* Chat message animations */
.ai-chat-message {
    animation: fadeInUp 0.3s ease-out;
}

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

/* Loading dots animation */
.ai-loading-dots {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    animation: loadingDot 1.4s infinite ease-in-out both;
}

.ai-loading-dot:nth-child(1) { animation-delay: -0.32s; }
.ai-loading-dot:nth-child(2) { animation-delay: -0.16s; }
.ai-loading-dot:nth-child(3) { animation-delay: 0s; }

@keyframes loadingDot {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

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

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

.ai-chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.5);
    border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background-color: rgba(156, 163, 175, 0.7);
}

/* Dark mode adjustments */
.dark .ai-chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(75, 85, 99, 0.5);
}

.dark .ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background-color: rgba(75, 85, 99, 0.7);
}

/* Modal backdrop blur effect */
.ai-modal-backdrop {
    backdrop-filter: blur(4px);
}

/* Additional modal improvements */
.fi-modal-content {
    border-radius: 12px !important;
    overflow: hidden !important;
}

/* Prevent modal from being too close to edges */
@media (min-width: 768px) {
    .fi-modal-window .fi-modal {
        margin: 3rem auto !important;
    }
}

/* Ensure proper stacking above all debug elements */
.fi-modal-window {
    z-index: 99999 !important;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .ai-chat-widget-container {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }

    .ai-chat-widget-popup {
        width: 100%;
        height: 70vh;
        max-height: 500px;
        bottom: 70px;
        right: 0;
        left: 0;
    }

    .ai-chat-widget-button {
        position: absolute;
        right: 0;
    }

    .ai-debug-info {
        width: 100%;
        left: 0;
        right: 0;
    }
}

@media (max-width: 480px) {
    .ai-chat-widget-popup {
        height: 80vh;
        border-radius: 12px;
    }

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

    .ai-chat-messages {
        padding: 12px;
    }

    .ai-chat-input-area {
        padding: 12px;
        border-radius: 0 0 12px 12px;
    }
}

/* Focus states for accessibility */
.ai-chat-input:focus {
    outline: 2px solid rgb(59, 130, 246);
    outline-offset: 2px;
}

/* Button hover effects */
.ai-helper-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

/* Message bubble styles */
.ai-message-user {
    background: linear-gradient(135deg, rgb(59, 130, 246), rgb(37, 99, 235));
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.ai-message-assistant {
    background: rgb(243, 244, 246);
    color: rgb(17, 24, 39);
    border-radius: 18px 18px 18px 4px;
}

.dark .ai-message-assistant {
    background: rgb(31, 41, 55);
    color: rgb(243, 244, 246);
}

/* Typing indicator */
.ai-typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgb(243, 244, 246);
    border-radius: 18px 18px 18px 4px;
    max-width: fit-content;
}

.dark .ai-typing-indicator {
    background: rgb(31, 41, 55);
}
