/**
 * Premium Animations & Effects
 * Enterprise Construction Platform - Advanced Animations
 */

/* ===== GSAP Animation Classes ===== */
.gsap-fade-in {
    opacity: 0;
    transform: translateY(30px);
}

.gsap-fade-in-up {
    opacity: 0;
    transform: translateY(50px);
}

.gsap-fade-in-down {
    opacity: 0;
    transform: translateY(-50px);
}

.gsap-fade-in-left {
    opacity: 0;
    transform: translateX(-50px);
}

.gsap-fade-in-right {
    opacity: 0;
    transform: translateX(50px);
}

.gsap-scale-in {
    opacity: 0;
    transform: scale(0.8);
}

.gsap-rotate-in {
    opacity: 0;
    transform: rotate(-5deg) scale(0.9);
}

/* ===== Scroll Reveal Animations ===== */
.scroll-reveal {
    opacity: 0;
    transform: translateY(60px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.scroll-reveal-left {
    opacity: 0;
    transform: translateX(-80px);
    transition: all 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-reveal-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.scroll-reveal-right {
    opacity: 0;
    transform: translateX(80px);
    transition: all 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-reveal-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

.scroll-reveal-scale {
    opacity: 0;
    transform: scale(0.7);
    transition: all 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scroll-reveal-scale.revealed {
    opacity: 1;
    transform: scale(1);
}

/* ===== Advanced Hover Effects ===== */
.hover-lift {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hover-lift:hover {
    transform: translateY(-15px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.hover-glow {
    position: relative;
    transition: all 0.3s ease;
}

.hover-glow::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--accent-color), transparent, var(--accent-color));
    border-radius: inherit;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.hover-glow:hover::before {
    opacity: 0.5;
    animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% {
        filter: blur(10px);
    }
    50% {
        filter: blur(15px);
    }
}

/* ===== Magnetic Button Effect ===== */
.magnetic-btn {
    position: relative;
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.magnetic-btn:hover {
    transform: scale(1.05);
}

/* ===== Text Reveal Animation ===== */
.text-reveal {
    overflow: hidden;
    position: relative;
}

.text-reveal span {
    display: inline-block;
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.text-reveal.revealed span {
    transform: translateY(0);
    opacity: 1;
}

/* ===== Shimmer Effect ===== */
.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* ===== Floating Animation ===== */
.float-animation {
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* ===== Pulse Animation ===== */
.pulse-animation {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

/* ===== Rotate Animation ===== */
.rotate-animation {
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ===== Gradient Animation ===== */
.gradient-animation {
    background: linear-gradient(-45deg, #1a1a1a, #2d2d2d, #1a1a1a, #141414);
    background-size: 400% 400%;
    animation: gradient-shift 15s ease infinite;
}

@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ===== Particle Background ===== */
.particles-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.particle {
    position: absolute;
    background: var(--accent-color);
    border-radius: 50%;
    opacity: 0.1;
    animation: particle-float 20s infinite ease-in-out;
}

@keyframes particle-float {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    25% {
        transform: translateY(-100px) translateX(50px);
    }
    50% {
        transform: translateY(-200px) translateX(-50px);
    }
    75% {
        transform: translateY(-100px) translateX(100px);
    }
}

/* ===== Image Reveal Animation ===== */
.image-reveal {
    position: relative;
    overflow: hidden;
}

.image-reveal img {
    transform: scale(1.1);
    transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.image-reveal:hover img {
    transform: scale(1);
}

.image-reveal::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(212, 175, 55, 0.2) 0%,
        transparent 50%
    );
    opacity: 0;
    transition: opacity 0.5s ease;
}

.image-reveal:hover::after {
    opacity: 1;
}

/* ===== Text Gradient Animation ===== */
.text-gradient {
    background: linear-gradient(90deg, #ffffff, #d4af37, #ffffff);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: text-gradient-shift 3s linear infinite;
}

@keyframes text-gradient-shift {
    to {
        background-position: 200% center;
    }
}

/* ===== Counter Animation ===== */
.counter-number {
    display: inline-block;
}

/* ===== Progress Bar Animation ===== */
.progress-bar {
    position: relative;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), #f4d03f);
    width: 0%;
    transition: width 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.progress-fill.animated {
    animation: progress-glow 2s ease-in-out infinite;
}

@keyframes progress-glow {
    0%, 100% {
        box-shadow: 0 0 10px var(--accent-color);
    }
    50% {
        box-shadow: 0 0 20px var(--accent-color);
    }
}

/* ===== Loading Spinner ===== */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(212, 175, 55, 0.1);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== 3D Flip Effect ===== */
.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* ===== Smooth Scroll Indicator ===== */
.scroll-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-color), #f4d03f);
    z-index: 10000;
    transition: width 0.1s ease;
}

/* ===== Cursor Follow Effect ===== */
.cursor-follow {
    cursor: none;
}

.cursor-dot {
    width: 10px;
    height: 10px;
    background: var(--accent-color);
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    transition: transform 0.1s ease;
}

.cursor-dot.active {
    transform: scale(2);
    background: rgba(212, 175, 55, 0.5);
}

/* ===== Stagger Children Animation ===== */
.stagger-children > * {
    opacity: 0;
    transform: translateY(30px);
}

.stagger-children.animate > *:nth-child(1) {
    animation: fade-in-up 0.6s ease forwards;
    animation-delay: 0.1s;
}

.stagger-children.animate > *:nth-child(2) {
    animation: fade-in-up 0.6s ease forwards;
    animation-delay: 0.2s;
}

.stagger-children.animate > *:nth-child(3) {
    animation: fade-in-up 0.6s ease forwards;
    animation-delay: 0.3s;
}

.stagger-children.animate > *:nth-child(4) {
    animation: fade-in-up 0.6s ease forwards;
    animation-delay: 0.4s;
}

.stagger-children.animate > *:nth-child(5) {
    animation: fade-in-up 0.6s ease forwards;
    animation-delay: 0.5s;
}

.stagger-children.animate > *:nth-child(6) {
    animation: fade-in-up 0.6s ease forwards;
    animation-delay: 0.6s;
}

@keyframes fade-in-up {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Parallax Layers ===== */
.parallax-layer {
    will-change: transform;
}

/* ===== Glitch Effect ===== */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 #ff00c1;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 #00fff9, 2px 2px #ff00c1;
    animation: glitch-anim2 1s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% {
        clip: rect(31px, 9999px, 94px, 0);
    }
    20% {
        clip: rect(74px, 9999px, 61px, 0);
    }
    40% {
        clip: rect(28px, 9999px, 16px, 0);
    }
    60% {
        clip: rect(45px, 9999px, 40px, 0);
    }
    80% {
        clip: rect(10px, 9999px, 62px, 0);
    }
    100% {
        clip: rect(78px, 9999px, 88px, 0);
    }
}

@keyframes glitch-anim2 {
    0% {
        clip: rect(65px, 9999px, 100px, 0);
    }
    20% {
        clip: rect(98px, 9999px, 14px, 0);
    }
    40% {
        clip: rect(33px, 9999px, 90px, 0);
    }
    60% {
        clip: rect(86px, 9999px, 7px, 0);
    }
    80% {
        clip: rect(23px, 9999px, 55px, 0);
    }
    100% {
        clip: rect(52px, 9999px, 76px, 0);
    }
}

/* ===== 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.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}

/* ===== Morphing Blob Background ===== */
.morphing-blob {
    position: absolute;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    background: linear-gradient(135deg, var(--accent-color), transparent);
    opacity: 0.1;
    animation: morph 20s ease-in-out infinite;
}

@keyframes morph {
    0%, 100% {
        border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        border-radius: 58% 42% 75% 25% / 76% 46% 54% 24%;
        transform: translate(20px, -20px) rotate(90deg);
    }
    50% {
        border-radius: 50% 50% 33% 67% / 55% 27% 73% 45%;
        transform: translate(-20px, 20px) rotate(180deg);
    }
    75% {
        border-radius: 33% 67% 58% 42% / 63% 68% 32% 37%;
        transform: translate(20px, 20px) rotate(270deg);
    }
}

/* ===== Text Split Animation ===== */
.split-text {
    display: inline-block;
    overflow: hidden;
}

.split-text span {
    display: inline-block;
    transform: translateY(100%);
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.split-text.revealed span {
    transform: translateY(0);
}

/* ===== Smooth Page Transition ===== */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    z-index: 10000;
    transform: translateY(100%);
    transition: transform 0.6s cubic-bezier(0.77, 0, 0.175, 1);
}

.page-transition.active {
    transform: translateY(0);
}

