/* =========================================
   Base Backgrounds for Themes
   ========================================= */

body.theme-leaves {
    background: linear-gradient(135deg, #2b5876 0%, #4e4376 100%);
}

body.theme-birds {
    background: linear-gradient(to bottom, #87CEEB 0%, #f6e5c0 100%);
}

body.theme-trees {
    background: linear-gradient(to top, #134E5E 0%, #71B280 100%);
}

.animation-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 99;
    /* Changed to front */
    pointer-events: none;
}

/* =========================================
   Theme 1: Falling Leaves
   ========================================= */
.anim-el.leaf {
    position: absolute;
    top: -50px;
    width: 25px;
    height: 25px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 0 50% 0 50%;
    /* Leaf shape */
    animation: fall linear infinite, sway ease-in-out infinite alternate;
}

/* Make some leaves slightly different colors */
.anim-el.leaf:nth-child(even) {
    background: rgba(255, 215, 0, 0.15);
    /* Hint of gold */
}

@keyframes fall {
    0% {
        top: -50px;
        transform: rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        top: 110vh;
        transform: rotate(360deg);
        opacity: 0;
    }
}

@keyframes sway {
    0% {
        margin-left: 0px;
    }

    100% {
        margin-left: 100px;
    }
}

/* =========================================
   Theme 2: Swaying Trees 
   ========================================= */
.anim-el.tree {
    position: absolute;
    bottom: -20px;
    width: 0;
    height: 0;
    border-left: 60px solid transparent;
    border-right: 60px solid transparent;
    border-bottom: 200px solid rgba(255, 255, 255, 0.08);
    transform-origin: bottom center;
    animation: swayTree 4s ease-in-out infinite alternate;
}

.anim-el.tree::after {
    content: '';
    position: absolute;
    top: 200px;
    left: -10px;
    width: 20px;
    height: 50px;
    background: rgba(0, 0, 0, 0.2);
}

@keyframes swayTree {
    0% {
        transform: scale(var(--tree-scale, 1)) rotate(-3deg);
    }

    100% {
        transform: scale(var(--tree-scale, 1)) rotate(3deg);
    }
}

/* =========================================
   Theme 3: Flying Birds
   ========================================= */
.anim-el.bird {
    position: absolute;
    left: -100px;
    width: 30px;
    height: 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    font-weight: bold;
    animation: fly linear infinite;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Use double arcs for simple CSS birds instead of complex SVGs to keep it lightweight */
.anim-el.bird::before {
    content: '';
    position: absolute;
    width: 15px;
    height: 15px;
    border-top: 2px solid rgba(255, 255, 255, 0.4);
    border-right: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 0 100% 0 0;
    transform: rotate(-45deg);
    right: 50%;
    animation: flapRight 0.5s ease-in-out infinite alternate;
    transform-origin: bottom left;
}

.anim-el.bird::after {
    content: '';
    position: absolute;
    width: 15px;
    height: 15px;
    border-top: 2px solid rgba(255, 255, 255, 0.4);
    border-left: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 100% 0 0 0;
    transform: rotate(45deg);
    left: 50%;
    animation: flapLeft 0.5s ease-in-out infinite alternate;
    transform-origin: bottom right;
}


@keyframes flapRight {
    0% {
        transform: rotate(-45deg) skewY(0deg);
    }

    100% {
        transform: rotate(-10deg) skewY(-20deg);
    }
}

@keyframes flapLeft {
    0% {
        transform: rotate(45deg) skewY(0deg);
    }

    100% {
        transform: rotate(10deg) skewY(20deg);
    }
}

@keyframes fly {
    0% {
        left: -100px;
        transform: scale(0.5) translateY(0);
    }

    25% {
        transform: scale(0.7) translateY(-20px);
    }

    50% {
        transform: scale(1) translateY(10px);
    }

    75% {
        transform: scale(0.8) translateY(-30px);
    }

    100% {
        left: 110vw;
        transform: scale(0.6) translateY(0);
    }
}