/* ===== АНИМАЦИИ И АНИМАЦИОННЫЕ ЭФФЕКТЫ ===== */

/* Плавное появление элементов */
@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);
    }
}

/* Вращения */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes rotate3D {
    0% {
        transform: rotateY(0deg) rotateX(0deg);
    }
    100% {
        transform: rotateY(360deg) rotateX(360deg);
    }
}

/* Пульсации */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 5px currentColor;
    }
    50% {
        box-shadow: 0 0 20px currentColor;
    }
}

@keyframes pulse-strong {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Мигание */
@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

@keyframes blink-fast {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

/* Скольжение */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

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

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Волны и рябь */
@keyframes wave {
    0% {
        transform: translateX(0) translateY(0);
    }
    50% {
        transform: translateX(25%) translateY(10px);
    }
    100% {
        transform: translateX(0) translateY(0);
    }
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* Парящие/плавающие элементы */
@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    33% {
        transform: translateY(-10px) rotate(1deg);
    }
    66% {
        transform: translateY(-5px) rotate(-1deg);
    }
}

@keyframes float-slow {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Дрожание/вибрация */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

@keyframes vibrate {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
    100% {
        transform: translate(0);
    }
}

/* Переливы цвета */
@keyframes colorShift {
    0% {
        filter: hue-rotate(0deg);
    }
    100% {
        filter: hue-rotate(360deg);
    }
}

@keyframes colorPulse {
    0%, 100% {
        color: var(--primary-neon);
    }
    50% {
        color: var(--secondary-neon);
    }
}

/* Свечение */
@keyframes glow {
    0%, 100% {
        text-shadow: 
            0 0 5px currentColor,
            0 0 10px currentColor;
    }
    50% {
        text-shadow: 
            0 0 10px currentColor,
            0 0 20px currentColor,
            0 0 30px currentColor;
    }
}

@keyframes glow-border {
    0%, 100% {
        box-shadow: 
            inset 0 0 10px currentColor,
            0 0 10px currentColor;
    }
    50% {
        box-shadow: 
            inset 0 0 20px currentColor,
            0 0 20px currentColor,
            0 0 30px currentColor;
    }
}

/* Загрузка и прогресс */
@keyframes loading {
    0% {
        width: 0%;
    }
    100% {
        width: 100%;
    }
}

@keyframes loading-dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Сканирование */
@keyframes scan {
    0% {
        background-position: 0 -100px;
    }
    100% {
        background-position: 0 100px;
    }
}

@keyframes scan-horizontal {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Матрица */
@keyframes matrix-fall {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    5% {
        opacity: 1;
    }
    95% {
        opacity: 1;
    }
    100% {
        transform: translateY(1000%);
        opacity: 0;
    }
}

/* Типинг (печатание) */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes typing-cursor {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: var(--primary-neon);
    }
}

/* Эффекты появления для конкретных элементов */

/* Для заголовков */
.animate-title {
    animation: fadeInUp 1s ease-out;
}

.animate-title-delay-1 {
    animation: fadeInUp 1s ease-out 0.2s both;
}

.animate-title-delay-2 {
    animation: fadeInUp 1s ease-out 0.4s both;
}

.animate-title-delay-3 {
    animation: fadeInUp 1s ease-out 0.6s both;
}

/* Для карточек */
.animate-card {
    animation: fadeInUp 0.8s ease-out;
}

.animate-card:hover {
    animation: pulse 2s infinite;
}

/* Для кнопок */
.animate-btn {
    animation: fadeIn 0.5s ease-out;
    transition: all 0.3s;
}

.animate-btn:hover {
    animation: pulse 0.5s;
}

/* Для статистики */
.animate-stat {
    animation: fadeInUp 0.8s ease-out;
}

.animate-stat:nth-child(1) { animation-delay: 0.1s; }
.animate-stat:nth-child(2) { animation-delay: 0.2s; }
.animate-stat:nth-child(3) { animation-delay: 0.3s; }

/* Для терминала */
.animate-terminal {
    animation: fadeInRight 1s ease-out;
}

.animate-terminal-line {
    animation: typing 3s steps(40, end);
}

/* Для навигации */
.animate-nav-item {
    animation: fadeInDown 0.5s ease-out;
}

.animate-nav-item:nth-child(1) { animation-delay: 0.1s; }
.animate-nav-item:nth-child(2) { animation-delay: 0.2s; }
.animate-nav-item:nth-child(3) { animation-delay: 0.3s; }
.animate-nav-item:nth-child(4) { animation-delay: 0.4s; }
.animate-nav-item:nth-child(5) { animation-delay: 0.5s; }

/* Для логотипа */
.animate-logo {
    animation: fadeInLeft 0.8s ease-out;
}

.animate-logo-subtitle {
    animation: fadeInLeft 0.8s ease-out 0.3s both;
}

/* Для героя */
.animate-hero-text {
    animation: fadeInLeft 1s ease-out;
}

.animate-hero-terminal {
    animation: fadeInRight 1s ease-out 0.5s both;
}

/* Утилитарные классы */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.fade-in-up {
    animation: fadeInUp 0.8s ease-out;
}

.fade-in-down {
    animation: fadeInDown 0.8s ease-out;
}

.fade-in-left {
    animation: fadeInLeft 0.8s ease-out;
}

.fade-in-right {
    animation: fadeInRight 0.8s ease-out;
}

.pulse {
    animation: pulse 2s infinite;
}

.pulse-glow {
    animation: pulse-glow 2s infinite;
}

.blink {
    animation: blink 1s infinite;
}

.blink-fast {
    animation: blink-fast 0.5s infinite;
}

.float {
    animation: float 6s ease-in-out infinite;
}

.float-slow {
    animation: float-slow 4s ease-in-out infinite;
}

.shake {
    animation: shake 0.5s;
}

.vibrate {
    animation: vibrate 0.3s infinite;
}

.rotate {
    animation: rotate 2s linear infinite;
}

.rotate-slow {
    animation: rotate 10s linear infinite;
}

.glow {
    animation: glow 2s ease-in-out infinite;
}

.color-shift {
    animation: colorShift 10s infinite linear;
}

.slide-in-right {
    animation: slideInRight 0.5s ease-out;
}

.slide-in-left {
    animation: slideInLeft 0.5s ease-out;
}

/* Эффекты при скролле */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.animate-on-scroll.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Задержки для анимаций */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.delay-900 { animation-delay: 0.9s; }
.delay-1000 { animation-delay: 1s; }

/* Длительности анимаций */
.duration-300 { animation-duration: 0.3s; }
.duration-500 { animation-duration: 0.5s; }
.duration-700 { animation-duration: 0.7s; }
.duration-1000 { animation-duration: 1s; }
.duration-2000 { animation-duration: 2s; }
.duration-3000 { animation-duration: 3s; }

/* Направления анимаций */
.animation-forwards { animation-fill-mode: forwards; }
.animation-backwards { animation-fill-mode: backwards; }
.animation-both { animation-fill-mode: both; }

/* Временные функции */
.ease-in-out { animation-timing-function: ease-in-out; }
.ease-out { animation-timing-function: ease-out; }
.ease-in { animation-timing-function: ease-in; }
.linear { animation-timing-function: linear; }
.steps { animation-timing-function: steps(10, end); }

/* Паузы анимаций */
.paused { animation-play-state: paused; }
.running { animation-play-state: running; }

/* Эффект наведения */
.hover-pulse:hover {
    animation: pulse 0.5s;
}

.hover-glow:hover {
    animation: glow 1s;
}

.hover-float:hover {
    animation: float 3s ease-in-out infinite;
}

.hover-shake:hover {
    animation: shake 0.5s;
}

/* Анимация иконок */
.icon-spin {
    animation: spin 1s linear infinite;
}

.icon-pulse {
    animation: pulse 2s infinite;
}

.icon-blink {
    animation: blink 1s infinite;
}

/* Анимация загрузки */
.loading {
    animation: spin 1s linear infinite;
}

.loading-dots::after {
    content: '...';
    animation: loading-dots 1.5s infinite;
}

.loading-bar {
    animation: loading 2s ease-in-out infinite;
}

/* Анимация прогресса */
@keyframes progress {
    0% {
        width: 0%;
    }
    100% {
        width: var(--progress);
    }
}

.progress-animate {
    animation: progress 1s ease-out forwards;
}

/* Специальные эффекты для киберпанка */
.matrix-char {
    animation: matrix-fall linear infinite;
}

.data-stream {
    position: relative;
    overflow: hidden;
}

.data-stream::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(0, 243, 255, 0.3),
        transparent
    );
    animation: slideInRight 2s infinite linear;
}

.hologram {
    position: relative;
    overflow: hidden;
}

.hologram::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(0, 243, 255, 0.1) 50%,
        transparent 70%
    );
    animation: slideInRight 3s infinite linear;
}

.neon-flicker {
    animation: blink 3s infinite;
}

/* Анимация для сетки */
.grid-animate {
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 50px 50px;
    }
}

/* Анимация для частиц */
.particle {
    animation: float 10s infinite ease-in-out;
}

.particle:nth-child(2n) {
    animation-delay: 1s;
    animation-duration: 8s;
}

.particle:nth-child(3n) {
    animation-delay: 2s;
    animation-duration: 12s;
}

/* Эффект перезагрузки */
.reboot {
    animation: colorShift 0.5s linear, vibrate 0.5s;
}

/* Эффект ошибки */
.error {
    animation: shake 0.5s, blink-fast 0.5s 3;
}

/* Эффект успеха */
.success {
    animation: pulse-glow 1s, fadeIn 0.5s;
}

/* Эффект предупреждения */
.warning {
    animation: pulse 1s infinite, colorPulse 2s infinite;
}

/* Анимация для появления с задержками по порядку */
.stagger-children > * {
    opacity: 0;
    animation: fadeInUp 0.8s 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; }
.stagger-children > *:nth-child(9) { animation-delay: 0.9s; }
.stagger-children > *:nth-child(10) { animation-delay: 1.0s; }

/* Анимация для текста построчно */
.text-reveal {
    overflow: hidden;
}

.text-reveal .line {
    display: inline-block;
    overflow: hidden;
}

.text-reveal .line span {
    display: inline-block;
    animation: fadeInUp 0.8s ease-out forwards;
}

/* Анимация для загрузки контента */
.content-load {
    animation: fadeIn 0.5s ease-out;
}

/* Анимация для модальных окон */
.modal-enter {
    animation: fadeIn 0.3s ease-out;
}

.modal-exit {
    animation: fadeIn 0.3s ease-out reverse;
}

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

.notification-exit {
    animation: fadeIn 0.3s ease-out reverse;
}

/* Анимация для переключения вкладок */
.tab-enter {
    animation: fadeIn 0.3s ease-out;
}

.tab-exit {
    animation: fadeIn 0.3s ease-out reverse;
}

/* Анимация для аккордеонов */
.accordion-enter {
    animation: fadeIn 0.3s ease-out;
    max-height: 1000px;
}

.accordion-exit {
    animation: fadeIn 0.3s ease-out reverse;
    max-height: 0;
}

/* Анимация для тултипов */
.tooltip-enter {
    animation: fadeIn 0.2s ease-out;
}

.tooltip-exit {
    animation: fadeIn 0.2s ease-out reverse;
}

/* Плавный скролл */
.smooth-scroll {
    scroll-behavior: smooth;
}

/* Анимация для градиентного фона */
@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.gradient-animate {
    background-size: 200% 200%;
    animation: gradient-shift 5s ease infinite;
}

/* Анимация для бордеров */
.border-glow {
    animation: glow-border 2s ease-in-out infinite;
}

/* Анимация для теней */
.shadow-pulse {
    animation: pulse-glow 2s infinite;
}

/* Анимация для иконок загрузки */
.loading-circle {
    animation: spin 1s linear infinite;
}

.loading-dots span {
    animation: blink 1.4s infinite both;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* Эффект печатающегося текста */
.typing-animation {
    overflow: hidden;
    white-space: nowrap;
    animation: typing 3.5s steps(40, end);
}

/* Эффект появления букв */
.letter-animation span {
    display: inline-block;
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0;
}

/* Анимация для диаграмм и графиков */
@keyframes draw {
    to {
        stroke-dashoffset: 0;
    }
}

.chart-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: draw 2s ease-out forwards;
}

/* Анимация для заполнения кругов */
@keyframes fill {
    0% {
        stroke-dashoffset: 283;
    }
    100% {
        stroke-dashoffset: calc(283 - (283 * var(--percentage) / 100));
    }
}

.circle-progress {
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    animation: fill 1.5s ease-out forwards;
}

/* Анимация для счетчиков */
@keyframes count-up {
    from {
        content: "0";
    }
    to {
        content: var(--count);
    }
}

.counter::after {
    content: "0";
    animation: count-up 2s ease-out forwards;
}

/* Анимация для перелистывания */
@keyframes flip {
    0% {
        transform: rotateY(0);
    }
    100% {
        transform: rotateY(360deg);
    }
}

.flip-animation {
    animation: flip 1s ease-out;
}

/* Анимация для зума */
@keyframes zoom-in {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.zoom-in {
    animation: zoom-in 0.5s ease-out;
}

/* Анимация для блеска */
@keyframes shine {
    0% {
        background-position: -100px;
    }
    100% {
        background-position: 200px;
    }
}

.shine-effect {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.2) 50%,
        transparent 100%
    );
    background-size: 200px 100%;
    animation: shine 2s infinite;
}

/* Анимация для волны текста */
@keyframes wave-text {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-5px);
    }
    75% {
        transform: translateY(5px);
    }
}

.wave-text span {
    display: inline-block;
    animation: wave-text 1s ease-in-out infinite;
}

.wave-text span:nth-child(2) { animation-delay: 0.1s; }
.wave-text span:nth-child(3) { animation-delay: 0.2s; }
.wave-text span:nth-child(4) { animation-delay: 0.3s; }
.wave-text span:nth-child(5) { animation-delay: 0.4s; }
.wave-text span:nth-child(6) { animation-delay: 0.5s; }

/* Медиа-запросы для производительности анимаций */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Оптимизация анимаций для мобильных устройств */
@media (max-width: 768px) {
    .float-slow,
    .float {
        animation: none;
    }
    
    .pulse,
    .pulse-glow {
        animation-duration: 3s;
    }
}

/* Классы для включения/выключения анимаций */
.animations-enabled {
    animation-play-state: running;
}

.animations-disabled {
    animation-play-state: paused;
}

/* Анимация для темной/светлой темы */
.theme-transition {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Анимация для изменения размера */
.resize-animation {
    transition: width 0.3s ease, height 0.3s ease;
}

/* Анимация для изменения прозрачности */
.opacity-animation {
    transition: opacity 0.3s ease;
}

/* Анимация для трансформаций */
.transform-animation {
    transition: transform 0.3s ease;
}

/* Анимация для фильтров */
.filter-animation {
    transition: filter 0.3s ease;
}

/* Анимация для блюра */
.blur-animation {
    transition: backdrop-filter 0.3s ease, filter 0.3s ease;
}

/* Финальные эффекты для завершения страницы */
.page-transition {
    animation: fadeIn 0.5s ease-out;
}

.page-exit {
    animation: fadeIn 0.5s ease-out reverse;
}

/* Анимация для загрузки изображений */
.image-load {
    animation: fadeIn 0.8s ease-out;
}

/* Анимация для скелетона */
@keyframes skeleton-loading {
    0% {
        background-color: var(--card-bg);
    }
    50% {
        background-color: rgba(0, 243, 255, 0.1);
    }
    100% {
        background-color: var(--card-bg);
    }
}

.skeleton {
    animation: skeleton-loading 1.5s infinite;
}

/* Анимация для маркера */
@keyframes marker {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(10px);
    }
}

.marker-animation {
    animation: marker 2s infinite;
}

/* Анимация для параллакса */
.parallax-element {
    transition: transform 0.1s ease-out;
}

/* Анимация для липких элементов */
.sticky-animation {
    transition: top 0.3s ease, position 0.3s ease;
}