/* ===================================
   Quantum Synapse AI - Chatbot Widget
   =================================== */

/* Chatbot Container */
#chatbot-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: var(--font-family, 'Inter', -apple-system, sans-serif);
}

/* Floating Toggle Button */
#chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #00E5FF 0%, #7C3AED 100%);
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 229, 255, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

#chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(0, 229, 255, 0.6);
}

#chatbot-toggle.active {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}

#chatbot-toggle svg {
    width: 28px;
    height: 28px;
    fill: white;
}

/* Chat Icon */
.chat-icon {
    display: block;
}

.close-icon {
    display: none;
}

#chatbot-toggle.active .chat-icon {
    display: none;
}

#chatbot-toggle.active .close-icon {
    display: block;
}

/* Chat Modal */
#chatbot-modal {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 380px;
    height: 520px;
    background: #1a1a1a;
    border-radius: 16px;
    border: 1px solid #2a2a2a;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

#chatbot-modal.active {
    display: flex;
}

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

/* Chat Header */
.chatbot-header {
    background: linear-gradient(135deg, #00E5FF 0%, #7C3AED 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-header-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-header-icon svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.chatbot-header-info h3 {
    color: white;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.chatbot-header-info span {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
}

/* Messages Container */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #111111;
}

/* Custom scrollbar for messages */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #2a2a2a;
    border-radius: 3px;
}

/* Message Bubbles */
.chatbot-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chatbot-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #00E5FF 0%, #7C3AED 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chatbot-message.assistant {
    align-self: flex-start;
    background: #1a1a1a;
    color: #e0e0e0;
    border: 1px solid #2a2a2a;
    border-bottom-left-radius: 4px;
}

/* Welcome Message */
.chatbot-welcome {
    text-align: center;
    padding: 20px;
    color: #a0a0a0;
}

.chatbot-welcome h4 {
    color: #00E5FF;
    margin-bottom: 8px;
    font-size: 16px;
}

.chatbot-welcome p {
    font-size: 13px;
    margin-bottom: 16px;
}

.chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.chatbot-suggestion {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: #00E5FF;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chatbot-suggestion:hover {
    background: #2a2a2a;
    border-color: #00E5FF;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    max-width: 60px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #00E5FF;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

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

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

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

/* Input Area */
.chatbot-input {
    padding: 16px;
    background: #1a1a1a;
    border-top: 1px solid #2a2a2a;
    display: flex;
    gap: 12px;
    align-items: center;
}

.chatbot-input input {
    flex: 1;
    background: #111111;
    border: 1px solid #2a2a2a;
    border-radius: 24px;
    padding: 12px 20px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.chatbot-input input:focus {
    border-color: #00E5FF;
}

.chatbot-input input::placeholder {
    color: #666666;
}

.chatbot-input button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #00E5FF 0%, #7C3AED 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chatbot-input button:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 10px rgba(0, 229, 255, 0.4);
}

.chatbot-input button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chatbot-input button svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Rate Limit Notice */
.chatbot-rate-limit {
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #EF4444;
    font-size: 13px;
    text-align: center;
    margin: 8px 16px;
}

/* Remaining Questions Counter */
.chatbot-remaining {
    padding: 8px 16px;
    background: #1a1a1a;
    font-size: 11px;
    color: #666666;
    text-align: center;
    border-top: 1px solid #2a2a2a;
}

.chatbot-remaining strong {
    color: #00E5FF;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #chatbot-widget {
        bottom: 16px;
        right: 16px;
    }

    #chatbot-toggle {
        width: 56px;
        height: 56px;
    }

    #chatbot-modal {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        animation: slideUpMobile 0.3s ease-out;
    }

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

/* Error Message */
.chatbot-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #EF4444;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    text-align: center;
}

/* Pulse Animation for Toggle */
@keyframes pulse {
    0% {
        box-shadow: 0 4px 20px rgba(0, 229, 255, 0.4);
    }
    50% {
        box-shadow: 0 4px 30px rgba(0, 229, 255, 0.6);
    }
    100% {
        box-shadow: 0 4px 20px rgba(0, 229, 255, 0.4);
    }
}

#chatbot-toggle:not(.active) {
    animation: pulse 2s infinite;
}
