/**
 * Music Library - Animations CSS
 * 
 * Ce fichier contient toutes les animations et transitions
 * pour la bibliothèque musicale.
 * 
 * @module assets/css/animations
 * @version 1.0.0
 */

/* ============================================
   KEYFRAMES ANIMATIONS
   ============================================ */

/* Rotation pour le spinner de chargement */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Pulsation pour les éléments actifs */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* Animation de fondu entrant */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Animation de fondu sortant */
@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Animation de glissement vers le haut */
@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Animation de glissement vers le bas */
@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Animation de glissement depuis la gauche */
@keyframes slideInLeft {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Animation de glissement depuis la droite */
@keyframes slideInRight {
    from {
        transform: translateX(20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Animation de zoom entrant */
@keyframes zoomIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Animation de rebond */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Animation de secousse */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Animation de brillance (shimmer) pour skeleton */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Animation de progression de barre */
@keyframes progressBar {
    from {
        width: 0%;
    }
    to {
        width: 100%;
    }
}

/* Animation de rotation infinie */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Animation de battement de cœur */
@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    10%, 30% {
        transform: scale(1.1);
    }
    20%, 40% {
        transform: scale(1);
    }
}

/* ============================================
   CLASSES D'ANIMATION UTILITAIRES
   ============================================ */

/* Animations de base */
.animate-fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.animate-fade-out {
    animation: fadeOut 0.3s ease-in-out;
}

.animate-slide-up {
    animation: slideUp 0.3s ease-out;
}

.animate-slide-down {
    animation: slideDown 0.3s ease-out;
}

.animate-slide-in-left {
    animation: slideInLeft 0.3s ease-out;
}

.animate-slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

.animate-zoom-in {
    animation: zoomIn 0.3s ease-out;
}

.animate-bounce {
    animation: bounce 0.6s ease-in-out;
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-rotate {
    animation: rotate 2s linear infinite;
}

.animate-heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

/* Délais d'animation */
.animate-delay-100 {
    animation-delay: 0.1s;
}

.animate-delay-200 {
    animation-delay: 0.2s;
}

.animate-delay-300 {
    animation-delay: 0.3s;
}

.animate-delay-500 {
    animation-delay: 0.5s;
}

/* ============================================
   TRANSITIONS HOVER
   ============================================ */

/* Élévation au survol */
.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 212, 255, 0.2);
}

/* Agrandissement au survol */
.hover-scale {
    transition: transform 0.2s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* Rotation au survol */
.hover-rotate {
    transition: transform 0.3s ease;
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

/* Brillance au survol */
.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

/* Changement de couleur au survol */
.hover-color-primary {
    transition: color 0.2s ease, background-color 0.2s ease;
}

.hover-color-primary:hover {
    color: white;
    background-color: var(--music-primary);
}

/* ============================================
   SKELETON LOADING
   ============================================ */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--music-bg-secondary) 0%,
        var(--music-bg-hover) 50%,
        var(--music-bg-secondary) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--music-radius);
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-text:last-child {
    margin-bottom: 0;
    width: 80%;
}

.skeleton-circle {
    border-radius: 50%;
}

.skeleton-card {
    padding: var(--music-spacing-md);
    background: var(--music-bg-card);
    border: 1px solid var(--music-border);
    border-radius: var(--music-radius);
}

/* ============================================
   LOADING STATES
   ============================================ */

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--music-border);
    border-top-color: var(--music-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-dots {
    display: flex;
    gap: 8px;
    align-items: center;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background: var(--music-primary);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

.loading-dot:nth-child(1) {
    animation-delay: 0s;
}

.loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* ============================================
   PROGRESS ANIMATIONS
   ============================================ */

.progress-bar-animated {
    position: relative;
    overflow: hidden;
}

.progress-bar-animated::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: shimmer 2s ease-in-out infinite;
}

/* ============================================
   NOTIFICATION ANIMATIONS
   ============================================ */

.notification-enter {
    animation: slideInRight 0.3s ease-out;
}

.notification-exit {
    animation: slideInRight 0.3s ease-in reverse;
}

/* ============================================
   MODAL ANIMATIONS
   ============================================ */

.modal-backdrop-enter {
    animation: fadeIn 0.2s ease-out;
}

.modal-backdrop-exit {
    animation: fadeOut 0.2s ease-in;
}

.modal-content-enter {
    animation: zoomIn 0.3s ease-out;
}

.modal-content-exit {
    animation: zoomIn 0.2s ease-in reverse;
}

/* ============================================
   TRACK CARD ANIMATIONS
   ============================================ */

.track-card {
    transition: all 0.2s ease;
}

.track-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 212, 255, 0.2);
}

.track-card:active {
    transform: translateY(0);
}

.track-card.playing {
    border-color: var(--music-primary);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.track-card.playing .track-cover {
    animation: pulse 2s ease-in-out infinite;
}

/* ============================================
   BUTTON ANIMATIONS
   ============================================ */

.btn-animated {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-animated::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-animated:active::before {
    width: 300px;
    height: 300px;
}

/* ============================================
   PLAYER ANIMATIONS
   ============================================ */

.player-playing .player-btn-play {
    animation: pulse 1.5s ease-in-out infinite;
}

.player-volume-slider {
    transition: all 0.2s ease;
}

.player-volume-slider:hover {
    transform: scaleY(1.1);
}

/* ============================================
   SIDEBAR ANIMATIONS
   ============================================ */

.sidebar-link {
    transition: all 0.2s ease;
}

.sidebar-link:hover {
    transform: translateX(4px);
    background: var(--music-bg-hover);
}

.sidebar-link.active {
    animation: slideInLeft 0.3s ease-out;
}

/* ============================================
   ALPHABET NAV ANIMATIONS
   ============================================ */

.alphabet-btn {
    transition: all 0.2s ease;
}

.alphabet-btn:hover {
    transform: scale(1.1);
}

.alphabet-btn.active {
    animation: bounce 0.5s ease-out;
}

/* ============================================
   RESPONSIVE ANIMATIONS
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
