/* ===============================================
   CUSTOM ANIMATIONS & IMPROVEMENTS
   =============================================== */

/* Preloader */
.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1b43fe 0%, #0f2ddb 100%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: all 0.6s ease-out;
}

.preloader.hidden {
  opacity: 0;
  visibility: hidden;
}

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

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

/* Page entrance animations */
body {
  overflow-x: hidden;
}

.page-enter {
  animation: pageEnter 0.8s ease-out forwards;
}

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

/* Enhanced button animations */
.btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateZ(0);
}

.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 0.5s;
}

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

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(27, 67, 254, 0.3);
}

.btn:active {
  transform: translateY(0);
}

.btn__icon {
  transition: transform 0.3s ease;
}

.btn:hover .btn__icon {
  transform: translateX(5px);
}

/* Service items hover effects */
.service-item {
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateZ(0);
}

.service-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(27, 67, 254, 0.1), rgba(27, 67, 254, 0.05));
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: inherit;
}

.service-item:hover::before {
  opacity: 1;
}

.service-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(27, 67, 254, 0.15);
}

.service-item__icon {
  transition: transform 0.3s ease;
}

.service-item:hover .service-item__icon {
  transform: rotate(180deg) scale(1.1);
}

/* Truck animation enhancement */
.hero__truck-icon,
.services__truck-icon {
  transition: transform 0.3s ease;
}

.hero__truck:hover .hero__truck-icon,
.services__truck:hover .services__truck-icon {
  animation: truckMove 1s ease-in-out;
}

@keyframes truckMove {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(10px);
  }
}

/* Accordion enhancements */
.accordion__item {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion__item:hover {
  transform: translateX(5px);
  box-shadow: 0 5px 20px rgba(27, 67, 254, 0.1);
}

.accordion__icon {
  transition: transform 0.3s ease;
}

.accordion__item--active .accordion__icon {
  transform: rotate(180deg);
}

/* Navigation animations */
.nav__link {
  position: relative;
  transition: color 0.3s ease;
}

.nav__link::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: #1b43fe;
  transition: width 0.3s ease;
}

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

/* Form animations */
.form__input,
.form__textarea {
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.form__input:focus,
.form__textarea:focus {
  border-color: #1b43fe;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(27, 67, 254, 0.1);
}

/* Scroll progress indicator */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, #1b43fe, #0f2ddb);
  z-index: 1000;
  transition: width 0.1s ease;
}

/* Floating elements */
.floating {
  animation: floating 3s ease-in-out infinite;
}

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

/* Section dividers */
.section-divider {
  height: 2px;
  background: linear-gradient(90deg, transparent, #1b43fe, transparent);
  margin: 4rem 0;
  opacity: 0.3;
}

/* Loading states */
.loading {
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Parallax enhancement */
.parallax {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .btn:hover {
    transform: none;
    box-shadow: none;
  }

  .service-item:hover {
    transform: none;
    box-shadow: none;
  }

  .accordion__item:hover {
    transform: none;
    box-shadow: none;
  }
}

/* Reduced motion support */
@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;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .btn {
    border: 2px solid currentColor;
  }

  .service-item {
    border: 1px solid currentColor;
  }
}

/* Custom AOS animations */
[data-aos="slide-right"] {
  transform: translate3d(100px, 0, 0);
  opacity: 0;
}

[data-aos="slide-right"].aos-animate {
  transform: translate3d(0, 0, 0);
  opacity: 1;
}

/* Section backgrounds enhancement */
.hero,
.about,
.team,
.services,
.services-detail,
.contact {
  position: relative;
  overflow: hidden;
}

.hero::before,
.about::before,
.team::before,
.services::before,
.services-detail::before,
.contact::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(27, 67, 254, 0.02) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
  animation: subtle-rotate 30s linear infinite;
}

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

/* Image lazy loading enhancement */
.image-container {
  position: relative;
  overflow: hidden;
  background: linear-gradient(45deg, #f0f0f0, #e0e0e0);
}

.image-container img {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.image-container img.loaded {
  opacity: 1;
  transform: scale(1);
}

.image-container img:not(.loaded) {
  opacity: 0;
  transform: scale(1.1);
}

/* Fix for about background positioning */
.about__background {
  transform: none !important;
  will-change: auto !important;
}

/* Ensure about section background stays in place */
.about {
  overflow: hidden;
}

.about__background {
  transition: opacity 0.6s ease;
  animation: none !important;
}

/* Improved parallax for other elements */
.services-detail__image,
.contact__bg-logo {
  will-change: transform;
  backface-visibility: hidden;
  transform: translateZ(0);
}
