/* ==========================================
   ANIMATED FULL-BODY CHARACTER (PNG)
   ========================================== */

/* Character Container */
.character-container {
    position: relative;
    width: 200px;
    height: 280px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: linear-gradient(180deg, rgba(0, 212, 255, 0.05) 0%, transparent 100%);
    border-radius: 25px;
    padding: 5px;
    box-shadow: 0 10px 40px rgba(0, 212, 255, 0.25);
    overflow: visible;
}

/* Image Wrapper with animations */
.character-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    animation: characterIdle 4s ease-in-out infinite;
    transform-origin: center bottom;
}

/* Character Image (PNG with transparency) */
.character-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center bottom;
    /* Removed drop-shadow to improve clarity */
}

/* Idle breathing/floating animation */
@keyframes characterIdle {

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

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

/* Talk bubbles */
.talk-bubbles {
    position: absolute;
    top: 8%;
    left: -10%;
    pointer-events: none;
}

.bubble {
    position: absolute;
    background: linear-gradient(135deg, #00d4ff, #7b2ff7);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.4);
    opacity: 0;
}

.bubble.b1 {
    width: 10px;
    height: 10px;
    top: 10px;
    left: 0;
    animation: bubble1Float 3.5s ease-in-out infinite;
}

.bubble.b2 {
    width: 14px;
    height: 14px;
    top: 0px;
    left: 20px;
    animation: bubble2Float 3.5s ease-in-out infinite 0.4s;
}

.bubble.b3 {
    width: 12px;
    height: 12px;
    top: 15px;
    left: 40px;
    animation: bubble3Float 3.5s ease-in-out infinite 0.8s;
}

@keyframes bubble1Float {

    0%,
    65%,
    100% {
        opacity: 0;
        transform: translateY(0) scale(0.3);
    }

    15%,
    55% {
        opacity: 0.9;
        transform: translateY(-25px) scale(1);
    }
}

@keyframes bubble2Float {

    0%,
    65%,
    100% {
        opacity: 0;
        transform: translateY(0) scale(0.3);
    }

    15%,
    55% {
        opacity: 1;
        transform: translateY(-30px) scale(1);
    }
}

@keyframes bubble3Float {

    0%,
    65%,
    100% {
        opacity: 0;
        transform: translateY(0) scale(0.3);
    }

    15%,
    55% {
        opacity: 0.8;
        transform: translateY(-28px) scale(1);
    }
}

/* Show bubbles when chatbot is talking */
.chatbot-widget.talking .talk-bubbles .bubble {
    animation-play-state: running;
}

/* Hover effect - character bounces energetically */
.chatbot-avatar-button:hover .character-image-wrapper {
    animation: characterHover 0.8s ease-in-out;
}

@keyframes characterHover {

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

    30% {
        transform: translateY(-20px) scale(1.05) rotate(-3deg);
    }

    60% {
        transform: translateY(-15px) scale(1.03) rotate(3deg);
    }
}

/* Greeting bubble adjustment */
.chatbot-avatar-button .avatar-greeting-bubble {
    bottom: calc(100% + 15px);
    right: 50%;
    transform: translateX(50%);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .character-container {
        width: 160px;
        height: 240px;
    }

    .talk-bubbles {
        left: -5%;
    }
}

/* On a phone, full size it covers the page's content (filters, figures,
   cards): an avatar in the corner, no bubbles — a tap still opens it. */
@media (max-width: 640px) {
    .character-container {
        width: 70px;
        height: 98px;
        box-shadow: none;
    }

    .avatar-greeting-bubble,
    .talk-bubbles {
        display: none;
    }
}

/* When chatbot window is open, reduce character size slightly */
.chatbot-window.active~.chatbot-avatar-button .character-container {
    transform: scale(0.85);
    transition: transform 0.3s ease;
}