/* Chatbot Styles */
.chatbot-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    max-height: 70vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none; /* Start hidden, will be shown by JS */
    flex-direction: column;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.chatbot-container.open {
    display: flex; /* Show when open */
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.chatbot-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 14px 16px;
    border-radius: 16px 16px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    font-weight: 600;
    font-size: 16px;
    text-transform: uppercase;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* If you want to use an image instead of initials */
.chatbot-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.chatbot-avatar .initials {
    line-height: 1;
    font-size: 16px;
}

/* Add a subtle animation on hover */
.chatbot-avatar:hover {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

.chatbot-info {
    flex: 1;
    min-width: 0;
}

.chatbot-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chatbot-info p {
    margin: 2px 0 0;
    font-size: 12px;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chatbot-actions {
    display: flex;
    gap: 8px;
    margin-left: 10px;
}

.chatbot-close,
.chatbot-clear {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.chatbot-close:hover,
.chatbot-clear:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.chatbot-close:active,
.chatbot-clear:active {
    transform: scale(0.95);
}

.chatbot-close i,
.chatbot-clear i {
    font-size: 14px;
}

.chatbot-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f9fafb;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db #f3f4f6;
}

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

.chatbot-messages::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 3px;
}

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

/* Message Styling */
.message {
    max-width: 80%;
    margin-bottom: 12px;
    line-height: 1.5;
    position: relative;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

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

/* User Message */
.user-message {
    background: #4f46e5;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Bot Message */
.bot-message {
    background: #f3f4f6;
    color: #111827;
    margin-right: auto;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Quick Questions */
.quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.quick-question {
    background: #eef2ff;
    border: 1px solid #e0e7ff;
    border-radius: 16px;
    padding: 6px 14px;
    font-size: 13px;
    color: #4f46e5;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 2px 0;
}

.quick-question:hover {
    background: #e0e7ff;
    transform: translateY(-1px);
}

/* Typing Indicator */
.typing-indicator {
    background: #f3f4f6;
    padding: 12px 16px;
    border-radius: 18px;
    display: inline-block;
    border-bottom-left-radius: 4px;
}

.typing-dots {
    display: flex;
    align-items: center;
    height: 20px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    margin: 0 2px;
    background-color: #9ca3af;
    border-radius: 50%;
    display: inline-block;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

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

/* Chat Input */
.chatbot-input {
    display: flex;
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    border-radius: 0 0 16px 16px;
}

.chatbot-input input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input input:focus {
    border-color: #a5b4fc;
    box-shadow: 0 0 0 3px rgba(165, 180, 252, 0.2);
}

#chatbot-send {
    background: #4f46e5;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-left: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#chatbot-send:hover {
    background: #4338ca;
    transform: scale(1.05);
}

#chatbot-send:active {
    transform: scale(0.95);
}

/* Chatbot Toggle Button */
#chatbot-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 1001; /* Higher than container */
    transition: all 0.3s ease;
    font-size: 24px;
    padding: 0;
    margin: 0;
    outline: none;
}

#chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.25);
}

#chatbot-toggle:active {
    transform: scale(0.95);
}

#chatbot-toggle i {
    color: white;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .chatbot-container {
        width: 90%;
        right: 5%;
        bottom: 80px;
        max-height: 60vh;
    }
    
    #chatbot-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
        bottom: 20px;
        right: 20px;
    }
    
    .chatbot-messages {
        padding: 12px;
    }
    
    .chatbot-input input {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .quick-questions {
        flex-direction: column;
        gap: 8px;
    }
    
    .quick-question {
        width: 100%;
        margin: 4px 0;
    }
}
