@layer base {
  body {
    background-color: #09090B; /* Fallback */
    scroll-behavior: smooth;
  }
}

@layer components {
  /* =========================================
     Section 1: Hero & Benefits 
     ========================================= */
  .glass-panel {
    background: rgba(24, 24, 27, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.05);
  }

  .text-gradient {
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  
  /* Subtle background glow effect */
  .bg-glow::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, rgba(255,46,147,0.15) 0%, rgba(9,9,11,0) 70%);
    z-index: -1;
    pointer-events: none;
  }

  /* =========================================
     Section 2: Course Program 
     ========================================= */
  .timeline-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
  }
  
  .timeline-card::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 1.6rem;
    background: linear-gradient(135deg, #FF2E93 0%, #00F0FF 100%);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  
  .timeline-card:hover {
    transform: translateY(-8px);
  }
  
  .timeline-card:hover::before {
    opacity: 1;
  }
  
  .bg-number {
    font-size: 8rem;
    line-height: 1;
    font-weight: 800;
    color: #27272A;
    position: absolute;
    right: -1rem;
    bottom: -2rem;
    opacity: 0.5;
    user-select: none;
    z-index: 0;
  }
  
  @media (min-width: 768px) {
    .bg-number.left-align {
      left: -1rem;
      right: auto;
    }
  }

  /* =========================================
     Section 3: Target Audience & Proof 
     ========================================= */
  .group:hover .group-hover\:pause {
    animation-play-state: paused;
  }

  /* =========================================
     Section 4: Success Modal 
     ========================================= */
  /* Confetti Animation CSS */
  @keyframes confetti-fall {
    0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
  }

  .confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #FF2E93;
    animation: confetti-fall 3s linear forwards;
  }
  
  .confetti:nth-child(2n) { background-color: #00F0FF; animation-duration: 4s; }
  .confetti:nth-child(3n) { background-color: #FF8000; animation-duration: 2.5s; }
  
  /* Modal Entry Animation */
  @keyframes modal-pop {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
  }
  
  .animate-modal-pop {
    animation: modal-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  }

  /* Checkmark Animation */
  @keyframes checkmark-draw {
    0% { stroke-dashoffset: 100; opacity: 0; }
    100% { stroke-dashoffset: 0; opacity: 1; }
  }
  
  .animate-checkmark {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: checkmark-draw 0.6s ease-out 0.2s forwards;
  }

  /* =========================================
     Global Helpers: Scroll Animations
     ========================================= */
  .fade-in-section,
  .fade-in-left,
  .fade-in-right,
  .scale-in,
  .mobile-slide-up {
    opacity: 0;
    transform: translateY(40px);
    visibility: hidden;
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.8s ease-out;
    will-change: opacity, transform, visibility;
  }

  /* Specific initial states for directional animations */
  .fade-in-left { transform: translateX(-50px); }
  .fade-in-right { transform: translateX(50px); }
  .scale-in { transform: scale(0.9); }
  
  /* Mobile specific animation */
  @media (max-width: 768px) {
    .mobile-slide-up {
      transform: translateY(60px);
      transition-duration: 0.6s;
    }
    .fade-in-left, .fade-in-right {
      transform: translateY(30px) !important; /* Convert side swipes to slide up on mobile for better UX */
    }
    
    #mobile-menu .stagger-link {
      opacity: 0;
      transform: translateY(20px);
      transition: opacity 0.4s ease, transform 0.4s ease;
    }
    #mobile-menu.opacity-100 .stagger-link {
      opacity: 1;
      transform: translateY(0);
    }
    #mobile-menu.opacity-100 .stagger-link:nth-child(1) { transition-delay: 0.1s; }
    #mobile-menu.opacity-100 .stagger-link:nth-child(2) { transition-delay: 0.15s; }
    #mobile-menu.opacity-100 .stagger-link:nth-child(3) { transition-delay: 0.2s; }
    #mobile-menu.opacity-100 .stagger-link:nth-child(4) { transition-delay: 0.25s; }
    #mobile-menu.opacity-100 .stagger-link:nth-child(5) { transition-delay: 0.3s; }
    #mobile-menu.opacity-100 .stagger-link:nth-child(6) { transition-delay: 0.4s; }
    
    @keyframes mobile-float-glow {
      0%, 100% { transform: translateY(0) scale(1); box-shadow: 0 0 15px rgba(255, 46, 147, 0.4); }
      50% { transform: translateY(-10px) scale(1.02); box-shadow: 0 0 35px rgba(255, 46, 147, 0.8); }
    }
    .mobile-eye-catcher {
      animation: mobile-float-glow 3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    }

    /* Additional subtle mobile continuous animations to keep user engaged */
    @keyframes mobile-bob {
      0%, 100% { transform: translateY(0); }
      50% { transform: translateY(-6px); }
    }
    .mobile-continuous {
      animation: mobile-bob 4s ease-in-out infinite;
    }
    .mobile-continuous-delay {
      animation: mobile-bob 4s ease-in-out infinite;
      animation-delay: -2s;
    }
    
    @keyframes mobile-soft-pulse {
      0%, 100% { transform: scale(1); opacity: 1; }
      50% { transform: scale(1.03); opacity: 0.95; }
    }
    .mobile-pulse {
      animation: mobile-soft-pulse 3.5s ease-in-out infinite;
    }
    
    /* Scroll-triggered mobile "hover" active state */
    .mobile-hover-active {
      transform: translateY(-8px) scale(1.02) !important;
      border-color: rgba(255, 46, 147, 0.5) !important;
      box-shadow: 0 0 35px rgba(255, 46, 147, 0.25) !important;
      transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1) !important;
      z-index: 10;
    }
    
    .mobile-hover-active.group\/card .opacity-0 {
      opacity: 1 !important;
    }
    
    /* Specific timeline-card overrides (Krok po Kroku section) */
    .timeline-card.mobile-hover-active {
      border-color: transparent !important;
      box-shadow: none !important;
    }
    .timeline-card.mobile-hover-active::before {
      opacity: 1 !important;
    }
    
    /* Subtle neon shadow for specific accents during mobile scroll */
    .mobile-hover-active:nth-child(2n) {
      border-color: rgba(0, 240, 255, 0.5) !important;
      box-shadow: 0 0 35px rgba(0, 240, 255, 0.25) !important;
    }
    
    .mobile-hover-active:nth-child(3n) {
      border-color: rgba(168, 85, 247, 0.5) !important;
      box-shadow: 0 0 35px rgba(168, 85, 247, 0.25) !important;
    }
  }

  .fade-in-section.is-visible,
  .fade-in-left.is-visible,
  .fade-in-right.is-visible,
  .scale-in.is-visible,
  .mobile-slide-up.is-visible {
    opacity: 1;
    transform: none !important;
    visibility: visible;
  }

  /* Stagger delays */
  .delay-100 { transition-delay: 100ms; }
  .delay-200 { transition-delay: 200ms; }
  .delay-300 { transition-delay: 300ms; }
  .delay-400 { transition-delay: 400ms; }
  .delay-500 { transition-delay: 500ms; }

  /* =========================================
     Continuous Animations (3D & Floating)
     ========================================= */
  
  /* Floating animation */
  @keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
    100% { transform: translateY(0px); }
  }

  .animate-float {
    animation: float 6s ease-in-out infinite;
  }
  
  .animate-float-delayed {
    animation: float 6s ease-in-out infinite;
    animation-delay: -3s;
  }

  /* 3D Floating animation for cards/elements */
  @keyframes float-3d {
    0% { transform: translateY(0px) perspective(1000px) rotateX(0deg) rotateY(0deg); }
    25% { transform: translateY(-10px) perspective(1000px) rotateX(2deg) rotateY(2deg); }
    50% { transform: translateY(-15px) perspective(1000px) rotateX(0deg) rotateY(0deg); }
    75% { transform: translateY(-10px) perspective(1000px) rotateX(-2deg) rotateY(-2deg); }
    100% { transform: translateY(0px) perspective(1000px) rotateX(0deg) rotateY(0deg); }
  }

  .animate-float-3d {
    animation: float-3d 8s ease-in-out infinite;
    transform-style: preserve-3d;
  }
  
  .animate-float-3d-fast {
    animation: float-3d 5s ease-in-out infinite;
    transform-style: preserve-3d;
  }

  /* Slow rotation for ambient backgrounds */
  @keyframes spin-slow {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
  }
  
  .animate-spin-slow {
    animation: spin-slow 20s linear infinite;
  }

  .animate-spin-slow-reverse {
    animation: spin-slow 25s linear infinite reverse;
  }

  /* Glow pulsing */
  @keyframes pulse-glow {
    0% { opacity: 0.5; box-shadow: 0 0 20px rgba(255, 46, 147, 0.2); }
    50% { opacity: 0.8; box-shadow: 0 0 50px rgba(255, 46, 147, 0.6); }
    100% { opacity: 0.5; box-shadow: 0 0 20px rgba(255, 46, 147, 0.2); }
  }

  .animate-pulse-glow {
    animation: pulse-glow 4s ease-in-out infinite;
  }

  /* Interactive 3D Box Effect */
  .box-3d-container {
    perspective: 1000px;
  }

  .box-3d-interactive {
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    transform-style: preserve-3d;
    mix-blend-mode: screen; /* Blends black background away on dark BG */
  }

  .box-3d-container:hover .box-3d-interactive {
    transform: rotateY(15deg) rotateX(10deg) scale(1.1);
  }
}
