/* Chatbot Container */
#chatbot-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9998;
    /* Below preloader but above most content */
    font-family: var(--font-main);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* Chat Toggle Button */
#chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    box-shadow: 0 5px 20px rgba(0, 242, 234, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2;
}

#chatbot-toggle:hover {
    transform: scale(1.1);
}

#chatbot-toggle svg {
    width: 30px;
    height: 30px;
    fill: var(--bg-dark);
    /* Icon color matches dark background */
}

/* Chat Window */
#chat-window {
    width: 350px;
    height: 500px;
    background: rgba(10, 14, 18, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 242, 234, 0.2);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 20px;
    transform-origin: bottom right;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);

    /* Hidden State */
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8) translateY(20px);
}

#chat-window.active {
    opacity: 1;
    pointer-events: all;
    transform: scale(1) translateY(0);
}

/* Chat Header */
.chat-header {
    background: var(--gradient-primary);
    padding: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--bg-dark);
}

.chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-header .close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--bg-dark);
    opacity: 0.7;
    transition: opacity 0.2s;
    font-size: 1.5rem;
    line-height: 1;
}

.chat-header .close-btn:hover {
    opacity: 1;
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

/* Message Bubbles */
.message {
    max-width: 80%;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

.message.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-dark);
    border-bottom-left-radius: 2px;
}

.message.user {
    align-self: flex-end;
    background: rgba(0, 242, 234, 0.2);
    border: 1px solid rgba(0, 242, 234, 0.3);
    color: var(--text-dark);
    border-bottom-right-radius: 2px;
}

/* Chat Input Area */
.chat-input-area {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 0.8rem;
    background: rgba(0, 0, 0, 0.2);
}

.chat-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 0.8rem 1rem;
    color: var(--white);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s;
}

.chat-input-area input:focus {
    border-color: var(--primary-color);
}

.chat-input-area button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    border: none;
    color: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.chat-input-area button:hover {
    transform: scale(1.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    #chat-window {
        width: 100%;
        height: 100%;
        position: fixed;
        bottom: 0;
        right: 0;
        margin: 0;
        border-radius: 0;
    }

    #chatbot-container {
        bottom: 20px;
        right: 20px;
    }
}