/**
 * Christmas Wishes - Custom Animations
 * Elegant, festive animations without gradients
 */

/* ========================================
   CSS VARIABLES
   ======================================== */
:root {
    /* Colors - No Gradients */
    --christmas-red: #C41E3A;
    --deep-red: #8B0000;
    --burgundy: #800020;
    --royal-gold: #D4AF37;
    --antique-gold: #CFB53B;
    --forest-green: #1D4D2C;
    --emerald: #228B22;
    --snow-white: #FFFAFA;
    --cream: #FFF8DC;
    --midnight: #1A1A2E;
    --charcoal: #2C3E50;
    --ice-blue: #A5F2F3;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Animation Durations */
    --duration-fast: 150ms;
    --duration-normal: 300ms;
    --duration-slow: 500ms;
    --duration-slower: 800ms;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 20px rgba(212, 175, 55, 0.3);
}

/* ========================================
   SNOWFALL ANIMATION
   ======================================== */
.snowfall-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 100;
}

.snowflake {
    position: absolute;
    top: -10px;
    color: var(--snow-white);
    font-size: 1rem;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
    animation: snowfall linear infinite;
    opacity: 0.8;
}

@keyframes snowfall {
    0% {
        transform: translateY(-10px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0.3;
    }
}

/* Different snowflake sizes and speeds */
.snowflake:nth-child(5n) { font-size: 0.6rem; animation-duration: 15s; }
.snowflake:nth-child(5n+1) { font-size: 0.8rem; animation-duration: 12s; }
.snowflake:nth-child(5n+2) { font-size: 1rem; animation-duration: 18s; }
.snowflake:nth-child(5n+3) { font-size: 1.2rem; animation-duration: 10s; }
.snowflake:nth-child(5n+4) { font-size: 0.7rem; animation-duration: 20s; }

/* Horizontal sway */
.snowflake:nth-child(odd) {
    animation: snowfall-sway-left linear infinite;
}

.snowflake:nth-child(even) {
    animation: snowfall-sway-right linear infinite;
}

@keyframes snowfall-sway-left {
    0% {
        transform: translateY(-10px) translateX(0) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: translateY(50vh) translateX(-30px) rotate(180deg);
    }
    100% {
        transform: translateY(100vh) translateX(10px) rotate(360deg);
        opacity: 0.3;
    }
}

@keyframes snowfall-sway-right {
    0% {
        transform: translateY(-10px) translateX(0) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: translateY(50vh) translateX(30px) rotate(180deg);
    }
    100% {
        transform: translateY(100vh) translateX(-10px) rotate(360deg);
        opacity: 0.3;
    }
}

/* ========================================
   FADE ANIMATIONS
   ======================================== */
.fade-in {
    animation: fadeIn var(--duration-slow) ease-out forwards;
}

.fade-in-up {
    animation: fadeInUp var(--duration-slow) ease-out forwards;
}

.fade-in-down {
    animation: fadeInDown var(--duration-slow) ease-out forwards;
}

.fade-in-left {
    animation: fadeInLeft var(--duration-slow) ease-out forwards;
}

.fade-in-right {
    animation: fadeInRight var(--duration-slow) ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Staggered children animation */
.stagger-children > * {
    opacity: 0;
    animation: fadeInUp var(--duration-slow) ease-out forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.6s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.7s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.8s; }

/* ========================================
   SCALE ANIMATIONS
   ======================================== */
.scale-in {
    animation: scaleIn var(--duration-normal) ease-out forwards;
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

.pulse-slow {
    animation: pulse 3s ease-in-out infinite;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

/* ========================================
   GLOW ANIMATIONS
   ======================================== */
.glow {
    animation: glow 2s ease-in-out infinite alternate;
}

.glow-gold {
    animation: glowGold 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 5px rgba(196, 30, 58, 0.3);
    }
    to {
        box-shadow: 0 0 20px rgba(196, 30, 58, 0.6);
    }
}

@keyframes glowGold {
    from {
        box-shadow: 0 0 5px rgba(212, 175, 55, 0.3);
    }
    to {
        box-shadow: 0 0 20px rgba(212, 175, 55, 0.6);
    }
}

/* Text glow */
.text-glow {
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
    animation: textGlow 2s ease-in-out infinite alternate;
}

@keyframes textGlow {
    from {
        text-shadow: 0 0 5px rgba(212, 175, 55, 0.3);
    }
    to {
        text-shadow: 0 0 15px rgba(212, 175, 55, 0.7);
    }
}

/* ========================================
   SPARKLE ANIMATION
   ======================================== */
.sparkle {
    position: relative;
}

.sparkle::before,
.sparkle::after {
    content: '✦';
    position: absolute;
    color: var(--royal-gold);
    animation: sparkle 1.5s ease-in-out infinite;
}

.sparkle::before {
    top: -10px;
    left: -10px;
    animation-delay: 0s;
}

.sparkle::after {
    bottom: -10px;
    right: -10px;
    animation-delay: 0.75s;
}

@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================
   FLOAT ANIMATION
   ======================================== */
.float {
    animation: float 3s ease-in-out infinite;
}

.float-slow {
    animation: float 5s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ========================================
   SHAKE ANIMATION (for errors)
   ======================================== */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ========================================
   BUTTON ANIMATIONS
   ======================================== */
.btn-hover {
    transition: all var(--duration-normal) ease;
}

.btn-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-hover:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Ripple effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    transform: scale(0);
    opacity: 0;
    transition: transform 0.5s, opacity 0.3s;
}

.ripple:active::after {
    transform: scale(2);
    opacity: 1;
    transition: transform 0s, opacity 0s;
}

/* ========================================
   CARD ANIMATIONS
   ======================================== */
.card-hover {
    transition: all var(--duration-normal) ease;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

/* Card flip */
.card-flip {
    perspective: 1000px;
}

.card-flip-inner {
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-flip:hover .card-flip-inner {
    transform: rotateY(180deg);
}

.card-flip-front,
.card-flip-back {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.card-flip-back {
    transform: rotateY(180deg);
}

/* ========================================
   LOADING ANIMATIONS
   ======================================== */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--cream);
    border-top-color: var(--christmas-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Dots loading */
.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--christmas-red);
    border-radius: 50%;
    animation: dotPulse 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========================================
   DECORATIVE ELEMENTS
   ======================================== */
/* Ornament swing */
.ornament {
    transform-origin: top center;
    animation: swing 3s ease-in-out infinite;
}

@keyframes swing {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

/* Star twinkle */
.twinkle {
    animation: twinkle 2s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Christmas lights */
.lights {
    display: flex;
    gap: 20px;
}

.light {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: lightFlicker 1s ease-in-out infinite;
}

.light:nth-child(1) { background: var(--christmas-red); animation-delay: 0s; }
.light:nth-child(2) { background: var(--royal-gold); animation-delay: 0.2s; }
.light:nth-child(3) { background: var(--forest-green); animation-delay: 0.4s; }
.light:nth-child(4) { background: var(--ice-blue); animation-delay: 0.6s; }
.light:nth-child(5) { background: var(--christmas-red); animation-delay: 0.8s; }

@keyframes lightFlicker {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.9); }
}

/* ========================================
   TRANSITION UTILITIES
   ======================================== */
.transition-all {
    transition: all var(--duration-normal) ease;
}

.transition-fast {
    transition: all var(--duration-fast) ease;
}

.transition-slow {
    transition: all var(--duration-slow) ease;
}

.transition-colors {
    transition: color var(--duration-normal) ease,
                background-color var(--duration-normal) ease,
                border-color var(--duration-normal) ease;
}

.transition-transform {
    transition: transform var(--duration-normal) ease;
}

.transition-opacity {
    transition: opacity var(--duration-normal) ease;
}

/* ========================================
   SCROLL ANIMATIONS (Intersection Observer)
   ======================================== */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   MOBILE-SPECIFIC ANIMATIONS
   ======================================== */
@media (max-width: 768px) {
    /* Reduce animation intensity on mobile for performance */
    .snowflake {
        animation-duration: 20s !important;
    }
    
    .float {
        animation-duration: 4s;
    }
    
    .pulse {
        animation-duration: 3s;
    }
    
    /* Disable some heavy animations on mobile */
    @media (prefers-reduced-motion: reduce) {
        *,
        *::before,
        *::after {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
        
        .snowflake {
            display: none;
        }
    }
}

/* ========================================
   PREFERS REDUCED MOTION
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

