/**
 * NextSet - Shared Animations
 * Subtle, fun animations to make the website more alive
 */

/* === SCROLL-TRIGGERED ANIMATIONS === */

/* Fade in from bottom */
.animate-fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-fade-in.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Fade in from left */
.animate-fade-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-fade-left.is-visible {
    opacity: 1;
    transform: translateX(0);
}

/* Fade in from right */
.animate-fade-right {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-fade-right.is-visible {
    opacity: 1;
    transform: translateX(0);
}

/* Scale up animation */
.animate-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.animate-scale.is-visible {
    opacity: 1;
    transform: scale(1);
}

/* Staggered children animation */
.animate-stagger > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.animate-stagger.is-visible > *:nth-child(1) { transition-delay: 0s; }
.animate-stagger.is-visible > *:nth-child(2) { transition-delay: 0.1s; }
.animate-stagger.is-visible > *:nth-child(3) { transition-delay: 0.2s; }
.animate-stagger.is-visible > *:nth-child(4) { transition-delay: 0.3s; }
.animate-stagger.is-visible > *:nth-child(5) { transition-delay: 0.4s; }
.animate-stagger.is-visible > *:nth-child(6) { transition-delay: 0.5s; }

.animate-stagger.is-visible > * {
    opacity: 1;
    transform: translateY(0);
}

/* === HOVER ANIMATIONS === */

/* Subtle float on hover */
.hover-float {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-float:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

/* Gentle pulse on hover */
.hover-pulse:hover {
    animation: gentlePulse 0.6s ease-in-out;
}

@keyframes gentlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

/* Icon bounce on hover */
.hover-bounce:hover .feature-icon,
.hover-bounce:hover .value-icon,
.hover-bounce:hover .stat-icon {
    animation: iconBounce 0.5s ease;
}

@keyframes iconBounce {
    0%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
    50% { transform: translateY(-4px); }
    70% { transform: translateY(-6px); }
}

/* Subtle glow on hover */
.hover-glow:hover {
    box-shadow: 0 0 20px rgba(255, 165, 0, 0.2);
}

/* === CONTINUOUS SUBTLE ANIMATIONS === */

/* Subtle floating animation */
.float-subtle {
    animation: floatSubtle 4s ease-in-out infinite;
}

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

/* Gentle rotate animation for icons/decorations */
.rotate-gentle {
    animation: rotateGentle 20s linear infinite;
}

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

/* Breathing effect for highlights */
.breathe {
    animation: breathe 3s ease-in-out infinite;
}

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

/* === BUTTON ANIMATIONS === */

/* Button shine effect */
.btn-shine {
    position: relative;
    overflow: hidden;
}

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

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

/* === CARD ANIMATIONS === */

/* Card tilt on hover (subtle 3D effect) */
.card-tilt {
    transition: transform 0.3s ease;
    transform-style: preserve-3d;
}

.card-tilt:hover {
    transform: perspective(1000px) rotateX(2deg) rotateY(-2deg) translateY(-4px);
}

/* === TEXT ANIMATIONS === */

/* Gradient text shimmer */
.text-shimmer {
    background: linear-gradient(
        90deg,
        var(--primary) 0%,
        var(--secondary) 50%,
        var(--primary) 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: textShimmer 3s linear infinite;
}

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

/* Underline grow animation */
.underline-grow {
    position: relative;
}

.underline-grow::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease, left 0.3s ease;
}

.underline-grow:hover::after {
    width: 100%;
    left: 0;
}

/* === LOADING/TRANSITION ANIMATIONS === */

/* Skeleton loading pulse */
.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

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

/* === DECORATIVE ELEMENTS === */

/* Floating dots/particles background */
.floating-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.floating-particles .particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0.15;
    animation: particleFloat 15s ease-in-out infinite;
}

.floating-particles .particle:nth-child(1) { left: 10%; animation-delay: 0s; animation-duration: 12s; }
.floating-particles .particle:nth-child(2) { left: 25%; animation-delay: 2s; animation-duration: 14s; }
.floating-particles .particle:nth-child(3) { left: 40%; animation-delay: 4s; animation-duration: 16s; }
.floating-particles .particle:nth-child(4) { left: 55%; animation-delay: 1s; animation-duration: 13s; }
.floating-particles .particle:nth-child(5) { left: 70%; animation-delay: 3s; animation-duration: 15s; }
.floating-particles .particle:nth-child(6) { left: 85%; animation-delay: 5s; animation-duration: 17s; }

@keyframes particleFloat {
    0%, 100% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.15;
    }
    90% {
        opacity: 0.15;
    }
    100% {
        transform: translateY(-20vh) rotate(360deg);
        opacity: 0;
    }
}

/* === NUMBER COUNTING ANIMATION (CSS support) === */

/* Visual feedback during count */
.counting {
    transition: transform 0.1s ease;
}

/* === REDUCED MOTION === */
/* Respect user preferences for reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .animate-fade-in,
    .animate-fade-left,
    .animate-fade-right,
    .animate-scale,
    .animate-stagger > * {
        opacity: 1;
        transform: none;
    }
}
