/* Дополнительные анимации и эффекты */

/* ========================================
   МЕГА НЕОНОВЫЕ АНИМАЦИИ
   ======================================== */

/* Пульсирующее неоновое свечение */
@keyframes neon-pulse {
    0%, 100% {
        box-shadow: 
            0 0 5px var(--neon-cyan, #00f5ff),
            0 0 10px var(--neon-cyan, #00f5ff),
            0 0 20px var(--neon-cyan, #00f5ff);
    }
    50% {
        box-shadow: 
            0 0 10px var(--neon-cyan, #00f5ff),
            0 0 20px var(--neon-cyan, #00f5ff),
            0 0 40px var(--neon-cyan, #00f5ff),
            0 0 60px var(--neon-pink, #ff00ff);
    }
}

/* Сканирующая линия */
@keyframes scan-line {
    0% {
        top: -10%;
    }
    100% {
        top: 110%;
    }
}

.scan-effect::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, transparent, var(--neon-cyan, #00f5ff), transparent);
    box-shadow: 0 0 20px var(--neon-cyan, #00f5ff);
    animation: scan-line 3s ease-in-out infinite;
    pointer-events: none;
}

/* Электрический разряд */
@keyframes electric-pulse {
    0%, 100% {
        filter: brightness(1);
        text-shadow: 0 0 5px var(--neon-cyan, #00f5ff);
    }
    5%, 15% {
        filter: brightness(1.5);
        text-shadow: 
            0 0 10px var(--neon-cyan, #00f5ff),
            0 0 20px var(--neon-pink, #ff00ff);
    }
    10% {
        filter: brightness(0.8);
        text-shadow: none;
    }
}

.electric-text {
    animation: electric-pulse 2s infinite;
}

/* Волновой эффект */
@keyframes wave-animation {
    0% {
        transform: translateX(-100%) skewX(-15deg);
    }
    100% {
        transform: translateX(200%) skewX(-15deg);
    }
}

.wave-shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 245, 255, 0.3), transparent);
    animation: wave-animation 3s ease-in-out infinite;
}

/* Вращающийся градиент по границе */
@keyframes border-spin {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 200% 50%;
    }
}

.animated-border {
    position: relative;
    background: transparent;
}

.animated-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(90deg, var(--neon-cyan, #00f5ff), var(--neon-pink, #ff00ff), var(--neon-purple, #bf00ff), var(--neon-cyan, #00f5ff));
    background-size: 200% 100%;
    border-radius: inherit;
    z-index: -1;
    animation: border-spin 3s linear infinite;
}

.animated-border::after {
    content: '';
    position: absolute;
    inset: 2px;
    background: var(--dark-bg, #0a0a0f);
    border-radius: inherit;
    z-index: -1;
}

/* Голографический эффект */
@keyframes holographic {
    0%, 100% {
        background-position: 0% 50%;
        filter: hue-rotate(0deg);
    }
    50% {
        background-position: 100% 50%;
        filter: hue-rotate(360deg);
    }
}

.holographic {
    background: linear-gradient(45deg, 
        var(--neon-cyan, #00f5ff), 
        var(--neon-pink, #ff00ff), 
        var(--neon-green, #00ff88), 
        var(--neon-purple, #bf00ff), 
        var(--neon-cyan, #00f5ff));
    background-size: 400% 400%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: holographic 5s ease infinite;
}

/* Мерцание экрана */
@keyframes screen-flicker {
    0%, 100% { opacity: 1; }
    3%, 5% { opacity: 0.9; }
    7% { opacity: 1; }
    50% { opacity: 1; }
    52% { opacity: 0.95; }
    54% { opacity: 1; }
}

.screen-flicker {
    animation: screen-flicker 5s infinite;
}

/* Неоновое дыхание */
@keyframes neon-breathe {
    0%, 100% {
        box-shadow: 
            0 0 5px var(--neon-cyan, #00f5ff),
            0 0 10px var(--neon-cyan, #00f5ff),
            inset 0 0 5px rgba(0, 245, 255, 0.1);
        transform: scale(1);
    }
    50% {
        box-shadow: 
            0 0 15px var(--neon-cyan, #00f5ff),
            0 0 30px var(--neon-cyan, #00f5ff),
            0 0 45px var(--neon-pink, #ff00ff),
            inset 0 0 15px rgba(0, 245, 255, 0.2);
        transform: scale(1.02);
    }
}

.neon-breathe {
    animation: neon-breathe 4s ease-in-out infinite;
}

/* Цифровой глитч */
@keyframes digital-glitch {
    0%, 100% {
        clip-path: inset(0 0 0 0);
        transform: translate(0);
    }
    2% {
        clip-path: inset(10% 0 85% 0);
        transform: translate(-5px, 0);
    }
    4% {
        clip-path: inset(43% 0 1% 0);
        transform: translate(5px, 0);
    }
    6% {
        clip-path: inset(25% 0 58% 0);
        transform: translate(-5px, 0);
    }
    8% {
        clip-path: inset(0 0 0 0);
        transform: translate(0);
    }
}

.glitch-hover:hover {
    animation: digital-glitch 0.5s linear;
}

/* Матричный дождь символов */
@keyframes matrix-fall {
    0% {
        transform: translateY(-100vh);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

.matrix-rain-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.matrix-char {
    position: absolute;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    color: var(--neon-cyan, #00f5ff);
    text-shadow: 0 0 10px var(--neon-cyan, #00f5ff);
    animation: matrix-fall 5s linear infinite;
}

/* Взрывное появление */
@keyframes explode-in {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    60% {
        transform: scale(1.2) rotate(10deg);
    }
    80% {
        transform: scale(0.9) rotate(-5deg);
    }
    100% {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

.explode-in {
    animation: explode-in 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* 3D переворот */
@keyframes flip-3d {
    0% {
        transform: perspective(1000px) rotateY(0);
    }
    100% {
        transform: perspective(1000px) rotateY(360deg);
    }
}

.flip-3d-hover:hover {
    animation: flip-3d 0.8s ease;
}

/* Частицы на фоне */
@keyframes float-particles {
    0%, 100% { 
        transform: translate(0, 0) rotate(0deg); 
        opacity: 0.7;
    }
    25% { 
        transform: translate(10px, -10px) rotate(90deg); 
        opacity: 1;
    }
    50% { 
        transform: translate(-5px, -20px) rotate(180deg); 
        opacity: 0.8;
    }
    75% { 
        transform: translate(-10px, -10px) rotate(270deg); 
        opacity: 0.9;
    }
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    animation: float-particles 8s infinite linear;
    pointer-events: none;
}

.particle:nth-child(2n) {
    background: rgba(118, 75, 162, 0.3);
    animation-duration: 6s;
    animation-delay: -2s;
}

.particle:nth-child(3n) {
    background: rgba(240, 147, 251, 0.3);
    animation-duration: 10s;
    animation-delay: -4s;
}

/* Эффект печатной машинки */
.typewriter {
    overflow: hidden;
    border-right: 0.15em solid var(--primary-color);
    white-space: nowrap;
    margin: 0 auto;
    letter-spacing: 0.15em;
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: var(--primary-color); }
}

/* Эффект морфинга кнопок */
.morph-btn {
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.morph-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    transition: width 0.6s, height 0.6s, top 0.6s, left 0.6s;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.morph-btn:hover::before {
    width: 300px;
    height: 300px;
}

/* Эффект волны */
.wave-effect {
    position: relative;
    overflow: hidden;
}

.wave-effect::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
    z-index: 1;
}

.wave-effect:hover::before {
    left: 100%;
}

/* Эффект тряски */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

.shake {
    animation: shake 0.82s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* Эффект дождя из кода */
@keyframes matrix-rain {
    0% { transform: translateY(-100vh); opacity: 1; }
    100% { transform: translateY(100vh); opacity: 0; }
}

.code-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.code-drop {
    position: absolute;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: rgba(102, 126, 234, 0.3);
    animation: matrix-rain 3s linear infinite;
}

/* Эффект параллакса */
.parallax-container {
    height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    perspective: 1px;
}

.parallax-element {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.parallax-back {
    transform: translateZ(-1px) scale(2);
}

.parallax-base {
    transform: translateZ(0);
}

/* Эффект свечения при наведении */
.glow-on-hover {
    position: relative;
    transition: var(--transition);
}

.glow-on-hover::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color), var(--accent-color), var(--primary-color));
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s;
    background-size: 400%;
    animation: gradient-shift 3s ease infinite;
}

.glow-on-hover:hover::after {
    opacity: 1;
}

/* Анимация набора текста */
.text-animation {
    font-family: 'Courier New', monospace;
    white-space: nowrap;
    overflow: hidden;
    border-right: 3px solid var(--primary-color);
}

.text-animation.typing {
    animation: typing 2s steps(20) 1s both, blinking 0.5s step-end infinite;
}

@keyframes blinking {
    50% { border-color: transparent; }
}

/* Эффект радуги */
.rainbow-text {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57, #ff9ff3, #54a0ff);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rainbow 3s ease infinite;
}

@keyframes rainbow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Эффект неонового свечения */
.neon-glow {
    color: var(--primary-color);
    text-shadow: 
        0 0 5px var(--primary-color),
        0 0 10px var(--primary-color),
        0 0 15px var(--primary-color),
        0 0 20px var(--primary-color);
    animation: neon-flicker 2s infinite alternate;
}

@keyframes neon-flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Эффект складывания карточки */
.card-flip {
    background-color: transparent;
    perspective: 1000px;
    height: 300px;
}

.card-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.card-flip:hover .card-flip-inner {
    transform: rotateY(180deg);
}

.card-flip-front, .card-flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--border-radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
}

.card-flip-front {
    background: var(--bg-card);
    color: var(--text-dark);
}

.card-flip-back {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    transform: rotateY(180deg);
}

/* Эффект падающих листьев */
@keyframes leaf-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

.falling-leaf {
    position: fixed;
    top: -50px;
    font-size: 20px;
    color: var(--primary-color);
    animation: leaf-fall 5s linear infinite;
    pointer-events: none;
    z-index: -1;
}

/* Эффект звездного неба */
@keyframes twinkle {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

.star {
    position: fixed;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    animation: twinkle 2s infinite;
    pointer-events: none;
    z-index: -1;
}

.star:nth-child(2n) { animation-delay: 0.5s; }
.star:nth-child(3n) { animation-delay: 1s; }
.star:nth-child(4n) { animation-delay: 1.5s; }

/* Эффект пульсации */
.pulse-ring {
    position: relative;
}

.pulse-ring::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Эффект магнитного притяжения */
.magnetic {
    transition: var(--transition);
    cursor: pointer;
}

.magnetic:hover {
    transform: scale(1.1);
}

/* Эффект кубического вращения */
.cube-rotate {
    animation: cube-rotate 10s infinite linear;
    transform-style: preserve-3d;
}

@keyframes cube-rotate {
    0% { transform: rotateX(0deg) rotateY(0deg); }
    25% { transform: rotateX(90deg) rotateY(0deg); }
    50% { transform: rotateX(90deg) rotateY(90deg); }
    75% { transform: rotateX(0deg) rotateY(90deg); }
    100% { transform: rotateX(0deg) rotateY(0deg); }
}

/* Эффект жидкости */
.liquid-fill {
    position: relative;
    overflow: hidden;
}

.liquid-fill::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(0deg, var(--primary-color), var(--secondary-color));
    transition: height 0.8s ease;
    z-index: -1;
}

.liquid-fill:hover::before {
    height: 100%;
}

/* Responsive анимации для мобильных устройств */
@media (max-width: 768px) {
    .typewriter {
        font-size: 14px;
        letter-spacing: 0.1em;
    }
    
    .card-flip {
        height: 250px;
    }
    
    .morph-btn::before {
        width: 200px;
        height: 200px;
    }
    
    /* Отключаем тяжелые анимации на мобильных */
    .particle,
    .code-drop,
    .falling-leaf,
    .star {
        display: none;
    }
}

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

/* Дополнительные утилитарные классы */
.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }

.animate-duration-fast { animation-duration: 0.3s; }
.animate-duration-normal { animation-duration: 0.5s; }
.animate-duration-slow { animation-duration: 1s; }
.animate-duration-slower { animation-duration: 2s; }

.transform-gpu { transform: translateZ(0); }
.will-change-transform { will-change: transform; }
.will-change-opacity { will-change: opacity; }