/* assets/css/chatbot.css */

/* Floating Button */
/* Floating Button (Robot Head) */
/* Floating Button (Robot Head) */
.chatbot-wrapper {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    touch-action: none;
    /* Prevent scrolling while dragging */
    transition: none;
    /* Disable transition during drag for responsiveness */
}

#chatbot-btn {
    position: relative;
    /* Changed from fixed - controlled by wrapper */
    width: 4rem;
    height: 4rem;
    border-radius: 40%;
    /* Squircle-ish head */
    background: #00F0FF;
    box-shadow: 0 10px 25px rgba(0, 240, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid rgba(255, 255, 255, 0.8);
    animation: float 6s ease-in-out infinite;
}

/* Speech Bubble */
#chatbot-bubble {
    background: white;
    color: #050505;
    padding: 12px 16px;
    border-radius: 12px;
    border-bottom-right-radius: 4px;
    /* Callout shape */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    /* Hidden by default, JS will show */
    transform: translateY(10px) translateX(-20px);
    transition: all 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    /* Click through until shown */
    margin-right: 10px;
}

#chatbot-bubble.visible {
    opacity: 1;
    transform: translateY(0) translateX(0);
    pointer-events: all;
}

/* Show immediately on hover */
.chatbot-wrapper:hover #chatbot-bubble {
    opacity: 1;
    transform: translateY(0) translateX(0);
    pointer-events: all;
}

#bubble-close {
    display: none;
    /* User wants hover-only behavior */
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 4px;
    line-height: 1;
}

#bubble-close:hover {
    color: #000;
}

#chatbot-btn:hover {
    transform: scale(1.1) rotate(-5deg);
    background: #fff;
    box-shadow: 0 0 40px rgba(0, 240, 255, 0.8);
}

/* Face Container */
.chatbot-face {
    position: relative;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 60%;
    height: 60%;
    pointer-events: none;
}

/* Eyes */
.eyes {
    display: flex;
    gap: 14px;
    justify-content: center;
    width: 100%;
}

.eye {
    display: block !important;
    width: 8px;
    height: 12px;
    background-color: #050505 !important;
    border-radius: 50%;
    animation: blink 4s infinite;
}

#chatbot-btn:hover .eye {
    background-color: #00F0FF !important;
    height: 10px;
}

/* Mouth */
.mouth {
    display: block !important;
    width: 16px;
    height: 8px;
    border-bottom: 3px solid #050505 !important;
    border-radius: 50%;
    transition: all 0.3s;
    animation: talk 3s infinite;
    /* Talk periodically */
}

#chatbot-btn:hover .mouth {
    border-color: #00F0FF !important;
    width: 20px;
    border-bottom: 4px solid #00F0FF !important;
    animation: none;
    /* Smile steadily on hover */
}

/* Animations */
@keyframes blink {

    0%,
    96%,
    100% {
        transform: scaleY(1);
    }

    98% {
        transform: scaleY(0.1);
    }
}

@keyframes talk {

    0%,
    90%,
    100% {
        height: 8px;
        border-bottom-width: 3px;
    }

    92% {
        height: 6px;
        border-bottom-width: 2px;
    }

    94% {
        height: 10px;
        border-bottom-width: 3px;
    }

    96% {
        height: 6px;
        border-bottom-width: 2px;
    }

    98% {
        height: 10px;
        border-bottom-width: 3px;
    }
}

/* Pulse Effect */
.chatbot-pulse::before,
.chatbot-pulse::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    /* Match button roundness if circular, currently button is 40% radius */
    border: 2px solid #00F0FF;
    animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

/* Animations */
@keyframes blink {

    0%,
    96%,
    100% {
        transform: scaleY(1);
    }

    98% {
        transform: scaleY(0.1);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.8;
    }

    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Chat Window */
#chatbot-window {
    position: fixed;
    bottom: 6.5rem;
    right: 2rem;
    width: 380px;
    height: 550px;
    max-height: 80vh;
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border-radius: 1.5rem;
    display: flex;
    flex-direction: column;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

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

/* Header */
.chat-header {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    color: white;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-close {
    color: #A1A1AA;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.chat-close:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

/* Messages Area */
.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

.message {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
    animation: messageIn 0.3s ease-out;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.message.user {
    align-self: flex-end;
    background: #00F0FF;
    color: #050505;
    border-bottom-right-radius: 0.25rem;
    box-shadow: 0 4px 15px rgba(0, 240, 255, 0.2);
}

.message.ai {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    color: #E4E4E7;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 0.25rem;
}

/* Typing Indicator */
.typing {
    display: flex;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    align-self: flex-start;
    width: fit-content;
}

.typing span {
    width: 0.4rem;
    height: 0.4rem;
    background: #A1A1AA;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

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

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Input Area */
.chat-input-area {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    gap: 0.5rem;
}

#chat-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    color: white;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

#chat-input:focus {
    border-color: #00F0FF;
}

#chat-send {
    background: #00F0FF;
    color: #050505;
    border: none;
    border-radius: 0.75rem;
    width: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

#chat-send:hover {
    background: #fff;
    transform: scale(1.05);
}

#chat-send:disabled {
    background: #333;
    color: #555;
    cursor: not-allowed;
    transform: none;
}

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

    #chatbot-btn {
        bottom: 1.5rem;
        right: 1.5rem;
    }
}