/* ===========================
   RAPIDWEBSOLUTION - ANIMATIONS
   Advanced 3D Effects & Smooth Transitions
   =========================== */

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

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

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

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

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

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-10deg) scale(0.9);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

/* ===========================
   3D CARD EFFECTS
   =========================== */
.card-3d {
    perspective: 1000px;
    transform-style: preserve-3d;
}

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

.card-3d:hover .card-3d-inner {
    transform: rotateY(5deg) rotateX(5deg);
}

.card-3d-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--border-radius-large);
}

/* ===========================
   FLOATING ANIMATIONS
   =========================== */
@keyframes floatUpDown {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-15px);
    }
}

@keyframes floatLeftRight {
    0%, 100% {
        transform: translateX(0px);
    }
    50% {
        transform: translateX(15px);
    }
}

@keyframes floatRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.float-animation {
    animation: floatUpDown 4s ease-in-out infinite;
}

.float-animation-delay {
    animation: floatUpDown 4s ease-in-out infinite;
    animation-delay: 2s;
}

.float-horizontal {
    animation: floatLeftRight 5s ease-in-out infinite;
}

.rotate-slow {
    animation: floatRotate 30s linear infinite;
}

/* ===========================
   MORPHING BACKGROUNDS
   =========================== */
@keyframes morphing {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    25% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
    50% {
        border-radius: 50% 30% 50% 60% / 40% 50% 70% 30%;
    }
    75% {
        border-radius: 70% 60% 40% 30% / 30% 70% 50% 40%;
    }
}

.morphing-bg {
    background: var(--gradient-primary);
    animation: morphing 8s ease-in-out infinite;
    opacity: 0.1;
}

/* ===========================
   PARALLAX EFFECTS
   =========================== */
.parallax-element {
    transform: translateZ(0);
    will-change: transform;
}

.parallax-slow {
    transform: translate3d(0, 0, 0);
}

.parallax-medium {
    transform: translate3d(0, 0, 0);
}

.parallax-fast {
    transform: translate3d(0, 0, 0);
}

/* ===========================
   GLOW EFFECTS
   =========================== */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 
            0 0 20px rgba(0, 102, 255, 0.3),
            0 0 40px rgba(0, 102, 255, 0.2),
            0 0 60px rgba(0, 102, 255, 0.1);
    }
    50% {
        box-shadow: 
            0 0 30px rgba(0, 102, 255, 0.5),
            0 0 60px rgba(0, 102, 255, 0.3),
            0 0 90px rgba(0, 102, 255, 0.2);
    }
}

@keyframes text-glow {
    0%, 100% {
        text-shadow: 
            0 0 10px rgba(0, 102, 255, 0.5),
            0 0 20px rgba(0, 102, 255, 0.3),
            0 0 30px rgba(0, 102, 255, 0.2);
    }
    50% {
        text-shadow: 
            0 0 15px rgba(0, 102, 255, 0.7),
            0 0 30px rgba(0, 102, 255, 0.5),
            0 0 45px rgba(0, 102, 255, 0.3);
    }
}

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

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

/* ===========================
   LOADING ANIMATIONS
   =========================== */
@keyframes loading-dots {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.loading-dots {
    display: inline-block;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    display: inline-block;
    margin: 0 2px;
    animation: loading-dots 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

/* ===========================
   HOVER EFFECTS
   =========================== */
.hover-lift {
    transition: all 0.3s ease;
}

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

.hover-tilt {
    transition: all 0.3s ease;
}

.hover-tilt:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(5deg);
}

.hover-scale {
    transition: transform 0.3s ease;
}

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

.hover-brightness {
    transition: filter 0.3s ease;
}

.hover-brightness:hover {
    filter: brightness(1.1);
}

/* ===========================
   TYPING ANIMATION
   =========================== */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

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

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

/* ===========================
   MAGNETIC EFFECT
   =========================== */
.magnetic {
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    cursor: pointer;
}

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

/* ===========================
   REVEAL ANIMATIONS
   =========================== */
@keyframes reveal-left {
    from {
        clip-path: polygon(0 0, 0 0, 0 100%, 0 100%);
    }
    to {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }
}

@keyframes reveal-right {
    from {
        clip-path: polygon(100% 0, 100% 0, 100% 100%, 100% 100%);
    }
    to {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }
}

@keyframes reveal-top {
    from {
        clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    }
    to {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }
}

@keyframes reveal-bottom {
    from {
        clip-path: polygon(0 100%, 100% 100%, 100% 100%, 0 100%);
    }
    to {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }
}

.reveal-left {
    animation: reveal-left 0.8s ease forwards;
}

.reveal-right {
    animation: reveal-right 0.8s ease forwards;
}

.reveal-top {
    animation: reveal-top 0.8s ease forwards;
}

.reveal-bottom {
    animation: reveal-bottom 0.8s ease forwards;
}

/* ===========================
   PARTICLE EFFECTS
   =========================== */
@keyframes particle-float {
    0% {
        opacity: 0;
        transform: translateY(100px) scale(0);
    }
    10% {
        opacity: 1;
        transform: translateY(80px) scale(0.5);
    }
    90% {
        opacity: 1;
        transform: translateY(-80px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(0);
    }
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: particle-float 6s infinite linear;
    pointer-events: none;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { left: 20%; animation-delay: 1s; }
.particle:nth-child(3) { left: 30%; animation-delay: 2s; }
.particle:nth-child(4) { left: 40%; animation-delay: 3s; }
.particle:nth-child(5) { left: 50%; animation-delay: 4s; }
.particle:nth-child(6) { left: 60%; animation-delay: 0.5s; }
.particle:nth-child(7) { left: 70%; animation-delay: 1.5s; }
.particle:nth-child(8) { left: 80%; animation-delay: 2.5s; }
.particle:nth-child(9) { left: 90%; animation-delay: 3.5s; }

/* ===========================
   GLITCH EFFECTS
   =========================== */
@keyframes glitch-1 {
    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);
    }
}

@keyframes glitch-2 {
    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 {
    position: relative;
}

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

.glitch::before {
    animation: glitch-1 0.6s infinite;
    color: #ff0000;
    z-index: -1;
}

.glitch::after {
    animation: glitch-2 0.6s infinite;
    color: #00ffff;
    z-index: -2;
}

/* ===========================
   SCROLL-TRIGGERED ANIMATIONS
   =========================== */
.scroll-fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

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

.scroll-slide-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.6s ease;
}

.scroll-slide-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.scroll-slide-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.6s ease;
}

.scroll-slide-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.scroll-zoom-in {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.6s ease;
}

.scroll-zoom-in.visible {
    opacity: 1;
    transform: scale(1);
}

/* ===========================
   COUNTER ANIMATIONS
   =========================== */
.counter {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

.counter.animate {
    animation: countUp 2s ease-out forwards;
}

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

/* ===========================
   BUTTON RIPPLE EFFECT
   =========================== */
.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%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}

/* ===========================
   PROGRESSIVE ENHANCEMENT
   =========================== */
@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;
    }
}

/* ===========================
   PERFORMANCE OPTIMIZATIONS
   =========================== */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

.smooth-animation {
    animation-fill-mode: both;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Enable hardware acceleration for animations */
.animate-on-scroll,
.hero-visual,
.floating-device,
.service-card,
.process-step {
    will-change: transform, opacity;
    transform: translateZ(0);
}

/* ===========================
   STAGGER ANIMATIONS
   =========================== */
.stagger-animation > * {
    animation: slideInFromBottom 0.6s ease forwards;
    opacity: 0;
}

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