/**
 * Funl Celebrations - CSS for visual celebration effects
 */

/* ===================================
 * CELEBRATION CONTAINER
 * =================================== */
.funl-celebration-container {
    position: fixed;
    pointer-events: none;
    overflow: hidden;
    z-index: 10000;
}

/* ===================================
 * BASE PARTICLE STYLES
 * =================================== */
.funl-celebration-particle {
    position: absolute;
    will-change: transform, opacity;
}

/* ===================================
 * CONFETTI EFFECT
 * =================================== */
.funl-celebration-confetti {
    width: 10px;
    height: 10px;
    animation: funl-confetti-rise 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.funl-celebration-confetti--circle {
    border-radius: 50%;
}

.funl-celebration-confetti--square {
    border-radius: 2px;
}

.funl-celebration-confetti--ribbon {
    width: 4px;
    height: 16px;
    border-radius: 2px;
}

@keyframes funl-confetti-rise {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg) scale(var(--particle-start-scale, 1));
        opacity: 1;
    }
    100% {
        transform: translateY(var(--particle-travel, -300px)) translateX(var(--particle-drift, 0)) rotate(var(--particle-rotation, 360deg)) scale(var(--particle-end-scale, 0.5));
        opacity: 0;
    }
}

/* ===================================
 * FIREWORKS EFFECT
 * =================================== */
.funl-celebration-firework {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: funl-firework-burst 1s ease-out forwards;
}

.funl-celebration-flash {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: funl-flash 0.3s ease-out forwards;
    filter: blur(10px);
}

@keyframes funl-firework-burst {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--firework-dx, 0), var(--firework-dy, 0)) scale(0.3);
        opacity: 0;
    }
}

@keyframes funl-flash {
    0% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(0.5);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2);
    }
}

/* ===================================
 * SPARKLES EFFECT
 * =================================== */
.funl-celebration-sparkle {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    box-shadow: 0 0 10px currentColor, 0 0 20px currentColor;
    animation: funl-sparkle-fall 2s ease-in forwards;
}

@keyframes funl-sparkle-fall {
    0% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateY(var(--sparkle-fall, 500px)) translateX(var(--sparkle-drift, 0)) scale(0.3);
        opacity: 0;
    }
}

/* Sparkle twinkle */
.funl-celebration-sparkle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: inherit;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: funl-twinkle 0.3s ease-in-out infinite alternate;
}

@keyframes funl-twinkle {
    from { opacity: 0.5; transform: translate(-50%, -50%) scale(0.8); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
}

/* ===================================
 * STARS EFFECT
 * =================================== */
.funl-celebration-star {
    font-size: 24px;
    text-shadow: 0 0 10px currentColor;
    animation: funl-star-burst 1.2s ease-out forwards;
    transform: translate(-50%, -50%);
}

@keyframes funl-star-burst {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(0deg);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(calc(-50% + var(--star-dx, 0)), calc(-50% + var(--star-dy, 0))) scale(1) rotate(var(--star-rotation, 360deg));
        opacity: 0;
    }
}

/* ===================================
 * BUBBLES EFFECT
 * =================================== */
.funl-celebration-bubble {
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    animation: funl-bubble-rise 3.5s cubic-bezier(0.2, 0, 0.4, 1) forwards, funl-bubble-wobble 1.2s ease-in-out infinite;
    box-shadow: inset -5px -5px 15px rgba(0, 0, 0, 0.05), 0 0 10px rgba(255, 255, 255, 0.3);
    transform: translateY(0) scale(0);
    opacity: 0;
}

@keyframes funl-bubble-rise {
    0% {
        transform: translateY(0) scale(0);
        opacity: 0;
    }
    20% {
        transform: translateY(-50px) scale(1);
        opacity: 0.85;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(calc(-1 * var(--bubble-rise, 500px))) scale(0.9);
        opacity: 0;
    }
}

@keyframes funl-bubble-wobble {
    0%, 100% { margin-left: 0; }
    50% { margin-left: var(--bubble-wobble, 30px); }
}

/* ===================================
 * BALLOONS EFFECT
 * =================================== */
.funl-celebration-balloon {
    width: 40px;
    height: 50px;
    border-radius: 55% 55% 55% 55% / 55% 55% 60% 60%;
    animation: funl-balloon-rise 3s ease-out forwards;
    position: relative;
}

.funl-celebration-balloon::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 8px;
	clip-path: polygon(40% 0%, 60% 0%, 100% 100%, 0% 100%);
	box-shadow: rgba(0,0,0,0.6) 2px 6px 12px inset;
	background-color: var(--balloon-color);
	border-radius: 5px;
}

@keyframes funl-balloon-rise {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(calc(-1 * var(--balloon-rise, 500px))) translateX(0) rotate(0deg);
        opacity: 1;
    }
}

/* Balloon sway */
.funl-celebration-balloon {
    animation: funl-balloon-rise 3s ease-out forwards, funl-balloon-sway 1.5s ease-in-out infinite;
}

@keyframes funl-balloon-sway {
    0%, 100% { margin-left: calc(-1 * var(--balloon-sway, 20px)); }
    50% { margin-left: var(--balloon-sway, 20px); }
}

/* ===================================
 * RINGS EFFECT
 * =================================== */
.funl-celebration-ring {
    width: 5vw;
    height: 5vw;
    border: 1vw solid;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: funl-ring-pulse 1.4s ease-in forwards;
}

@keyframes funl-ring-pulse {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(35);
        opacity: 0;
    }
}

/* ===================================
 * RAINBOW EFFECT
 * =================================== */
.funl-celebration-rainbow {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(
        circle at center,
        transparent 0%,
        transparent 62%,
        #9400d3 63%,
        #4b0082 64%,
        #0000ff 65%,
        #00ff00 66%,
        #ffff00 67%,
        #ff7f00 68%,
        #ff0000 69%,
        transparent 69.5%,
        transparent 100%
    );
    opacity: 0.8;
    filter: blur(2px);
    animation: funl-rainbow-rotate 5s ease-in-out forwards;
    -webkit-mask: conic-gradient(
        from 180deg,
        transparent 0deg,
        transparent 20deg,
        black 50deg,
        black 130deg,
        transparent 160deg,
        transparent 360deg
    );
    mask: conic-gradient(
        from 180deg,
        transparent 0deg,
        transparent 20deg,
        black 50deg,
        black 130deg,
        transparent 160deg,
        transparent 360deg
    );
}

@keyframes funl-rainbow-rotate {
    0% {
        transform: rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
	50% {
		opacity: 0.5;
	}
    90% {
        opacity: 0;
    }
    100% {
        transform: rotate(360deg);
        opacity: 0;
    }
}

/* ===================================
 * CHECKMARK EFFECT
 * =================================== */
.funl-celebration-checkmark {
    position: absolute;
    width: 120px;
    height: 120px;
    transform: translate(-50%, -50%);
}

.funl-celebration-checkmark svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: #22c55e;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.funl-celebration-checkmark svg path {
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: funl-checkmark-draw 0.6s ease-out forwards;
}

@keyframes funl-checkmark-draw {
    to {
        stroke-dashoffset: 0;
    }
}

.funl-celebration-checkmark.expand-fade svg {
    animation: funl-checkmark-draw 0.6s ease-out forwards, funl-checkmark-shrink 0.4s ease-out forwards;
}

@keyframes funl-checkmark-shrink {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

/* Checkmark background circle */
.funl-celebration-checkmark::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: rgba(34, 197, 94, 0.1);
    border: 3px solid rgba(34, 197, 94, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    animation: funl-checkmark-circle 0.4s ease-out forwards;
}

@keyframes funl-checkmark-circle {
    to {
        transform: translate(-50%, -50%) scale(1.2);
    }
}

.funl-celebration-checkmark.expand-fade::before {
    animation: funl-checkmark-circle 0.4s ease-out forwards, funl-checkmark-expand 0.4s ease-out forwards;
}

@keyframes funl-checkmark-expand {
    0% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
}

/* Check burst particles */
.funl-celebration-check-particle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: funl-check-burst 0.8s ease-out forwards;
}

@keyframes funl-check-burst {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(calc(-50% + var(--particle-dx, 0)), calc(-50% + var(--particle-dy, 0))) scale(0.3);
        opacity: 0;
    }
}

/* ===================================
 * ACCESSIBILITY - Reduced Motion
 * =================================== */
@media (prefers-reduced-motion: reduce) {
    .funl-celebration-container * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* ===================================
 * TEST PANEL (Development Only)
 * =================================== */
.funl-celebrations-test-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 15px;
    border-radius: 8px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 200px;
}

.funl-celebrations-test-panel h4 {
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 14px;
    font-weight: 600;
}

.funl-celebrations-test-panel button {
    display: block;
    width: 100%;
    margin-bottom: 6px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    text-align: left;
    font-size: 12px;
    transition: all 0.2s ease;
}

.funl-celebrations-test-panel button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.funl-celebrations-test-panel button:last-child {
    margin-bottom: 0;
}
