/* ====================================
   BurstingRainbow.com - Animations
   ==================================== */

/* ====================================
   Keyframe Animations
   ==================================== */

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0) translateX(-50%);
    }
    40% {
        transform: translateY(-20px) translateX(-50%);
    }
    60% {
        transform: translateY(-10px) translateX(-50%);
    }
}

@keyframes popIn {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(0deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

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

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

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

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

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

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

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

/* ====================================
   Rainbow Burst Animations
   ==================================== */

@keyframes burstOut {
    0% {
        stroke-dashoffset: 1000;
        opacity: 0.7;
        stroke-width: 20;
    }
    50% {
        opacity: 1;
        stroke-width: 25;
    }
    100% {
        stroke-dashoffset: 0;
        opacity: 0.9;
        stroke-width: 20;
    }
}

@keyframes arcPulse {
    0%, 100% {
        stroke-width: 20;
        opacity: 0.7;
    }
    50% {
        stroke-width: 25;
        opacity: 1;
    }
}

.rainbow-arc {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: burstOut 1s ease forwards;
}

.rainbow-arc.burst-active {
    animation: arcPulse 2s ease-in-out infinite;
}

.arc-red { animation-delay: 0s; }
.arc-orange { animation-delay: 0.1s; }
.arc-yellow { animation-delay: 0.2s; }
.arc-green { animation-delay: 0.3s; }
.arc-blue { animation-delay: 0.4s; }
.arc-indigo { animation-delay: 0.5s; }
.arc-purple { animation-delay: 0.6s; }

/* ====================================
   Page Load Animations
   ==================================== */

.fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
}

.fade-in-down {
    animation: fadeInDown 0.6s ease forwards;
    opacity: 0;
}

.slide-in-left {
    animation: slideInLeft 0.6s ease forwards;
    opacity: 0;
}

.slide-in-right {
    animation: slideInRight 0.6s ease forwards;
    opacity: 0;
}

.scale-in {
    animation: scaleIn 0.6s ease forwards;
    opacity: 0;
}

/* Staggered animation delays */
.animation-delay-1 { animation-delay: 0.1s; }
.animation-delay-2 { animation-delay: 0.2s; }
.animation-delay-3 { animation-delay: 0.3s; }
.animation-delay-4 { animation-delay: 0.4s; }
.animation-delay-5 { animation-delay: 0.5s; }
.animation-delay-6 { animation-delay: 0.6s; }

/* ====================================
   Hover Animations
   ==================================== */

.hover-float:hover {
    animation: float 1s ease-in-out infinite;
}

.hover-pulse:hover {
    animation: pulse 1s ease-in-out infinite;
}

.hover-spin:hover i {
    animation: spin 0.5s linear;
}

/* ====================================
   Scroll-triggered Animations
   ==================================== */

.scroll-fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

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

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

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

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

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

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

/* ====================================
   Particle Animation
   ==================================== */

@keyframes particleFloat {
    0%, 100% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(10px, -10px);
    }
    50% {
        transform: translate(-5px, -20px);
    }
    75% {
        transform: translate(-10px, -10px);
    }
}

/* ====================================
   Loading Animations
   ==================================== */

@keyframes skeletonLoading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton-loading {
    background: linear-gradient(
        90deg,
        #f0f0f0 0px,
        #e0e0e0 40px,
        #f0f0f0 80px
    );
    background-size: 200px 100%;
    animation: skeletonLoading 1.5s infinite;
}

/* ====================================
   Button Animations
   ==================================== */

.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-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;
}

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

/* ====================================
   Text Animations
   ==================================== */

@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.typewriter {
    overflow: hidden;
    white-space: nowrap;
    animation: typewriter 3s steps(40) 1s forwards;
    width: 0;
}

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

.gradient-text-animated {
    background: linear-gradient(
        90deg,
        var(--color-red),
        var(--color-orange),
        var(--color-yellow),
        var(--color-green),
        var(--color-blue),
        var(--color-indigo),
        var(--color-purple),
        var(--color-red)
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-text 3s ease infinite;
}

/* ====================================
   Card Animations
   ==================================== */

@keyframes cardFlip {
    from {
        transform: rotateY(0);
    }
    to {
        transform: rotateY(180deg);
    }
}

.card-flip {
    animation: cardFlip 0.6s ease forwards;
}

/* ====================================
   Image Reveal Animations
   ==================================== */

@keyframes imageReveal {
    0% {
        clip-path: inset(0 100% 0 0);
    }
    100% {
        clip-path: inset(0 0 0 0);
    }
}

.image-reveal {
    animation: imageReveal 1s ease forwards;
}

@keyframes imageZoom {
    from {
        transform: scale(1.2);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.image-zoom {
    animation: imageZoom 0.8s ease forwards;
}

/* ====================================
   Modal Animations
   ==================================== */

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

.modal-slide-in {
    animation: modalSlideIn 0.4s ease forwards;
}

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

.backdrop-fade-in {
    animation: backdropFadeIn 0.3s ease forwards;
}

/* ====================================
   Progress Bar Animations
   ==================================== */

@keyframes progressBar {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.progress-animate {
    animation: progressBar 1.5s ease-in-out forwards;
}

/* ====================================
   Music Visualizer Animations
   ==================================== */

@keyframes audioBar {
    0%, 100% {
        height: 20%;
    }
    50% {
        height: 100%;
    }
}

.audio-bar {
    animation: audioBar 0.5s ease-in-out infinite;
}

.audio-bar:nth-child(1) { animation-delay: 0s; }
.audio-bar:nth-child(2) { animation-delay: 0.1s; }
.audio-bar:nth-child(3) { animation-delay: 0.2s; }
.audio-bar:nth-child(4) { animation-delay: 0.3s; }
.audio-bar:nth-child(5) { animation-delay: 0.4s; }

/* ====================================
   Notification Animations
   ==================================== */

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

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

.notification-enter {
    animation: slideInRight 0.4s ease forwards;
}

.notification-exit {
    animation: slideOutRight 0.4s ease forwards;
}

/* ====================================
   Infinite Scroll Animations
   ==================================== */

@keyframes marquee {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}

.marquee {
    animation: marquee 20s linear infinite;
}

/* ====================================
   Glitch Effect (Optional)
   ==================================== */

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

.glitch {
    animation: glitch 0.3s ease;
}

/* ====================================
   Performance Optimizations
   ==================================== */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .scroll-indicator {
        animation: none;
    }
    
    .rainbow-arc {
        animation: none;
        stroke-dashoffset: 0;
    }
}