/* Phuzzy Think Tank - Animations & Effects */

/* Enhanced Confetti Animation - 3-Burst System */
.confetti {
    position: absolute;
    pointer-events: none;
    z-index: 1000;
    animation: confetti-fall 3s linear forwards;
}

/* Burst-specific animations */
.confetti.burst-1 {
    animation: confetti-burst-1 3s ease-out forwards;
}

.confetti.burst-2 {
    animation: confetti-burst-2 4s ease-out forwards;
}

.confetti.burst-3 {
    animation: confetti-burst-3 5s ease-out forwards;
}

/* Different confetti shapes */
.confetti-circle {
    border-radius: 50%;
}

.confetti-square {
    border-radius: 2px;
}

.confetti-triangle {
    width: 0;
    height: 0;
    background: transparent !important;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 10px solid;
    border-bottom-color: inherit;
}

.confetti-star {
    background: transparent !important;
    position: relative;
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 8px solid;
    border-bottom-color: inherit;
    transform: rotate(35deg);
}

.confetti-star:before {
    content: '';
    position: absolute;
    left: -6px;
    top: -5px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 8px solid;
    border-bottom-color: inherit;
    transform: rotate(-70deg);
}

.confetti-star:after {
    content: '';
    position: absolute;
    left: -6px;
    top: 2px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 8px solid;
    border-bottom-color: inherit;
    transform: rotate(70deg);
}

.confetti:nth-child(odd) {
    background: #ff6b6b;
    animation-delay: 0s;
}

.confetti:nth-child(even) {
    background: #4ecdc4;
    animation-delay: 0.5s;
}

.confetti:nth-child(3n) {
    background: #45b7d1;
    animation-delay: 1s;
}

.confetti:nth-child(4n) {
    background: #f9ca24;
    animation-delay: 1.5s;
}

.confetti:nth-child(5n) {
    background: #f0932b;
    animation-delay: 2s;
}

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

/* Burst 1: Small focused explosion */
@keyframes confetti-burst-1 {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(0.8);
        opacity: 1;
    }
    20% {
        transform: translate(var(--random-x, 0px), var(--random-y, -50px)) rotate(180deg) scale(1);
    }
    100% {
        transform: translate(calc(var(--random-x, 0px) * 2), calc(var(--random-y, -50px) + 200px)) rotate(720deg) scale(0.3);
        opacity: 0;
    }
}

/* Burst 2: Medium spread explosion */
@keyframes confetti-burst-2 {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(0.9);
        opacity: 1;
    }
    15% {
        transform: translate(var(--random-x, 0px), var(--random-y, -80px)) rotate(270deg) scale(1.2);
    }
    100% {
        transform: translate(calc(var(--random-x, 0px) * 3), calc(var(--random-y, -80px) + 300px)) rotate(1080deg) scale(0.2);
        opacity: 0;
    }
}

/* Burst 3: MASSIVE finale explosion */
@keyframes confetti-burst-3 {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
    10% {
        transform: translate(var(--random-x, 0px), var(--random-y, -120px)) rotate(360deg) scale(1.5);
    }
    30% {
        opacity: 1;
    }
    100% {
        transform: translate(calc(var(--random-x, 0px) * 4), calc(var(--random-y, -120px) + 400px)) rotate(1440deg) scale(0.1);
        opacity: 0;
    }
}

/* Sparkle Effects */
.sparkle {
    position: fixed;
    font-size: 1.5em;
    animation: floatUp 2s ease-out forwards;
    pointer-events: none;
    z-index: 1100;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-150px) rotate(360deg);
    }
}

/* Bear Reaction Popup */
.bear-reaction {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8em;
    z-index: 200;
    animation: bearPop 1.5s ease-out forwards;
    pointer-events: none;
}

@keyframes bearPop {
    0% { 
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    50% { 
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% { 
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes bearReactionPop {
    0% { 
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }
    15% { 
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
    25% {
        transform: translate(-50%, -50%) scale(1);
    }
    85% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% { 
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

@keyframes textSlideUp {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(40px) scale(0.5);
    }
    15% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1.1);
    }
    20% {
        transform: translateX(-50%) translateY(0) scale(1);
    }
    80% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px) scale(0.8);
    }
}

/* Button Hover Effects */
.quiz-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    opacity: 0;
    transform: translateX(-100%);
    transition: transform 0.5s, opacity 0.5s;
    pointer-events: none;
}

.quiz-option:hover::before {
    opacity: 1;
    transform: translateX(0) translateX(100%);
}

/* Feedback Animations */
.feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 10000;
    font-weight: 600;
    font-size: 1.1rem;
}

.feedback.correct {
    border-left: 5px solid #48bb78;
    color: #2f855a;
}

.feedback.incorrect {
    border-left: 5px solid #f56565;
    color: #c53030;
}

.fade-in {
    animation: fadeInOut 3s ease-in-out forwards;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    20%, 80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

/* Progress Bar Animation */
.scenario-progress-bar {
    animation: progressFill 0.8s ease-out forwards;
}

@keyframes progressFill {
    from {
        width: 0%;
    }
    to {
        width: var(--progress-width);
    }
}

/* Bear Analysis Reveal */
.bear-analysis {
    opacity: 0;
    transform: translateY(20px);
    animation: slideUp 0.6s ease-out forwards;
}

.bear-analysis:nth-child(2) {
    animation-delay: 0.2s;
}

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

/* Meter Fill Animation - REMOVED: Conflicted with direct style.width setting */

/* Mini Meter Animations */
.mini-meter-fill {
    width: 0;
    transition: width 1s ease-out;
}

.mini-meter-fill.animate {
    width: var(--fill-width);
}

/* Score Collection Animations */
.score-collecting {
    animation: scoreCollecting 2s ease-in-out;
    transform-origin: center;
}

@keyframes scoreCollecting {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.15);
        box-shadow: 0 12px 40px rgba(246, 211, 101, 0.4);
    }
    50% {
        transform: scale(1.25);
        box-shadow: 0 16px 50px rgba(246, 211, 101, 0.6);
    }
    75% {
        transform: scale(1.15);
        box-shadow: 0 12px 40px rgba(246, 211, 101, 0.4);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    }
}

.score-tick {
    animation: scoreTick 0.2s ease-out;
}

@keyframes scoreTick {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
    }
}

.score-pulse {
    animation: scorePulse 0.6s ease-in-out;
}

@keyframes scorePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* Correct Answer Highlight - Clear success indication */
.correct-highlight {
    animation: correctAnswerPulse 4s ease-in-out;
    position: relative;
    z-index: 10;
    border-color: #10b981 !important;
    background: white !important;
}

.correct-highlight::before {
    content: '';
    position: absolute;
    inset: -6px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 13px;
    z-index: -1;
    opacity: 0;
    animation: greenGlowPulse 4s ease-in-out;
}

.correct-highlight::after {
    content: '✓ Correct!';
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: #10b981;
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    opacity: 0;
    animation: labelBounceIn 4s ease-in-out;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

@keyframes correctAnswerPulse {
    0%, 100% {
        transform: scale(1);
    }
    15%, 25%, 35% {
        transform: scale(1.02);
    }
    20%, 30% {
        transform: scale(0.98);
    }
}

@keyframes greenGlowPulse {
    0%, 10% {
        opacity: 0;
    }
    15%, 85% {
        opacity: 0.3;
    }
    20%, 40%, 60%, 80% {
        opacity: 0.5;
    }
    30%, 50%, 70% {
        opacity: 0.3;
    }
    90%, 100% {
        opacity: 0;
    }
}

@keyframes labelBounceIn {
    0%, 10% {
        opacity: 0;
        transform: translateX(-50%) translateY(10px) scale(0.5);
    }
    15% {
        opacity: 1;
        transform: translateX(-50%) translateY(-3px) scale(1.1);
    }
    20% {
        transform: translateX(-50%) translateY(0) scale(1);
    }
    85% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
    90%, 100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-5px) scale(0.8);
    }
}

/* Floating Reward Animation */
.floating-reward {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    animation: floatingRewardSparkle 1.5s ease-out;
}

@keyframes floatingRewardSparkle {
    0% {
        filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3)) brightness(1);
    }
    25% {
        filter: drop-shadow(0 6px 12px rgba(246, 211, 101, 0.5)) brightness(1.3);
    }
    50% {
        filter: drop-shadow(0 8px 16px rgba(246, 211, 101, 0.7)) brightness(1.5);
    }
    75% {
        filter: drop-shadow(0 6px 12px rgba(246, 211, 101, 0.5)) brightness(1.3);
    }
    100% {
        filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3)) brightness(1);
    }
}

/* Floating Celebration Emojis */
@keyframes celebrationFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 0.8;
    }
    25% {
        transform: translateY(-10px) rotate(5deg) scale(1.1);
        opacity: 1;
    }
    50% {
        transform: translateY(-20px) rotate(-3deg) scale(0.9);
        opacity: 0.9;
    }
    75% {
        transform: translateY(-15px) rotate(8deg) scale(1.05);
        opacity: 1;
    }
}

/* Honey Pot Usage Animation */
.honey-pot.using {
    animation: honeyUsed 0.8s ease-out forwards;
}

@keyframes honeyUsed {
    0% {
        transform: scale(1) rotate(0deg);
    }
    50% {
        transform: scale(1.3) rotate(10deg);
    }
    100% {
        transform: scale(0.7) rotate(0deg);
        opacity: 0.3;
        filter: grayscale(100%);
    }
}

.honey-pot.used {
    opacity: 0.3;
    filter: grayscale(100%);
}

/* Page Transition */
.page-transition {
    opacity: 0;
    transform: translateX(20px);
    animation: pageSlide 0.5s ease-out forwards;
}

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

/* Success Celebration */
.celebration {
    animation: celebrate 2s ease-in-out;
}

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

/* Loading Spinner */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* Bounce Animation for Loading Bear */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

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