/* ============================================
   ANIMATIONS & TRANSITIONS
   ============================================ */

/* Page Transitions */
.screen {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.screen.active {
    opacity: 1;
    transform: translateY(0);
}

/* Card Animations */
.card {
    animation: fadeInUp 0.4s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Button Hover Effects */
.btn,
.action-btn,
.icon-btn {
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: translateY(0);
}

.icon-btn:hover {
    transform: scale(1.1);
}

.icon-btn:active {
    transform: scale(0.95);
}

/* Food Item Hover */
.food-item {
    transition: all 0.2s ease;
}

.food-item:hover {
    transform: translateX(4px);
    background: var(--bg-secondary);
}

/* Modal Animations */
[id$="-modal"] {
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0);
    }

    to {
        opacity: 1;
        backdrop-filter: blur(4px);
    }
}

[id$="-modal"]>div {
    animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Progress Bars Animation */
.macro-fill,
.ring-progress,
#hydrationProgress {
    transition: width 0.5s ease, stroke-dashoffset 0.5s ease;
}

/* Chart Animations */
canvas {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Loading Skeleton */
@keyframes skeleton-loading {
    0% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.skeleton {
    background: linear-gradient(90deg,
            var(--bg-tertiary) 0%,
            var(--bg-secondary) 50%,
            var(--bg-tertiary) 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

/* Toast Animations */
#toast-container>div {
    animation: toastSlideIn 0.3s ease forwards;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Number Count Up Animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.count-up {
    animation: countUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Badge Pulse */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

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

/* Quick Actions Stagger */
.quick-actions button {
    animation: fadeInUp 0.4s ease forwards;
}

.quick-actions button:nth-child(1) {
    animation-delay: 0.1s;
    opacity: 0;
}

.quick-actions button:nth-child(2) {
    animation-delay: 0.2s;
    opacity: 0;
}

.quick-actions button:nth-child(3) {
    animation-delay: 0.3s;
    opacity: 0;
}

/* Micro Animations */
.filter-chip {
    transition: all 0.2s ease;
}

.filter-chip:hover {
    transform: translateY(-2px);
}

.filter-chip.active {
    animation: chipSelect 0.3s ease;
}

@keyframes chipSelect {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Checkbox/Toggle Animations */
input[type="checkbox"],
input[type="radio"] {
    transition: all 0.2s ease;
}

input[type="checkbox"]:checked {
    animation: checkBounce 0.4s ease;
}

@keyframes checkBounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* Bottom Nav Animation */
.bottom-nav button {
    transition: all 0.2s ease;
}

.bottom-nav button:hover {
    transform: translateY(-3px);
}

.bottom-nav button.active {
    animation: navActive 0.3s ease;
}

@keyframes navActive {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* Exercise Card Animations */
.exercise-card {
    transition: all 0.2s ease;
}

.exercise-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

/* Star Favorite Animation */
.exercise-favorite-btn,
.favorite-btn {
    transition: all 0.2s ease;
}

.exercise-favorite-btn:hover,
.favorite-btn:hover {
    transform: scale(1.2) rotate(15deg);
}

.exercise-favorite-btn.favorited {
    animation: favoritePop 0.5s ease;
}

@keyframes favoritePop {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3) rotate(10deg);
    }
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Add smooth transitions to all interactive elements */
a,
button,
input,
select,
textarea {
    transition: all 0.2s ease;
}

/* Focus Effects */
input:focus,
select:focus,
textarea:focus,
button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* Ripple Effect (Optional - requires JS) */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}

/* Loader Animation */
.loader {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-tertiary);
    border-bottom-color: var(--primary-500);
    border-radius: 50%;
    display: inline-block;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Shimmer Effect */
.shimmer {
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.2),
            transparent);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Add stagger delay utility */
.stagger-1 {
    animation-delay: 0.1s;
}

.stagger-2 {
    animation-delay: 0.2s;
}

.stagger-3 {
    animation-delay: 0.3s;
}

.stagger-4 {
    animation-delay: 0.4s;
}

.stagger-5 {
    animation-delay: 0.5s;
}

/* 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;
    }
}