/* ============================================================================
   PupGatchi Avatar Animations
   
   These animations bring "Pixel" (the digital twin) to life.
   Used by PuppyAvatar.razor component in both Web and Mobile.
   
   States:
   - chill/normal: Breathing animation, calm glow
   - hungry: Wiggle animation, warm glow
   - zoomies/happy: Bounce animation, excited glow
   - critical: Alert pulse, red glow
   - sleeping: Slow breathing, dim glow
   ============================================================================ */

/* CONTAINER & GLOW */
.avatar-container {
    position: relative;
    width: 280px;
    height: 280px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    transition: all 0.5s ease;
    margin: 0 auto;
}

/* Small variant for dashboard widgets */
.avatar-container.avatar-small {
    width: 120px;
    height: 120px;
}

.avatar-container.avatar-small .puppy-visual img {
    width: 90px;
}

/* STATE: CRITICAL (Red Pulse Background) */
.state-critical {
    background: radial-gradient(circle, rgba(255, 69, 0, 0.3) 0%, rgba(0,0,0,0) 70%);
    animation: critical-pulse 1s ease-in-out infinite;
}

@keyframes critical-pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 69, 0, 0.3); }
    50% { box-shadow: 0 0 40px rgba(255, 69, 0, 0.6); }
}

/* STATE: HUNGRY (Warm Orange Background) */
.state-hungry {
    background: radial-gradient(circle, rgba(255, 165, 0, 0.15) 0%, rgba(0,0,0,0) 70%);
}

/* STATE: NORMAL/CHILL (Calm Green Background) */
.state-normal,
.state-chill {
    background: radial-gradient(circle, rgba(50, 205, 50, 0.1) 0%, rgba(0,0,0,0) 70%);
}

/* STATE: HAPPY/ZOOMIES (Excited Blue Background) */
.state-happy,
.state-zoomies {
    background: radial-gradient(circle, rgba(0, 191, 255, 0.15) 0%, rgba(0,0,0,0) 70%);
}

/* STATE: SLEEPING (Dim Purple Background) */
.state-sleeping {
    background: radial-gradient(circle, rgba(138, 43, 226, 0.1) 0%, rgba(0,0,0,0) 70%);
}

/* THE COLLAR GLOW (Dynamic Island Style) */
.collar-glow {
    position: absolute;
    bottom: 40px;
    width: 60px;
    height: 12px;
    border-radius: 10px;
    z-index: 10;
    transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

.collar-glow.glow-green {
    background-color: #00ff88;
    box-shadow: 0 0 15px #00ff88, 0 0 30px rgba(0, 255, 136, 0.5);
}

.collar-glow.glow-orange {
    background-color: #ff9800;
    box-shadow: 0 0 15px #ff9800, 0 0 30px rgba(255, 152, 0, 0.5);
}

.collar-glow.glow-red {
    background-color: #ff4444;
    box-shadow: 0 0 15px #ff4444, 0 0 30px rgba(255, 68, 68, 0.5);
    animation: collar-pulse 0.5s ease-in-out infinite;
}

.collar-glow.glow-blue {
    background-color: #00bfff;
    box-shadow: 0 0 15px #00bfff, 0 0 30px rgba(0, 191, 255, 0.5);
}

.collar-glow.glow-purple {
    background-color: #8a2be2;
    box-shadow: 0 0 10px #8a2be2, 0 0 20px rgba(138, 43, 226, 0.3);
    opacity: 0.6;
}

@keyframes collar-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* PUPPY VISUAL */
.puppy-visual {
    position: relative;
    z-index: 5;
}

.puppy-visual img,
.puppy-visual svg {
    width: 220px;
    height: auto;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.3));
    transition: transform 0.3s ease;
}

/* 1. Breathe (Normal/Chill State) */
@keyframes breathe {
    0% { transform: scale(1) translateY(0); }
    50% { transform: scale(1.02) translateY(-2px); }
    100% { transform: scale(1) translateY(0); }
}

.breathing-animation {
    animation: breathe 4s ease-in-out infinite;
}

/* 2. Wiggle (Hungry/Needs Attention) */
@keyframes wiggle {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

.wiggle-animation {
    animation: wiggle 0.4s ease-in-out infinite;
}

/* 3. Bounce (Zoomies/Happy) */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.bounce-animation {
    animation: bounce 0.6s cubic-bezier(0.28, 0.84, 0.42, 1) infinite;
}

/* 4. Sleep (Slow breathing with slight opacity) */
@keyframes sleep-breathe {
    0% { transform: scale(1) translateY(0); opacity: 0.9; }
    50% { transform: scale(1.01) translateY(-1px); opacity: 1; }
    100% { transform: scale(1) translateY(0); opacity: 0.9; }
}

.sleeping-animation {
    animation: sleep-breathe 6s ease-in-out infinite;
}

/* 5. Alert/Critical (Fast shake) */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.alert-animation {
    animation: shake 0.5s ease-in-out infinite;
}

/* HUD OVERLAY (Vitality Info) */
.hud-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 12px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 100px;
}

/* BREED-SPECIFIC METER */
.breed-meter {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
}

.breed-meter .meter-icon {
    font-size: 1rem;
}

.breed-meter .meter-label {
    color: rgba(255, 255, 255, 0.7);
}

.breed-meter .meter-status {
    margin-left: auto;
}

.breed-meter.meter-ok {
    border-left: 3px solid #00ff88;
}

.breed-meter.meter-ok .meter-status {
    color: #00ff88;
}

.breed-meter.meter-warning {
    border-left: 3px solid #ff9800;
    background: rgba(255, 152, 0, 0.15);
}

.breed-meter.meter-warning .meter-status {
    color: #ff9800;
}

.breed-meter.meter-critical {
    border-left: 3px solid #ff4444;
    background: rgba(255, 68, 68, 0.2);
    animation: meter-pulse 0.5s ease-in-out infinite;
}

.breed-meter.meter-critical .meter-status {
    color: #ff4444;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@keyframes meter-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.heart-rate {
    color: #00ffaa;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 2px 0;
}

.heart-rate.warning {
    color: #ff9800;
}

.heart-rate.critical {
    color: #ff4444;
    animation: blink 0.5s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ARCHETYPE BADGE */
.archetype-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    backdrop-filter: blur(8px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: help;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.archetype-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

/* SPEECH BUBBLE */
.speech-bubble {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 0.9rem;
    white-space: nowrap;
    z-index: 20;
    animation: bubble-pop 0.3s ease-out;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid white;
}

@keyframes bubble-pop {
    0% { transform: translateX(-50%) scale(0); opacity: 0; }
    100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* MOOD EMOJI */
.mood-emoji {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 15;
}

/* ACCESSORY SLOT */
.accessory-slot {
    position: absolute;
    z-index: 8;
}

.accessory-slot.hat {
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.accessory-slot.bandana {
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
}
