/* Анимации и плавные переходы */

/* Плавное появление секций при скролле */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Анимация для карточек преимуществ */
@keyframes card-float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.benefit-card {
    animation: card-float 6s ease-in-out infinite;
}

.benefit-card:nth-child(1) {
    animation-delay: 0s;
}

.benefit-card:nth-child(2) {
    animation-delay: 1s;
}

.benefit-card:nth-child(3) {
    animation-delay: 2s;
}

.benefit-card:nth-child(4) {
    animation-delay: 0.5s;
}

.benefit-card:nth-child(5) {
    animation-delay: 1.5s;
}

.benefit-card:nth-child(6) {
    animation-delay: 2.5s;
}

/* Пульсация таймера */
@keyframes pulse {
    0%, 100% {
        text-shadow: 0 0 30px rgba(255, 165, 0, 0.8);
    }
    50% {
        text-shadow: 0 0 50px rgba(255, 165, 0, 1), 0 0 80px rgba(255, 165, 0, 0.6);
    }
}

.countdown-value {
    animation: pulse 2s ease-in-out infinite;
}

.countdown-value:nth-child(1) {
    animation-delay: 0s;
}

.countdown-value:nth-child(3) {
    animation-delay: 0.5s;
}

.countdown-value:nth-child(5) {
    animation-delay: 1s;
}

.countdown-value:nth-child(7) {
    animation-delay: 1.5s;
}

/* Анимация загрузки изображения */
@keyframes image-load {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

#editor-canvas {
    animation: image-load 0.5s ease;
}

/* Анимация появления drop-zone при наведении файла */
@keyframes drop-zone-pulse {
    0%, 100% {
        box-shadow: 0 8px 32px rgba(255, 165, 0, 0.2);
    }
    50% {
        box-shadow: 0 8px 40px rgba(255, 165, 0, 0.4);
    }
}

.drop-zone.drag-over {
    animation: drop-zone-pulse 1s ease-in-out infinite;
}

/* Анимация кнопки сохранения */
@keyframes save-button-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 165, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 165, 0, 0.8);
    }
}

#save-btn:hover {
    animation: save-button-glow 1.5s ease-in-out infinite;
}

/* Анимация появления модального окна */
@keyframes modal-appear {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal.show .modal-content {
    animation: modal-appear 0.3s ease;
}

/* Анимация для иконок преимуществ */
@keyframes icon-rotate {
    0%, 100% {
        transform: rotate(0deg) scale(1);
    }
    25% {
        transform: rotate(-5deg) scale(1.1);
    }
    75% {
        transform: rotate(5deg) scale(1.1);
    }
}

.benefit-card:hover .benefit-icon {
    animation: icon-rotate 0.6s ease;
}

/* Плавное появление hero секции */
@keyframes hero-fade-in {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-title {
    animation: hero-fade-in 1s ease;
}

.hero-emblem {
    animation: hero-fade-in 1s ease 0.3s both;
}

/* Анимация для эмблемы при загрузке */
@keyframes emblem-rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.hero-emblem img:hover {
    animation: emblem-rotate 2s linear infinite;
}

/* Анимация для секций при скролле */
.section-title {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.section-title.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Анимация для карточек при появлении */
.benefit-card {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.benefit-card.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Задержка анимации для каждой карточки */
.benefit-card:nth-child(1) { transition-delay: 0.1s; }
.benefit-card:nth-child(2) { transition-delay: 0.2s; }
.benefit-card:nth-child(3) { transition-delay: 0.3s; }
.benefit-card:nth-child(4) { transition-delay: 0.4s; }
.benefit-card:nth-child(5) { transition-delay: 0.5s; }
.benefit-card:nth-child(6) { transition-delay: 0.6s; }

/* Анимация для таймера при появлении */
.countdown-container {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.countdown-container.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Анимация для CTA кнопки */
.cta-section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.cta-section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Эффект свечения для границ */
@keyframes border-glow {
    0%, 100% {
        border-color: var(--color-border);
        box-shadow: 0 0 10px rgba(255, 165, 0, 0.2);
    }
    50% {
        border-color: var(--color-primary);
        box-shadow: 0 0 20px rgba(255, 165, 0, 0.5);
    }
}

.benefit-card:hover {
    animation: card-float 6s ease-in-out infinite, border-glow 2s ease-in-out infinite;
}

/* Плавное исчезновение при скрытии элементов */
.fade-out {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Анимация для ошибок */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

.error-message {
    animation: shake 0.5s ease;
}

/* Отключение анимаций для пользователей с prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Анимация для загрузки файла */
@keyframes loading-spinner {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--color-primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: loading-spinner 0.8s linear infinite;
    margin-left: 10px;
}
