/* ============================================================================
   SMARTBUILDER AVATAR ANIMATIONS 🎬
   Bring Open Peeps avatars to LIFE with CSS animations!
   ============================================================================ */

/* ============================================================================
   IDLE ANIMATIONS - Subtle, Always-On
   ============================================================================ */

/* Breathing Animation - Subtle chest rise/fall */
@keyframes breathe {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-2px) scale(1.01);
    }
}

.avatar-anim-breathe {
    animation: breathe 4s ease-in-out infinite;
}

/* Blinking Animation - Eyes close briefly */
@keyframes blink {
    0%, 90%, 100% {
        opacity: 1;
    }
    93%, 97% {
        opacity: 0.1;
    }
}

.avatar-anim-blink #face,
.avatar-anim-blink #accessories {
    animation: blink 5s infinite;
}

/* ============================================================================
   INTERACTIVE ANIMATIONS - Triggered by user actions
   ============================================================================ */

/* Wave Animation - Friendly greeting */
@keyframes wave {
    0%, 100% {
        transform: rotate(0deg);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: rotate(15deg);
    }
    20%, 40%, 60%, 80% {
        transform: rotate(-15deg);
    }
}

.avatar-anim-wave {
    animation: wave 2s ease-in-out infinite;
}

/* Celebration Animation - Victory dance! */
@keyframes celebrate {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    20% {
        transform: scale(1.1) rotate(-5deg);
    }
    40% {
        transform: scale(1.1) rotate(5deg);
    }
    60% {
        transform: scale(1.1) rotate(-5deg);
    }
    80% {
        transform: scale(1.1) rotate(5deg);
    }
}

.avatar-anim-celebrate {
    animation: celebrate 1s ease-in-out infinite;
}

/* Floating Animation - Ethereal hover effect */
@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-10px) rotate(2deg);
    }
    50% {
        transform: translateY(-20px) rotate(0deg);
    }
    75% {
        transform: translateY(-10px) rotate(-2deg);
    }
}

.avatar-anim-float {
    animation: float 4s ease-in-out infinite;
}

/* ============================================================================
   ENTRANCE ANIMATIONS - Avatar appears
   ============================================================================ */

@keyframes avatarEnter {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(30px);
    }
    50% {
        transform: scale(1.05) translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.avatar-enter {
    animation: avatarEnter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ============================================================================
   HOVER EFFECTS - Interactive feedback
   ============================================================================ */

.openpeeps-avatar:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 10px 20px rgba(0, 178, 227, 0.4));
}

.openpeeps-avatar {
    transition: transform 0.3s ease, filter 0.3s ease;
    cursor: pointer;
}

/* ============================================================================
   LEGENDARY GLOW - For legendary unlocks
   ============================================================================ */

@keyframes legendaryPulse {
    0%, 100% {
        filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.4));
    }
    50% {
        filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.8));
    }
}

.legendary-avatar {
    animation: legendaryPulse 2s ease-in-out infinite;
}

/* ============================================================================
   UNLOCK CELEBRATION - When unlocking new cosmetics
   ============================================================================ */

@keyframes unlockCelebration {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.cosmetic-unlock {
    animation: unlockCelebration 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* ============================================================================
   SHIMMER EFFECT - For locked items preview
   ============================================================================ */

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.locked-item {
    position: relative;
    overflow: hidden;
}

.locked-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.2) 50%,
        transparent 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 3s infinite;
}

/* ============================================================================
   COLOR TRANSITION - Smooth color changes
   ============================================================================ */

.avatar-color-transition {
    transition: fill 0.5s ease, stroke 0.5s ease;
}

/* ============================================================================
   POSE TRANSITION - Smooth pose swaps
   ============================================================================ */

@keyframes poseSwap {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.pose-changing {
    animation: poseSwap 0.4s ease-in-out;
}

/* ============================================================================
   RAINBOW ANIMATION - For rainbow hair color
   ============================================================================ */

@keyframes rainbowShift {
    0% {
        filter: hue-rotate(0deg);
    }
    100% {
        filter: hue-rotate(360deg);
    }
}

.rainbow-hair {
    animation: rainbowShift 3s linear infinite;
}
