/*
 * Enhanced animations.css
 * Complete animation system for NIRDY character
 */

/* ============================================================================
   NIRDY CHARACTER STYLES
   ============================================================================ */

#nirdy {
    position: relative;
    width: 150px;
    height: 180px;
    transition: all 0.3s ease;
}

.nirdy-sprite {
    width: 120px;
    height: 120px;
    margin: 0 auto;
    background: linear-gradient(180deg, #0f0, #060);
    border: 3px solid #0f0;
    box-shadow: 0 0 8px #0f0, 0 0 16px rgba(0, 255, 0, 0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: monospace;
    color: #000;
    font-size: 48px;
    transition: all 0.3s ease;
    position: relative;
}

.face-name {
    font-size: 1rem;
    font-weight: bold;
    margin-top: 10px;
    color: #0f0;
    text-align: center;
    text-shadow: 0 0 8px rgba(0, 255, 0, 0.5);
}

/* ============================================================================
   SPEECH BUBBLE
   ============================================================================ */

.nirdy-bubble {
    position: fixed;
    background: #111;
    color: #0f0;
    border: 2px solid #0f0;
    padding: 12px 16px;
    max-width: 260px;
    border-radius: 12px;
    font-size: 12px;
    box-shadow: 0 4px 15px rgba(0, 255, 0, 0.3);
    z-index: 999;
    transition: all 0.3s ease;
    font-family: 'Press Start 2P', monospace;
    line-height: 1.6;
}

.nirdy-bubble.hidden {
    display: none;
}

.nirdy-bubble::after {
    content: '';
    position: absolute;
    border: 10px solid transparent;
    border-right-color: #0f0;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
}

/* ============================================================================
   CHARACTER EXPRESSIONS
   ============================================================================ */

.nirdy.idle .nirdy-sprite {
    background: linear-gradient(180deg, #0f0, #060);
    box-shadow: 0 0 8px #0f0;
}

.nirdy.happy .nirdy-sprite {
    background: linear-gradient(180deg, #6f6, #2b2);
    box-shadow: 0 0 12px #6f6;
}

.nirdy.thinking .nirdy-sprite {
    background: linear-gradient(180deg, #66f, #223);
    box-shadow: 0 0 12px #66f;
    border-color: #66f;
}

.nirdy.concerned .nirdy-sprite {
    background: linear-gradient(180deg, #f66, #522);
    box-shadow: 0 0 12px #f66;
    border-color: #f66;
}

.nirdy.victory .nirdy-sprite {
    background: linear-gradient(180deg, #ff0, #f80);
    box-shadow: 0 0 16px #ff0, 0 0 32px rgba(255, 255, 0, 0.5);
    border-color: #ff0;
}

.nirdy.excited .nirdy-sprite {
    background: linear-gradient(180deg, #f0f, #808);
    box-shadow: 0 0 12px #f0f;
    border-color: #f0f;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

/* Floating animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.float {
    animation: float 2s ease-in-out infinite;
}

/* Bounce animation */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-20px) scale(1.05);
    }
}

.bounce {
    animation: bounce 0.6s ease-in-out;
}

/* Shake animation */
@keyframes shake {
    0%, 100% {
        transform: translateX(0) rotate(0deg);
    }
    25% {
        transform: translateX(-10px) rotate(-5deg);
    }
    75% {
        transform: translateX(10px) rotate(5deg);
    }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* Spin animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 0.8s ease-in-out;
}

/* Pulse animation */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.pulse {
    animation: pulse 0.5s ease-in-out;
}

/* Bob animation (idle) */
@keyframes nirdy-bob {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-6px);
    }
}

.animate-bob {
    animation: nirdy-bob 2s ease-in-out infinite;
}

/* Celebrate animation */
@keyframes nirdy-celebrate {
    0% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.15) rotate(-10deg);
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    75% {
        transform: scale(1.15) rotate(-10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

.celebrate {
    animation: nirdy-celebrate 1.2s ease-in-out;
}

/* Particle effects */
@keyframes particleFloat {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) scale(0);
        opacity: 0;
    }
}

.particle {
    position: fixed;
    pointer-events: none;
    font-size: 24px;
    animation: particleFloat 1.5s ease-out forwards;
    z-index: 9999;
}

/* ============================================================================
   STATUS BAR & BADGES
   ============================================================================ */

#status-bar {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
    margin: 16px 0;
    padding: 12px;
    background: rgba(0, 255, 0, 0.05);
    border: 2px solid #0f0;
    border-radius: 8px;
}

#xp-display {
    color: #0f0;
    border: 2px solid #0f0;
    padding: 8px 12px;
    background: #000;
    border-radius: 6px;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(0, 255, 0, 0.5);
}

#badges-container {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.badge {
    background: #111;
    color: #0f0;
    border: 2px solid #0f0;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    display: flex;
    gap: 6px;
    align-items: center;
    animation: badgeAppear 0.5s ease-out;
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.3);
}

.badge-icon {
    font-size: 16px;
}

.badge-placeholder {
    color: #888;
    font-size: 12px;
    font-style: italic;
}

@keyframes badgeAppear {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 768px) {
    #nirdy {
        width: 100px;
        height: 130px;
    }

    .nirdy-sprite {
        width: 80px;
        height: 80px;
        font-size: 32px;
    }

    .nirdy-bubble {
        max-width: 200px;
        font-size: 10px;
        padding: 8px 12px;
    }

    .face-name {
        font-size: 0.8rem;
    }
}

/* ============================================================================
   GLOW EFFECTS
   ============================================================================ */

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 8px #0f0, 0 0 16px rgba(0, 255, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 16px #0f0, 0 0 32px rgba(0, 255, 0, 0.5);
    }
}

.nirdy-sprite:hover {
    animation: glow 2s ease-in-out infinite;
}

/* ============================================================================
   FADE IN ANIMATION
   ============================================================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

#nirdy {
    animation: fadeIn 0.5s ease-out;
}