/* ===== АНИМАЦИИ ДЛЯ ГАЧА-КРУТКИ ===== */

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

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

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.9);
    }
}

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

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

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

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

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

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

@keyframes confetti {
    0% {
        transform: translateY(0) rotate(0);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ===== АНИМАЦИИ ДЛЯ ПЛЕЕРА ===== */

@keyframes equalizer {
    0%, 100% {
        height: 15px;
    }
    25% {
        height: 25px;
    }
    50% {
        height: 10px;
    }
    75% {
        height: 20px;
    }
}

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

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

@keyframes borderPulse {
    0%, 100% {
        border-color: rgba(78, 205, 196, 0.3);
    }
    50% {
        border-color: rgba(78, 205, 196, 1);
    }
}

/* ===== КЛАССЫ АНИМАЦИЙ ===== */

.animate-spin {
    animation: spin 2s linear infinite;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

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

.animate-slide-up {
    animation: slideInUp 0.5s ease-out;
}

.animate-slide-right {
    animation: slideInRight 0.5s ease-out;
}

.animate-slide-left {
    animation: slideInLeft 0.5s ease-out;
}

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

.animate-scale-in {
    animation: scaleIn 0.3s ease-out;
}

/* ===== АНИМАЦИИ ГАЧА-КРУТКИ ===== */

.gacha-pull-button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gacha-pull-button:hover {
    transform: scale(1.05) translateY(-2px);
}

.gacha-pull-button:active {
    transform: scale(0.95);
}

.gacha-pull-button.pulling {
    animation: shake 0.5s ease-in-out;
}

.gacha-result {
    animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gacha-result.rarity-common {
    animation: scaleIn 0.5s ease-out;
}

.gacha-result.rarity-uncommon {
    animation: scaleIn 0.5s ease-out, pulse 2s ease-in-out infinite;
}

.gacha-result.rarity-rare {
    animation: scaleIn 0.5s ease-out, float 3s ease-in-out infinite;
}

.gacha-result.rarity-epic {
    animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), glow 2s ease-in-out infinite;
}

.gacha-result.rarity-legendary {
    animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), glow 1.5s ease-in-out infinite;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

/* Конфетти для легендарок */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    animation: confetti 3s ease-out forwards;
    pointer-events: none;
    z-index: 1002;
}

/* ===== АНИМАЦИИ ПЛЕЕРА ===== */

.playing .progress-fill {
    background: linear-gradient(90deg, #4ecdc4, #45b7d1, #4ecdc4);
    background-size: 200% 100%;
    animation: gradientFlow 2s linear infinite;
}

.playing .track-cover {
    animation: borderPulse 2s ease-in-out infinite;
    border: 2px solid rgba(78, 205, 196, 0.5);
}

.vinyl-spin {
    animation: vinyl 20s linear infinite;
}

.equalizer-bar {
    width: 4px;
    height: 15px;
    background: #4ecdc4;
    display: inline-block;
    margin: 0 2px;
    animation: equalizer 1s ease-in-out infinite;
}

.equalizer-bar:nth-child(2) {
    animation-delay: 0.2s;
}

.equalizer-bar:nth-child(3) {
    animation-delay: 0.4s;
}

.equalizer-bar:nth-child(4) {
    animation-delay: 0.6s;
}

.equalizer-bar:nth-child(5) {
    animation-delay: 0.8s;
}

/* ===== АНИМАЦИИ ПЕРЕКЛЮЧЕНИЯ ТРЕКОВ ===== */

.track-transition-out {
    animation: slideInLeft 0.3s reverse;
}

.track-transition-in {
    animation: slideInRight 0.3s ease-out;
}

/* ===== АНИМАЦИИ УВЕДОМЛЕНИЙ ===== */

.notification {
    animation: slideInRight 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* ===== АНИМАЦИИ ЗАГРУЗКИ ===== */

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

.skeleton {
    background: linear-gradient(90deg, #e2e8f0, #edf2f7, #e2e8f0);
    background-size: 200% 100%;
    animation: skeleton 1.5s ease-in-out infinite, gradientFlow 1.5s linear infinite;
}

/* ===== МЕДИА-ЗАПРОСЫ ДЛЯ ПРОИЗВОДИТЕЛЬНОСТИ ===== */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== АНИМАЦИИ ДЛЯ МОБИЛЬНЫХ ===== */

@media (max-width: 768px) {
    .gacha-result {
        animation: slideInUp 0.3s ease-out;
    }

    .gacha-result.rarity-legendary {
        animation: slideInUp 0.3s ease-out, glow 1.5s ease-in-out infinite;
    }
}