/**
 * Nexus Pro - Enhanced Animations & Motion Effects
 * Premium smooth scrolling animations using GSAP & ScrollTrigger
 * 
 * @package Nexus_Pro
 * @version 2.0.0
 */

/* ===== CSS VARIABLES FOR ANIMATIONS ===== */
:root {
  --anim-duration-short: 0.4s;
  --anim-duration-base: 0.6s;
  --anim-duration-long: 0.8s;
  --anim-duration-xlng: 1.2s;
  
  --anim-easing-ease-out: cubic-bezier(0.23, 1, 0.320, 1);
  --anim-easing-ease-in: cubic-bezier(0.420, 0, 1, 1);
  --anim-easing-ease-inout: cubic-bezier(0.645, 0.045, 0.355, 1);
  --anim-easing-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --anim-easing-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== SCROLL REVEAL ANIMATIONS ===== */
.scroll-reveal {
  opacity: 0;
}

.scroll-reveal.active {
  opacity: 1;
}

/* Fade In */
.fade-in {
  opacity: 0;
}

.fade-in.active {
  animation: fadeInAnim var(--anim-duration-base) var(--anim-easing-ease-out) forwards;
}

/* Fade Up */
.fade-up {
  opacity: 0;
  transform: translateY(30px);
}

.fade-up.active {
  animation: fadeUpAnim var(--anim-duration-base) var(--anim-easing-ease-out) forwards;
}

/* Fade Left */
.fade-left {
  opacity: 0;
  transform: translateX(-30px);
}

.fade-left.active {
  animation: fadeLeftAnim var(--anim-duration-base) var(--anim-easing-ease-out) forwards;
}

/* Fade Right */
.fade-right {
  opacity: 0;
  transform: translateX(30px);
}

.fade-right.active {
  animation: fadeRightAnim var(--anim-duration-base) var(--anim-easing-ease-out) forwards;
}

/* Scale In */
.scale-in {
  opacity: 0;
  transform: scale(0.9);
}

.scale-in.active {
  animation: scaleInAnim var(--anim-duration-base) var(--anim-easing-ease-out) forwards;
}

/* Rotate In */
.rotate-in {
  opacity: 0;
  transform: rotate(-5deg) scale(0.95);
}

.rotate-in.active {
  animation: rotateInAnim var(--anim-duration-base) var(--anim-easing-spring) forwards;
}

/* ===== STAGGER ANIMATIONS ===== */
.stagger-item {
  opacity: 0;
  transform: translateY(30px);
}

.stagger-item.active {
  animation: fadeUpAnim var(--anim-duration-base) var(--anim-easing-ease-out) forwards;
}

/* Stagger delay increments */
.stagger-item:nth-child(1) { animation-delay: 0s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.2s; }
.stagger-item:nth-child(4) { animation-delay: 0.3s; }
.stagger-item:nth-child(5) { animation-delay: 0.4s; }
.stagger-item:nth-child(n+6) { animation-delay: 0.5s; }

/* ===== PARALLAX HELPERS ===== */
.parallax {
  position: relative;
  overflow: hidden;
}

.parallax-element {
  will-change: transform;
}

/* ===== HOVER ANIMATIONS ===== */
.hover-lift {
  transition: all var(--anim-duration-short) var(--anim-easing-ease-inout);
}

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

.hover-lift-big {
  transition: all var(--anim-duration-short) var(--anim-easing-ease-inout);
}

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

.hover-scale {
  transition: all var(--anim-duration-short) var(--anim-easing-ease-inout);
}

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

.hover-scale-lg {
  transition: all var(--anim-duration-short) var(--anim-easing-ease-inout);
}

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

.hover-glow {
  transition: all var(--anim-duration-short) var(--anim-easing-ease-inout);
}

.hover-glow:hover {
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.4);
}

/* ===== SMOOTH SCROLLING ENHANCEMENTS ===== */
html.lenis {
  height: auto;
}

html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-smooth iframe {
  pointer-events: none;
}

/* ===== HEADER ANIMATIONS ===== */
.nexus-pro-header {
  animation: headerSlideDown 0.6s var(--anim-easing-ease-out);
}

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

.nexus-pro-logo {
  animation: logoFadeInScale 0.6s var(--anim-easing-ease-out) 0.1s backwards;
}

@keyframes logoFadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.nexus-pro-nav-item {
  animation: navItemSlide 0.6s var(--anim-easing-ease-out) backwards;
}

.nexus-pro-nav-item:nth-child(1) { animation-delay: 0.2s; }
.nexus-pro-nav-item:nth-child(2) { animation-delay: 0.3s; }
.nexus-pro-nav-item:nth-child(3) { animation-delay: 0.4s; }
.nexus-pro-nav-item:nth-child(4) { animation-delay: 0.5s; }
.nexus-pro-nav-item:nth-child(n+5) { animation-delay: 0.6s; }

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

/* ===== HERO SLIDER ANIMATIONS ===== */
.nexus-pro-slider-content {
  animation: sliderContentIn 0.8s var(--anim-easing-spring) forwards !important;
}

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

.nexus-pro-slider-content h2 {
  animation: headingReveal 0.8s var(--anim-easing-ease-out) 0.2s backwards;
}

.nexus-pro-slider-content p {
  animation: descriptionReveal 0.8s var(--anim-easing-ease-out) 0.4s backwards;
}

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

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

.nexus-pro-slider-controls {
  animation: controlsFadeIn 0.8s var(--anim-easing-ease-out) 0.6s backwards;
}

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

/* ===== CARD ANIMATIONS ===== */
.nexus-pro-card {
  transition: all var(--anim-duration-short) var(--anim-easing-ease-inout);
}

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

.nexus-pro-card-image img {
  transition: transform var(--anim-duration-base) var(--anim-easing-ease-inout);
}

.nexus-pro-card:hover .nexus-pro-card-image img {
  transform: scale(1.08);
}



/* ===== COUNTER ANIMATIONS ===== */
.nexus-pro-counter-value {
  font-variant-numeric: tabular-nums;
  transition: color var(--anim-duration-short) var(--anim-easing-ease-inout);
}

.nexus-pro-counter-item {
  transition: all var(--anim-duration-short) var(--anim-easing-ease-inout);
}

.nexus-pro-counter-item:hover {
  transform: translateY(-6px);
}

/* ===== TESTIMONIAL ANIMATIONS ===== */
.nexus-pro-testimonial {
  transition: all var(--anim-duration-short) var(--anim-easing-ease-inout);
}

.nexus-pro-testimonial:hover {
  transform: translateY(-4px);
}

.nexus-pro-testimonial-stars {
  animation: starsReveal 0.6s var(--anim-easing-ease-out) backwards;
}

@keyframes starsReveal {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ===== FEATURE SECTION ANIMATIONS ===== */
.nexus-pro-feature {
  transition: all var(--anim-duration-base) var(--anim-easing-ease-inout);
}

.nexus-pro-feature-image img {
  transition: transform var(--anim-duration-long) var(--anim-easing-ease-inout);
}

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

.nexus-pro-feature-list-item {
  transition: all var(--anim-duration-short) var(--anim-easing-ease-inout);
}

.nexus-pro-feature-list-item:hover {
  transform: translateX(5px);
}

.nexus-pro-feature-list-icon {
  transition: all var(--anim-duration-short) var(--anim-easing-ease-inout);
}

.nexus-pro-feature-list-item:hover .nexus-pro-feature-list-icon {
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

/* ===== BUTTON ANIMATIONS ===== */
.btn {
  position: relative;
  overflow: hidden;
  transition: all var(--anim-duration-short) var(--anim-easing-ease-inout);
}

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

.btn:active::before {
  width: 300px;
  height: 300px;
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(99, 102, 241, 0.3);
}

.btn-secondary:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(139, 92, 246, 0.2);
}

/* ===== FOOTER ANIMATIONS ===== */
.nexus-pro-footer-widget {
  animation: footerFadeUp 0.6s var(--anim-easing-ease-out) backwards;
}

.nexus-pro-footer-widget:nth-child(1) { animation-delay: 0.1s; }
.nexus-pro-footer-widget:nth-child(2) { animation-delay: 0.2s; }
.nexus-pro-footer-widget:nth-child(3) { animation-delay: 0.3s; }
.nexus-pro-footer-widget:nth-child(4) { animation-delay: 0.4s; }

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

.nexus-pro-footer-social-link {
  transition: all var(--anim-duration-short) var(--anim-easing-ease-inout);
}

.nexus-pro-footer-social-link:hover {
  transform: translateY(-3px) scale(1.05);
}

/* ===== KEYFRAME ANIMATIONS ===== */
@keyframes fadeInAnim {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

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

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

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

@keyframes rotateInAnim {
  from {
    opacity: 0;
    transform: rotate(-5deg) scale(0.95);
  }
  to {
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }
}

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

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

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

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

/* ===== PROGRESS BAR ===== */
.scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary), var(--color-accent));
  transform: scaleX(0);
  transform-origin: left;
  z-index: 9999;
  will-change: transform;
}

/* ===== PAGE TRANSITION ===== */
.page-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  pointer-events: none;
  z-index: 9998;
  animation: pageTransitionOut 0.6s var(--anim-easing-ease-inout) forwards;
}

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

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

/* ===== LOADING STATE ===== */
.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-dark-secondary) 0%,
    var(--color-border) 50%,
    var(--color-dark-secondary) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

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

@media (max-width: 768px) {
  .stagger-item { animation-delay: 0s !important; }
  .stagger-item:nth-child(n+2) { animation-delay: 0.05s !important; }
  
  .nexus-pro-nav-item { animation-delay: 0s !important; }
  
  .nexus-pro-feature-list-item:hover {
    transform: translateX(3px);
  }
  
  .hover-lift:hover,
  .hover-lift-big:hover {
    transform: translateY(-2px);
  }
}

/* ===== TEXT ANIMATIONS ===== */
.text-animate {
  display: inline-block;
  opacity: 0;
}

.text-animate.active {
  animation: textReveal var(--anim-duration-base) var(--anim-easing-ease-out) forwards;
}

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

/* ===== LINK HOVER STATE ===== */
a {
  position: relative;
  transition: color var(--anim-duration-short) var(--anim-easing-ease-inout);
}

/* ===== SMOOTH BORDER ANIMATIONS ===== */
.border-animate {
  position: relative;
  border: 2px solid transparent;
  transition: all var(--anim-duration-short) var(--anim-easing-ease-inout);
}

.border-animate::before,
.border-animate::after {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border: 2px solid var(--color-primary);
  transition: all var(--anim-duration-short) var(--anim-easing-ease-inout);
}

.border-animate::before {
  top: -2px;
  left: -2px;
  border-right: 0;
  border-bottom: 0;
}

.border-animate::after {
  bottom: -2px;
  right: -2px;
  border-left: 0;
  border-top: 0;
}

.border-animate:hover::before,
.border-animate:hover::after {
  width: calc(100% + 4px);
  height: calc(100% + 4px);
}
