/* Advanced Animations and Loading States */

/* Loading Skeleton for Cards */
.skeleton {
    background: linear-gradient(90deg, 
        var(--color-dark-grey-3) 25%, 
        var(--color-medium-grey-1) 50%, 
        var(--color-dark-grey-3) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

.skeleton-card {
    width: 100%;
    height: 280px;
    margin-bottom: 16px;
}

.skeleton-text {
    height: 16px;
    margin: 8px 0;
}

.skeleton-text-short {
    width: 60%;
}

.skeleton-text-long {
    width: 90%;
}

@keyframes skeleton-loading {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-dark-grey-3);
    border-top: 4px solid var(--color-spotify-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

.spinner-small {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-large {
    width: 60px;
    height: 60px;
    border-width: 6px;
}

/* Music Visualizer */
.music-visualizer {
    display: flex;
    align-items: end;
    gap: 2px;
    height: 20px;
    margin: 0 8px;
}

.visualizer-bar {
    width: 3px;
    background: var(--gradient-primary);
    border-radius: 1px;
    animation: visualizer 1.2s ease-in-out infinite;
}

.visualizer-bar:nth-child(1) { animation-delay: 0.1s; height: 100%; }
.visualizer-bar:nth-child(2) { animation-delay: 0.2s; height: 70%; }
.visualizer-bar:nth-child(3) { animation-delay: 0.3s; height: 90%; }
.visualizer-bar:nth-child(4) { animation-delay: 0.4s; height: 60%; }
.visualizer-bar:nth-child(5) { animation-delay: 0.5s; height: 80%; }

@keyframes visualizer {
    0%, 100% {
        transform: scaleY(1);
        opacity: 0.8;
    }
    50% {
        transform: scaleY(0.3);
        opacity: 1;
    }
}

/* Floating Animation */
.float {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Glow Effect */
.glow {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 5px var(--color-spotify-green), 
                    0 0 10px var(--color-spotify-green), 
                    0 0 15px var(--color-spotify-green);
    }
    to {
        box-shadow: 0 0 10px var(--color-spotify-green), 
                    0 0 20px var(--color-spotify-green), 
                    0 0 30px var(--color-spotify-green);
    }
}

/* Typing Animation */
.typing {
    overflow: hidden;
    border-right: 2px solid var(--color-spotify-green);
    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: var(--color-spotify-green);
    }
}

/* Stagger Animation for Lists */
.stagger-animation {
    animation: fadeInUp 0.6s ease-out both;
}

.stagger-animation:nth-child(1) { animation-delay: 0.1s; }
.stagger-animation:nth-child(2) { animation-delay: 0.2s; }
.stagger-animation:nth-child(3) { animation-delay: 0.3s; }
.stagger-animation:nth-child(4) { animation-delay: 0.4s; }
.stagger-animation:nth-child(5) { animation-delay: 0.5s; }
.stagger-animation:nth-child(6) { animation-delay: 0.6s; }
.stagger-animation:nth-child(7) { animation-delay: 0.7s; }
.stagger-animation:nth-child(8) { animation-delay: 0.8s; }

/* Progress Bar Animation */
.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--color-dark-grey-3);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::before {
    width: 300px;
    height: 300px;
}

/* Notification Slide In */
.notification {
    transform: translateX(100%);
    animation: slideInNotification 0.5s ease-out forwards;
}

@keyframes slideInNotification {
    to {
        transform: translateX(0);
    }
}

/* Card Flip Animation */
.card-flip {
    perspective: 1000px;
}

.card-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.card-flip:hover .card-flip-inner {
    transform: rotateY(180deg);
}

.card-flip-front, .card-flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
}

.card-flip-back {
    transform: rotateY(180deg);
}

/* Breathing Animation */
.breathe {
    animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Smooth Reveal */
.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Typewriter Effect */
.typewriter {
    overflow: hidden;
    border-right: 0.15em solid var(--color-spotify-green);
    white-space: nowrap;
    margin: 0 auto;
    letter-spacing: 0.15em;
    animation: typewriter 4s steps(30, end), cursor-blink 0.75s step-end infinite;
}

@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes cursor-blink {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: var(--color-spotify-green);
    }
}

/* 3D Card Effect */
.card-3d {
    transform-style: preserve-3d;
    transition: transform 0.3s ease-out;
}

.card-3d:hover {
    transform: rotateX(5deg) rotateY(5deg) translateZ(10px);
}

/* Particle Animation */
.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--color-spotify-green);
    border-radius: 50%;
    animation: particle-float 3s infinite ease-in-out;
}

@keyframes particle-float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: translateY(-50px) rotate(180deg);
        opacity: 0.5;
    }
}

/* Success Animation */
.success-checkmark {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: block;
    stroke-width: 2;
    stroke: var(--color-success);
    stroke-miterlimit: 10;
    box-shadow: inset 0px 0px 0px var(--color-success);
    animation: fill 0.4s ease-in-out 0.4s forwards, scale 0.3s ease-in-out 0.9s both;
}

.success-checkmark__circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: var(--color-success);
    fill: none;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.success-checkmark__check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes stroke {
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes scale {
    0%, 100% {
        transform: none;
    }
    50% {
        transform: scale3d(1.1, 1.1, 1);
    }
}

@keyframes fill {
    100% {
        box-shadow: inset 0px 0px 0px 30px var(--color-success);
    }
}