/**
 * Advanced Animations & Effects
 * Umfassende Animationsbibliothek für die Website
 */

/* ========================================
   ANIMATION VARIABLES
   ======================================== */
:root {
  --anim-duration-fast: 0.3s;
  --anim-duration-base: 0.6s;
  --anim-duration-slow: 1s;
  --anim-duration-slower: 1.5s;
  --anim-easing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --anim-easing-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --anim-easing-elastic: cubic-bezier(0.68, -0.6, 0.32, 1.6);
}

/* ========================================
   HERO ANIMATIONS
   ======================================== */

/* Hero Title Fade In */
.hero-title {
  animation: fadeInDown 1s var(--anim-easing-smooth) 0.2s both;
}

/* Hero Logo Animation */
.hero-logo {
  animation: scaleInBounce 0.8s var(--anim-easing-elastic) 0.5s both,
             float 4s ease-in-out 1.3s infinite;
}

/* Brand Name Animation */
.brand-name {
  animation: fadeInUp 0.8s var(--anim-easing-smooth) 0.8s both,
             shimmer 3s ease-in-out 1.6s infinite;
  background: linear-gradient(
    90deg,
    var(--color-dark) 0%,
    var(--color-primary) 50%,
    var(--color-dark) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  animation: fadeInUp 0.8s var(--anim-easing-smooth) 1s both;
}

/* Logo Container Glow */
.logo-container {
  animation: fadeIn 1s var(--anim-easing-smooth) 0.3s both;
}

.logo-outer {
  animation: pulse 3s ease-in-out infinite, 
             glow 2s ease-in-out infinite alternate;
}

/* ========================================
   SCROLL REVEAL ANIMATIONS
   ======================================== */

/* Base state for animated elements */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity var(--anim-duration-base) var(--anim-easing-smooth),
              transform var(--anim-duration-base) var(--anim-easing-smooth);
}

.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Slide from left */
.animate-slide-left {
  opacity: 0;
  transform: translateX(-60px);
  transition: opacity var(--anim-duration-base) var(--anim-easing-smooth),
              transform var(--anim-duration-base) var(--anim-easing-smooth);
}

.animate-slide-left.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Slide from right */
.animate-slide-right {
  opacity: 0;
  transform: translateX(60px);
  transition: opacity var(--anim-duration-base) var(--anim-easing-smooth),
              transform var(--anim-duration-base) var(--anim-easing-smooth);
}

.animate-slide-right.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Scale up animation */
.animate-scale {
  opacity: 0;
  transform: scale(0.8);
  transition: opacity var(--anim-duration-base) var(--anim-easing-smooth),
              transform var(--anim-duration-base) var(--anim-easing-elastic);
}

.animate-scale.is-visible {
  opacity: 1;
  transform: scale(1);
}

/* Rotate in */
.animate-rotate {
  opacity: 0;
  transform: rotate(-10deg) scale(0.9);
  transition: opacity var(--anim-duration-base) var(--anim-easing-smooth),
              transform var(--anim-duration-base) var(--anim-easing-bounce);
}

.animate-rotate.is-visible {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* Staggered children animation */
.stagger-children > * {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.5s var(--anim-easing-smooth),
              transform 0.5s var(--anim-easing-smooth);
}

.stagger-children.is-visible > *:nth-child(1) { transition-delay: 0.1s; opacity: 1; transform: translateY(0); }
.stagger-children.is-visible > *:nth-child(2) { transition-delay: 0.2s; opacity: 1; transform: translateY(0); }
.stagger-children.is-visible > *:nth-child(3) { transition-delay: 0.3s; opacity: 1; transform: translateY(0); }
.stagger-children.is-visible > *:nth-child(4) { transition-delay: 0.4s; opacity: 1; transform: translateY(0); }
.stagger-children.is-visible > *:nth-child(5) { transition-delay: 0.5s; opacity: 1; transform: translateY(0); }
.stagger-children.is-visible > *:nth-child(6) { transition-delay: 0.6s; opacity: 1; transform: translateY(0); }

/* ========================================
   SECTION ANIMATIONS
   ======================================== */

.section-title {
  position: relative;
  overflow: hidden;
}

.section-title::after {
  transform-origin: left;
  animation: none;
}

.section.is-visible .section-title::after {
  animation: expandWidth 0.8s var(--anim-easing-smooth) 0.3s both;
}

.section-icon {
  animation: bounce 2s ease-in-out infinite;
}

/* Highlight box animation */
.highlight-box {
  position: relative;
  overflow: hidden;
}

.highlight-box::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  transition: left 0.5s ease;
}

.highlight-box:hover::after {
  left: 100%;
}

/* Feature list items */
.feature-list li {
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.section.is-visible .feature-list li:nth-child(1) { transition-delay: 0.1s; opacity: 1; transform: translateX(0); }
.section.is-visible .feature-list li:nth-child(2) { transition-delay: 0.2s; opacity: 1; transform: translateX(0); }
.section.is-visible .feature-list li:nth-child(3) { transition-delay: 0.3s; opacity: 1; transform: translateX(0); }
.section.is-visible .feature-list li:nth-child(4) { transition-delay: 0.4s; opacity: 1; transform: translateX(0); }
.section.is-visible .feature-list li:nth-child(5) { transition-delay: 0.5s; opacity: 1; transform: translateX(0); }
.section.is-visible .feature-list li:nth-child(6) { transition-delay: 0.6s; opacity: 1; transform: translateX(0); }
.section.is-visible .feature-list li:nth-child(7) { transition-delay: 0.7s; opacity: 1; transform: translateX(0); }
.section.is-visible .feature-list li:nth-child(8) { transition-delay: 0.8s; opacity: 1; transform: translateX(0); }

/* ========================================
   PRICING CARD ANIMATIONS
   ======================================== */

.pricing-card {
  transition: transform 0.4s var(--anim-easing-bounce),
              box-shadow 0.4s ease;
}

.pricing-card:hover {
  transform: translateY(-12px) scale(1.02);
  box-shadow: 0 25px 50px rgba(194, 71, 159, 0.25);
}

.pricing-card::before {
  transition: height 0.3s ease, background 0.3s ease;
}

.pricing-card:hover::before {
  height: 8px;
}

.pricing-card__icon {
  transition: transform 0.4s var(--anim-easing-elastic),
              filter 0.3s ease;
}

.pricing-card:hover .pricing-card__icon {
  transform: scale(1.2) rotate(5deg);
}

.pricing-card__price {
  transition: transform 0.3s var(--anim-easing-bounce);
}

.pricing-card:hover .pricing-card__price {
  transform: scale(1.1);
}

/* ========================================
   CONTACT ANIMATIONS
   ======================================== */

.contact-link {
  position: relative;
  overflow: hidden;
  transition: all 0.4s var(--anim-easing-smooth);
}

.contact-link::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(194, 71, 159, 0.1);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.contact-link:hover::before {
  width: 300%;
  height: 300%;
}

.contact-link:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 15px 30px rgba(194, 71, 159, 0.2);
}

.contact-icon {
  transition: transform 0.4s var(--anim-easing-elastic);
}

.contact-link:hover .contact-icon {
  transform: scale(1.3) rotate(10deg);
}

/* ========================================
   NAVBAR ANIMATIONS
   ======================================== */

.navbar {
  transition: background 0.3s ease, 
              box-shadow 0.3s ease,
              padding 0.3s ease;
}

.navbar--scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  padding: 0.5rem 0;
}

.nav-link {
  position: relative;
  transition: color 0.3s ease, transform 0.3s ease;
}

.nav-link:hover {
  transform: translateY(-2px);
}

.nav-link::after {
  transition: width 0.3s var(--anim-easing-bounce),
              background 0.3s ease;
}

.nav-link--cta {
  transition: background 0.3s ease,
              transform 0.3s var(--anim-easing-bounce),
              box-shadow 0.3s ease;
}

.nav-link--cta:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 10px 25px rgba(194, 71, 159, 0.4);
}

/* ========================================
   BUTTON ANIMATIONS
   ======================================== */

.btn,
button:not(.nav-toggle):not(.nav-dropdown-toggle) {
  position: relative;
  overflow: hidden;
  transition: all 0.3s var(--anim-easing-smooth);
}

.btn::after,
button:not(.nav-toggle):not(.nav-dropdown-toggle)::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1, 1) translate(-50%);
  transform-origin: 50% 50%;
}

.btn:hover::after,
button:not(.nav-toggle):not(.nav-dropdown-toggle):hover::after {
  animation: ripple 1s ease-out;
}

/* ========================================
   MOUSE FOLLOWER (Optional enhancement)
   ======================================== */

.cursor-glow {
  position: fixed;
  width: 300px;
  height: 300px;
  background: radial-gradient(
    circle,
    rgba(194, 71, 159, 0.15) 0%,
    transparent 70%
  );
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s ease;
  opacity: 0;
}

.cursor-glow.active {
  opacity: 1;
}

/* ========================================
   TEXT ANIMATIONS
   ======================================== */

/* Typing effect for headings */
.typing-effect {
  overflow: hidden;
  border-right: 2px solid var(--color-primary);
  white-space: nowrap;
  animation: typing 3.5s steps(40, end),
             blink-caret 0.75s step-end infinite;
}

/* Gradient text animation */
.gradient-text {
  background: linear-gradient(
    270deg,
    var(--color-primary),
    var(--color-primary-light),
    var(--color-primary-dark),
    var(--color-primary)
  );
  background-size: 400% 400%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 8s ease infinite;
}

/* ========================================
   LOADING ANIMATIONS
   ======================================== */

/* Page loader */
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(194, 71, 159, 0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ========================================
   SCROLL INDICATOR
   ======================================== */

.scroll-indicator {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  animation: bounce 2s ease-in-out infinite;
  z-index: 10;
}

.scroll-indicator::before {
  content: '';
  display: block;
  width: 30px;
  height: 50px;
  border: 2px solid var(--color-dark);
  border-radius: 25px;
  position: relative;
}

.scroll-indicator::after {
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  width: 6px;
  height: 10px;
  background: var(--color-primary);
  border-radius: 3px;
  transform: translateX(-50%);
  animation: scrollDown 2s ease-in-out infinite;
}

/* ========================================
   PARALLAX EFFECTS
   ======================================== */

.parallax-bg {
  transform: translateZ(0);
  will-change: transform;
}

/* ========================================
   KEYFRAME DEFINITIONS
   ======================================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleInBounce {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-15px);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 10px 30px rgba(194, 71, 159, 0.3);
  }
  50% {
    transform: scale(1.03);
    box-shadow: 0 15px 40px rgba(194, 71, 159, 0.4);
  }
}

@keyframes glow {
  from {
    box-shadow: 0 0 20px rgba(194, 71, 159, 0.4),
                0 0 40px rgba(194, 71, 159, 0.2);
  }
  to {
    box-shadow: 0 0 30px rgba(194, 71, 159, 0.6),
                0 0 60px rgba(194, 71, 159, 0.3);
  }
}

@keyframes shimmer {
  0% { background-position: 200% center; }
  100% { background-position: -200% center; }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-20px);
  }
  60% {
    transform: translateY(-10px);
  }
}

@keyframes expandWidth {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes ripple {
  0% {
    transform: scale(0, 0);
    opacity: 0.5;
  }
  100% {
    transform: scale(40, 40);
    opacity: 0;
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes scrollDown {
  0%, 100% {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
  50% {
    transform: translateX(-50%) translateY(15px);
    opacity: 0.5;
  }
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--color-primary); }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Floating elements animation */
@keyframes floatRotate {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-10px) rotate(2deg);
  }
  75% {
    transform: translateY(5px) rotate(-2deg);
  }
}

/* Sparkle animation */
@keyframes sparkle {
  0%, 100% {
    opacity: 0;
    transform: scale(0);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ========================================
   REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .hero-title,
  .hero-logo,
  .brand-name,
  .brand-subtitle,
  .logo-container,
  .logo-outer {
    animation: none !important;
  }
}
