/* =======================================================
   BACKGROUND_ANIMATION.CSS - Анимация фонового изображения
   ======================================================= */

/* Переменные для анимации */
:root {
    --animation-duration: 15s;
    --particle-color: rgba(32, 201, 151, 0.3);
    --gradient-primary: rgba(40, 167, 69, 0.1);
    --gradient-secondary: rgba(32, 201, 151, 0.1);
}

/* Основной контейнер с анимированным фоном */
.animated-background {
    position: relative;
    background: url("../img/Image897.d980852ac4d3.png") center/cover fixed no-repeat;
    animation: backgroundBreathing 8s ease-in-out infinite;
    overflow: hidden;
}

/* Анимированный градиент поверх фона */
.animated-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        45deg,
        var(--gradient-primary) 0%,
        transparent 25%,
        var(--gradient-secondary) 50%,
        transparent 75%,
        var(--gradient-primary) 100%
    );
    background-size: 400% 400%;
    animation: gradientShift var(--animation-duration) ease infinite;
    z-index: 1;
    pointer-events: none;
}

/* Контейнер для плавающих частиц */
.animated-background::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 80%, var(--particle-color) 2px, transparent 2px),
        radial-gradient(circle at 80% 20%, var(--particle-color) 1px, transparent 1px),
        radial-gradient(circle at 40% 40%, var(--particle-color) 1.5px, transparent 1.5px),
        radial-gradient(circle at 60% 70%, var(--particle-color) 1px, transparent 1px),
        radial-gradient(circle at 90% 50%, var(--particle-color) 2px, transparent 2px);
    background-size: 200px 200px, 150px 150px, 300px 300px, 180px 180px, 250px 250px;
    animation: particleFloat 20s linear infinite;
    z-index: 2;
    pointer-events: none;
}

/* Анимация дыхания фона */
@keyframes backgroundBreathing {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1) contrast(1);
    }
    50% {
        transform: scale(1.02);
        filter: brightness(1.05) contrast(1.1);
    }
}

/* Анимация смещения градиента */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Анимация плавающих частиц */
@keyframes particleFloat {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0.7;
    }
    25% {
        transform: translateY(-20px) translateX(10px) rotate(90deg);
        opacity: 1;
    }
    50% {
        transform: translateY(-40px) translateX(-10px) rotate(180deg);
        opacity: 0.8;
    }
    75% {
        transform: translateY(-20px) translateX(15px) rotate(270deg);
        opacity: 0.9;
    }
    100% {
        transform: translateY(0) translateX(0) rotate(360deg);
        opacity: 0.7;
    }
}

/* Применение к основным контейнерам */
body.animated-bg {
    background: none;
    position: relative;
}

/* Отдельный слой только для дышащего фона */
body.animated-bg::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("../img/Image897.d980852ac4d3.png") center/cover fixed no-repeat;
    animation: backgroundBreathing 8s ease-in-out infinite;
    z-index: -10;
    pointer-events: none;
}

/* Градиентный слой - создается через JS */
.bg-gradient-layer {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        45deg,
        var(--gradient-primary) 0%,
        transparent 25%,
        var(--gradient-secondary) 50%,
        transparent 75%,
        var(--gradient-primary) 100%
    );
    background-size: 400% 400%;
    animation: gradientShift var(--animation-duration) ease infinite;
    z-index: -9;
    pointer-events: none;
}

/* Слой частиц - создается через JS */
.bg-particles-layer {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 80%, var(--particle-color) 2px, transparent 2px),
        radial-gradient(circle at 80% 20%, var(--particle-color) 1px, transparent 1px),
        radial-gradient(circle at 40% 40%, var(--particle-color) 1.5px, transparent 1.5px),
        radial-gradient(circle at 60% 70%, var(--particle-color) 1px, transparent 1px),
        radial-gradient(circle at 90% 50%, var(--particle-color) 2px, transparent 2px);
    background-size: 200px 200px, 150px 150px, 300px 300px, 180px 180px, 250px 250px;
    animation: particleFloat 20s linear infinite;
    z-index: -8;
    pointer-events: none;
}

/* Водяные капли эффект для hover */
.water-droplet {
    position: absolute;
    width: 10px;
    height: 10px;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(32,201,151,0.4) 100%);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    animation: dropletFall 2s ease-out forwards;
}

@keyframes dropletFall {
    0% {
        opacity: 1;
        transform: translateY(-20px) scale(0);
    }
    50% {
        opacity: 0.8;
        transform: translateY(20px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(60px) scale(0.5);
    }
}

/* Мобильная оптимизация */
@media (max-width: 768px) {
    .bg-particles-layer {
        background-size: 150px 150px, 100px 100px, 200px 200px, 120px 120px, 180px 180px;
        animation-duration: 15s;
    }
    
    @keyframes backgroundBreathing {
        0%, 100% {
            transform: scale(1);
            filter: brightness(1) contrast(1);
        }
        50% {
            transform: scale(1.01);
            filter: brightness(1.03) contrast(1.05);
        }
    }
}

/* Уменьшение анимации для пользователей с prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    body.animated-bg::before,
    .bg-gradient-layer,
    .bg-particles-layer {
        animation: none;
    }
}
