/* Animation Keyframes */
@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 scaleUp {
    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 bounceGentle {
    0%, 20%, 53%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-15px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

@keyframes wiggle {
    0%, 7% {
        transform: rotateZ(0);
    }
    15% {
        transform: rotateZ(-15deg);
    }
    20% {
        transform: rotateZ(10deg);
    }
    25% {
        transform: rotateZ(-10deg);
    }
    30% {
        transform: rotateZ(6deg);
    }
    35% {
        transform: rotateZ(-4deg);
    }
    40%, 100% {
        transform: rotateZ(0);
    }
}

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Animation Classes */
.animate-slide-up {
    animation: slideUp 0.8s ease-out;
}

.animate-slide-down {
    animation: slideDown 0.8s ease-out;
}

.animate-slide-right {
    animation: slideRight 0.8s ease-out;
}

.animate-slide-left {
    animation: slideLeft 0.8s ease-out;
}

.animate-scale-up {
    animation: scaleUp 0.8s ease-out;
}

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

.animate-bounce-gentle {
    animation: bounceGentle 2s ease-in-out infinite;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-fade-in {
    animation: fadeIn 1s ease-out;
}

.animate-rotate-in {
    animation: rotateIn 1s ease-out;
}

.animate-zoom-in {
    animation: zoomIn 0.6s ease-out;
}

.animate-wiggle {
    animation: wiggle 1s ease-in-out;
}

.animate-gradient {
    background-size: 400% 400%;
    animation: gradient 4s ease infinite;
}

/* Delay Classes */
.animate-delay-75 {
    animation-delay: 0.075s;
    animation-fill-mode: both;
}

.animate-delay-100 {
    animation-delay: 0.1s;
    animation-fill-mode: both;
}

.animate-delay-150 {
    animation-delay: 0.15s;
    animation-fill-mode: both;
}

.animate-delay-200 {
    animation-delay: 0.2s;
    animation-fill-mode: both;
}

.animate-delay-300 {
    animation-delay: 0.3s;
    animation-fill-mode: both;
}

.animate-delay-400 {
    animation-delay: 0.4s;
    animation-fill-mode: both;
}

.animate-delay-500 {
    animation-delay: 0.5s;
    animation-fill-mode: both;
}

.animate-delay-700 {
    animation-delay: 0.7s;
    animation-fill-mode: both;
}

.animate-delay-1000 {
    animation-delay: 1s;
    animation-fill-mode: both;
}

/* Hover Animations */
.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

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

.hover-rotate:hover {
    transform: rotate(5deg);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(91, 79, 207, 0.4);
}

/* Transition Classes */
.transition-all {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.transition-colors {
    transition: color 0.3s ease, background-color 0.3s ease;
}

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

.transition-opacity {
    transition: opacity 0.3s ease;
}

.transition-shadow {
    transition: box-shadow 0.3s ease;
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Loading Animation */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(91, 79, 207, 0.3);
    border-radius: 50%;
    border-top-color: #5B4FCF;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Reveal Animation on Scroll */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger Animation */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    animation: slideUp 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; }

/* Parallax Effect */
.parallax {
    transform: translateZ(0);
    will-change: transform;
}

/* Gradient Animation */
.animated-gradient {
    background: linear-gradient(-45deg, #5B4FCF, #7B6FE8, #4A3FB8, #6B5FD8);
    background-size: 400% 400%;
    animation: gradient 8s ease infinite;
}

/* Interactive Elements */
.interactive-card {
    cursor: pointer;
    transition: all 0.3s ease;
}

.interactive-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.interactive-card:active {
    transform: translateY(-2px) scale(1.01);
}

/* Button Animations */
.btn-animated {
    position: relative;
    overflow: hidden;
}

.btn-animated::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.5s ease;
}

.btn-animated:hover::before {
    left: 100%;
}

/* Text Animations */
.typewriter {
    overflow: hidden;
    border-right: 2px solid #5B4FCF;
    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: #5B4FCF;
    }
}

/* Card Flip Animation */
.flip-card {
    background-color: transparent;
    width: 100%;
    height: 200px;
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    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;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* Progress Bar Animation */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #5B4FCF, #7B6FE8);
    border-radius: 4px;
    animation: progress 2s ease-in-out;
}

@keyframes progress {
    from {
        width: 0%;
    }
    to {
        width: var(--progress-width, 100%);
    }
}

/* Glitch Effect */
.glitch {
    position: relative;
    color: white;
    mix-blend-mode: lighten;
}

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

.glitch::before {
    animation: glitch 0.3s calc(var(--speed, 2) * 1s) infinite linear alternate-reverse;
    color: #7B6FE8;
    z-index: -1;
}

.glitch::after {
    animation: glitch 0.3s calc(var(--speed, 2) * 1s) infinite linear alternate-reverse;
    color: #4A3FB8;
    z-index: -2;
}

@keyframes glitch {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
    100% {
        transform: translate(0);
    }
}

/* Particle Animation */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #5B4FCF;
    border-radius: 50%;
    animation: particle-float 6s infinite linear;
    opacity: 0.7;
}

@keyframes particle-float {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.7;
    }
    90% {
        opacity: 0.7;
    }
    100% {
        transform: translateY(-10vh) rotate(360deg);
        opacity: 0;
    }
}

/* Morphing Animation */
.morph {
    animation: morph 8s ease-in-out infinite;
}

@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%;
    }
}

/* 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;
}

/* Shake Animation */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Glow Effect */
.glow {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 5px #5B4FCF, 0 0 10px #5B4FCF, 0 0 15px #5B4FCF;
    }
    to {
        box-shadow: 0 0 10px #5B4FCF, 0 0 20px #5B4FCF, 0 0 30px #5B4FCF;
    }
}

/* Tilt Animation */
.tilt {
    transition: transform 0.3s ease;
}

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

/* 3D Tilt Effect */
.tilt-3d {
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

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

/* Magnetic Effect */
.magnetic {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.magnetic:hover {
    transform: translate(3px, -3px);
}

/* Neon Effect */
.neon {
    color: #5B4FCF;
    text-shadow: 0 0 5px #5B4FCF, 0 0 10px #5B4FCF, 0 0 20px #5B4FCF, 0 0 40px #5B4FCF;
    animation: neon-flicker 1.5s infinite alternate;
}

@keyframes neon-flicker {
    0%, 18%, 22%, 25%, 53%, 57%, 100% {
        text-shadow: 0 0 5px #5B4FCF, 0 0 10px #5B4FCF, 0 0 20px #5B4FCF, 0 0 40px #5B4FCF;
    }
    20%, 24%, 55% {
        text-shadow: none;
    }
}

/* Elastic Animation */
.elastic {
    animation: elastic 2s ease-out;
}

@keyframes elastic {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Sliding Underline */
.sliding-underline {
    position: relative;
    text-decoration: none;
}

.sliding-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(135deg, #5B4FCF, #7B6FE8);
    transition: width 0.3s ease;
}

.sliding-underline:hover::after {
    width: 100%;
}

/* Background Wave Animation */
.wave-bg {
    background: linear-gradient(135deg, #5B4FCF, #7B6FE8);
    position: relative;
    overflow: hidden;
}

.wave-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: wave 2s infinite;
}

@keyframes wave {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Text Reveal Animation */
.text-reveal {
    opacity: 0;
    animation: textReveal 1s ease forwards;
}

@keyframes textReveal {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}