/**
 * Dashboard Animations & Transitions
 * Modern, smooth animations for enhanced UX
 */

/* Toast Animations */
.toast.show > div {
    opacity: 1 !important;
    transform: translateX(0) !important;
}

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

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

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

.animate-scale-in {
    animation: scaleIn 0.3s ease-out;
}

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

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

/* Slide In From Top */
@keyframes slideInTop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-in-top {
    animation: slideInTop 0.3s ease-out;
}

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

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

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

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

/* Highlight Row Animation */
@keyframes highlight {
    0% {
        background-color: transparent;
    }
    50% {
        background-color: #d1fae5;
    }
    100% {
        background-color: transparent;
    }
}

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

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

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

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

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

/* Progress Bar Animation */
@keyframes progress {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.animate-progress {
    animation: progress 0.3s ease-out;
}

/* Shimmer Loading Effect */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.animate-shimmer {
    animation: shimmer 2s infinite linear;
    background: linear-gradient(
        to right,
        #f3f4f6 0%,
        #e5e7eb 20%,
        #f3f4f6 40%,
        #f3f4f6 100%
    );
    background-size: 1000px 100%;
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(
        90deg,
        #f3f4f6 25%,
        #e5e7eb 50%,
        #f3f4f6 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.375rem;
}

/* Hover Lift Effect */
.hover-lift {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

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

.transition-colors-smooth {
    transition: color 0.2s ease-in-out, background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

/* Card Flip Animation */
@keyframes flipIn {
    from {
        transform: perspective(400px) rotateY(90deg);
        opacity: 0;
    }
    to {
        transform: perspective(400px) rotateY(0deg);
        opacity: 1;
    }
}

.animate-flip-in {
    animation: flipIn 0.5s ease-out;
}

/* Fade Out Animation */
@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.animate-fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

/* Scale Out Animation */
@keyframes scaleOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

.animate-scale-out {
    animation: scaleOut 0.3s ease-out forwards;
}

/* Glow Effect */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(139, 92, 246, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(139, 92, 246, 0.8), 0 0 30px rgba(139, 92, 246, 0.6);
    }
}

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

/* Gradient Animation */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.animate-gradient {
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

/* Count Up Animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.animate-count-up {
    animation: countUp 0.4s ease-out;
}

/* Success Checkmark Animation */
@keyframes checkmark {
    0% {
        stroke-dashoffset: 100;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

.animate-checkmark {
    stroke-dasharray: 100;
    animation: checkmark 0.6s ease-out forwards;
}

/* Loading Dots Animation */
@keyframes loadingDots {
    0%, 20% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
    100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
}

.loading-dots span {
    display: inline-block;
    animation: loadingDots 1.4s infinite;
}

.loading-dots span:nth-child(1) {
    animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* Ripple Effect */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 0.5;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

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

.ripple-effect::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%);
    animation: ripple 0.6s ease-out;
}

/* Progress Ring Animation */
@keyframes progressRing {
    from {
        stroke-dashoffset: 251.2;
    }
    to {
        stroke-dashoffset: 0;
    }
}

.animate-progress-ring {
    stroke-dasharray: 251.2;
    animation: progressRing 2s ease-out forwards;
}

/* Backdrop Blur In */
@keyframes backdropBlurIn {
    from {
        backdrop-filter: blur(0px);
        background-color: rgba(0, 0, 0, 0);
    }
    to {
        backdrop-filter: blur(4px);
        background-color: rgba(0, 0, 0, 0.5);
    }
}

.animate-backdrop-blur-in {
    animation: backdropBlurIn 0.3s ease-out forwards;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    /* Faster animations on mobile */
    .toast,
    .animate-scale-in,
    .animate-fade-in,
    .animate-slide-in-right,
    .animate-slide-in-top {
        animation-duration: 0.2s !important;
    }
    
    /* Reduce motion for accessibility */
    @media (prefers-reduced-motion: reduce) {
        *,
        *::before,
        *::after {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
}

/* Z-index layers for proper stacking */
.z-toast {
    z-index: 9999;
}

.z-modal {
    z-index: 9998;
}

.z-dropdown {
    z-index: 9997;
}

.z-overlay {
    z-index: 9996;
}

/* Utility Classes */
.hover-scale {
    transition: transform 0.2s ease-in-out;
}

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

.hover-brighten {
    transition: filter 0.2s ease-in-out;
}

.hover-brighten:hover {
    filter: brightness(1.1);
}

.hover-shadow {
    transition: box-shadow 0.2s ease-in-out;
}

.hover-shadow:hover {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
