@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

@keyframes slideUp {
    0% {
        transform: translateY(100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

#chat-button {
    width: 65px;
    height: 65px;
    background-color: rgba(173, 216, 230, 0.5);
    color: none;
    border: none;
    border-radius: 50%;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1001;
    backdrop-filter: blur(4px);
}

#chat-button::before {
    content: '';
    width: 60px;
    height: 60px;
    background: url('chat-icon.svg') no-repeat center center / contain;
    display: inline-block;
    fill: white;
}

.chat-icon {
    width: 120px;
    height: 120px;
}

#chat-button svg {
    fill: white;
    width: 56px;
    height: 56px;
    transition: transform 0.3s ease;
}

#chat-button:hover svg {
    transform: scale(1.1);
}

#chat-button:hover {
    animation: bounce 0.5s ease-in-out;
}

#chat-button::after {
    content: "Let's Chat";
    position: absolute;
    top: -40px;
    left: -40px;
    background-color: rgba(144, 202, 249, 0.95);
    color: var(--user-message-text);
    padding: 6px 10px;
    border-radius: 6px 6px 0px 6px;
    font-size: 12px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(10px) scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    z-index: 1002;
    animation: showTooltip 30s infinite;
}

@keyframes showTooltip {
    0%, 85% {
        opacity: 0;
        transform: translateY(10px) scale(0.9);
    }
    90%, 95% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(10px) scale(0.9);
    }
}

#chat-button:hover::after {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
    animation: none !important;
    transition: opacity 0.3s ease, transform 0.3s ease, filter 0.3s ease;
    filter: drop-shadow(0 0 8px rgba(144, 202, 249, 0.8));
    animation: coolTooltipAnimation 1.5s infinite ease-in-out;
}

@keyframes coolTooltipAnimation {
    0% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-5px) scale(1.05);
    }
    100% {
        transform: translateY(0) scale(1);
    }
}

#chatbot-iframe-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 1001;
    background-color: white;
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.5s ease, opacity 0.5s ease;
}

#chatbot-iframe-container.open {
    display: block;
    animation: slideUp 0.5s ease forwards;
}

#chatbot-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

#chatbot-close-button {
    position: absolute;
    top: 22px;
    right: 15px;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1003;
}

#chatbot-close-button:hover {
    color: lightgray;
}

@media (max-width: 600px) {
    #chatbot-iframe-container {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    #chatbot-close-button {
        right: 20px;
    }
}
