/**
 * Kurzgesagt-Style Weather Background CSS
 * Flat design with smooth animations - Matching exact style
 */

/* ========== Container ========== */
.weather-bg-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    transition: background-color 2s ease;
}

.weather-scene {
    width: 100%;
    height: 100%;
    position: relative;
}

/* ========== Sunny/Clear Scene (Default) ========== */
.sunny-scene {
    background: linear-gradient(to bottom, 
        #87CEEB 0%, 
        #98D8F4 20%,
        #A8E4F8 40%,
        #B8ECFC 60%,
        #C8F0FC 80%, 
        #D0F4FC 100%);
    box-shadow: inset 0 0 200px rgba(255, 255, 255, 0.4);
}

.sun {
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, #FFD700 0%, #FFB84D 50%, #FF9F3A 100%);
    border-radius: 50%;
    box-shadow: 0 0 60px rgba(255, 184, 77, 0.8),
                0 0 120px rgba(255, 184, 77, 0.6),
                0 0 180px rgba(255, 184, 77, 0.4),
                inset 0 0 40px rgba(255, 215, 0, 0.6);
    animation: sun-pulse 8s ease-in-out infinite;
}

@keyframes sun-pulse {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.05); filter: brightness(1.1); }
}

/* ========== Cloudy Scene ========== */
.cloudy-scene {
    background: linear-gradient(to bottom, 
        #A0C4D8 0%,
        #B4D4E6 30%,
        #C8E4F4 60%,
        #D8EDF8 100%);
    box-shadow: inset 0 0 150px rgba(200, 200, 200, 0.3);
}

/* ========== Rainy Scene ========== */
.rainy-scene {
    background: linear-gradient(to bottom, 
        #7A9CB0 0%,
        #8CACC0 30%,
        #9EBCD0 60%,
        #B0CCE0 100%);
    box-shadow: inset 0 0 200px rgba(100, 100, 120, 0.4);
}

/* ========== Snowy Scene ========== */
.snowy-scene {
    background: linear-gradient(to bottom, 
        #E8F6FC 0%,
        #F0F8FD 30%,
        #F6FAFE 60%,
        #FAFCFE 100%);
    box-shadow: inset 0 0 200px rgba(255, 255, 255, 0.5);
}

/* ========== Thunderstorm Scene ========== */
.thunderstorm-scene {
    background: linear-gradient(to bottom, 
        #5A7A90 0%,
        #6888A0 30%,
        #7896B0 60%,
        #88A4C0 100%);
    box-shadow: inset 0 0 250px rgba(50, 50, 70, 0.6);
}

/* ========== Foggy Scene ========== */
.foggy-scene {
    background: linear-gradient(to bottom, 
        #C8D8E8 0%,
        #D4E4F0 30%,
        #E0ECF4 60%,
        #E8F2F8 100%);
    box-shadow: inset 0 0 200px rgba(200, 200, 200, 0.4);
}

/* ========== Night Scene ========== */
.night-scene {
    background: radial-gradient(ellipse at top, 
        #1a2a3a 0%,
        #0f1922 30%,
        #0a1218 60%,
        #050a10 100%);
    box-shadow: inset 0 0 300px rgba(10, 15, 25, 0.8);
}

/* Day/Night scene transitions - Slow and Subtle */
.weather-bg-container {
    transition: all 5s ease-in-out;
}

.weather-scene {
    transition: background 5s ease-in-out;
}

/* Smooth fade for sun/moon */
.sun,
.moon {
    opacity: 0;
    animation: fadeIn 3s ease-in-out forwards;
}

@keyframes fadeIn {
    0% { opacity: 0; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1); }
}

/* Smooth transitions for all weather elements */
.cloud,
.star,
.raindrop,
.snowflake {
    animation-timing-function: ease-in-out;
}

/* ========== Clouds (Kurzgesagt Style) ========== */
.cloud {
    position: absolute;
    background: linear-gradient(to bottom, #FFFFFF 0%, #F8FCFF 50%, #F0F8FF 100%);
    border-radius: 200px;
    width: 220px;
    height: 80px;
    animation: float-cloud linear infinite;
    opacity: 0.98;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.08),
                0 8px 20px rgba(0, 0, 0, 0.06),
                inset 0 -5px 15px rgba(200, 220, 240, 0.3);
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.05));
}

.cloud::before,
.cloud::after {
    content: '';
    position: absolute;
    background: #FFFFFF;
    border-radius: 50%;
}

.cloud::before {
    width: 110px;
    height: 110px;
    top: -55px;
    left: 30px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.05);
}

.cloud::after {
    width: 130px;
    height: 130px;
    top: -65px;
    right: 35px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.05);
}

/* Cloud variants - Kurzgesagt inspired */
.cloud-light {
    background: #FFFFFF;
    opacity: 0.92;
}

.cloud-light::before,
.cloud-light::after {
    background: #FFFFFF;
}

.cloud-medium {
    background: #E8F2F7;
    opacity: 0.95;
}

.cloud-medium::before,
.cloud-medium::after {
    background: #E8F2F7;
}

.cloud-dark {
    background: #D0DEEA;
    opacity: 0.95;
}

.cloud-dark::before,
.cloud-dark::after {
    background: #D0DEEA;
}

.cloud-very-dark {
    background: #B0BED0;
    opacity: 0.95;
}

.cloud-very-dark::before,
.cloud-very-dark::after {
    background: #B0BED0;
}

.cloud-night {
    background: #3A4F64;
    opacity: 0.75;
}

.cloud-night::before,
.cloud-night::after {
    background: #3A4F64;
}

@keyframes float-cloud {
    0% {
        transform: translateX(-250px) translateY(0px);
    }
    50% {
        transform: translateX(calc(50vw - 125px)) translateY(-8px);
    }
    100% {
        transform: translateX(calc(100vw + 250px)) translateY(0px);
    }
}

/* ========== Birds (Simple V-shapes) ========== */
.bird {
    position: absolute;
    left: -50px;
    animation: fly-bird linear infinite;
}

.bird::before,
.bird::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 3px;
    background: rgba(60, 80, 100, 0.6);
    border-radius: 3px;
    animation: flap 0.8s ease-in-out infinite;
}

.bird::before {
    transform-origin: right center;
    transform: rotate(-25deg);
}

.bird::after {
    transform-origin: left center;
    transform: rotate(25deg);
}

@keyframes fly-bird {
    0% { left: -50px; }
    100% { left: calc(100vw + 50px); }
}

@keyframes flap {
    0%, 100% { transform: scaleX(1) scaleY(1); }
    50% { transform: scaleX(1.2) scaleY(0.95); }
}

/* ========== Rain (Kurzgesagt style drops) ========== */
.raindrop {
    position: absolute;
    top: -10px;
    width: 3px;
    height: 20px;
    background: linear-gradient(to bottom, 
        rgba(160, 196, 224, 0) 0%, 
        rgba(160, 196, 224, 0.4) 20%,
        rgba(140, 180, 220, 0.8) 100%);
    border-radius: 0 0 3px 3px;
    animation: fall-rain linear infinite;
    opacity: 0.8;
    box-shadow: 0 0 2px rgba(160, 196, 224, 0.4),
                0 2px 4px rgba(140, 180, 220, 0.2);
}

@keyframes fall-rain {
    0% { 
        transform: translateY(-20px); 
        opacity: 0.8;
        filter: blur(0px);
    }
    100% { 
        transform: translateY(100vh); 
        opacity: 0.1;
        filter: blur(1px);
    }
}

/* ========== Snow (Round, soft flakes) ========== */
.snowflake {
    position: absolute;
    top: -20px;
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, #FFFFFF 0%, #F8FCFF 50%, #E8F4FF 100%);
    border-radius: 50%;
    animation: fall-snow linear infinite;
    opacity: 0.95;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.8),
                0 0 20px rgba(200, 220, 255, 0.4),
                inset 0 0 4px rgba(255, 255, 255, 0.6);
}

.snowflake::before,
.snowflake::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 3px;
    background: #FFFFFF;
    border-radius: 3px;
    top: 4.5px;
    left: 0;
}

.snowflake::after {
    transform: rotate(90deg);
}

@keyframes fall-snow {
    0% {
        transform: translateY(-20px) translateX(0) rotate(0deg);
        opacity: 0.85;
    }
    100% {
        transform: translateY(100vh) translateX(40px) rotate(360deg);
        opacity: 0.2;
    }
}

/* ========== Moon (Kurzgesagt style - Simple) ========== */
.moon {
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, #F0F4F8 0%, #E8EDF2 50%, #D8DDE4 100%);
    border-radius: 50%;
    box-shadow: 0 0 60px rgba(240, 244, 248, 0.6),
                0 0 120px rgba(232, 237, 242, 0.4),
                0 0 180px rgba(200, 210, 225, 0.2),
                inset -20px -20px 40px rgba(180, 190, 205, 0.3);
    animation: moon-glow 8s ease-in-out infinite;
}

.moon::before {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, #BCC6D0 0%, #CDD5DD 100%);
    border-radius: 50%;
    top: 35%;
    left: 35%;
    box-shadow: inset 2px 2px 6px rgba(150, 160, 175, 0.4);
}

.moon::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: radial-gradient(circle, #BCC6D0 0%, #CDD5DD 100%);
    border-radius: 50%;
    bottom: 35%;
    right: 30%;
    box-shadow: inset 2px 2px 6px rgba(150, 160, 175, 0.4);
}

@keyframes moon-glow {
    0%, 100% { 
        transform: scale(1); 
        filter: brightness(1);
        box-shadow: 0 0 60px rgba(240, 244, 248, 0.6),
                    0 0 120px rgba(232, 237, 242, 0.4),
                    0 0 180px rgba(200, 210, 225, 0.2),
                    inset -20px -20px 40px rgba(180, 190, 205, 0.3);
    }
    50% { 
        transform: scale(1.02); 
        filter: brightness(1.1);
        box-shadow: 0 0 80px rgba(240, 244, 248, 0.7),
                    0 0 140px rgba(232, 237, 242, 0.5),
                    0 0 200px rgba(200, 210, 225, 0.3),
                    inset -20px -20px 40px rgba(180, 190, 205, 0.3);
    }
}

/* ========== Stars (Simple twinkling dots) ========== */
.star {
    position: absolute;
    background: radial-gradient(circle, #FFFFFF 0%, #F8FCFF 50%, rgba(255, 255, 255, 0) 100%);
    border-radius: 50%;
    animation: twinkle 4s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.9),
                0 0 12px rgba(200, 220, 255, 0.6),
                0 0 16px rgba(150, 180, 255, 0.3);
}

@keyframes twinkle {
    0%, 100% { 
        opacity: 0.5; 
        transform: scale(0.9);
        filter: brightness(0.8);
    }
    50% { 
        opacity: 1; 
        transform: scale(1.3);
        filter: brightness(1.2);
    }
}

/* ========== Lightning (Bright flash) ========== */
.lightning {
    position: absolute;
    top: 35%;
    left: 50%;
    width: 6px;
    height: 140px;
    background: linear-gradient(to bottom, #FFFFFF 0%, #FFEB3B 50%, #FFC107 100%);
    box-shadow: 0 0 40px 12px rgba(255, 235, 59, 0.9),
                0 0 80px 20px rgba(255, 235, 59, 0.6),
                0 0 120px 30px rgba(255, 235, 59, 0.3);
    opacity: 0;
    animation: flash-lightning 6s ease-in-out infinite;
    clip-path: polygon(40% 0%, 50% 25%, 60% 25%, 45% 55%, 55% 55%, 30% 100%, 45% 55%, 35% 55%, 50% 25%, 40% 25%);
    filter: brightness(1.8) contrast(1.2);
}

@keyframes flash-lightning {
    0%, 88%, 90%, 92%, 100% { 
        opacity: 0; 
        filter: brightness(1.8) contrast(1.2);
    }
    89%, 91% { 
        opacity: 1;
        filter: brightness(2.2) contrast(1.4) saturate(1.2);
    }
}

/* ========== Fog (Soft drifting layers) ========== */
.fog-layer-item {
    position: absolute;
    width: 100%;
    height: 250px;
    background: linear-gradient(to right,
        transparent 0%,
        rgba(255, 255, 255, 0.6) 20%,
        rgba(255, 255, 255, 0.6) 80%,
        transparent 100%
    );
    animation: drift-fog linear infinite;
    border-radius: 50%;
    filter: blur(30px);
}

.fog-layer-item:nth-child(1) { top: 15%; }
.fog-layer-item:nth-child(2) { top: 35%; }
.fog-layer-item:nth-child(3) { top: 55%; }
.fog-layer-item:nth-child(4) { top: 75%; }

@keyframes drift-fog {
    0% { transform: translateX(-50%); }
    100% { transform: translateX(150%); }
}

/* ========== Wind Lines (Subtle motion) ========== */
.wind-line {
    position: absolute;
    left: -120px;
    width: 100px;
    height: 3px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.5), transparent);
    border-radius: 3px;
    animation: blow-wind linear infinite;
}

@keyframes blow-wind {
    0% { transform: translateX(-120px); opacity: 0; }
    15% { opacity: 0.7; }
    85% { opacity: 0.7; }
    100% { transform: translateX(100vw); opacity: 0; }
}

/* ========== Shooting Stars ========== */
.shooting-star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #FFFFFF;
    border-radius: 50%;
    animation: shoot-star linear infinite;
    opacity: 0;
    box-shadow: 0 0 4px 2px rgba(255, 255, 255, 0.8);
}

.shooting-star::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 2px;
    background: linear-gradient(to left, 
        rgba(255, 255, 255, 1) 0%, 
        rgba(200, 220, 255, 0.8) 20%,
        rgba(150, 180, 255, 0.4) 50%,
        transparent 100%);
    border-radius: 2px;
    transform-origin: right center;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

@keyframes shoot-star {
    0% { 
        transform: translateX(0) translateY(0) rotate(-45deg);
        opacity: 0;
    }
    10% { 
        opacity: 1;
    }
    90% { 
        opacity: 1;
    }
    100% { 
        transform: translateX(300px) translateY(300px) rotate(-45deg);
        opacity: 0;
    }
}

/* ========== Responsive (Mobile adjustments) ========== */
@media (max-width: 768px) {
    .sun, .moon {
        width: 90px;
        height: 90px;
        top: 6%;
        right: 8%;
    }

    .cloud {
        width: 150px;
        height: 55px;
        border-radius: 150px;
    }

    .cloud::before {
        width: 75px;
        height: 75px;
        top: -38px;
        left: 20px;
    }

    .cloud::after {
        width: 90px;
        height: 90px;
        top: -45px;
        right: 25px;
    }
}

@media (max-width: 480px) {
    .sun, .moon {
        width: 70px;
        height: 70px;
    }

    .cloud {
        width: 120px;
        height: 45px;
    }

    .cloud::before {
        width: 60px;
        height: 60px;
        top: -30px;
    }

    .cloud::after {
        width: 70px;
        height: 70px;
        top: -35px;
    }
}

/* ========== Smooth Transitions (Enhanced) ========== */
.weather-bg-container {
    transition: all 8s cubic-bezier(0.4, 0, 0.2, 1);
}

.weather-bg-container * {
    transition: opacity 4s ease-in-out,
                background 4s ease-in-out,
                background-color 4s ease-in-out,
                transform 4s ease-in-out;
}

/* Smooth crossfade between scenes */
.weather-scene {
    opacity: 0;
    animation: sceneFadeIn 6s ease-in-out forwards;
}

@keyframes sceneFadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}
