/**
 * Animations for Fanify
 * Smooth, modern animations for glassmorphic design
 */

/* Keyframe Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(73, 114, 243, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(217, 37, 210, 0.5);
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Scroll reveal animations */
.fade-in,
.slide-up,
.slide-down,
.slide-left,
.slide-right,
.scale-in {
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in.visible {
    animation: fadeIn 0.6s ease-out forwards;
}

.slide-up.visible {
    animation: slideUp 0.6s ease-out forwards;
}

.slide-down.visible {
    animation: slideDown 0.6s ease-out forwards;
}

.slide-left.visible {
    animation: slideLeft 0.6s ease-out forwards;
}

.slide-right.visible {
    animation: slideRight 0.6s ease-out forwards;
}

.scale-in.visible {
    animation: scaleIn 0.6s ease-out forwards;
}

/* Delay classes for staggered animations */
.delay-100 {
    animation-delay: 100ms !important;
}

.delay-200 {
    animation-delay: 200ms !important;
}

.delay-300 {
    animation-delay: 300ms !important;
}

.delay-400 {
    animation-delay: 400ms !important;
}

.delay-500 {
    animation-delay: 500ms !important;
}

/* Continuous animations */
.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

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

.animate-rotate {
    animation: rotate 20s linear infinite;
}

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

/* Shimmer effect */
.shimmer {
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* Hover animations */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.hover-scale {
    transition: transform var(--transition-base);
}

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

.hover-glow {
    transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
    box-shadow: 
        0 0 20px rgba(73, 114, 243, 0.4),
        0 0 40px rgba(217, 37, 210, 0.3);
}

/* Button press animation */
.btn-press:active {
    transform: scale(0.95);
}

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--glass-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

/* Page transition */
.page-transition {
    animation: fadeIn 0.4s ease-out;
}

/* Glassmorphic shine effect */
.glass-shine {
    position: relative;
    overflow: hidden;
}

.glass-shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transition: left 0.5s ease;
}

.glass-shine:hover::before {
    left: 100%;
}

/* Ripple effect */
@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.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.3);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.ripple:active::after {
    width: 100px;
    height: 100px;
    animation: ripple 0.6s ease-out;
}

/* 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;
    }
}
