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

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Slide In from Right */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Slide In from Left */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Slide In from Bottom */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Slide Up - For PWA Install Banners */
@keyframes slideUp {
    from {
        transform: translate(-50%, 20px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* Scale In */
@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

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

/* Pulse Glow - For Avatar */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 
            0 0 30px rgba(59, 130, 246, 0.6),
            0 0 60px rgba(59, 130, 246, 0.4),
            0 0 100px rgba(59, 130, 246, 0.2);
    }
    50% {
        box-shadow: 
            0 0 40px rgba(59, 130, 246, 0.8),
            0 0 80px rgba(59, 130, 246, 0.6),
            0 0 120px rgba(59, 130, 246, 0.4);
    }
}


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

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

/* Shake */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Bounce */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

/* Heartbeat - Emergency Service Icon */
@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
    }
    10% {
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(239, 68, 68, 0.6);
    }
    20% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
    }
    30% {
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(239, 68, 68, 0.6);
    }
    40%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
    }
}

/* Emergency Badge Pulse */
@keyframes pulse-emergency {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
    }
}

/* ==================== ANIMATION CLASSES ==================== */

.animate-fade-in {
    animation: fadeIn 0.5s ease;
}

.animate-slide-in-right {
    animation: slideInRight 0.3s ease;
}

.animate-slide-in-left {
    animation: slideInLeft 0.3s ease;
}

.animate-slide-in-up {
    animation: slideInUp 0.4s ease;
}

.animate-scale-in {
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.animate-spin {
    animation: spin 1s linear infinite;
}

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

/* ==================== HOVER EFFECTS ==================== */

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
}

.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

/* ==================== PAGE TRANSITIONS ==================== */

.page-enter {
    animation: slideInRight 0.3s ease;
}

.page-exit {
    animation: slideInLeft 0.3s ease reverse;
}

/* ==================== RIPPLE EFFECT ==================== */

.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}

/* ==================== LOADING STATES ==================== */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 25%,
        var(--bg-card) 50%,
        var(--bg-secondary) 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

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

.stagger-container > * {
    animation: slideInUp 0.5s ease both;
}

.stagger-container > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-container > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-container > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-container > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-container > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-container > *:nth-child(6) { animation-delay: 0.6s; }

/* ==================== SMOOTH TRANSITIONS ==================== */

.smooth {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.smooth-fast {
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.smooth-slow {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
