/* Interactive Progress Celebration Styles */

#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Enhanced task completion animation */
.task-complete-animation {
    animation: taskCompleteGlow 0.8s ease-out, taskCompletePulse 0.4s ease-out;
}

@keyframes taskCompleteGlow {
    0% {
        box-shadow: 0 0 0 rgba(76, 175, 80, 0);
        transform: scale(1);
        background-color: inherit;
    }
    25% {
        box-shadow: 0 0 15px rgba(76, 175, 80, 0.4);
        transform: scale(1.05);
        background-color: rgba(76, 175, 80, 0.1);
    }
    50% {
        box-shadow: 0 0 25px rgba(76, 175, 80, 0.8);
        transform: scale(1.08);
        background-color: rgba(76, 175, 80, 0.2);
    }
    75% {
        box-shadow: 0 0 15px rgba(76, 175, 80, 0.4);
        transform: scale(1.03);
        background-color: rgba(76, 175, 80, 0.1);
    }
    100% {
        box-shadow: 0 0 0 rgba(76, 175, 80, 0);
        transform: scale(1);
        background-color: inherit;
    }
}

@keyframes taskCompletePulse {
    0%, 100% {
        border-color: inherit;
    }
    50% {
        border-color: #4CAF50;
        border-width: 3px;
    }
}

/* Enhanced microstep completion animation */
.microstep-complete {
    animation: microstepSuccess 0.6s ease-out, microstepCheckmark 0.3s ease-out 0.1s;
}

@keyframes microstepSuccess {
    0% {
        background-color: transparent;
        transform: translateX(0) scale(1);
    }
    20% {
        background-color: rgba(76, 175, 80, 0.15);
        transform: translateX(3px) scale(1.02);
    }
    40% {
        background-color: rgba(76, 175, 80, 0.2);
        transform: translateX(-2px) scale(1.03);
    }
    60% {
        background-color: rgba(76, 175, 80, 0.15);
        transform: translateX(1px) scale(1.01);
    }
    80% {
        background-color: rgba(76, 175, 80, 0.1);
        transform: translateX(-0.5px) scale(1.005);
    }
    100% {
        background-color: transparent;
        transform: translateX(0) scale(1);
    }
}

@keyframes microstepCheckmark {
    0% {
        box-shadow: inset 0 0 0 rgba(76, 175, 80, 0);
    }
    50% {
        box-shadow: inset 0 0 10px rgba(76, 175, 80, 0.3);
    }
    100% {
        box-shadow: inset 0 0 0 rgba(76, 175, 80, 0);
    }
}

/* Focus session completion styles */
.focus-complete-celebration {
    position: relative;
    overflow: hidden;
}

.focus-complete-celebration::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(78, 205, 196, 0.3), transparent);
    animation: focusCompleteShine 0.8s ease-out;
}

@keyframes focusCompleteShine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Enhanced milestone celebration styles */
.milestone-celebration {
    animation: milestoneJump 1.2s ease-out, milestoneGlow 1.5s ease-out;
}

@keyframes milestoneJump {
    0%, 100% {
        transform: translateY(0) scale(1) rotate(0deg);
    }
    15% {
        transform: translateY(-15px) scale(1.08) rotate(2deg);
    }
    30% {
        transform: translateY(-8px) scale(1.05) rotate(-1deg);
    }
    45% {
        transform: translateY(-12px) scale(1.07) rotate(1deg);
    }
    60% {
        transform: translateY(-4px) scale(1.03) rotate(-0.5deg);
    }
    75% {
        transform: translateY(-6px) scale(1.04) rotate(0.5deg);
    }
    90% {
        transform: translateY(-1px) scale(1.01) rotate(0deg);
    }
}

@keyframes milestoneGlow {
    0%, 100% {
        box-shadow: 0 0 0 rgba(255, 193, 7, 0);
        filter: brightness(1);
    }
    25% {
        box-shadow: 0 0 20px rgba(255, 193, 7, 0.6);
        filter: brightness(1.1);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 193, 7, 0.8);
        filter: brightness(1.2);
    }
    75% {
        box-shadow: 0 0 20px rgba(255, 193, 7, 0.6);
        filter: brightness(1.1);
    }
}

/* Celebration button styles */
.celebration-trigger {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.celebration-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.celebration-trigger.celebrating {
    animation: celebratingPulse 0.6s ease-out;
}

@keyframes celebratingPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

/* Progress bar celebration animation */
.progress-celebration {
    position: relative;
    overflow: hidden;
}

.progress-celebration::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: progressShine 1s ease-out;
}

@keyframes progressShine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Daily goal completion celebration */
.daily-goal-complete {
    animation: dailyGoalCelebration 1.2s ease-out;
}

@keyframes dailyGoalCelebration {
    0% {
        transform: scale(1) rotate(0deg);
        background-color: transparent;
    }
    25% {
        transform: scale(1.1) rotate(2deg);
        background-color: rgba(255, 193, 7, 0.1);
    }
    50% {
        transform: scale(1.05) rotate(-1deg);
        background-color: rgba(255, 193, 7, 0.2);
    }
    75% {
        transform: scale(1.02) rotate(1deg);
        background-color: rgba(255, 193, 7, 0.1);
    }
    100% {
        transform: scale(1) rotate(0deg);
        background-color: transparent;
    }
}

/* Reduce motion preferences */
@media (prefers-reduced-motion: reduce) {
    .task-complete-animation,
    .microstep-complete,
    .focus-complete-celebration,
    .milestone-celebration,
    .celebration-trigger.celebrating,
    .progress-celebration,
    .daily-goal-complete {
        animation: none;
    }
    
    .focus-complete-celebration::after,
    .progress-celebration::before {
        display: none;
    }
    
    #confetti-canvas {
        display: none;
    }
}

/* Accessibility improvements */
.celebration-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(76, 175, 80, 0.9);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 500;
    z-index: 10000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.celebration-message.show {
    transform: translateX(0);
}

.celebration-message.hide {
    transform: translateX(100%);
}

/* Enhanced celebration styles */
.celebration-message.enhanced {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.95), rgba(56, 142, 60, 0.95));
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    font-size: 16px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.celebration-icon {
    font-size: 24px;
    animation: iconBounce 0.6s ease-out infinite alternate;
}

@keyframes iconBounce {
    0% { transform: scale(1) rotate(0deg); }
    100% { transform: scale(1.2) rotate(5deg); }
}

/* Full-screen celebration overlay */
.celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.celebration-content {
    text-align: center;
    color: white;
    animation: celebrationPop 0.8s ease-out;
}

.celebration-content h2 {
    font-size: 3rem;
    margin: 0 0 1rem 0;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textShimmer 2s ease-in-out infinite;
}

.celebration-content p {
    font-size: 1.5rem;
    margin: 0;
    opacity: 0.9;
}

.celebration-stars {
    font-size: 4rem;
    animation: starsRotate 3s linear infinite;
    margin-bottom: 1rem;
}

@keyframes celebrationPop {
    0% {
        transform: scale(0.3) rotate(-10deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotate(5deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes textShimmer {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.3); }
}

@keyframes starsRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced task card hover effects */
.task-card {
    transition: all 0.3s ease;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Button press celebration effect */
.celebration-trigger:active {
    transform: scale(0.95);
    animation: buttonCelebrate 0.3s ease-out;
}

@keyframes buttonCelebrate {
    0% { background-color: currentColor; }
    50% { background-color: #4CAF50; }
    100% { background-color: currentColor; }
}

/* Responsive design for celebrations */
@media (max-width: 768px) {
    .celebration-content h2 {
        font-size: 2rem;
    }
    
    .celebration-content p {
        font-size: 1.2rem;
    }
    
    .celebration-stars {
        font-size: 3rem;
    }
    
    .celebration-message.enhanced {
        font-size: 14px;
        padding: 12px 16px;
        margin: 10px;
    }
}

/* Accessibility considerations */
@media (prefers-reduced-motion: reduce) {
    .task-complete-animation,
    .microstep-complete,
    .milestone-celebration,
    .celebration-content,
    .celebration-icon,
    .celebration-stars {
        animation: none !important;
    }
    
    .celebration-message.enhanced {
        transition: opacity 0.3s ease;
    }
}