/**
 * Search Celebrations Animation Styles
 * 
 * Celebratory animations that appear when certain keywords are searched
 */

/* Celebration Container */
.niriv-celebration-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

/* Celebration Particle - Confetti/Paper Style */
.niriv-celebration-particle {
    position: absolute;
    width: 10px;
    height: 10px;
    pointer-events: none;
    opacity: 1 !important;
    will-change: transform, opacity;
    display: block !important;
    visibility: visible !important;
    transform-style: preserve-3d;
    border-radius: 2px;
}

/* Paper/confetti shape - rectangular with slight rotation */
.niriv-celebration-particle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    border-radius: 2px;
    transform: rotate(45deg);
    box-shadow: 0 0 8px rgba(0,0,0,0.2);
}

.niriv-celebration-particle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60%;
    height: 60%;
    background: rgba(255,255,255,0.6);
    border-radius: 1px;
    transform: translate(-50%, -50%) rotate(45deg);
    animation: paperShine 1.5s ease-in-out infinite;
}

@keyframes paperShine {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

/* Celebration Burst - Colorful Confetti/Paper */
.niriv-celebration-burst .niriv-celebration-particle {
    animation: celebrationBurst 2s ease-out forwards;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

/* Festival Burst - Festive Confetti/Paper */
.niriv-festival-burst .niriv-celebration-particle {
    animation: festivalBurst 2s ease-out forwards;
    box-shadow: 0 0 12px rgba(0,0,0,0.3);
}

/* Trophy Burst - Paper Cutout Trophy Particles */
.niriv-trophy-burst .niriv-celebration-particle {
    width: 12px;
    height: 14px;
    animation: trophyBurst 2s ease-out forwards;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 2px rgba(0, 0, 0, 0.2);
    border-radius: 0;
    transform-style: preserve-3d;
}

/* Trophy paper cutout shape - simplified trophy silhouette */
.niriv-trophy-burst .niriv-celebration-particle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    /* Trophy shape: cup with base */
    clip-path: polygon(
        20% 0%, 
        80% 0%, 
        90% 15%, 
        90% 50%, 
        75% 50%, 
        75% 100%, 
        25% 100%, 
        25% 50%, 
        10% 50%, 
        10% 15%
    );
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.3), 
                inset 0 -1px 2px rgba(0, 0, 0, 0.2);
}

/* Paper texture effect */
.niriv-trophy-burst .niriv-celebration-particle::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 2px,
        rgba(255, 255, 255, 0.1) 2px,
        rgba(255, 255, 255, 0.1) 4px
    );
    clip-path: polygon(
        20% 0%, 
        80% 0%, 
        90% 15%, 
        90% 50%, 
        75% 50%, 
        75% 100%, 
        25% 100%, 
        25% 50%, 
        10% 50%, 
        10% 15%
    );
    opacity: 0.4;
}

/* Celebration Burst Colors - Vibrant crystals */
.niriv-celebration-burst .niriv-celebration-particle:nth-child(odd) { 
    background: linear-gradient(135deg, #fbbf24, #f59e0b); 
    color: #fbbf24; 
}
.niriv-celebration-burst .niriv-celebration-particle:nth-child(even) { 
    background: linear-gradient(135deg, #3b82f6, #2563eb); 
    color: #3b82f6; 
}
.niriv-celebration-burst .niriv-celebration-particle:nth-child(3n) { 
    background: linear-gradient(135deg, #ef4444, #dc2626); 
    color: #ef4444; 
}
.niriv-celebration-burst .niriv-celebration-particle:nth-child(4n) { 
    background: linear-gradient(135deg, #10b981, #059669); 
    color: #10b981; 
}
.niriv-celebration-burst .niriv-celebration-particle:nth-child(5n) { 
    background: linear-gradient(135deg, #8b5cf6, #7c3aed); 
    color: #8b5cf6; 
}

/* Festival Burst Colors - Festive crystals */
.niriv-festival-burst .niriv-celebration-particle:nth-child(odd) { 
    background: linear-gradient(135deg, #fb923c, #f97316); 
    color: #fb923c; 
}
.niriv-festival-burst .niriv-celebration-particle:nth-child(even) { 
    background: linear-gradient(135deg, #fbbf24, #f59e0b); 
    color: #fbbf24; 
}
.niriv-festival-burst .niriv-celebration-particle:nth-child(3n) { 
    background: linear-gradient(135deg, #f472b6, #ec4899); 
    color: #f472b6; 
}
.niriv-festival-burst .niriv-celebration-particle:nth-child(4n) { 
    background: linear-gradient(135deg, #a855f7, #9333ea); 
    color: #a855f7; 
}
.niriv-festival-burst .niriv-celebration-particle:nth-child(5n) { 
    background: linear-gradient(135deg, #ec4899, #db2777); 
    color: #ec4899; 
}

/* Trophy Burst Colors - Colorful paper cutouts (green, blue, brand blue, red) */
.niriv-trophy-burst .niriv-celebration-particle:nth-child(odd) { 
    background: #10b981; /* Green */
    color: #10b981; 
}
.niriv-trophy-burst .niriv-celebration-particle:nth-child(even) { 
    background: #3b82f6; /* Blue */
    color: #3b82f6; 
}
.niriv-trophy-burst .niriv-celebration-particle:nth-child(3n) { 
    background: #2563eb; /* Brand blue */
    color: #2563eb; 
}
.niriv-trophy-burst .niriv-celebration-particle:nth-child(4n) { 
    background: #ef4444; /* Red */
    color: #ef4444; 
}
.niriv-trophy-burst .niriv-celebration-particle:nth-child(5n) { 
    background: #059669; /* Darker green */
    color: #059669; 
}
.niriv-trophy-burst .niriv-celebration-particle:nth-child(6n) { 
    background: #1d4ed8; /* Darker brand blue */
    color: #1d4ed8; 
}
.niriv-trophy-burst .niriv-celebration-particle:nth-child(7n) { 
    background: #dc2626; /* Darker red */
    color: #dc2626; 
}

/* Celebration Burst Animation - Confetti/Paper shooting upward with rotation */
@keyframes celebrationBurst {
    0% {
        opacity: 1;
        transform: translateY(0) translateX(0) scale(0.6) rotate(0deg);
    }
    15% {
        opacity: 1;
        transform: translateY(-15vh) translateX(var(--random-x, 0)) scale(1.1) rotate(180deg);
    }
    40% {
        opacity: 0.9;
        transform: translateY(-40vh) translateX(var(--random-x, 0)) scale(1) rotate(360deg);
    }
    70% {
        opacity: 0.6;
        transform: translateY(-70vh) translateX(var(--random-x, 0)) scale(0.7) rotate(540deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-100vh) translateX(var(--random-x, 0)) scale(0.3) rotate(720deg);
    }
}

/* Festival Burst Animation - Fast one-shot burst */
@keyframes festivalBurst {
    0% {
        opacity: 1;
        transform: translateY(0) translateX(0) scale(0.8) rotate(0deg);
    }
    30% {
        opacity: 1;
        transform: translateY(-50vh) translateX(var(--random-x, 0)) scale(1.1) rotate(180deg);
    }
    60% {
        opacity: 0.8;
        transform: translateY(-80vh) translateX(var(--random-x, 0)) scale(0.7) rotate(360deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-120vh) translateX(var(--random-x, 0)) scale(0.2) rotate(540deg);
    }
}

/* Trophy Burst Animation - Fast one-shot burst */
@keyframes trophyBurst {
    0% {
        opacity: 1;
        transform: translateY(0) translateX(0) scale(0.8) rotate(0deg) rotateX(0deg);
    }
    30% {
        opacity: 1;
        transform: translateY(-50vh) translateX(var(--random-x, 0)) scale(1) rotate(180deg) rotateX(45deg);
    }
    60% {
        opacity: 0.8;
        transform: translateY(-80vh) translateX(var(--random-x, 0)) scale(0.7) rotate(360deg) rotateX(90deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-120vh) translateX(var(--random-x, 0)) scale(0.2) rotate(540deg) rotateX(135deg);
    }
}

/* Keyword Display - Stylish text in burst */
.niriv-celebration-keyword {
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%) translateY(0) scale(0.8);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 3rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: #fff;
    text-shadow: 
        0 0 20px rgba(255, 255, 255, 0.8),
        0 0 40px rgba(255, 255, 255, 0.6),
        0 0 60px rgba(255, 255, 255, 0.4),
        0 4px 20px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 10000;
    opacity: 0;
    animation: keywordReveal 2s ease-out forwards;
    background: linear-gradient(135deg, #fbbf24, #f59e0b, #3b82f6, #2563eb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 30px rgba(255, 255, 255, 0.8));
}

/* Festival keyword styling - applied via class */
.niriv-celebration-keyword.festival-keyword {
    background: linear-gradient(135deg, #fb923c, #f97316, #f472b6, #ec4899, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Trophy keyword styling - applied via class */
.niriv-celebration-keyword.trophy-keyword {
    background: linear-gradient(135deg, #10b981, #3b82f6, #2563eb, #ef4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes keywordReveal {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(50px) scale(0.5);
        filter: blur(10px);
    }
    15% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
        filter: blur(0);
    }
    40% {
        opacity: 1;
        transform: translateX(-50%) translateY(-20px) scale(1.05);
        filter: blur(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-100px) scale(0.8);
        filter: blur(5px);
    }
}

/* Additional sparkle particles around keyword */
.niriv-celebration-keyword::before,
.niriv-celebration-keyword::after {
    content: '✨';
    position: absolute;
    font-size: 2rem;
    animation: sparkleFloat 3s ease-in-out infinite;
}

.niriv-celebration-keyword::before {
    left: -60px;
    top: 50%;
    animation-delay: 0s;
}

.niriv-celebration-keyword::after {
    right: -60px;
    top: 50%;
    animation-delay: 1.5s;
}

@keyframes sparkleFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 0.7;
    }
    50% {
        transform: translateY(-20px) rotate(180deg) scale(1.3);
        opacity: 1;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .niriv-celebration-particle {
        width: 8px;
        height: 8px;
    }
    
    .niriv-trophy-burst .niriv-celebration-particle {
        width: 10px;
        height: 12px;
    }
    
    .niriv-celebration-keyword {
        font-size: 2rem;
        letter-spacing: 0.1em;
    }
    
    .niriv-celebration-keyword::before,
    .niriv-celebration-keyword::after {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .niriv-celebration-keyword {
        font-size: 1.5rem;
    }
}

/* Celebration Button - Fixed at bottom (white full circle) */
.niriv-celebration-button {
    position: fixed;
    bottom: 80px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    transition: all 0.3s ease;
    animation: celebrationButtonPulse 2s ease-in-out infinite;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.niriv-celebration-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2), 0 2px 12px rgba(0, 0, 0, 0.15);
    border-color: #d1d5db;
}

.niriv-celebration-button:active {
    transform: scale(0.95);
}

@keyframes celebrationButtonPulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    50% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), 0 2px 12px rgba(0, 0, 0, 0.15);
    }
}

@media (max-width: 768px) {
    .niriv-celebration-button {
        width: 50px;
        height: 50px;
        bottom: 70px;
        right: 20px;
        font-size: 24px;
    }
}
