/* ==========================================
   ROIATEK AI - Animations CSS (Enhanced)
   ========================================== */

/* ---------- Scroll-Triggered Animations ---------- */
[data-aos] {
    opacity: 0;
    transition-property: opacity, transform;
    transition-duration: 0.7s;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
}

[data-aos].aos-animate {
    opacity: 1;
}

/* Fade Up */
[data-aos="fade-up"] {
    transform: translateY(50px);
}

[data-aos="fade-up"].aos-animate {
    transform: translateY(0);
}

/* Fade Down */
[data-aos="fade-down"] {
    transform: translateY(-50px);
}

[data-aos="fade-down"].aos-animate {
    transform: translateY(0);
}

/* Fade Left */
[data-aos="fade-left"] {
    transform: translateX(50px);
}

[data-aos="fade-left"].aos-animate {
    transform: translateX(0);
}

/* Fade Right */
[data-aos="fade-right"] {
    transform: translateX(-50px);
}

[data-aos="fade-right"].aos-animate {
    transform: translateX(0);
}

/* Zoom In */
[data-aos="zoom-in"] {
    transform: scale(0.85);
}

[data-aos="zoom-in"].aos-animate {
    transform: scale(1);
}

/* Zoom Out */
[data-aos="zoom-out"] {
    transform: scale(1.15);
}

[data-aos="zoom-out"].aos-animate {
    transform: scale(1);
}

/* Flip Up */
[data-aos="flip-up"] {
    transform: perspective(2500px) rotateX(-30deg);
    transform-origin: center bottom;
}

[data-aos="flip-up"].aos-animate {
    transform: perspective(2500px) rotateX(0);
}

/* Flip Down */
[data-aos="flip-down"] {
    transform: perspective(2500px) rotateX(30deg);
    transform-origin: center top;
}

[data-aos="flip-down"].aos-animate {
    transform: perspective(2500px) rotateX(0);
}

/* Slide Up */
[data-aos="slide-up"] {
    transform: translateY(100px);
    opacity: 0;
}

[data-aos="slide-up"].aos-animate {
    transform: translateY(0);
    opacity: 1;
}

/* Slide Down */
[data-aos="slide-down"] {
    transform: translateY(-100px);
    opacity: 0;
}

[data-aos="slide-down"].aos-animate {
    transform: translateY(0);
    opacity: 1;
}

/* Fade In */
[data-aos="fade-in"] {
    opacity: 0;
}

[data-aos="fade-in"].aos-animate {
    opacity: 1;
}

/* Scale Up */
[data-aos="scale-up"] {
    transform: scale(0.7);
    opacity: 0;
}

[data-aos="scale-up"].aos-animate {
    transform: scale(1);
    opacity: 1;
}

/* Rotate In */
[data-aos="rotate-in"] {
    transform: rotate(-180deg);
    opacity: 0;
}

[data-aos="rotate-in"].aos-animate {
    transform: rotate(0);
    opacity: 1;
}

/* Animation Delays */
[data-aos-delay="100"] {
    transition-delay: 0.1s;
}

[data-aos-delay="200"] {
    transition-delay: 0.2s;
}

[data-aos-delay="300"] {
    transition-delay: 0.3s;
}

[data-aos-delay="400"] {
    transition-delay: 0.4s;
}

[data-aos-delay="500"] {
    transition-delay: 0.5s;
}

[data-aos-delay="600"] {
    transition-delay: 0.6s;
}

[data-aos-delay="700"] {
    transition-delay: 0.7s;
}

[data-aos-delay="800"] {
    transition-delay: 0.8s;
}

/* Animation Durations */
[data-aos-duration="400"] {
    transition-duration: 0.4s;
}

[data-aos-duration="600"] {
    transition-duration: 0.6s;
}

[data-aos-duration="800"] {
    transition-duration: 0.8s;
}

[data-aos-duration="1000"] {
    transition-duration: 1s;
}

[data-aos-duration="1200"] {
    transition-duration: 1.2s;
}

/* Animation Easing */
[data-aos-easing="ease"] {
    transition-timing-function: ease;
}

[data-aos-easing="ease-in"] {
    transition-timing-function: ease-in;
}

[data-aos-easing="ease-out"] {
    transition-timing-function: ease-out;
}

[data-aos-easing="ease-in-out"] {
    transition-timing-function: ease-in-out;
}

[data-aos-easing="linear"] {
    transition-timing-function: linear;
}

/* ---------- Continuous Animations ---------- */

/* Glow Pulse */
@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 245, 212, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(0, 245, 212, 0.6);
    }
}

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

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

.shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s linear infinite;
}

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

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

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

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

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

.pulse {
    animation: pulse 2s ease-in-out 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;
}

/* Shake Animation */
@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-in-out;
}

/* Float Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

.float {
    animation: float 3s ease-in-out 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;
}

/* Typewriter Effect */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

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

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

/* Scale In */
@keyframes scale-in {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

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

/* Slide In from Bottom */
@keyframes slide-in-bottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.slide-in-bottom {
    animation: slide-in-bottom 0.5s ease-out;
}

/* Slide In from Top */
@keyframes slide-in-top {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.slide-in-top {
    animation: slide-in-top 0.5s ease-out;
}

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

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

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    animation: ripple 0.6s ease-out;
}

/* Particle Float */
@keyframes particle-float {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx, 100px), var(--ty, -100px)) rotate(360deg);
        opacity: 0;
    }
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: particle-float 4s ease-in-out infinite;
}

/* Staggered Animation for Children */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
    animation: fade-up-children 0.6s ease forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.6s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.7s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.8s; }

@keyframes fade-up-children {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Glitch Effect */
@keyframes glitch {
    0% {
        clip-path: polygon(0 2%, 100% 2%, 100% 5%, 0 5%);
        transform: translate(-2px, 0);
    }
    20% {
        clip-path: polygon(0 15%, 100% 15%, 100% 15%, 0 15%);
        transform: translate(2px, 0);
    }
    40% {
        clip-path: polygon(0 10%, 100% 10%, 100% 20%, 0 20%);
        transform: translate(-2px, 0);
    }
    60% {
        clip-path: polygon(0 1%, 100% 1%, 100% 2%, 0 2%);
        transform: translate(2px, 0);
    }
    80% {
        clip-path: polygon(0 33%, 100% 33%, 100% 33%, 0 33%);
        transform: translate(-2px, 0);
    }
    100% {
        clip-path: polygon(0 44%, 100% 44%, 100% 44%, 0 44%);
        transform: translate(2px, 0);
    }
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    animation: glitch 0.3s ease-in-out infinite;
    color: var(--color-primary);
    z-index: -1;
}

.glitch::after {
    animation: glitch 0.3s ease-in-out infinite reverse;
    color: var(--color-accent);
    z-index: -1;
}

/* Number Counter Animation */
@keyframes count-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.count-up {
    animation: count-up 0.6s ease-out forwards;
}

/* Loading Skeleton */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-bg-card) 0px,
        var(--color-bg-card-hover) 40px,
        var(--color-bg-card) 80px
    );
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

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

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

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

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

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

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

/* Border Animation */
@keyframes border-dance {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 100% 100%;
    }
}

.animated-border {
    position: relative;
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
}

.animated-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: var(--gradient-primary);
    border-radius: calc(var(--radius-lg) + 2px);
    z-index: -1;
    animation: border-dance 3s linear infinite;
    background-size: 200% 200%;
}

/* Morph Animation */
@keyframes morph {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
}

.morph {
    animation: morph 8s ease-in-out infinite;
}

/* Heartbeat Animation */
@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    10%, 30% {
        transform: scale(0.9);
    }
    20%, 40% {
        transform: scale(1.1);
    }
}

.heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

/* 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;
    }
    
    [data-aos] {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

/* Mobile Optimizations - Keep scroll animations but simplify */
@media (max-width: 768px) {
    /* Keep scroll animations but make them simpler and faster */
    [data-aos] {
        transition-duration: 0.4s !important;
    }
    
    /* Reduce transform distances on mobile */
    [data-aos="fade-up"],
    [data-aos="fade-down"] {
        transform: translateY(30px);
    }
    
    [data-aos="fade-left"],
    [data-aos="fade-right"] {
        transform: translateX(30px);
    }
    
    [data-aos="zoom-in"] {
        transform: scale(0.9);
    }
    
    /* Disable heavy continuous animations on mobile */
    .glow-pulse,
    .gradient-animate,
    .morph,
    .heartbeat {
        animation: none !important;
    }
    
    /* Simplify shimmer on mobile */
    .shimmer {
        animation-duration: 3s !important;
    }
    
    /* Reduce particle animations */
    .particle {
        animation-duration: 6s !important;
    }
}
