/* Анимации и эффекты для виртуальной лаборатории */

/* Анимация загрузки */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

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

@keyframes fadeInUp {
    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);
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
        transform: translate3d(0, -30px, 0);
    }
    70% {
        animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
        transform: translate3d(0, -15px, 0);
    }
    90% {
        transform: translate3d(0, -4px, 0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes glow {
    0% { box-shadow: 0 0 5px rgba(59, 130, 246, 0.5); }
    50% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.8); }
    100% { box-shadow: 0 0 5px rgba(59, 130, 246, 0.5); }
}

@keyframes flyIn {
    0% {
        transform: translateY(-100px) rotate(-10deg);
        opacity: 0;
    }
    50% {
        transform: translateY(10px) rotate(5deg);
        opacity: 0.8;
    }
    100% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
}

@keyframes morphColor {
    0% { background-color: #fef3c7; }
    25% { background-color: #fed7aa; }
    50% { background-color: #fca5a5; }
    75% { background-color: #c7d2fe; }
    100% { background-color: #fef3c7; }
}

/* Классы для применения анимаций */
.animate-pulse { animation: pulse 2s infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-fade-in-up { animation: fadeInUp 0.6s ease-out; }
.animate-fade-in-left { animation: fadeInLeft 0.6s ease-out; }
.animate-fade-in-right { animation: fadeInRight 0.6s ease-out; }
.animate-bounce { animation: bounce 1s; }
.animate-shake { animation: shake 0.5s; }
.animate-glow { animation: glow 2s infinite; }
.animate-fly-in { animation: flyIn 0.8s ease-out; }
.animate-morph-color { animation: morphColor 3s infinite; }

/* Анимации для бабочек */
.butterfly-hover:hover {
    animation: bounce 0.6s ease-in-out;
}

.butterfly-selected {
    animation: glow 1.5s infinite;
    transform: scale(1.1);
}

.butterfly-dying {
    animation: shake 0.5s ease-in-out;
    opacity: 0.3;
    filter: grayscale(100%);
}

.butterfly-new {
    animation: flyIn 1s ease-out;
}

/* Эффекты для среды обитания */
.environment-light {
    background: linear-gradient(135deg, #f0fdf4 0%, #bbf7d0 100%);
    transition: all 0.8s ease;
}

.environment-dark {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    color: white;
    transition: all 0.8s ease;
}

.environment-mixed {
    background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 50%, #f3f4f6 100%);
    transition: all 0.8s ease;
}

/* Анимации для графиков и данных */
.chart-animate {
    animation: fadeInUp 1s ease-out;
}

.progress-bar {
    transition: width 0.5s ease-in-out;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(
        to right,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Анимации для уведомлений */
.notification-enter {
    animation: slideInRight 0.3s ease-out;
}

.notification-exit {
    animation: slideOutRight 0.3s ease-in;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Анимации для переключения вкладок */
.tab-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-content-enter {
    animation: fadeInUp 0.4s ease-out;
}

/* Интерактивные эффекты */
.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
}

.click-ripple {
    position: relative;
    overflow: hidden;
}

.click-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.click-ripple:active::after {
    width: 200px;
    height: 200px;
}

/* Анимации для загрузки данных */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Эффекты для форм */
.form-focus-effect:focus {
    transform: scale(1.02);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transition: all 0.2s ease;
}

.input-success {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.input-error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
    animation: shake 0.5s ease-in-out;
}

/* Адаптивные анимации */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Темная тема */
@media (prefers-color-scheme: dark) {
    .environment-light {
        background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    }
    
    .environment-dark {
        background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    }
}