/* ============================================
   MilkyPot - Animations
   ============================================ */

/* Fade In Up */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.stagger-children.visible > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-children.visible > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-children.visible > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-children.visible > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-children.visible > *:nth-child(5) { transition-delay: 0.5s; }
.stagger-children.visible > *:nth-child(6) { transition-delay: 0.6s; }

.stagger-children.visible > * {
    opacity: 1;
    transform: translateY(0);
}

/* Scale In */
.scale-in {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.scale-in.visible {
    opacity: 1;
    transform: scale(1);
}

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

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

/* Shimmer effect for loading */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.shimmer {
    background: linear-gradient(
        90deg,
        var(--pink-light) 0%,
        white 50%,
        var(--pink-light) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite linear;
}

/* Sparkle */
@keyframes sparkle {
    0%, 100% { opacity: 0; transform: scale(0) rotate(0deg); }
    50% { opacity: 1; transform: scale(1) rotate(180deg); }
}

.sparkle-container {
    position: relative;
}

.sparkle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--yellow-dark);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    animation: sparkle 2s ease-in-out infinite;
}

/* Gradient border animation */
@keyframes gradient-rotate {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.gradient-border {
    background: linear-gradient(270deg, var(--pink), var(--purple), var(--blue), var(--pink));
    background-size: 600% 600%;
    animation: gradient-rotate 4s ease infinite;
    padding: 3px;
    border-radius: var(--radius-lg);
}

.gradient-border-inner {
    background: white;
    border-radius: calc(var(--radius-lg) - 3px);
}

/* Confetti animation for success */
@keyframes confetti-fall {
    0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.confetti-piece {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    z-index: 9999;
    animation: confetti-fall 3s ease-in forwards;
}

/* Float animation */
@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-10px) rotate(2deg); }
    75% { transform: translateY(5px) rotate(-2deg); }
}

.float-animation {
    animation: float 4s ease-in-out infinite;
}

/* Wiggle */
@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

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

/* Cart item add animation */
@keyframes cart-add {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.cart-add-anim {
    animation: cart-add 0.4s ease-in-out;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--gradient-pink);
    color: white;
    padding: 14px 28px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 5000;
    box-shadow: 0 4px 20px rgba(66, 165, 245, 0.4);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--pink-light);
    border-top-color: var(--pink-dark);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
