/* ═══════════════════════════════════════════════════════════════════════════
   СОВРЕМЕННЫЕ АНИМАЦИИ ДЛЯ SHOP-LEHEICH
   Cyberpunk-стиль с производительными CSS анимациями
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── ДОПОЛНИТЕЛЬНЫЕ ПЕРЕМЕННЫЕ ДЛЯ АНИМАЦИЙ ─────────────────────────────── */
:root {
    /* Animation easing curves */
    --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
    --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
    --ease-in-out-circ: cubic-bezier(0.85, 0, 0.15, 1);
    
    /* Glow effects */
    --glow-cyan-soft: 0 0 20px rgba(0, 212, 255, 0.3), 
                      0 0 40px rgba(0, 212, 255, 0.1),
                      0 0 60px rgba(0, 212, 255, 0.05);
    --glow-purple-soft: 0 0 20px rgba(168, 85, 247, 0.3), 
                        0 0 40px rgba(168, 85, 247, 0.1);
    --glow-blue-soft: 0 0 20px rgba(59, 130, 246, 0.3),
                      0 0 40px rgba(59, 130, 246, 0.1);
    
    /* Pulse keyframes duration */
    --pulse-duration: 2s;
}

/* ═══════════════════════════════════════════════════════════════════════════
   КНОПКИ — современные интерактивные эффекты
   ═══════════════════════════════════════════════════════════════════════════ */

/* Базовая анимация для всех кнопок */
button,
.btn,
[role="button"],
.header-action-btn,
.product-card,
.catalog-item {
    position: relative;
    transform: translateZ(0); /* Hardware acceleration */
    transition: all var(--transition-fast);
    cursor: pointer;
}

/* Деликатные эффекты для кнопок */
button,
.btn,
[role="button"],
.header-action-btn {
    transition: all 0.2s ease;
}

/* Тонкий hover эффект только для primary кнопок */
.btn-primary:hover,
.purchase-btn:hover {
    filter: brightness(1.05);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.15);
}

/* Subtle ripple только при клике на primary кнопки */
.btn-primary,
.purchase-btn {
    position: relative;
    overflow: hidden;
}

.btn-primary::before,
.purchase-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease-out, height 0.4s ease-out, opacity 0.4s ease-out;
    pointer-events: none;
    opacity: 0;
    z-index: 1;
}

.btn-primary:active::before,
.purchase-btn:active::before {
    width: 120px;
    height: 120px;
    opacity: 1;
    transition: width 0s, height 0s, opacity 0s;
}

/* ═══════════════════════════════════════════════════════════════════════════
   КАРТОЧКИ ТОВАРОВ — subtle hover эффекты
   ═══════════════════════════════════════════════════════════════════════════ */

.product-card,
.catalog-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover,
.catalog-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

/* Staggered animation для списка товаров */
.catalog-item {
    opacity: 0;
    transform: translateY(20px);
    animation: slideInUp 0.6s var(--ease-out-expo) forwards;
}

.catalog-item:nth-child(1) { animation-delay: 0.1s; }
.catalog-item:nth-child(2) { animation-delay: 0.15s; }
.catalog-item:nth-child(3) { animation-delay: 0.2s; }
.catalog-item:nth-child(4) { animation-delay: 0.25s; }
.catalog-item:nth-child(5) { animation-delay: 0.3s; }
.catalog-item:nth-child(n+6) { animation-delay: 0.35s; }

/* ═══════════════════════════════════════════════════════════════════════════
   ПЕРЕХОДЫ МЕЖДУ СТРАНИЦАМИ
   ═══════════════════════════════════════════════════════════════════════════ */

/* Fade transition для контента */
.page-transition-enter {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s var(--ease-out-expo);
}

.page-transition-enter-active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.page-transition-exit {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: all 0.3s var(--ease-in-out-circ);
}

.page-transition-exit-active {
    opacity: 0;
    transform: translateY(-10px) scale(1.02);
}

/* Sliding transition для мобильных устройств */
@media (max-width: 768px) {
    .page-transition-enter {
        transform: translateX(100%);
    }
    
    .page-transition-enter-active {
        transform: translateX(0);
    }
    
    .page-transition-exit-active {
        transform: translateX(-100%);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ДИНАМИЧЕСКИЕ ФОНОВЫЕ АНИМАЦИИ
   ═══════════════════════════════════════════════════════════════════════════ */

/* Анимированная сетка */
@keyframes gridFlow {
    0%, 100% { 
        background-position: 0 0, 0 0, 0 0, 0 0;
    }
    50% { 
        background-position: 0 0, 0 0, 20px 20px, 20px 20px;
    }
}

body::before {
    animation: gridFlow 8s ease-in-out infinite;
}

/* Floating particles эффект */
.cyber-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: 0.6;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--accent-cyan);
    border-radius: 50%;
    animation: floatUp 15s linear infinite;
    opacity: 0;
}

.particle:nth-child(odd) {
    background: var(--accent-purple);
    animation-duration: 20s;
}

.particle:nth-child(3n) {
    background: var(--accent-blue);
    animation-duration: 18s;
}

/* Градиентное "дыхание" фона */
@keyframes breatheGlow {
    0%, 100% {
        background-image:
            radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 212, 255, 0.06), transparent),
            radial-gradient(ellipse 60% 40% at 80% 100%, rgba(168, 85, 247, 0.04), transparent);
    }
    50% {
        background-image:
            radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 212, 255, 0.12), transparent),
            radial-gradient(ellipse 60% 40% at 80% 100%, rgba(168, 85, 247, 0.08), transparent);
    }
}

/* Применяем дыхание к фону, но только если пользователь не предпочитает уменьшенную анимацию */
@media (prefers-reduced-motion: no-preference) {
    body::before {
        animation: gridFlow 8s ease-in-out infinite, breatheGlow 6s ease-in-out infinite;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   СПЕЦИАЛЬНЫЕ ЭФФЕКТЫ
   ═══════════════════════════════════════════════════════════════════════════ */

/* Pulsing glow для важных элементов */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(0, 212, 255, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(0, 212, 255, 0.8), 
                    0 0 30px rgba(0, 212, 255, 0.4);
    }
}

.pulse-glow {
    animation: pulseGlow var(--pulse-duration) ease-in-out infinite;
}

/* Typewriter эффект для текста */
@keyframes typewriter {
    from { 
        width: 0;
    }
    to { 
        width: 100%;
    }
}

.typewriter {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    margin: 0;
    animation: typewriter 2s steps(40, end) 0.5s forwards;
    width: 0;
}

/* Loading spinner (cyberpunk стиль) */
@keyframes spinCyber {
    0% {
        transform: rotate(0deg);
        border-color: var(--accent-cyan) transparent var(--accent-purple) transparent;
    }
    50% {
        border-color: var(--accent-purple) transparent var(--accent-blue) transparent;
    }
    100% {
        transform: rotate(360deg);
        border-color: var(--accent-cyan) transparent var(--accent-purple) transparent;
    }
}

.cyber-loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-radius: 50%;
    animation: spinCyber 1s linear infinite;
}

/* ═══════════════════════════════════════════════════════════════════════════
   KEYFRAMES ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

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

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

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

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes floatUp {
    0% {
        opacity: 0;
        transform: translateY(100vh) translateX(0px);
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) translateX(var(--random-x, 0px));
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════════════════ */

.animate-slide-in-up {
    animation: slideInUp 0.6s var(--ease-out-expo) forwards;
}

.animate-slide-in-down {
    animation: slideInDown 0.6s var(--ease-out-expo) forwards;
}

.animate-slide-in-left {
    animation: slideInLeft 0.6s var(--ease-out-expo) forwards;
}

.animate-slide-in-right {
    animation: slideInRight 0.6s var(--ease-out-expo) forwards;
}

.animate-scale-in {
    animation: scaleIn 0.4s var(--ease-out-back) forwards;
}

.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; }

/* ═══════════════════════════════════════════════════════════════════════════
   ACCESSIBILITY & PERFORMANCE
   ═══════════════════════════════════════════════════════════════════════════ */

/* Отключаем анимации для пользователей с проблемами моторики */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .particle,
    .cyber-particles {
        display: none;
    }
    
    body::before {
        animation: none;
    }
}

/* GPU acceleration для анимируемых элементов */
.animate-slide-in-up,
.animate-slide-in-down,
.animate-slide-in-left,
.animate-slide-in-right,
.animate-scale-in,
.product-card,
.catalog-item,
button,
.btn {
    will-change: transform, opacity;
    transform: translateZ(0);
}

/* Оптимизация для мобильных устройств */
@media (max-width: 768px) {
    /* Упрощенные анимации на мобильных */
    .product-card:hover,
    .catalog-item:hover {
        transform: translateY(-4px); /* Меньше движения */
    }
    
    /* Убираем сложные эффекты на слабых устройствах */
    .particle {
        display: none;
    }
}