/* Advanced Animations and Transitions */

/* Scroll-triggered animations */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.slide-in-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.6s ease;
}

.slide-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.slide-in-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.6s ease;
}

.slide-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Enhanced button animations */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:active {
    transform: translateY(-1px) scale(0.98);
}

/* Floating elements */
.float-animation {
    animation: float 6s ease-in-out infinite;
}

.float-animation:nth-child(2n) {
    animation-delay: -2s;
}

.float-animation:nth-child(3n) {
    animation-delay: -4s;
}

/* Pulsing elements */
.pulse-animation {
    animation: pulse 3s ease-in-out infinite;
}

.pulse-animation:nth-child(2n) {
    animation-delay: -1s;
}

/* Rotating elements */
.rotate-animation {
    animation: rotate 8s linear infinite;
}

.rotate-slow {
    animation: rotate 12s linear infinite;
}

/* Bouncing elements */
.bounce-animation {
    animation: bounce 2s ease-in-out infinite;
}

.bounce-animation:nth-child(2n) {
    animation-delay: -0.5s;
}

/* Wobble effect */
.wobble {
    animation: wobble 1s ease-in-out;
}

@keyframes wobble {
    0% { transform: translateX(0%); }
    15% { transform: translateX(-25px) rotate(-5deg); }
    30% { transform: translateX(20px) rotate(3deg); }
    45% { transform: translateX(-15px) rotate(-3deg); }
    60% { transform: translateX(10px) rotate(2deg); }
    75% { transform: translateX(-5px) rotate(-1deg); }
    100% { transform: translateX(0%); }
}

/* Shake effect */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

/* Glow effect */
.glow {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 5px #FFD700, 0 0 10px #FFD700, 0 0 15px #FFD700;
    }
    to {
        box-shadow: 0 0 10px #FFD700, 0 0 20px #FFD700, 0 0 30px #FFD700;
    }
}

/* Scale on hover */
.scale-hover {
    transition: transform 0.3s ease;
}

.scale-hover:hover {
    transform: scale(1.05);
}

/* Flip animation */
.flip {
    animation: flip 1s ease-in-out;
}

@keyframes flip {
    0% { transform: rotateY(0); }
    50% { transform: rotateY(180deg); }
    100% { transform: rotateY(0); }
}

/* Slide up animation */
.slide-up {
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Zoom in animation */
.zoom-in {
    animation: zoomIn 0.5s ease-out;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Typewriter effect */
.typewriter {
    overflow: hidden;
    border-right: 3px solid #FF4500;
    white-space: nowrap;
    animation: typing 3s 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: #FF4500; }
}

/* Gradient animation */
.gradient-animation {
    background: linear-gradient(-45deg, #FFD700, #FFA500, #FF8C00, #FF4500);
    background-size: 400% 400%;
    animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Particle effect */
.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #FFD700;
    border-radius: 50%;
    animation: particle 3s linear infinite;
}

@keyframes particle {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(0);
    }
}

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #FF4500;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Stagger animation for lists */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    animation: staggerIn 0.6s ease forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.1s; }
.stagger-item:nth-child(2) { animation-delay: 0.2s; }
.stagger-item:nth-child(3) { animation-delay: 0.3s; }
.stagger-item:nth-child(4) { animation-delay: 0.4s; }
.stagger-item:nth-child(5) { animation-delay: 0.5s; }
.stagger-item:nth-child(6) { animation-delay: 0.6s; }

@keyframes staggerIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Morphing shapes */
.morph {
    animation: morph 4s ease-in-out infinite;
}

@keyframes morph {
    0%, 100% {
        border-radius: 50% 50% 50% 50%;
    }
    25% {
        border-radius: 60% 40% 60% 40%;
    }
    50% {
        border-radius: 40% 60% 40% 60%;
    }
    75% {
        border-radius: 70% 30% 70% 30%;
    }
}

/* Text reveal animation */
.text-reveal {
    position: relative;
    overflow: hidden;
}

.text-reveal::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #FFD700;
    animation: reveal 1.5s ease-in-out forwards;
}

@keyframes reveal {
    0% {
        left: 0;
        width: 100%;
    }
    50% {
        left: 0;
        width: 100%;
    }
    100% {
        left: 100%;
        width: 0;
    }
}

/* Hover effects for cards */
.card-hover {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card-hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.card-hover:hover::before {
    left: 100%;
}

.card-hover:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

/* Smooth scroll indicator */
.scroll-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 4px;
    background: linear-gradient(90deg, #FFD700, #FF4500);
    z-index: 9999;
    transition: width 0.1s ease;
}

/* Mobile-specific animations */
@media (max-width: 768px) {
    .float-animation {
        animation-duration: 4s;
    }
    
    .pulse-animation {
        animation-duration: 2s;
    }
    
    .rotate-animation {
        animation-duration: 6s;
    }
    
    .bounce-animation {
        animation-duration: 1.5s;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .float-animation,
    .pulse-animation,
    .rotate-animation,
    .bounce-animation,
    .wobble,
    .shake,
    .glow,
    .flip,
    .gradient-animation,
    .particle,
    .spinner,
    .morph {
        animation: none;
    }
    
    .scale-hover:hover {
        transform: none;
    }
    
    .card-hover:hover {
        transform: none;
    }
}