/* Favorites — refined add / remove feedback */

.favorite-btn {
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.favorite-btn .fa-heart {
    display: inline-block;
    transform-origin: center;
    transition: color 0.25s ease, transform 0.25s ease;
}

.favorite-btn.is-favorited .fa-heart,
.favorite-btn .fa-heart.fas {
    color: #EE4D26;
}

.favorite-btn.fav-anim-add .fa-heart {
    animation: fav-heart-pop 0.62s cubic-bezier(0.34, 1.45, 0.64, 1) both;
}

.favorite-btn.fav-anim-remove .fa-heart {
    animation: fav-heart-soft 0.38s ease both;
}

.favorite-btn.fav-anim-add::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    border: 1.5px solid rgba(238, 77, 38, 0.55);
    pointer-events: none;
    animation: fav-ripple 0.55s ease-out both;
}

.favorite-btn .fav-spark {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    pointer-events: none;
    z-index: 6;
    color: #EE4D26;
    font-size: 7px;
    line-height: 1;
    opacity: 0;
    animation: fav-spark-fly 0.7s ease-out forwards;
}

.favorite-btn .fav-spark i {
    display: block;
}

.fav-fly-heart {
    position: fixed;
    z-index: 10050;
    pointer-events: none;
    color: #EE4D26;
    font-size: 1rem;
    line-height: 1;
    will-change: transform, opacity;
    filter: drop-shadow(0 2px 6px rgba(238, 77, 38, 0.25));
}

.fav-fly-heart i {
    display: block;
    animation: fav-fly-spin 0.75s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#favorites-count.fav-count-pulse,
.nav-link.fav-header-pulse > i.fa-heart {
    display: inline-block;
    animation: fav-header-pulse 0.55s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

.nav-link.fav-header-pulse > i.fa-heart {
    color: #EE4D26;
}

@keyframes fav-heart-pop {
    0% {
        transform: scale(1);
    }
    28% {
        transform: scale(0.72);
    }
    58% {
        transform: scale(1.32);
    }
    78% {
        transform: scale(0.94);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes fav-heart-soft {
    0% {
        transform: scale(1);
    }
    40% {
        transform: scale(0.82);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fav-ripple {
    0% {
        transform: scale(0.4);
        opacity: 0.7;
    }
    100% {
        transform: scale(3.6);
        opacity: 0;
    }
}

@keyframes fav-spark-fly {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(0.4);
    }
    18% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(var(--fav-dx, 0), var(--fav-dy, -28px)) scale(0.85);
    }
}

@keyframes fav-fly-spin {
    0% {
        transform: scale(0.85) rotate(-8deg);
        opacity: 1;
    }
    70% {
        opacity: 1;
    }
    100% {
        transform: scale(0.55) rotate(12deg);
        opacity: 0.15;
    }
}

@keyframes fav-header-pulse {
    0% {
        transform: scale(1);
    }
    35% {
        transform: scale(1.35);
    }
    100% {
        transform: scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .favorite-btn.fav-anim-add .fa-heart,
    .favorite-btn.fav-anim-remove .fa-heart,
    .favorite-btn.fav-anim-add::before,
    .favorite-btn .fav-spark,
    .fav-fly-heart i,
    #favorites-count.fav-count-pulse,
    .nav-link.fav-header-pulse > i.fa-heart {
        animation: none !important;
    }

    .fav-fly-heart {
        display: none !important;
    }
}
