/* ================================================
   Ubden® Modern Website - Animations
   GSAP ScrollTrigger & CSS Animations
   ================================================ */

/* ================================================
   Loading Animation
   ================================================ */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0a0a0f 0%, #13131a 50%, #0a0a0f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.8s ease, visibility 0.8s ease;
  overflow: hidden;
}

.page-loader::before {
  content: '';
  position: absolute;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(0, 212, 255, 0.05) 0%, transparent 70%);
  animation: loaderPulse 3s ease-in-out infinite;
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-lg);
  position: relative;
  z-index: 1;
}

.loader-logo {
  width: 120px;
  height: 120px;
  margin-bottom: var(--spacing-sm);
  animation: floatLoader 3s ease-in-out infinite;
  filter: drop-shadow(0 0 30px rgba(0, 212, 255, 0.5));
}

.loader-brand {
  margin-bottom: var(--spacing-sm);
}

.loader-logo-img {
  height: 60px;
  width: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.6));
  animation: logoGlow 2s ease-in-out infinite;
}

@keyframes logoGlow {
  0%, 100% {
    filter: drop-shadow(0 0 15px rgba(0, 212, 255, 0.5));
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 30px rgba(0, 212, 255, 0.9)) drop-shadow(0 0 40px rgba(124, 58, 237, 0.6));
    transform: scale(1.05);
  }
}

.loader-title {
  font-family: var(--font-heading);
  font-size: var(--font-size-4xl);
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
  letter-spacing: 2px;
  animation: titlePulse 2s ease-in-out infinite;
}

.loader-title sup {
  font-size: var(--font-size-sm);
  opacity: 0.8;
}

.loader-tagline {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin: var(--spacing-xs) 0 0 0;
  letter-spacing: 3px;
  text-transform: uppercase;
  opacity: 0.7;
  animation: fadeInOut 2s ease-in-out infinite;
}

.loader-bar {
  width: 300px;
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
}

.loader-progress {
  height: 100%;
  background: var(--gradient-primary);
  animation: loading 1.8s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.loader-text {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: var(--spacing-sm);
  animation: dotPulse 1.5s ease-in-out infinite;
}

@keyframes loaderPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.5;
  }
}

@keyframes floatLoader {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-10px) rotate(5deg);
  }
}

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

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

@keyframes dotPulse {
  0%, 100% {
    opacity: 0.4;
  }
  50% {
    opacity: 1;
  }
}

/* Loader Responsive */
@media (max-width: 767px) {
  .loader-logo {
    width: 100px;
    height: 100px;
  }
  
  .loader-title {
    font-size: var(--font-size-3xl);
  }
  
  .loader-tagline {
    font-size: var(--font-size-xs);
    letter-spacing: 2px;
  }
  
  .loader-bar {
    width: 250px;
  }
  
  .loader-text {
    font-size: var(--font-size-xs);
  }
}

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

@keyframes loading {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* ================================================
   Fade In Animations
   ================================================ */
.fade-in {
  opacity: 0;
  animation: fadeIn 0.8s ease-out forwards;
}

.fade-in-up {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 0.8s ease-out forwards;
}

.fade-in-down {
  opacity: 0;
  transform: translateY(-30px);
  animation: fadeInDown 0.8s ease-out forwards;
}

.fade-in-left {
  opacity: 0;
  transform: translateX(-30px);
  animation: fadeInLeft 0.8s ease-out forwards;
}

.fade-in-right {
  opacity: 0;
  transform: translateX(30px);
  animation: fadeInRight 0.8s ease-out forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 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; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }

/* ================================================
   Particle Background Animation
   ================================================ */
#particleCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* ================================================
   Gradient Background Animation
   ================================================ */
.gradient-bg {
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    -45deg,
    rgba(0, 212, 255, 0.05),
    rgba(124, 58, 237, 0.05),
    rgba(16, 185, 129, 0.05),
    rgba(245, 158, 11, 0.05)
  );
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

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

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

/* ================================================
   Glow Pulse Animation
   ================================================ */
.glow-pulse {
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.6), 0 0 60px rgba(124, 58, 237, 0.3);
  }
}

/* ================================================
   Rotate Animation
   ================================================ */
.rotate-slow {
  animation: rotateSlow 20s linear infinite;
}

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

/* ================================================
   Scale on Hover
   ================================================ */
.scale-hover {
  transition: transform var(--transition-base);
}

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

/* ================================================
   Slide In Animations (for scroll triggers)
   ================================================ */
.slide-in-left {
  opacity: 0;
  transform: translateX(-100px);
}

.slide-in-right {
  opacity: 0;
  transform: translateX(100px);
}

.slide-in-up {
  opacity: 0;
  transform: translateY(100px);
}

.slide-in-down {
  opacity: 0;
  transform: translateY(-100px);
}

/* These will be animated by GSAP ScrollTrigger */
.gsap-fade-in {
  opacity: 0;
}

.gsap-scale-in {
  opacity: 0;
  transform: scale(0.8);
}

.gsap-rotate-in {
  opacity: 0;
  transform: rotate(-10deg);
}

/* ================================================
   Typing Animation Effect
   ================================================ */
.typing-text {
  overflow: hidden;
  border-right: 3px solid var(--color-primary);
  white-space: nowrap;
  animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
  display: inline-block;
}

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

@keyframes blink-caret {
  from, to {
    border-color: transparent;
  }
  50% {
    border-color: var(--color-primary);
  }
}

/* ================================================
   Stagger Animation (for GSAP)
   ================================================ */
.stagger-item {
  opacity: 1;
  transform: translateY(0);
}

/* ================================================
   Parallax Elements
   ================================================ */
.parallax-slow {
  will-change: transform;
}

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

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

/* ================================================
   Light Beam Effect
   ================================================ */
.light-beam {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  opacity: 0.3;
  animation: moveLight 10s ease-in-out infinite;
}

.light-beam.cyan {
  background: radial-gradient(circle, rgba(0, 212, 255, 0.4) 0%, transparent 70%);
}

.light-beam.purple {
  background: radial-gradient(circle, rgba(124, 58, 237, 0.4) 0%, transparent 70%);
  animation-delay: -5s;
}

.light-beam.green {
  background: radial-gradient(circle, rgba(16, 185, 129, 0.4) 0%, transparent 70%);
  animation-delay: -2.5s;
}

@keyframes moveLight {
  0%, 100% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(100px, 100px);
  }
  50% {
    transform: translate(-100px, 200px);
  }
  75% {
    transform: translate(200px, -100px);
  }
}

/* ================================================
   Card Flip Effect
   ================================================ */
.flip-card {
  perspective: 1000px;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.flip-card-back {
  transform: rotateY(180deg);
}

/* ================================================
   Shimmer Effect
   ================================================ */
.shimmer {
  position: relative;
  overflow: hidden;
}

.shimmer::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  100% {
    left: 100%;
  }
}

/* ================================================
   Button Ripple Effect
   ================================================ */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

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

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

/* ================================================
   Number Counter Animation
   ================================================ */
.counter {
  font-size: var(--font-size-4xl);
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ================================================
   Scroll Progress Indicator
   ================================================ */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--gradient-primary);
  z-index: var(--z-tooltip);
  transition: width 0.1s ease-out;
}

/* ================================================
   Section Reveal Animation
   ================================================ */
.reveal {
  position: relative;
  opacity: 1;
  transform: translateY(0);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ================================================
   Text Gradient Animation
   ================================================ */
.gradient-text-animate {
  background: linear-gradient(
    90deg,
    var(--color-primary),
    var(--color-secondary),
    var(--color-accent),
    var(--color-primary)
  );
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientTextMove 4s ease infinite;
}

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

/* ================================================
   Border Animation
   ================================================ */
.border-animate {
  position: relative;
}

.border-animate::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  padding: 2px;
  background: var(--gradient-primary);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: borderRotate 3s linear infinite;
}

@keyframes borderRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ================================================
   Smooth Scroll Behavior
   ================================================ */
html {
  scroll-behavior: smooth;
}

/* Override for users who prefer reduced motion */
@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;
  }
}

/* ================================================
   Mobile Menu Animation
   ================================================ */
.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ================================================
   Performance Optimizations
   ================================================ */
.will-animate {
  will-change: transform, opacity;
}

/* Remove will-change after animation completes */
.animation-complete {
  will-change: auto;
}

