/* ✨ MICRO-INTERACTIONS & ANIMATIONS - RIO'S MAGIC ✨ */

/* ========================================
   1️⃣ CHECKMARK ANIMATION (Enhanced)
======================================== */

.custom-checkbox.checked i {
    animation: checkmark-pop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes checkmark-pop {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.4) rotate(200deg);
        opacity: 1;
    }
    70% {
        transform: scale(0.9) rotate(340deg);
    }
    100% {
        transform: scale(1) rotate(360deg);
        opacity: 1;
    }
}

/* Ripple effect on checkbox click */
.custom-checkbox::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 0.5rem;
    background: rgba(59, 130, 246, 0.3);
    transform: scale(0);
    opacity: 0;
    transition: all 0.4s ease;
}

.custom-checkbox:active::before {
    transform: scale(3);
    opacity: 0;
    transition: all 0s;
}

/* ========================================
   2️⃣ CONFETTI ANIMATION 🎉
======================================== */

.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #f59e0b;
    animation: confetti-fall 3s linear forwards;
}

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

.confetti:nth-child(1) { background: #f59e0b; left: 10%; animation-delay: 0s; }
.confetti:nth-child(2) { background: #3b82f6; left: 20%; animation-delay: 0.1s; }
.confetti:nth-child(3) { background: #10b981; left: 30%; animation-delay: 0.2s; }
.confetti:nth-child(4) { background: #8b5cf6; left: 40%; animation-delay: 0.3s; }
.confetti:nth-child(5) { background: #ef4444; left: 50%; animation-delay: 0.4s; }
.confetti:nth-child(6) { background: #f59e0b; left: 60%; animation-delay: 0.5s; }
.confetti:nth-child(7) { background: #3b82f6; left: 70%; animation-delay: 0.6s; }
.confetti:nth-child(8) { background: #10b981; left: 80%; animation-delay: 0.7s; }
.confetti:nth-child(9) { background: #8b5cf6; left: 90%; animation-delay: 0.8s; }
.confetti:nth-child(10) { background: #ef4444; left: 95%; animation-delay: 0.9s; }

/* ========================================
   3️⃣ WAVE ANIMATION for "Mark All" Button
======================================== */

.btn-check-all {
    position: relative;
    overflow: hidden;
}

.btn-check-all::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;
}

.btn-check-all:active::after {
    width: 300px;
    height: 300px;
}

.btn-check-all.wave-active {
    animation: button-wave 0.6s ease;
}

@keyframes button-wave {
    0% {
        transform: translateY(0) scale(1);
    }
    25% {
        transform: translateY(-5px) scale(1.05);
    }
    50% {
        transform: translateY(0) scale(1);
    }
    75% {
        transform: translateY(-3px) scale(1.02);
    }
    100% {
        transform: translateY(0) scale(1);
    }
}

/* ========================================
   4️⃣ ITEM CHECK ANIMATION (Row highlight)
======================================== */

.checklist-item.just-checked {
    animation: item-flash 0.6s ease;
}

@keyframes item-flash {
    0% {
        background: rgba(16, 185, 129, 0.1);
        transform: scale(1);
    }
    50% {
        background: rgba(16, 185, 129, 0.3);
        transform: scale(1.02);
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
    }
    100% {
        background: linear-gradient(135deg, 
            rgba(16, 185, 129, 0.15), 
            rgba(167, 243, 208, 0.2));
        transform: scale(1);
    }
}

/* ========================================
   5️⃣ CATEGORY COMPLETE CELEBRATION
======================================== */

.category-header.celebrate {
    animation: category-celebrate 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes category-celebrate {
    0% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.05) rotate(2deg);
    }
    50% {
        transform: scale(1.1) rotate(-2deg);
    }
    75% {
        transform: scale(1.05) rotate(1deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Complete Badge entrance */
.category-complete-badge {
    animation: badge-entrance 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes badge-entrance {
    0% {
        transform: scale(0) translateX(50px);
        opacity: 0;
    }
    60% {
        transform: scale(1.2) translateX(-10px);
    }
    100% {
        transform: scale(1) translateX(0);
        opacity: 1;
    }
}

/* ========================================
   6️⃣ PROGRESS BAR ANIMATION
======================================== */

.category-progress-bar {
    position: relative;
}

.category-progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.4), 
        transparent);
    animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* ========================================
   7️⃣ SMOOTH HOVER EFFECTS
======================================== */

.checklist-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.checklist-item:hover {
    transform: translateX(8px) scale(1.01);
}

.category-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.season-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.season-btn:hover {
    transform: translateY(-3px) scale(1.05);
}

.season-btn.active {
    animation: season-select 0.4s ease;
}

@keyframes season-select {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* ========================================
   8️⃣ DELETE BUTTON ANIMATION
======================================== */

.delete-btn:active {
    animation: delete-shake 0.4s ease;
}

@keyframes delete-shake {
    0%, 100% {
        transform: translateX(0) scale(1);
    }
    25% {
        transform: translateX(-5px) scale(1.1);
    }
    75% {
        transform: translateX(5px) scale(1.1);
    }
}

/* ========================================
   9️⃣ LOADING / ENTRANCE ANIMATIONS
======================================== */

.category-card {
    animation: slide-in-up 0.5s ease-out backwards;
}

.category-card:nth-child(1) { animation-delay: 0.1s; }
.category-card:nth-child(2) { animation-delay: 0.2s; }
.category-card:nth-child(3) { animation-delay: 0.3s; }
.category-card:nth-child(4) { animation-delay: 0.4s; }
.category-card:nth-child(5) { animation-delay: 0.5s; }

@keyframes slide-in-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   🔟 MOBILE OPTIMIZATIONS
======================================== */

@media (max-width: 640px) {
    /* Reduce animation intensity on mobile */
    .checklist-item:hover {
        transform: translateX(5px) scale(1);
    }
    
    .confetti {
        animation-duration: 2s;
    }
    
    .btn-check-all:active::after {
        width: 200px;
        height: 200px;
    }
}

/* ========================================
   ⚡ PERFORMANCE: Reduce motion for accessibility
======================================== */

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