/* ==========================================
   TechVision - Animations CSS
   ========================================== */

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn 0.8s ease forwards;
}

.animate-slide-up {
    animation: slideUp 0.8s ease forwards;
}

.animate-slide-up.delay-1 {
    animation-delay: 0.2s;
    opacity: 0;
}

.animate-slide-up.delay-2 {
    animation-delay: 0.4s;
    opacity: 0;
}

.animate-fade-in.delay-3 {
    animation-delay: 0.6s;
    opacity: 0;
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

/* Scroll Animations */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered animations for children */
.animate-on-scroll[data-delay="100"] {
    transition-delay: 0.1s;
}

.animate-on-scroll[data-delay="200"] {
    transition-delay: 0.2s;
}

.animate-on-scroll[data-delay="300"] {
    transition-delay: 0.3s;
}

/* Keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes floatRotate {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-15px) rotate(5deg);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes wave {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(20deg);
    }
    75% {
        transform: rotate(-20deg);
    }
}

@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(99, 102, 241, 0.5);
    }
    50% {
        box-shadow: 0 0 30px rgba(99, 102, 241, 0.8);
    }
}

@keyframes borderGlow {
    0%, 100% {
        border-color: rgba(99, 102, 241, 0.3);
    }
    50% {
        border-color: rgba(99, 102, 241, 0.8);
    }
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Hover Animation Classes */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.5);
}

/* Text Animations */
.text-gradient-animate {
    background: linear-gradient(
        90deg,
        #6366f1,
        #0ea5e9,
        #f43f5e,
        #6366f1
    );
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientMove 4s ease infinite;
}

/* Loading Animations */
.loading-dots {
    display: inline-flex;
    gap: 5px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: bounce 0.6s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.1s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.2s;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* Parallax Effect */
.parallax {
    transition: transform 0.1s ease-out;
}

/* Tilt Effect */
.tilt-effect {
    transform-style: preserve-3d;
    transition: transform 0.5s ease;
}

.tilt-effect:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(-5deg);
}

/* Magnetic Button Effect */
.magnetic-btn {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 50%;
    left: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 60%);
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: transform 0.6s ease, opacity 0.6s ease;
}

.ripple:active::after {
    transform: translate(-50%, -50%) scale(2);
    opacity: 1;
    transition: transform 0s, opacity 0s;
}

/* Cursor Effects */
.cursor-pointer {
    cursor: pointer;
}

/* Particle Animation */
@keyframes particle {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-1000px) rotate(720deg);
        opacity: 0;
    }
}

.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: rgba(99, 102, 241, 0.5);
    border-radius: 50%;
    animation: particle 10s linear infinite;
}

/* Morphing Shapes */
@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-shape {
    animation: morph 8s ease-in-out infinite;
}

/* Counter Animation */
.counter-animate {
    transition: all 0.5s ease;
}

/* Card Flip Animation */
.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    backface-visibility: hidden;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* Smooth Scroll Reveal */
.reveal {
    position: relative;
    overflow: hidden;
}

.reveal::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--primary);
    transform: translateX(-100%);
    transition: transform 0.6s cubic-bezier(0.77, 0, 0.175, 1);
}

.reveal.revealed::after {
    transform: translateX(100%);
}

/* Staggered Grid Animation */
.stagger-grid > * {
    opacity: 0;
    transform: translateY(20px);
}

.stagger-grid.animated > *:nth-child(1) { animation: slideUp 0.5s ease forwards 0.1s; }
.stagger-grid.animated > *:nth-child(2) { animation: slideUp 0.5s ease forwards 0.2s; }
.stagger-grid.animated > *:nth-child(3) { animation: slideUp 0.5s ease forwards 0.3s; }
.stagger-grid.animated > *:nth-child(4) { animation: slideUp 0.5s ease forwards 0.4s; }
.stagger-grid.animated > *:nth-child(5) { animation: slideUp 0.5s ease forwards 0.5s; }
.stagger-grid.animated > *:nth-child(6) { animation: slideUp 0.5s ease forwards 0.6s; }

/* Smooth Color Transition */
.color-transition {
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

/* Image Zoom on Hover */
.img-zoom {
    overflow: hidden;
}

.img-zoom img {
    transition: transform 0.5s ease;
}

.img-zoom:hover img {
    transform: scale(1.1);
}

/* Underline Animation */
.underline-animation {
    position: relative;
}

.underline-animation::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 0;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width 0.3s ease;
}

.underline-animation:hover::after {
    width: 100%;
}

/* 3D Button */
.btn-3d {
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.btn-3d::before {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    filter: brightness(0.7);
    transform: translateZ(-10px);
    border-radius: inherit;
}

.btn-3d:hover {
    transform: translateZ(10px);
}

/* Glitch Effect */
@keyframes glitch {
    0%, 100% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
}

.glitch:hover {
    animation: glitch 0.3s ease infinite;
}

/* Neon Glow */
.neon-glow {
    text-shadow: 
        0 0 5px currentColor,
        0 0 10px currentColor,
        0 0 20px currentColor,
        0 0 40px currentColor;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
