/* ====================================
   ADVANCED ANIMATIONS EXTENSION
   Extra animations and effects
   ==================================== */

/* ====================================
   3D TRANSFORMATIONS
   ==================================== */

.transform-3d {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.card-3d {
    transition: transform 0.3s ease;
    transform-style: preserve-3d;
}

.card-3d:hover {
    transform: rotateY(15deg) rotateX(10deg) translateZ(50px);
}

/* Flip cards animation */
.flip-card {
    background-color: transparent;
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    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%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* ====================================
   LIQUID ANIMATIONS
   ==================================== */

.liquid-button {
    position: relative;
    overflow: hidden;
    border: none;
    background: transparent;
    cursor: pointer;
}

.liquid-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.liquid-button:hover::before {
    left: 100%;
}

.liquid-bg {
    position: relative;
    overflow: hidden;
}

.liquid-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, 
        rgba(102, 126, 234, 0.1) 0%,
        rgba(118, 75, 162, 0.1) 25%,
        rgba(240, 147, 251, 0.1) 50%,
        rgba(102, 126, 234, 0.1) 75%,
        rgba(118, 75, 162, 0.1) 100%);
    background-size: 400% 400%;
    animation: liquidGradient 15s ease infinite;
    z-index: -1;
}

@keyframes liquidGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ====================================
   MAGNETIC HOVER EFFECTS
   ==================================== */

.magnetic-hover {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
}

.magnetic-hover:hover {
    transform: scale(1.05);
}

.magnetic-text {
    display: inline-block;
    transition: transform 0.3s ease;
}

.magnetic-text:hover {
    transform: translateY(-5px);
}

/* ====================================
   GLITCH EFFECTS
   ==================================== */

.glitch {
    position: relative;
    display: inline-block;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.8;
}

.glitch::before {
    animation: glitch-1 2s infinite;
    color: #ff00ff;
    z-index: -1;
}

.glitch::after {
    animation: glitch-2 2s infinite;
    color: #00ffff;
    z-index: -2;
}

@keyframes glitch-1 {
    0%, 14%, 15%, 49%, 50%, 99%, 100% {
        transform: translate(0, 0);
    }
    15%, 49% {
        transform: translate(-2px, 1px);
    }
}

@keyframes glitch-2 {
    0%, 20%, 21%, 62%, 63%, 99%, 100% {
        transform: translate(0, 0);
    }
    21%, 62% {
        transform: translate(2px, -1px);
    }
}

/* ====================================
   NEON GLOW EFFECTS
   ==================================== */

.neon-glow {
    color: #fff;
    text-shadow: 
        0 0 5px #667eea,
        0 0 10px #667eea,
        0 0 15px #667eea,
        0 0 20px #667eea,
        0 0 35px #667eea,
        0 0 40px #667eea;
    animation: neonFlicker 2s infinite alternate;
}

@keyframes neonFlicker {
    0%, 100% {
        text-shadow: 
            0 0 5px #667eea,
            0 0 10px #667eea,
            0 0 15px #667eea,
            0 0 20px #667eea,
            0 0 35px #667eea,
            0 0 40px #667eea;
    }
    50% {
        text-shadow: 
            0 0 2px #667eea,
            0 0 5px #667eea,
            0 0 8px #667eea,
            0 0 12px #667eea,
            0 0 18px #667eea,
            0 0 25px #667eea;
    }
}

.neon-border {
    border: 2px solid #667eea;
    box-shadow: 
        inset 0 0 10px #667eea,
        0 0 10px #667eea,
        0 0 20px #667eea,
        0 0 40px #667eea;
    animation: neonBorderPulse 3s ease-in-out infinite alternate;
}

@keyframes neonBorderPulse {
    from {
        box-shadow: 
            inset 0 0 10px #667eea,
            0 0 10px #667eea,
            0 0 20px #667eea,
            0 0 40px #667eea;
    }
    to {
        box-shadow: 
            inset 0 0 20px #764ba2,
            0 0 20px #764ba2,
            0 0 30px #764ba2,
            0 0 60px #764ba2;
    }
}

/* ====================================
   PARTICLE TRAIL EFFECTS
   ==================================== */

.particle-trail {
    position: relative;
    overflow: hidden;
}

.particle-trail::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    background: #667eea;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    animation: particleTrail 1s ease-out;
}

@keyframes particleTrail {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(3);
    }
}

/* ====================================
   WAVE ANIMATIONS
   ==================================== */

.wave-container {
    position: relative;
    height: 100px;
    overflow: hidden;
}

.wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M321.39,56.44c58-10.79,114.16-30.13,172-41.86,82.39-16.72,168.19-17.73,250.45-.39C823.78,31,906.67,72,985.66,92.83c70.05,18.48,146.53,26.09,214.34,3V0H0V27.35A600.21,600.21,0,0,0,321.39,56.44Z' fill='%23667eea' fill-opacity='0.3'/%3E%3C/svg%3E") repeat-x;
    animation: waveMove 10s linear infinite;
}

.wave:nth-child(2) {
    bottom: 10px;
    opacity: 0.5;
    animation: waveMove 15s linear infinite reverse;
}

.wave:nth-child(3) {
    bottom: 20px;
    opacity: 0.3;
    animation: waveMove 20s linear infinite;
}

@keyframes waveMove {
    0% { transform: translateX(0); }
    100% { transform: translateX(-1200px); }
}

/* ====================================
   HOLOGRAPHIC EFFECTS
   ==================================== */

.holographic {
    background: linear-gradient(45deg, 
        rgba(255, 0, 150, 0.5),
        rgba(0, 255, 255, 0.5),
        rgba(255, 255, 0, 0.5),
        rgba(255, 0, 150, 0.5));
    background-size: 400% 400%;
    animation: holographicShift 3s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes holographicShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.holographic-border {
    border: 2px solid;
    border-image: linear-gradient(45deg, 
        rgba(255, 0, 150, 0.8),
        rgba(0, 255, 255, 0.8),
        rgba(255, 255, 0, 0.8),
        rgba(255, 0, 150, 0.8)) 1;
    animation: holographicBorder 2s linear infinite;
}

@keyframes holographicBorder {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

/* ====================================
   MATRIX RAIN EFFECT
   ==================================== */

.matrix-rain {
    position: relative;
    overflow: hidden;
    background: #000;
    color: #0f0;
}

.matrix-rain::after {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 200%;
    background-image: 
        radial-gradient(1px 1px at 20px 30px, #0f0, transparent),
        radial-gradient(1px 1px at 40px 70px, rgba(0, 255, 0, 0.8), transparent),
        radial-gradient(1px 1px at 80px 120px, rgba(0, 255, 0, 0.6), transparent),
        radial-gradient(1px 1px at 90px 40px, rgba(0, 255, 0, 0.4), transparent);
    background-size: 100px 100px;
    animation: matrixFall 15s linear infinite;
}

@keyframes matrixFall {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

/* ====================================
   CYBERPUNK EFFECTS
   ==================================== */

.cyberpunk {
    position: relative;
    background: linear-gradient(45deg, #ff00ff, #00ffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cyberpunk::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, 
        transparent 30%, 
        rgba(255, 255, 255, 0.5) 50%, 
        transparent 70%);
    transform: translateX(-100%);
    animation: cyberpunkScan 2s infinite;
}

@keyframes cyberpunkScan {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.cyberpunk-grid {
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { background-position: 0 0; }
    100% { background-position: 20px 20px; }
}

/* ====================================
   GLASS MORPHISM ENHANCED
   ==================================== */

.glass-morphism {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 8px 32px 0 rgba(31, 38, 135, 0.37),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.glass-morphism-hover {
    transition: all 0.3s ease;
}

.glass-morphism-hover:hover {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(25px);
    transform: translateY(-5px);
    box-shadow: 
        0 15px 40px 0 rgba(31, 38, 135, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* ====================================
   ADVANCED BUTTON ANIMATIONS
   ==================================== */

.btn-quantum {
    position: relative;
    background: transparent;
    border: 2px solid #667eea;
    color: #667eea;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-quantum::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, #667eea, transparent);
    transition: left 0.5s ease;
}

.btn-quantum:hover::before {
    left: 100%;
}

.btn-quantum:hover {
    color: #ffffff;
    box-shadow: 0 0 30px #667eea;
}

.btn-morphing {
    background: linear-gradient(45deg, #667eea, #764ba2);
    border: none;
    color: white;
    border-radius: 50px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-morphing:hover {
    border-radius: 15px;
    transform: scale(1.05) rotate(2deg);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

/* ====================================
   TEXT ANIMATIONS
   ==================================== */

.typewriter {
    overflow: hidden;
    border-right: 0.15em solid #667eea;
    white-space: nowrap;
    animation: 
        typing 3.5s steps(40, end),
        blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: #667eea; }
}

.text-reveal {
    position: relative;
    overflow: hidden;
}

.text-reveal::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #667eea;
    animation: textRevealSlide 2s ease-in-out;
}

@keyframes textRevealSlide {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(0); }
    100% { transform: translateX(100%); }
}

/* ====================================
   HOVER TRAIL EFFECTS
   ==================================== */

.hover-trail {
    position: relative;
}

.hover-trail::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
    pointer-events: none;
}

.hover-trail:hover::after {
    width: 100px;
    height: 100px;
    opacity: 0;
}

/* ====================================
   PERFORMANCE OPTIMIZATIONS
   ==================================== */

/* Use GPU acceleration for animations */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000;
}

/* 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;
        scroll-behavior: auto !important;
    }
}

/* ====================================
   RESPONSIVE ANIMATION ADJUSTMENTS
   ==================================== */

@media (max-width: 768px) {
    .card-3d:hover {
        transform: rotateY(5deg) rotateX(3deg) translateZ(20px);
    }
    
    .magnetic-hover:hover {
        transform: scale(1.02);
    }
    
    .neon-glow {
        text-shadow: 
            0 0 2px #667eea,
            0 0 5px #667eea,
            0 0 8px #667eea;
    }
}

@media (max-width: 480px) {
    .glitch::before,
    .glitch::after {
        display: none;
    }
    
    .particle-trail::after {
        display: none;
    }
    
    .wave-container {
        height: 50px;
    }
}
