/**
 * Professional Animations for Tradelink Prime
 * Simple, elegant, and performance-optimized animations
 */

/* ================================
   SMOOTH SCROLLING
   ================================ */
html {
  scroll-behavior: smooth;
}

/* ================================
   FADE IN ANIMATIONS ON SCROLL
   ================================ */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

/* Fade in from left */
.fade-in-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in-left.animated {
  opacity: 1;
  transform: translateX(0);
}

/* Fade in from right */
.fade-in-right {
  opacity: 0;
  transform: translateX(50px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in-right.animated {
  opacity: 1;
  transform: translateX(0);
}

/* Scale up animation */
.scale-up {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scale-up.animated {
  opacity: 1;
  transform: scale(1);
}

/* ================================
   BUTTON ANIMATIONS
   ================================ */
.theme-btn,
.btn,
button[type="submit"] {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  transform: translateZ(0);
}

.theme-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.theme-btn:hover::before {
  width: 300px;
  height: 300px;
}

.theme-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.theme-btn:active {
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* ================================
   CARD HOVER EFFECTS
   ================================ */
.service-block,
.feature-block,
.pricing-block,
.team-block {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateZ(0);
}

.service-block:hover,
.feature-block:hover,
.pricing-block:hover,
.team-block:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* ================================
   IMAGE HOVER EFFECTS
   ================================ */
.image-box,
.img-box,
figure {
  overflow: hidden;
  position: relative;
}

.image-box img,
.img-box img,
figure img {
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform: scale(1);
}

.image-box:hover img,
.img-box:hover img,
figure:hover img {
  transform: scale(1.08);
}

/* Image overlay effect */
.image-box::after,
.img-box::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(0, 102, 204, 0.2), rgba(31, 168, 79, 0.2));
  opacity: 0;
  transition: opacity 0.4s ease;
}

.image-box:hover::after,
.img-box:hover::after {
  opacity: 1;
}

/* ================================
   ICON ANIMATIONS
   ================================ */
.icon-box,
.icon {
  transition: all 0.3s ease;
}

.icon-box:hover,
.icon:hover {
  transform: scale(1.1) rotate(5deg);
}

/* Pulse animation for icons */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
}

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

/* ================================
   COUNTER ANIMATIONS
   ================================ */
.counter {
  display: inline-block;
  font-weight: 700;
  transition: all 0.3s ease;
}

/* ================================
   NAVIGATION ANIMATIONS
   ================================ */
.main-menu ul li {
  transition: all 0.3s ease;
}

.main-menu ul li a {
  position: relative;
  transition: color 0.3s ease;
}

.main-menu ul li a::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #0066CC, #1fa84f);
  transform: translateX(-50%);
  transition: width 0.3s ease;
}

.main-menu ul li a:hover::after,
.main-menu ul li.current a::after {
  width: 80%;
}

/* ================================
   FORM INPUT ANIMATIONS
   ================================ */
.form-group input,
.form-group textarea,
.form-group select {
  transition: all 0.3s ease;
  border: 2px solid #e0e0e0;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: #0066CC;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
  transform: scale(1.01);
}

/* Label float animation */
.form-group {
  position: relative;
}

.form-group label {
  transition: all 0.3s ease;
}

.form-group input:focus + label,
.form-group textarea:focus + label,
.form-group input:not(:placeholder-shown) + label,
.form-group textarea:not(:placeholder-shown) + label {
  transform: translateY(-25px) scale(0.9);
  color: #0066CC;
}

/* ================================
   SECTION REVEAL ANIMATIONS
   ================================ */
.section-reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 1s ease-out, transform 1s ease-out;
}

.section-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ================================
   LOADING SPINNER
   ================================ */
@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 102, 204, 0.1);
  border-top-color: #0066CC;
  border-radius: 50%;
  animation: rotate 1s linear infinite;
}

/* ================================
   FLOAT ANIMATION
   ================================ */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

.float-animation {
  animation: float 3s ease-in-out infinite;
}

/* ================================
   GRADIENT ANIMATION
   ================================ */
@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.animated-gradient {
  background: linear-gradient(270deg, #0066CC, #00A8A8, #1fa84f);
  background-size: 600% 600%;
  animation: gradient-shift 15s ease infinite;
}

/* ================================
   SLIDE IN ANIMATIONS
   ================================ */
@keyframes slideInFromLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

@keyframes slideInFromTop {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

.slide-in-left {
  animation: slideInFromLeft 0.8s ease-out;
}

.slide-in-right {
  animation: slideInFromRight 0.8s ease-out;
}

.slide-in-top {
  animation: slideInFromTop 0.8s ease-out;
}

.slide-in-bottom {
  animation: slideInFromBottom 0.8s ease-out;
}

/* ================================
   TYPING ANIMATION
   ================================ */
@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink {
  50% {
    border-color: transparent;
  }
}

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

/* ================================
   LINK HOVER EFFECTS
   ================================ */
a {
  transition: color 0.3s ease, background-color 0.3s ease;
}

a:hover {
  color: #0066CC;
}

/* Underline animation */
.link-underline {
  position: relative;
  text-decoration: none;
}

.link-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #0066CC, #1fa84f);
  transition: width 0.3s ease;
}

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

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

.bounce {
  animation: bounce 2s infinite;
}

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

.shake {
  animation: shake 0.5s;
}

/* ================================
   PARALLAX EFFECT
   ================================ */
.parallax {
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  will-change: transform;
}

/* ================================
   STAGGER ANIMATION DELAYS
   ================================ */
.stagger-item:nth-child(1) { transition-delay: 0.1s; }
.stagger-item:nth-child(2) { transition-delay: 0.2s; }
.stagger-item:nth-child(3) { transition-delay: 0.3s; }
.stagger-item:nth-child(4) { transition-delay: 0.4s; }
.stagger-item:nth-child(5) { transition-delay: 0.5s; }
.stagger-item:nth-child(6) { transition-delay: 0.6s; }

/* ================================
   PROGRESS BAR ANIMATION
   ================================ */
.progress-bar {
  position: relative;
  width: 100%;
  height: 8px;
  background: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0066CC, #1fa84f);
  border-radius: 10px;
  transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0;
}

.progress-bar-fill.animate {
  width: var(--progress, 0%);
}

/* ================================
   TOOLTIP ANIMATIONS
   ================================ */
.tooltip {
  position: relative;
  cursor: pointer;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-5px);
  padding: 8px 12px;
  background: #2c2c2c;
  color: white;
  border-radius: 4px;
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.tooltip:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-10px);
}

/* ================================
   MOBILE OPTIMIZATIONS
   ================================ */
@media (max-width: 768px) {
  /* Reduce animation intensity on mobile */
  .animate-on-scroll,
  .fade-in-left,
  .fade-in-right,
  .scale-up {
    transform: translateY(15px) !important;
  }

  .service-block:hover,
  .feature-block:hover,
  .pricing-block:hover,
  .team-block:hover {
    transform: translateY(-5px);
  }

  /* Disable parallax on mobile for performance */
  .parallax {
    background-attachment: scroll;
  }
}

/* ================================
   ACCESSIBILITY - Respect user preferences
   ================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ================================
   PERFORMANCE OPTIMIZATIONS
   ================================ */
.will-animate {
  will-change: transform, opacity;
}

.will-animate.animation-complete {
  will-change: auto;
}
