/* ========================================
   ANIMATIONS & MICRO-INTERACTIONS
   Smooth, Performant, Delightful
   ======================================== */

/* ============ PAGE TRANSITIONS ============ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

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

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

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

/* ============ BUTTON ANIMATIONS ============ */
@keyframes buttonPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.7);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(0, 255, 136, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 255, 136, 0);
    }
}

.cta-primary:hover {
    animation: buttonPulse 1.5s infinite;
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

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

.btn-ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 50%;
    left: 50%;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
}

.btn-ripple:active::after {
    animation: ripple 0.6s ease-out;
}

/* ============ LOADING ANIMATIONS ============ */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.95);
    }
}

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

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-card) 0%,
        var(--bg-light) 50%,
        var(--bg-card) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}

/* ============ TEXT ANIMATIONS ============ */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blinkCursor {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: var(--primary);
    }
}

.typewriter-text {
    overflow: hidden;
    border-right: 3px solid var(--primary);
    white-space: nowrap;
    animation: 
        typewriter 3s steps(40) 1s both,
        blinkCursor 0.75s step-end infinite;
}

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

.gradient-text {
    background: linear-gradient(
        90deg,
        var(--primary),
        var(--secondary),
        var(--accent),
        var(--primary)
    );
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 5s ease infinite;
}

/* ============ HOVER EFFECTS ============ */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

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

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.5);
}

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

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

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

.hover-rotate:hover {
    transform: rotate(5deg);
}

/* ============ SCROLL ANIMATIONS ============ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scroll-reveal {
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards;
}

.scroll-reveal-delay-1 {
    animation-delay: 0.1s;
}

.scroll-reveal-delay-2 {
    animation-delay: 0.2s;
}

.scroll-reveal-delay-3 {
    animation-delay: 0.3s;
}

.scroll-reveal-delay-4 {
    animation-delay: 0.4s;
}

/* ============ PARALLAX EFFECTS ============ */
.parallax-layer {
    transition: transform 0.3s cubic-bezier(0.33, 1, 0.68, 1);
}

/* ============ CARD ANIMATIONS ============ */
.card-flip {
    perspective: 1000px;
}

.card-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.card-flip:hover .card-flip-inner {
    transform: rotateY(180deg);
}

.card-flip-front,
.card-flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.card-flip-back {
    transform: rotateY(180deg);
}

/* ============ MODAL ANIMATIONS ============ */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(100px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes modalSlideOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(100px) scale(0.9);
    }
}

.modal-enter {
    animation: modalSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-exit {
    animation: modalSlideOut 0.3s cubic-bezier(0.7, 0, 0.84, 0);
}

/* ============ FORM ANIMATIONS ============ */
@keyframes inputFocus {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.4);
    }
    100% {
        box-shadow: 0 0 0 4px rgba(0, 255, 136, 0.1);
    }
}

input:focus,
textarea:focus,
select:focus {
    animation: inputFocus 0.3s ease;
}

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

.shake {
    animation: shake 0.5s ease;
}

@keyframes success {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.success-animate {
    animation: success 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ============ PROGRESS ANIMATIONS ============ */
@keyframes progressBar {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.progress-bar {
    animation: progressBar 2s ease forwards;
}

@keyframes circularProgress {
    0% {
        stroke-dashoffset: 440;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

.circular-progress {
    animation: circularProgress 2s ease forwards;
}

/* ============ NOTIFICATION ANIMATIONS ============ */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(120%);
    }
}

.notification-enter {
    animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.notification-exit {
    animation: slideOutRight 0.3s cubic-bezier(0.7, 0, 0.84, 0);
}

/* ============ NUMBER COUNTER ANIMATION ============ */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.count-up {
    animation: countUp 0.8s ease;
}

/* ============ WAVE ANIMATION ============ */
@keyframes wave {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

.wave {
    animation: wave 20s linear infinite;
}

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

.bounce {
    animation: bounce 2s ease infinite;
}

/* ============ SWING ANIMATION ============ */
@keyframes swing {
    0%, 100% {
        transform: rotate(0deg);
    }
    20% {
        transform: rotate(15deg);
    }
    40% {
        transform: rotate(-10deg);
    }
    60% {
        transform: rotate(5deg);
    }
    80% {
        transform: rotate(-5deg);
    }
}

.swing {
    transform-origin: top center;
    animation: swing 2s ease-in-out infinite;
}

/* ============ PARTICLE ANIMATION ============ */
@keyframes particle {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(0);
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(var(--x), var(--y)) scale(1);
    }
}

.particle {
    animation: particle 1s ease-out forwards;
}

/* ============ GLITCH EFFECT ============ */
@keyframes glitch {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
    100% {
        transform: translate(0);
    }
}

.glitch {
    animation: glitch 0.3s ease;
}

/* ============ NEON GLOW ============ */
@keyframes neonGlow {
    0%, 100% {
        text-shadow: 
            0 0 10px var(--primary),
            0 0 20px var(--primary),
            0 0 30px var(--primary),
            0 0 40px var(--primary);
    }
    50% {
        text-shadow: 
            0 0 5px var(--primary),
            0 0 10px var(--primary),
            0 0 15px var(--primary),
            0 0 20px var(--primary);
    }
}

.neon-text {
    animation: neonGlow 2s ease-in-out infinite;
}

/* ============ TYPEWRITER CURSOR ============ */
@keyframes cursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.cursor {
    animation: cursor 1s step-end infinite;
}

/* ============ MAGNETIC EFFECT ============ */
.magnetic {
    transition: transform 0.2s cubic-bezier(0.33, 1, 0.68, 1);
}

.magnetic:hover {
    transform: translate(var(--mouse-x, 0), var(--mouse-y, 0));
}

/* ============ STAGGER ANIMATIONS ============ */
.stagger > * {
    animation: fadeInUp 0.6s ease backwards;
}

.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.3s; }
.stagger > *:nth-child(7) { animation-delay: 0.35s; }
.stagger > *:nth-child(8) { animation-delay: 0.4s; }
.stagger > *:nth-child(9) { animation-delay: 0.45s; }
.stagger > *:nth-child(10) { animation-delay: 0.5s; }

/* ============ PERFORMANCE OPTIMIZATIONS ============ */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* GPU acceleration */
.gpu-accelerate {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* ============ ACCESSIBILITY - RESPECT MOTION PREFERENCES ============ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}