/**
 * ============================================
 * ANIMATIONS.CSS — Анимации и переходы
 * ============================================
 */

/* ========== KEYFRAME ANIMATIONS ========== */

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Fade In Up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Down */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Left */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade In Right */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale In */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Bounce */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Pulse */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(33, 160, 56, 0.4);
    }
    70% {
        transform: scale(1.02);
        box-shadow: 0 0 0 15px rgba(33, 160, 56, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(33, 160, 56, 0);
    }
}

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

/* Float */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Gradient Shift */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

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

/* ========== ANIMATION CLASSES ========== */

/* Base Animation Setup */
[data-animate] {
    opacity: 0;
    will-change: transform, opacity;
}

[data-animate].animated {
    animation-fill-mode: forwards;
}

/* Fade In */
.animate-fade-in,
[data-animate="fade-in"].animated {
    animation: fadeIn 0.6s ease forwards;
}

/* Fade In Up */
.animate-fade-in-up,
[data-animate="fade-in-up"].animated {
    animation: fadeInUp 0.6s ease forwards;
}

/* Fade In Down */
.animate-fade-in-down,
[data-animate="fade-in-down"].animated {
    animation: fadeInDown 0.6s ease forwards;
}

/* Fade In Left */
.animate-fade-in-left,
[data-animate="fade-in-left"].animated {
    animation: fadeInLeft 0.6s ease forwards;
}

/* Fade In Right */
.animate-fade-in-right,
[data-animate="fade-in-right"].animated {
    animation: fadeInRight 0.6s ease forwards;
}

/* Scale In */
.animate-scale-in,
[data-animate="scale-in"].animated {
    animation: scaleIn 0.5s ease forwards;
}

/* Bounce */
.animate-bounce {
    animation: bounce 1s ease infinite;
}

/* Pulse */
.animate-pulse {
    animation: pulse 2s ease infinite;
}

/* Float */
.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Spin */
.animate-spin {
    animation: spin 1s linear infinite;
}

/* ========== DELAY UTILITIES ========== */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }
.delay-600 { animation-delay: 600ms; }
.delay-700 { animation-delay: 700ms; }
.delay-800 { animation-delay: 800ms; }
.delay-900 { animation-delay: 900ms; }
.delay-1000 { animation-delay: 1000ms; }

/* ========== DURATION UTILITIES ========== */
.duration-fast { animation-duration: 150ms; }
.duration-normal { animation-duration: 300ms; }
.duration-slow { animation-duration: 500ms; }
.duration-slower { animation-duration: 700ms; }

/* ========== HOVER ANIMATIONS ========== */

/* Button Hover Lift */
.btn {
    transition: 
        transform var(--transition-fast),
        box-shadow var(--transition-fast),
        background-color var(--transition-fast);
}

/* Card Hover Lift */
.offer-card,
.service-card {
    transition: 
        transform var(--transition-base),
        box-shadow var(--transition-base);
}

/* Link Underline Animation */
.animated-link {
    position: relative;
    display: inline-block;
}

.animated-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: currentColor;
    transition: width var(--transition-base);
}

.animated-link:hover::after {
    width: 100%;
}

/* Icon Bounce on Hover */
.icon-bounce:hover svg,
.icon-bounce:hover .icon {
    animation: bounce 0.5s ease;
}

/* ========== SCROLL REVEAL STAGGER ========== */

/* Stagger children animation */
.stagger-children > * {
    opacity: 0;
}

.stagger-children.animated > *:nth-child(1) { animation: fadeInUp 0.5sease 0.1s forwards; }
.stagger-children.animated > *:nth-child(2) { animation: fadeInUp 0.5s ease 0.2s forwards; }
.stagger-children.animated > *:nth-child(3) { animation: fadeInUp 0.5s ease 0.3s forwards; }
.stagger-children.animated > *:nth-child(4) { animation: fadeInUp 0.5s ease 0.4s forwards; }
.stagger-children.animated > *:nth-child(5) { animation: fadeInUp 0.5s ease 0.5s forwards; }
.stagger-children.animated > *:nth-child(6) { animation: fadeInUp 0.5s ease 0.6s forwards; }

/* ========== LOADING STATES ========== */

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-bg-secondary) 25%,
        var(--color-bg-tertiary) 50%,
        var(--color-bg-secondary) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-md);
}

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

/* Button Loading */
.btn--loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn--loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ========== INTERACTIVE ELEMENTS ========== */

/* Checkbox Animation */
.form__checkbox-input:checked + .form__checkbox-label::before {
    animation: scaleIn 0.2s ease;
}

/* FAQ Accordion */
.faq__answer {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: 
        max-height var(--transition-base),
        opacity var(--transition-base),
        padding var(--transition-base);
}

.faq__item[open] .faq__answer {
    max-height: 500px;
    opacity: 1;
}

/* Input Focus Animation */
.form__input-wrapper {
    transition: 
        border-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.form__input-wrapper:focus-within {
    box-shadow: 0 0 0 3px rgba(33, 160, 56, 0.2);
}

/* ========== PAGE TRANSITIONS ========== */

/* Page Load Animation */
.page-enter {
    opacity: 0;
}

.page-enter-active {
    animation: fadeIn 0.3s ease forwards;
}

/* Hero Section Entry */
.hero__content {
    animation: fadeInLeft 0.8s ease 0.2s forwards;
    opacity: 0;
}

.hero__image {
    animation: fadeInRight 0.8s ease 0.4s forwards;
    opacity: 0;
}

.hero__stats {
    animation: fadeInUp 0.6s ease 0.6s forwards;
    opacity: 0;
}

/* ========== COUNTER ANIMATION ========== */

/* For animated numbers */
.counter {
    display: inline-block;
}

.counter.counting {
    animation: countPulse 0.1s ease;
}

@keyframes countPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ========== NOTIFICATION ANIMATIONS ========== */

/* Toast slide in */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

.toast-enter {
    animation: slideInRight 0.3s ease forwards;
}

.toast-exit {
    animation: slideOutRight 0.3s ease forwards;
}

/* ========== SMOOTH SCROLL INDICATOR ========== */

/* Scroll down indicator */
.scroll-indicator {
    animation: bounce 2s infinite;
}

/* Progress bar on scroll */
.scroll-progress {
    transform-origin: left;
    transition: transform 0.1s linear;
}
