/* Анимации */

/* CSS переменные для анимаций */
:root {
  --animation-duration-fast: 0.3s;
  --animation-duration-normal: 0.5s;
  --animation-duration-slow: 0.8s;
  --animation-easing: ease-out;
  --animation-delay-step: 0.1s;
}

/* Анимация появления */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

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

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

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

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

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

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

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

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

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

@keyframes ping {
  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(-25%);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

@keyframes shake {
  10%,
  90% {
    transform: translate3d(-1px, 0, 0);
  }
  20%,
  80% {
    transform: translate3d(2px, 0, 0);
  }
  30%,
  50%,
  70% {
    transform: translate3d(-4px, 0, 0);
  }
  40%,
  60% {
    transform: translate3d(4px, 0, 0);
  }
}

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

@keyframes scaleOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.9);
  }
}

@keyframes dots {
  0%,
  20% {
    content: ".";
  }
  40% {
    content: "..";
  }
  60% {
    content: "...";
  }
  80%,
  100% {
    content: "";
  }
}

@keyframes progress-slide {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink-caret {
  from,
  to {
    border-color: transparent;
  }
  50% {
    border-color: #3b82f6;
  }
}

@keyframes particle-float {
  0% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-100px) rotate(360deg);
    opacity: 0;
  }
}

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

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-slide-up {
  animation: slideUp 0.8s ease-out;
}

.animate-slide-up.animated {
  opacity: 1;
}

.animate-slide-down {
  opacity: 0;
  will-change: opacity, transform;
  animation: slideDown var(--animation-duration-normal) var(--animation-easing);
}

.animate-slide-down.animated {
  opacity: 1;
}

.animate-slide-left {
  opacity: 0;
  will-change: opacity, transform;
  animation: slideLeft var(--animation-duration-normal) var(--animation-easing);
}

.animate-slide-left.animated {
  opacity: 1;
}

.animate-slide-right {
  opacity: 0;
  will-change: opacity, transform;
  animation: slideRight var(--animation-duration-normal) var(--animation-easing);
}

.animate-slide-right.animated {
  opacity: 1;
}

.animate-fade-in {
  opacity: 0;
  will-change: opacity;
  animation: fadeIn var(--animation-duration-fast) ease-in-out;
}

.animate-fade-in.animated {
  opacity: 1;
}

.animate-fade-out {
  opacity: 1;
  will-change: opacity;
  animation: fadeOut var(--animation-duration-normal) ease-out;
}

.animate-fade-out.animated {
  opacity: 0;
}

.animate-scale-in {
  animation: scaleIn 0.5s ease-out;
}

.animate-scale-in.animated {
  opacity: 1;
}

.animate-scale-out {
  opacity: 1;
  will-change: opacity, transform;
  animation: scaleOut var(--animation-duration-fast) ease-out;
}

.animate-scale-out.animated {
  opacity: 0;
}

.animate-bounce {
  animation: bounce 1s infinite;
}

.animate-shake {
  animation: shake 0.82s cubic-bezier(.36,.07,.19,.97) both;
}

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

.animate-ping {
  animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.hover-float:hover {
  transform: translateY(-5px);
  transition: transform 0.3s ease;
}

.hover-scale {
  transition: transform var(--transition-normal);
}

.hover-scale:hover {
  transform: scale(1.02);
}

.hover-rotate:hover {
  transform: rotate(5deg);
  transition: transform 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
  transition: box-shadow 0.3s ease;
}

.hover-lift {
  transition: transform var(--transition-normal);
}

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

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

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-dots {
  display: inline-block;
}

.loading-dots::after {
  content: "...";
  animation: dots 1.5s steps(4, end) infinite;
}

/* Анимации при скролле */
.scroll-animate {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease-out;
}

.scroll-animate.animated {
  opacity: 1;
  transform: translateY(0);
}

.scroll-fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.scroll-slide-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-slide-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.scroll-slide-right {
  opacity: 0;
  transform: translateX(50px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-slide-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Анимации для карточек */
.card-hover {
  transition: all 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

.card-hover:hover .service-icon {
  transform: scale(1.1);
}

/* Анимации для кнопок */
.btn-animate {
  position: relative;
  overflow: hidden;
}

.btn-animate::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left var(--transition-normal);
}

.btn-animate:hover::before {
  left: 100%;
}

/* Анимации для навигации */
.nav-link {
  position: relative;
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* Анимации для форм */
.form-input,
.form-select,
.form-textarea {
  transition: all 0.3s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  transform: scale(1.02);
}

/* Анимации для уведомлений */
@keyframes slideInFromRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

.notification {
  animation: slideInFromRight 0.3s ease;
}

.notification.removing {
  animation: slideOutToRight 0.3s ease;
}

/* Анимации для счетчиков */
.counter-animate {
  transition: all 0.3s ease;
}

/* Анимации для изображений */
.image-hover {
  transition: all 0.3s ease;
  overflow: hidden;
}

.image-hover img {
  transition: all 0.3s ease;
}

.image-hover:hover img {
  transform: scale(1.05);
}

/* Анимации для текста */
.text-gradient {
  background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 3s ease-in-out infinite;
}

.typewriter {
  overflow: hidden;
  border-right: 2px solid #3b82f6;
  white-space: nowrap;
  animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes gradient-shift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* Анимации для иконок */
.icon-bounce {
  transition: all 0.3s ease;
}

.icon-bounce:hover {
  animation: bounce 0.6s;
}

.icon-rotate {
  transition: all 0.3s ease;
}

.icon-rotate:hover {
  transform: rotate(360deg);
}

/* Анимации для прогресс-баров */
.progress-bar {
  height: 4px;
  background-color: var(--primary);
  width: 0;
}

.progress-bar.animated {
  animation: progress 2s ease forwards;
}

/* Анимации для скелетонов загрузки */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

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

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

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

/* Медиа-запросы для анимаций */
@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;
  }
  
  .animate-slide-up,
  .animate-slide-down,
  .animate-slide-left,
  .animate-slide-right,
  .animate-fade-in,
  .animate-fade-out,
  .animate-scale-in,
  .animate-scale-out {
    opacity: 1 !important;
    animation: none !important;
  }
}

/* Анимации для мобильных устройств */
@media (max-width: 768px) {
  .animate-slide-up {
    animation-duration: var(--animation-duration-fast);
  }
  
  .animate-slide-up.animated {
    opacity: 1;
  }

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

  .floating-element {
    animation: none;
  }
}

/* Particle Effects */
.particles {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(59, 130, 246, 0.6);
  border-radius: 50%;
  animation: particle-float 8s infinite linear;
}

/* Performance Optimizations */
.will-change-transform {
  will-change: transform;
}

.will-change-opacity {
  will-change: opacity;
}

.gpu-accelerated {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Animation Delays */
.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; }

/* Stats Counter Animation */
.stat-number {
  transition: all var(--transition-normal);
}

.stat-item:hover .stat-number {
  transform: scale(1.1);
}

/* Timeline Animations */
.timeline-item {
  /* opacity: 0; */
  /* transform: translateX(-20px); */
  /* transition: all 0.3s ease; */
}

.timeline-item.active {
  /* opacity: 1; */
  /* transform: translateX(0); */
}

/* Hero Section Animations - только анимации, стили в main.css */
.hero-content {
  opacity: 0;
  animation: slideUp 0.8s ease forwards;
}

/* Удаляем дублирующиеся стили hero-title - они есть в main.css */
/* .hero-title {
  opacity: 0;
  animation: slideUp 0.8s ease forwards 0.2s;
} */

/* Удаляем дублирующиеся стили hero-subtitle - они есть в main.css */
/* .hero-subtitle {
  opacity: 0;
  animation: slideUp 0.8s ease forwards 0.4s;
} */

/* Company Info Section Animations */
.company-info-header {
  opacity: 0;
  animation: slideUp 0.8s ease forwards;
}

.company-info-text {
  opacity: 0;
  animation: fadeIn 0.8s ease forwards 0.2s;
}

/* Stats Section Animations */
.stat-item {
  opacity: 0;
  animation: scaleIn 0.6s ease forwards;
}

.stat-item:nth-child(1) { animation-delay: 0.2s; }
.stat-item:nth-child(2) { animation-delay: 0.4s; }
.stat-item:nth-child(3) { animation-delay: 0.6s; }
.stat-item:nth-child(4) { animation-delay: 0.8s; }

/* Services Section Animations - только анимации, стили в main.css и components.css */
/* Удаляем дублирующиеся стили service-card - они есть в main.css и components.css */
/* .service-card {
  opacity: 0;
  animation: slideUp 0.6s ease forwards;
} */

.service-card:nth-child(1) { animation-delay: 0.2s; }
.service-card:nth-child(2) { animation-delay: 0.4s; }
.service-card:nth-child(3) { animation-delay: 0.6s; }

/* Intersection Observer Animations */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Loading Animations */
@keyframes progress {
  from {
    width: 0;
  }
}

/* Hover Effects */
.hover-shadow {
  transition: box-shadow 0.2s ease;
}

.hover-shadow:hover {
  box-shadow: var(--shadow-lg);
}

/* Анимации для улучшения UX */

/* Slide Up Animation */
.slide-up {
  animation: slideUp 0.8s ease-out;
}

/* Scale In Animation */
.scale-in {
  animation: scaleIn 0.5s ease-out;
}

/* Pulse Animation */
.pulse {
  animation: pulse 2s infinite;
}

/* Stagger Animation for Lists */
.stagger-item {
  opacity: 0;
  animation: slideUp 0.6s ease-out 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; }
.stagger-item:nth-child(6) { animation-delay: 0.6s; }
.stagger-item:nth-child(7) { animation-delay: 0.7s; }
.stagger-item:nth-child(8) { animation-delay: 0.8s; }

/* Card Hover Effects */
.service-card {
  transition: all var(--transition-normal);
}

.service-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

.service-card:hover .service-icon {
  transform: scale(1.1);
}

.service-card:hover .service-icon svg {
  transform: scale(1.1);
}

/* Button Hover Effects */
.btn {
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left var(--transition-normal);
}

.btn:hover::before {
  left: 100%;
}

/* Icon Animations */
.service-icon {
  transition: all var(--transition-normal);
}

.service-icon svg {
  transition: all var(--transition-normal);
}

.service-card:hover .service-icon svg {
  transform: scale(1.1);
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* Focus States */
.btn:focus,
.form-control:focus,
.nav-item a:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Loading States */
.loading {
  opacity: 0.7;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--gray-300);
  border-top: 2px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
