/**
 * VolleyGO - Анимации
 */

/* ===================================
   Scroll Reveal Animations
   =================================== */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-left.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-right.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-scale.active {
    opacity: 1;
    transform: scale(1);
}

/* Delay classes */
.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }
.delay-400 { transition-delay: 400ms; }
.delay-500 { transition-delay: 500ms; }

/* ===================================
   Hover Animations
   =================================== */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.hover-grow {
    transition: transform var(--transition-base);
}

.hover-grow:hover {
    transform: scale(1.05);
}

.hover-shrink {
    transition: transform var(--transition-base);
}

.hover-shrink:hover {
    transform: scale(0.98);
}

/* ===================================
   Loading States
   =================================== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-light-secondary) 0%,
        var(--color-light) 50%,
        var(--color-light-secondary) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-card {
    height: 200px;
}

/* ===================================
   Spinner
   =================================== */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-light-tertiary);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 4px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===================================
   Pulse Effect
   =================================== */
.pulse {
    animation: pulse-animation 2s ease-in-out infinite;
}

@keyframes pulse-animation {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse-ring {
    position: relative;
}

.pulse-ring::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--color-primary);
    animation: pulse-ring-animation 1.5s ease-out infinite;
}

@keyframes pulse-ring-animation {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* ===================================
   Ripple Effect
   =================================== */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.ripple:active::after {
    width: 300%;
    height: 300%;
}

/* ===================================
   Shake Animation
   =================================== */
.shake {
    animation: shake-animation 0.5s ease-in-out;
}

@keyframes shake-animation {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ===================================
   Bounce Animation
   =================================== */
.bounce-in {
    animation: bounce-in-animation 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounce-in-animation {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

/* ===================================
   Slide Animations
   =================================== */
.slide-in-up {
    animation: slide-in-up-animation 0.5s ease forwards;
}

@keyframes slide-in-up-animation {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-down {
    animation: slide-in-down-animation 0.5s ease forwards;
}

@keyframes slide-in-down-animation {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-left {
    animation: slide-in-left-animation 0.5s ease forwards;
}

@keyframes slide-in-left-animation {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-right {
    animation: slide-in-right-animation 0.5s ease forwards;
}

@keyframes slide-in-right-animation {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===================================
   Fade Animations
   =================================== */
.fade-in {
    animation: fade-in-animation 0.5s ease forwards;
}

@keyframes fade-in-animation {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-out {
    animation: fade-out-animation 0.5s ease forwards;
}

@keyframes fade-out-animation {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ===================================
   Typing Animation
   =================================== */
.typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.typing span {
    width: 8px;
    height: 8px;
    background: var(--color-text-muted);
    border-radius: 50%;
    animation: typing-animation 1.4s infinite ease-in-out both;
}

.typing span:nth-child(1) { animation-delay: -0.32s; }
.typing span:nth-child(2) { animation-delay: -0.16s; }
.typing span:nth-child(3) { animation-delay: 0; }

@keyframes typing-animation {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* ===================================
   Gradient Text Animation
   =================================== */
.gradient-text-animated {
    background: linear-gradient(
        90deg,
        var(--color-primary),
        var(--color-warning),
        var(--color-primary)
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-text-animation 3s linear infinite;
}

@keyframes gradient-text-animation {
    to {
        background-position: 200% center;
    }
}

/* ===================================
   Glow Effect
   =================================== */
.glow {
    animation: glow-animation 2s ease-in-out infinite alternate;
}

@keyframes glow-animation {
    from {
        box-shadow: 0 0 20px rgba(255, 230, 0, 0.3);
    }
    to {
        box-shadow: 0 0 40px rgba(255, 230, 0, 0.6);
    }
}

/* ===================================
   Floating Animation
   =================================== */
.float {
    animation: float-animation 3s ease-in-out infinite;
}

@keyframes float-animation {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.float-slow {
    animation-duration: 5s;
}

.float-fast {
    animation-duration: 2s;
}

/* ===================================
   Marquee Animation
   =================================== */
.marquee {
    overflow: hidden;
    white-space: nowrap;
}

.marquee-content {
    display: inline-block;
    animation: marquee-animation 20s linear infinite;
}

@keyframes marquee-animation {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* ===================================
   Counter Animation
   =================================== */
.counter {
    display: inline-block;
}

/* ===================================
   Stagger Children Animation
   =================================== */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
}

.stagger-children.active > * {
    animation: stagger-animation 0.5s ease forwards;
}

.stagger-children.active > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children.active > *:nth-child(2) { animation-delay: 100ms; }
.stagger-children.active > *:nth-child(3) { animation-delay: 200ms; }
.stagger-children.active > *:nth-child(4) { animation-delay: 300ms; }
.stagger-children.active > *:nth-child(5) { animation-delay: 400ms; }
.stagger-children.active > *:nth-child(6) { animation-delay: 500ms; }

@keyframes stagger-animation {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================
   Parallax Effect (via JS)
   =================================== */
[data-parallax] {
    will-change: transform;
}

/* ===================================
   Reduced Motion
   =================================== */
@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;
    }
}
