/**
 * Smooth Animations for Real-Time Dashboard Updates
 * No jarring page reloads - just smooth, beautiful transitions
 */

/* Pulse animation for stats updates */
@keyframes stat-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 10px 5px rgba(13, 110, 253, 0.3);
    }
}

.stat-update-pulse {
    animation: stat-pulse 0.6s ease-in-out;
}

/* Pulse animation for badges */
@keyframes badge-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7);
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 0 8px 3px rgba(255, 193, 7, 0.4);
    }
}

.badge-update-pulse {
    animation: badge-pulse 0.6s ease-in-out;
}

/* Fade-in for new items */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-new {
    animation: fade-in 0.4s ease-out;
}

/* Highlight new row in table */
@keyframes highlight-new-row {
    0% {
        background-color: rgba(13, 110, 253, 0.2);
    }
    100% {
        background-color: transparent;
    }
}

.new-row-highlight {
    animation: highlight-new-row 2s ease-out;
}

/* Smooth number transition */
.stat-number {
    transition: all 0.3s ease-in-out;
}

/* Loading spinner for smooth refresh */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.refresh-loading {
    position: relative;
}

.refresh-loading::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(13, 110, 253, 0.3);
    border-top-color: #0d6efd;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Smooth opacity transition */
.smooth-update {
    transition: opacity 0.2s ease-in-out;
}

.smooth-update.updating {
    opacity: 0.6;
}

/* Success flash for updated stat */
@keyframes success-flash {
    0%, 100% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(40, 167, 69, 0.15);
    }
}

.stat-success-flash {
    animation: success-flash 0.8s ease-in-out;
}

/* Notification badge glow */
@keyframes notification-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(220, 53, 69, 0.5);
    }
    50% {
        box-shadow: 0 0 15px rgba(220, 53, 69, 0.8);
    }
}

.notification-badge-glow {
    animation: notification-glow 1.5s ease-in-out infinite;
}

/* Smooth card update */
.card-updating {
    position: relative;
    overflow: hidden;
}

.card-updating::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    to {
        left: 100%;
    }
}

/* Prevent layout shift */
.stat-card {
    min-height: 100px;
}

/* Smooth transitions for all stats */
[data-stat] {
    transition: all 0.3s ease-in-out;
    display: inline-block;
}

/* Badge smooth update */
.badge {
    transition: all 0.2s ease-in-out;
}

