/* =============================================================================
   UI/UX Enhancements - Micro-interactions & Polish
   Created: January 2026
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Favorite Button Micro-interactions
   ----------------------------------------------------------------------------- */

.favorite-btn {
    transition: transform 0.2s ease, color 0.2s ease, background-color 0.2s ease;
    position: relative;
}

.favorite-btn:hover {
    transform: translateY(-2px);
}

.favorite-btn:active {
    transform: scale(0.95);
}

.favorite-btn.favorited {
    animation: heartbeat 0.6s ease-in-out;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.3); }
    50% { transform: scale(1.1); }
    75% { transform: scale(1.15); }
}

/* Add subtle pulse when favorited */
.favorite-btn.favorited::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: currentColor;
    opacity: 0;
    animation: pulse-ring 0.6s ease-out;
    pointer-events: none;
}

@keyframes pulse-ring {
    0% {
        width: 100%;
        height: 100%;
        opacity: 0.5;
    }
    100% {
        width: 200%;
        height: 200%;
        opacity: 0;
    }
}

/* -----------------------------------------------------------------------------
   Lazy Loading Images
   ----------------------------------------------------------------------------- */

img.lazy-load {
    opacity: 0;
    filter: blur(20px);
    transition: opacity 0.5s ease, filter 0.5s ease;
}

img.lazy-load.loaded {
    opacity: 1;
    filter: blur(0);
}

/* -----------------------------------------------------------------------------
   Card Hover Effects
   ----------------------------------------------------------------------------- */

.recipe-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.recipe-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.recipe-card img {
    transition: transform 0.5s ease;
}

.recipe-card:hover img {
    transform: scale(1.05);
}

/* -----------------------------------------------------------------------------
   Loading Skeletons
   ----------------------------------------------------------------------------- */

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 1.5rem;
    margin-bottom: 1rem;
}

.skeleton-image {
    width: 100%;
    height: 200px;
    border-radius: 8px;
}

@keyframes loading-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* -----------------------------------------------------------------------------
   Empty State Animations
   ----------------------------------------------------------------------------- */

.empty-state {
    animation: empty-state-fade-in 0.5s ease;
}

@keyframes empty-state-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* -----------------------------------------------------------------------------
   Rating Stars Interaction
   ----------------------------------------------------------------------------- */

.rating-star {
    transition: transform 0.2s ease, color 0.2s ease;
    cursor: pointer;
}

.rating-star:hover {
    transform: scale(1.2) rotate(15deg);
}

.rating-star.filled {
    animation: star-fill 0.3s ease;
}

@keyframes star-fill {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* -----------------------------------------------------------------------------
   Button Effects
   ----------------------------------------------------------------------------- */

.btn-hover-lift {
    transition: all 0.3s ease;
}

.btn-hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-hover-lift:active {
    transform: translateY(0);
}

/* -----------------------------------------------------------------------------
   Focus Styles (Accessibility)
   ----------------------------------------------------------------------------- */

*:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 4px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

/* -----------------------------------------------------------------------------
   Smooth Animations
   ----------------------------------------------------------------------------- */

html {
    scroll-behavior: smooth;
}

/* -----------------------------------------------------------------------------
   Reduce Motion for Accessibility
   ----------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
