/* JS-DRIVEN ANIMATION & INTERACTION STYLES */

/* Navbar scroll state */
.navbar {
  transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

.navbar-scrolled {
  box-shadow: var(--shadow-m) !important;
  background-color: var(--bg-light) !important;
}

[data-bs-theme="dark"] .navbar-scrolled {
  background-color: var(--bg-dark) !important;
}

/* Section visibility for lazy animations */
section[id] {
  transition: opacity 0.6s ease;
}

.section-visible {
  opacity: 1;
}

/* Feature card icon animation */
.feature-card i {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), 
              filter 0.3s ease;
  display: inline-block;
}

.feature-card:hover i {
  filter: drop-shadow(0 4px 8px rgba(var(--landing-gradient-primary-rgb), 0.3));
}

/* Waterfall bar base state for animation */
.waterfall-bar {
  transition: height 0.5s ease-out;
}

/* Ternary marker pulse */
.marker-dot {
  transition: box-shadow 0.5s ease;
}

/* CTA button scale on valid email */
.btn-dashboard {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), 
              background-image 0.2s ease-in-out, 
              box-shadow 0.3s ease-in-out;
  position: relative;
  overflow: hidden;
}

.btn-dashboard::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 ease, height 0.6s ease;
}

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

/* Email input validation state */
#final-cta input[type="email"] {
  transition: border-color 0.3s ease;
}

/* Placeholder content fade for tab switches */
.placeholder-content {
  transition: opacity 0.15s ease;
}

/* Comparison table row hover */
.comparison-table tbody tr {
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Visual comparison cards - subtle float animation */
.comparison-visual {
  animation: gentleFloat 6s ease-in-out infinite;
}

.comparison-visual.statsalpha-visual {
  animation-delay: 0.5s;
}

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

.comparison-visual:hover {
  animation-play-state: paused;
}

/* Percentile bar animation on view */
.percentile-fill {
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.percentile-marker {
  transition: left 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Scroll progress bar glow */
.scroll-progress-bar {
  box-shadow: 0 0 12px rgba(var(--landing-gradient-primary-rgb), 0.6),
              0 0 24px rgba(var(--landing-gradient-secondary-rgb), 0.4);
  background: linear-gradient(
    90deg, 
    var(--sa-primary-600) 0%, 
    var(--sa-secondary-600) 50%,
    var(--sa-primary-600) 100%
  );
  background-size: 200% 100%;
  animation: progressGradient 3s ease infinite;
}

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

/* Smooth scroll anchor offset (accounts for fixed navbar) */
[id] {
  scroll-margin-top: 80px;
}

/* Prefers reduced motion - disable animations */
@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;
  }

  .scroll-progress-bar {
    display: none;
  }

  .placeholder-frame {
    transform: none !important;
  }
}

/* Add subtle animation to badge percentiles on hover */
.badge {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.placeholder-row:hover .badge {
  transform: scale(1.1);
}

/* Radar badge hover effect */
.radar-badge {
  transition: transform 0.2s ease;
}

.radar-axis:hover .radar-badge {
  transform: scale(1.15);
}

/* Delta item pulse on section visible */
.section-visible .delta-item {
  animation: deltaPulse 0.6s ease forwards;
}

@keyframes deltaPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Staggered animation for objection items */
.objection-item:nth-child(1) { transition-delay: 0s; }
.objection-item:nth-child(2) { transition-delay: 0.1s; }
.objection-item:nth-child(3) { transition-delay: 0.2s; }
.objection-item:nth-child(4) { transition-delay: 0.3s; }

/* FAQ accordion smooth expand */
.faq-accordion .accordion-collapse {
  transition: height 0.35s ease;
}

/* Module showcase content entrance */
.module-showcase .module-content {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-visible .module-content,
.module-showcase:hover .module-content {
  opacity: 1;
  transform: translateY(0);
}

/* Module visual enhanced animations */
.module-visual-placeholder {
  opacity: 0;
  transform: translateY(30px) scale(0.95);
  transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-visible .module-visual-placeholder {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Staggered animation for modules */
.module-showcase:nth-child(1) .module-visual-placeholder {
  transition-delay: 0.1s;
}

.module-showcase:nth-child(1) .module-content {
  transition-delay: 0.2s;
}

.module-showcase:nth-child(2) .module-visual-placeholder {
  transition-delay: 0.3s;
}

.module-showcase:nth-child(2) .module-content {
  transition-delay: 0.4s;
}

.module-showcase:nth-child(3) .module-visual-placeholder {
  transition-delay: 0.5s;
}

.module-showcase:nth-child(3) .module-content {
  transition-delay: 0.6s;
}

/* Module badge animations */
.module-content .badge {
  display: inline-block;
  animation: badgeFadeIn 0.6s ease backwards;
}

.module-showcase:nth-child(1) .module-content .badge {
  animation-delay: 0.3s;
}

.module-showcase:nth-child(2) .module-content .badge {
  animation-delay: 0.5s;
}

.module-showcase:nth-child(3) .module-content .badge {
  animation-delay: 0.7s;
}

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

/* Waterfall bars sequential animation */
.waterfall-bar {
  animation: waterfallGrow 0.8s cubic-bezier(0.4, 0, 0.2, 1) backwards;
  transform-origin: bottom;
}

.waterfall-item:nth-child(1) .waterfall-bar { animation-delay: 0.1s; }
.waterfall-item:nth-child(2) .waterfall-bar { animation-delay: 0.2s; }
.waterfall-item:nth-child(3) .waterfall-bar { animation-delay: 0.3s; }
.waterfall-item:nth-child(4) .waterfall-bar { animation-delay: 0.4s; }
.waterfall-item:nth-child(5) .waterfall-bar { animation-delay: 0.5s; }
.waterfall-item:nth-child(6) .waterfall-bar { animation-delay: 0.6s; }
.waterfall-item:nth-child(7) .waterfall-bar { animation-delay: 0.7s; }

@keyframes waterfallGrow {
  from {
    transform: scaleY(0);
    opacity: 0;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}

/* Leak drip animation */
.waterfall-item.leak .waterfall-bar {
  animation: waterfallGrow 0.8s cubic-bezier(0.4, 0, 0.2, 1) backwards,
             leakPulse 3s ease-in-out infinite 1s;
}

@keyframes leakPulse {
  0%, 100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.15);
  }
}

/* Radar axis fade-in animation */
.radar-axis {
  animation: radarAxisReveal 0.6s ease backwards;
}

.radar-axis:nth-child(1) { animation-delay: 0.1s; }
.radar-axis:nth-child(2) { animation-delay: 0.2s; }
.radar-axis:nth-child(3) { animation-delay: 0.3s; }
.radar-axis:nth-child(4) { animation-delay: 0.4s; }
.radar-axis:nth-child(5) { animation-delay: 0.5s; }
.radar-axis:nth-child(6) { animation-delay: 0.6s; }

@keyframes radarAxisReveal {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(0deg) translateY(-80px) scale(0.8);
  }
  to {
    opacity: 1;
  }
}

/* Ternary marker pulse animation */
.marker-dot {
  animation: markerPulse 2s ease-in-out infinite;
}

@keyframes markerPulse {
  0%, 100% {
    box-shadow: 
      0 4px 12px rgba(37, 99, 235, 0.4),
      0 0 0 4px rgba(37, 99, 235, 0.15);
  }
  50% {
    box-shadow: 
      0 4px 12px rgba(37, 99, 235, 0.6),
      0 0 0 8px rgba(37, 99, 235, 0.25);
  }
}

/* Module features list stagger */
.module-features li {
  opacity: 0;
  animation: featureItemReveal 0.5s ease both;
}

.module-features li:nth-child(1) { animation-delay: 0.4s; }
.module-features li:nth-child(2) { animation-delay: 0.5s; }
.module-features li:nth-child(3) { animation-delay: 0.6s; }

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

/* Hero section floating animation for visual */
@keyframes float {
  0%, 100% { 
    transform: translateY(0) rotateY(-2deg) rotateX(1deg); 
  }
  50% { 
    transform: translateY(-12px) rotateY(-2deg) rotateX(1deg); 
  }
}

.hero-visual-placeholder .placeholder-frame {
  animation: float 8s ease-in-out infinite;
}

.hero-visual-placeholder:hover .placeholder-frame {
  animation-play-state: paused;
  transform: scale(1.02) rotateY(0) rotateX(0);
}

/* Pain card enhanced interactions - main styles in 01_sections-core.css */

/* Pain section title emphasis */
#pain h2 {
  position: relative;
  display: inline-block;
}

#pain h2 .text-danger {
  position: relative;
  display: inline-block;
  color: var(--bs-danger);
  font-weight: 700;
}

/* Pain section subtitle */
#pain .text-muted {
  color: rgba(107, 114, 128, 0.85) !important;
  font-weight: 400;
}

[data-bs-theme="dark"] #pain .text-muted {
  color: rgba(209, 213, 219, 0.75) !important;
}

/* Pain card text styling */
.pain-card h5 {
  font-weight: 600;
  color: var(--bs-gray-900);
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

[data-bs-theme="dark"] .pain-card h5 {
  color: var(--bs-gray-100);
}

.pain-card p {
  color: var(--bs-gray-700);
  line-height: 1.6;
  font-size: 0.95rem;
}

[data-bs-theme="dark"] .pain-card p {
  color: var(--bs-gray-300);
}

/* Outcome card enhanced interactions */
.outcome-card {
  perspective: 1000px;
}

.outcome-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(37, 99, 235, 0.08),
    transparent 40%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.outcome-card:hover::after {
  opacity: 1;
}

/* Outcome icon animation */
.outcome-card i {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), 
              filter 0.3s ease;
  display: inline-block;
}

.outcome-card:hover i {
  filter: drop-shadow(0 4px 8px rgba(37, 99, 235, 0.3));
}

/* Staggered animation for outcome cards */
.outcome-card:nth-child(1) { 
  transition-delay: 0s; 
}

.outcome-card:nth-child(2) { 
  transition-delay: 0.1s; 
}

.outcome-card:nth-child(3) { 
  transition-delay: 0.2s; 
}

/* Outcome section scroll-triggered animations */
.section-visible .outcome-card {
  animation: outcomeCardReveal 0.6s ease forwards;
}

@keyframes outcomeCardReveal {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Pain more info button hover */
.pain-more-info .btn-main-color {
  position: relative;
  z-index: 2;
  font-weight: 600;
  font-size: 1.05rem;
  padding: 0.875rem 2.5rem;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.4);
  /* Smooth transitions */
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease,
              background-image 0.2s ease;
  will-change: transform;
}

.pain-more-info .btn-main-color:hover {
  transform: scale(1.03) translateY(-2px);
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.45);
}

/* ===================================================================
   FINAL CTA SECTION - Enhanced Animations & Interactions
   =================================================================== */

/* CTA buttons hover effects */
.cta-primary-btn,
.cta-secondary-btn {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Accessibility: Respect reduced motion preference for CTA */
@media (prefers-reduced-motion: reduce) {
  .cta-section,
  .tier-card,
  .tier-icon,
  .cta-badge,
  .cta-primary-btn,
  .cta-secondary-btn,
  .cta-feature-item,
  .cta-header,
  .cta-value-tiers,
  .cta-actions,
  .cta-footer,
  .cta-footer-link i {
    animation: none !important;
  }
}
