/* Анимации в стиле Apple */
@keyframes float {
    0%, 100% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0.5;
    }
    25% {
        transform: translateY(-20px) translateX(10px) rotate(90deg);
        opacity: 0.8;
    }
    50% {
        transform: translateY(0) translateX(20px) rotate(180deg);
        opacity: 0.5;
    }
    75% {
        transform: translateY(20px) translateX(10px) rotate(270deg);
        opacity: 0.8;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    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.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

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

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

/* Классы анимаций */
.animate-float {
    animation: float 6s ease-in-out infinite;
}

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

.animate-shimmer {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.4) 50%, 
        transparent 100%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}

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

/* Анимации появления элементов */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    animation: slideUp 0.5s ease forwards;
}

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

/* Анимация загрузки */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 122, 255, 0.2);
    border-top-color: var(--apple-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Анимация успеха */
.success-check {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--apple-green);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    animation: scaleIn 0.3s ease, pulse 2s ease 0.3s 3;
}

/* Анимация перехода страниц */
.page-transition-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-transition-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.page-transition-exit {
    opacity: 1;
    transform: translateY(0);
}

.page-transition-exit-active {
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Анимация кнопок */
.button-loading {
    position: relative;
    color: transparent !important;
}

.button-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Анимация карточек */
.card-hover-lift {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card-hover-lift:hover {
    transform: translateY(-8px);
}

/* Анимация текста */
.text-glow {
    text-shadow: 0 0 20px rgba(0, 122, 255, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

/* Анимация прогресса */
.progress-bar {
    height: 4px;
    background: linear-gradient(90deg, var(--apple-blue), var(--apple-light-blue));
    border-radius: 2px;
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% {
        width: 0%;
        opacity: 1;
    }
    100% {
        width: 100%;
        opacity: 0;
    }
}

/* Анимация появления контента */
.content-reveal {
    opacity: 0;
    transform: translateY(30px);
    animation: reveal 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes reveal {
    to {
        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; }

/* Анимация для примеров */
.example-appear {
    opacity: 0;
    transform: translateX(-20px);
    animation: slideInLeft 0.5s ease forwards;
}

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

/* Анимация для принципов */
.principle-appear {
    opacity: 0;
    transform: translateX(20px);
    animation: slideInRight 0.5s ease forwards;
}

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

/* Анимация для статистики */
.stat-appear {
    opacity: 0;
    transform: scale(0.8);
    animation: scaleIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

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

/* Анимация для этапов */
.stage-appear {
    opacity: 0;
    transform: translateY(40px) rotateX(-90deg);
    animation: stageReveal 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes stageReveal {
    to {
        opacity: 1;
        transform: translateY(0) rotateX(0);
    }
}

.stage-appear:nth-child(1) { animation-delay: 0.1s; }
.stage-appear:nth-child(2) { animation-delay: 0.2s; }
.stage-appear:nth-child(3) { animation-delay: 0.3s; }
.stage-appear:nth-child(4) { animation-delay: 0.4s; }

/* Анимация для трансформации */
.transform-appear {
    opacity: 0;
    animation: transformReveal 0.6s ease forwards;
}

@keyframes transformReveal {
    0% {
        opacity: 0;
        transform: scale(0.8) rotate(-5deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

/* Анимация для уведомлений */
.notification-slide {
    animation: notificationSlide 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

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

.modal-content-animation {
    animation: modalAppear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: translateY(60px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Анимация для сетки библиотеки */
.grid-item-appear {
    opacity: 0;
    transform: scale(0.8);
    animation: gridItemAppear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes gridItemAppear {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Случайные задержки для сетки */
.grid-item-appear:nth-child(1) { animation-delay: 0.05s; }
.grid-item-appear:nth-child(2) { animation-delay: 0.1s; }
.grid-item-appear:nth-child(3) { animation-delay: 0.15s; }
.grid-item-appear:nth-child(4) { animation-delay: 0.2s; }
.grid-item-appear:nth-child(5) { animation-delay: 0.25s; }
.grid-item-appear:nth-child(6) { animation-delay: 0.3s; }
.grid-item-appear:nth-child(7) { animation-delay: 0.35s; }
.grid-item-appear:nth-child(8) { animation-delay: 0.4s; }

/* Анимация для пустого состояния */
.empty-state-appear {
    animation: emptyStateAppear 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes emptyStateAppear {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}