/* Enhanced Animations for FocusBuddy */

/* Basic Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes pop-in {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

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

@keyframes pulse-strong {
    0%, 100% { transform: scale(1); box-shadow: 0 8px 20px rgba(254, 197, 187, 0.3); }
    50% { transform: scale(1.1); box-shadow: 0 12px 30px rgba(254, 197, 187, 0.5); }
}

@keyframes pulse-subtle {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

@keyframes focus-attention {
    0%, 100% { box-shadow: 0 15px 30px rgba(254, 197, 187, 0.2); }
    50% { box-shadow: 0 15px 40px rgba(254, 197, 187, 0.4); }
}

@keyframes float-character {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

@keyframes float-bubble {
    0% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0); }
}

/* Character Animations */
.buddy-image.interactive {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.buddy-image.interactive:hover {
    transform: scale(1.1) rotate(5deg);
    cursor: pointer;
}

.pulse-animation {
    animation: pulse 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.wiggle {
    animation: wiggle 0.6s ease-in-out;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-12deg); }
    75% { transform: rotate(12deg); }
}

.celebration-bounce {
    animation: bounce 1s ease-in-out;
}

.character-jump {
    animation: jump 0.5s ease-in-out;
}

@keyframes jump {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-30px); }
}

/* Progress Animations */
.progress-animate circle:nth-child(2) {
    stroke-dasharray: 113;
    stroke-dashoffset: 113;
    transition: stroke-dashoffset 1.5s ease-in-out;
}

.progress-number {
    transition: all 0.8s ease-in-out;
}

.reward-shine {
    position: relative;
    overflow: hidden;
}

.reward-shine::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(30deg);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: rotate(30deg) translateX(-100%); }
    20%, 100% { transform: rotate(30deg) translateX(100%); }
}

/* Button Animations */
.attention-grabber {
    animation: pulse 2s infinite;
    box-shadow: 0 0 0 0 rgba(254, 197, 187, 0.7);
    position: relative;
    overflow: hidden;
}

.attention-grabber::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: slide 2s infinite;
}

@keyframes slide {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

.button-clicked {
    transform: scale(0.95);
    opacity: 0.9;
    transition: all 0.2s;
}

/* Confetti Animation */
@keyframes confetti-fall {
    0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    top: 0;
    left: calc(var(--x, 50%) - 5px);
    opacity: 0;
    animation: fall 3s var(--delay, 0s) linear forwards;
}

@keyframes fall {
    0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
    20% { opacity: 1; }
    80% { opacity: 0.8; }
    100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}

.confetti-heart::before {
    content: '❤️';
    font-size: 12px;
    position: absolute;
}

.confetti-star::before {
    content: '⭐';
    font-size: 12px;
    position: absolute;
}

/* Enhanced Task Card Animation */
.task-card.enhanced {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                box-shadow 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.task-card.enhanced:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(254, 197, 187, 0.25);
}

.task-card.enhanced::before {
    transition: opacity 0.3s ease;
}

.task-card.enhanced:hover::before {
    opacity: 1;
}

/* Interactive Speech Bubble */
.speech-bubble.enhanced {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.speech-bubble.enhanced::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(30deg);
    animation: speech-shine 6s infinite;
    opacity: 0;
    transition: opacity 0.3s;
}

.speech-bubble.enhanced:hover::before {
    opacity: 1;
}

@keyframes speech-shine {
    0% { transform: rotate(30deg) translateX(-100%); }
    20%, 100% { transform: rotate(30deg) translateX(100%); }
}

/* Emoji Animation */
.emoji-animate {
    display: inline-block;
    animation: emoji-pulse 1.5s infinite;
}

@keyframes emoji-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* Timeline Animation */
.timeline.enhanced {
    position: relative;
}

.timeline.enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 20px;
    width: 2px;
    background: linear-gradient(to bottom, var(--cute-pink), var(--cute-lavender));
    opacity: 0.3;
    z-index: 0;
}

/* Badge Animation */
.badge-item {
    transition: all 0.3s ease;
}

.badge-item:not(.locked):hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 30px rgba(254, 197, 187, 0.3);
}

/* Loading Animation */
.loading-spinner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid rgba(254, 197, 187, 0.3);
    border-top-color: var(--primary-color);
    animation: spin 1s infinite linear;
}

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

/* Page Transition */
.page-transition {
    animation: page-fade 0.5s ease-in-out;
}

@keyframes page-fade {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Welcome Animation */
.welcome-appear {
    animation: welcome-appear 1s ease-in-out;
}

@keyframes welcome-appear {
    0% { opacity: 0; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1); }
}

/* Custom Focus Effect */
.custom-focus {
    position: relative;
}

.custom-focus::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(to right, var(--cute-pink), var(--primary-color));
    transition: width 0.3s ease;
}

.custom-focus:focus::after,
.custom-focus:active::after {
    width: 100%;
}

/* Heartbeat Animation */
.heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    10%, 30% { transform: scale(0.91); }
    20%, 40% { transform: scale(1.1); }
    50%, 70% { transform: scale(0.93); }
    60%, 80% { transform: scale(1.07); }
}

/* Character Mood Animation */
.mood-change {
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

/* Level Up Animation */
.level-up {
    animation: level-up 1s ease-in-out;
}

@keyframes level-up {
    0% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.2); filter: brightness(1.5); }
    100% { transform: scale(1); filter: brightness(1); }
}

/* Sparkle Effect */
.sparkle {
    display: inline-block;
    animation: sparkle-twinkle 2s infinite;
}

@keyframes sparkle-twinkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.8); }
}

/* Screen Transition */
.screen-transition {
    animation: screen-transition 0.5s ease-in-out;
}

@keyframes screen-transition {
    0% { opacity: 0; transform: translateX(30px); }
    100% { opacity: 1; transform: translateX(0); }
}

/* Task completion celebration */
.task-completing {
    animation: task-completing 0.8s ease-in-out;
}

@keyframes task-completing {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); opacity: 0.8; }
    100% { transform: scale(0.9); opacity: 0; }
}

.task-completed {
    animation: task-completed 0.5s ease-in-out forwards;
}

@keyframes task-completed {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Timer Animation */
.timer-progress {
    transition: stroke-dashoffset 1s linear;
}

.timer-progress-complete {
    animation: timer-complete 1s ease-in-out;
}

@keyframes timer-complete {
    0% { stroke-width: 4px; }
    50% { stroke-width: 10px; opacity: 0.8; }
    100% { stroke-width: 4px; opacity: 1; }
}

/* Notification Animation */
.notification-pop {
    animation: notification-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes notification-pop {
    0% { transform: scale(0); opacity: 0; }
    80% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* Reveal Effects */
.reveal-bottom {
    animation: reveal-bottom 0.5s ease-out forwards;
}

@keyframes reveal-bottom {
    0% { transform: translateY(20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.reveal-left {
    animation: reveal-left 0.5s ease-out forwards;
}

@keyframes reveal-left {
    0% { transform: translateX(-20px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}