/* Chat Button Styles */
.ai-chatbot-button {
    position: fixed;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    z-index: 9999;
    transition: all 0.3s ease;
    bottom: 20px;
    font-size: 24px;
    border: none;
    outline: none;
}

.ai-chatbot-button.right {
    right: 20px;
}

.ai-chatbot-button.left {
    left: 20px;
}

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

.ai-chatbot-button.is-hidden {
    display: none;
}

/* Chat Modal Styles */
#ai-chatbot-modal {
    position: fixed;
    width: 380px;
    height: 500px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 9998;
    background: #fff;
    display: none;
    flex-direction: column;
    overflow: hidden;
    bottom: 90px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#ai-chatbot-modal.is-visible {
    display: flex;
    animation: slideUp 0.3s ease;
}

#ai-chatbot-modal.right {
    right: 20px;
}

#ai-chatbot-modal.left {
    left: 20px;
}

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

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

.ai-chatbot-header .ai-chatbot-title {
    font-weight: 600;
    font-size: 16px;
}

.ai-chatbot-header .ai-chatbot-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.ai-chatbot-header .ai-chatbot-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Messages Container */
.ai-chatbot-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f8f9fa;
    max-height: 350px;
}

.ai-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

.ai-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Message Bubble Styles */
.message {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 85%;
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 14px;
    animation: messageAppear 0.3s ease;
}

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

.message.user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
}

.message.ai {
    background: white;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message.ai a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid rgba(102, 126, 234, 0.3);
    transition: all 0.2s ease;
}

.message.ai a:hover {
    color: #764ba2;
    border-bottom-color: #764ba2;
}

/* Typing Indicator */
.message.typing {
    background: white;
    align-self: flex-start;
    animation: pulse 1.5s infinite;
}

.typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.typing-dots span {
    height: 8px;
    width: 8px;
    background: #667eea;
    border-radius: 50%;
    display: inline-block;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Input Form Styles */
.ai-chatbot-form {
    display: flex;
    padding: 20px;
    border-top: 1px solid #e9ecef;
    background: white;
    border-radius: 0 0 15px 15px;
    gap: 10px;
}

.ai-chatbot-form input {
    flex-grow: 1;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    padding: 12px 18px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.3s ease;
    background: #f8f9fa;
}

.ai-chatbot-form input:focus {
    border-color: #667eea;
    background: white;
}

.ai-chatbot-form input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ai-chatbot-form button {
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 25px;
    padding: 12px 24px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    min-width: 80px;
}

.ai-chatbot-form button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.ai-chatbot-form button:active {
    transform: translateY(0);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    #ai-chatbot-modal {
        width: 90vw;
        height: 70vh;
        max-width: 350px;
        max-height: 500px;
        right: 5vw !important;
        left: 5vw !important;
    }
    
    .ai-chatbot-button {
        width: 55px;
        height: 55px;
        font-size: 22px;
        bottom: 15px;
        right: 15px !important;
    }
    
    .message {
        max-width: 90%;
        font-size: 13px;
    }
}