/* Step 4 - Interactive Card Flip & Confetti (Green Theme) */
.step4-section {
  width: 100%;
  max-width: 440px;
  padding-top: clamp(32px, 8vh, 64px);
  padding-bottom: clamp(32px, 8vh, 64px);
  position: relative;
  overflow: hidden;
}

/* Headline */
.step4-headline {
  font-size: clamp(22px, 5.5vw, 28px);
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.35;
  margin-bottom: 12px;
  text-align: center;
  max-width: 400px;
}

.step4-subheadline {
  font-size: clamp(13px, 3.5vw, 15px);
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: 40px;
  text-align: center;
  max-width: 380px;
}

/* Card Container */
.step4-card-container {
  width: 100%;
  max-width: 340px;
  height: 210px;
  perspective: 1200px;
  margin: 0 auto 40px;
}

/* Card */
.step4-card {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.step4-card.flipped {
  transform: rotateY(180deg);
}

/* Card Faces */
.step4-card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  overflow: hidden;
}

/* Front Face - Green Gradient */
.step4-card-front {
  background: linear-gradient(145deg, #4CAF8B 0%, #3D9A7A 50%, #2E8B6A 100%);
  color: var(--color-white);
  box-shadow:
    0 8px 32px rgba(76, 175, 139, 0.35),
    0 4px 12px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Shimmer Effect */
.step4-card-front::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(255, 255, 255, 0.15) 50%,
    transparent 70%
  );
  transform: rotate(45deg);
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(100%) rotate(45deg); }
}

/* Front Card Content */
.step4-card-front-icon {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  animation: iconPulse 2s ease-in-out infinite;
}

.step4-card-front-icon svg {
  width: 24px;
  height: 24px;
  color: var(--color-white);
}

@keyframes iconPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.3); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
}

.step4-card-front-title {
  font-size: clamp(16px, 4.2vw, 20px);
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
  text-align: center;
}

.step4-card-front-subtitle {
  font-size: clamp(12px, 3.2vw, 14px);
  opacity: 0.9;
  text-align: center;
  font-weight: 500;
}

/* Green Glow Border */
.step4-card-front::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(76, 175, 139, 0.5), transparent, rgba(76, 175, 139, 0.5));
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.step4-card-container:hover .step4-card-front::after {
  opacity: 1;
}

/* Back Face - Dark with Green Accent */
.step4-card-back {
  background: linear-gradient(145deg, #1A2E1A 0%, #0D1F0D 50%, #162616 100%);
  color: var(--color-white);
  transform: rotateY(180deg);
  text-align: center;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 4px 12px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(76, 175, 139, 0.3);
}

.step4-card-back-badge {
  font-size: clamp(10px, 2.5vw, 12px);
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 12px;
}

.step4-card-back-discount {
  font-size: clamp(52px, 14vw, 80px);
  font-weight: 800;
  color: var(--color-white);
  line-height: 1;
  margin-bottom: 8px;
  text-shadow: 0 4px 24px rgba(76, 175, 139, 0.5);
}

.step4-card-back-discount span {
  font-size: clamp(26px, 7vw, 40px);
  font-weight: 700;
}

.step4-card-back-text {
  font-size: clamp(12px, 3.2vw, 14px);
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.4;
}

/* Back Face Glow */
.step4-card-back::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: radial-gradient(circle at center, rgba(76, 175, 139, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

/* Card Float Animation */
.step4-card-container.animate-in .step4-card {
  animation: cardFloat 3s ease-in-out infinite;
}

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

/* Stop float when flipped */
.step4-card-container.animate-in .step4-card.flipped {
  animation: none;
}

/* Pulse Glow for CTA */
.step4-card-pulse {
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow:
      0 8px 32px rgba(76, 175, 139, 0.35),
      0 4px 12px rgba(0, 0, 0, 0.1);
  }
  50% {
    box-shadow:
      0 8px 32px rgba(76, 175, 139, 0.35),
      0 4px 12px rgba(0, 0, 0, 0.1),
      0 0 40px rgba(76, 175, 139, 0.5);
  }
}

/* Flip Shine Effect */
@keyframes flipShine {
  0% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}

.step4-card.flipped .step4-card-front::after {
  opacity: 1;
  animation: flipShine 0.4s ease 0.3s;
}

/* Final CTA */
.step4-cta {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.6s ease 0.3s, transform 0.6s ease 0.3s;
  text-align: center;
}

.step4-cta.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.step4-cta-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--color-accent) 0%, #3D9A7A 100%);
  color: var(--color-white);
  font-family: var(--font-primary);
  font-size: clamp(16px, 4vw, 18px);
  font-weight: 600;
  border: none;
  border-radius: var(--radius-lg);
  padding: 20px 52px;
  cursor: pointer;
  box-shadow:
    0 6px 20px rgba(76, 175, 139, 0.35),
    0 2px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.step4-cta-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.step4-cta-button:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 28px rgba(76, 175, 139, 0.45),
    0 4px 10px rgba(0, 0, 0, 0.12);
}

.step4-cta-button:hover::before {
  left: 100%;
}

.step4-cta-button:active {
  transform: translateY(0) scale(0.98);
  box-shadow:
    0 2px 8px rgba(76, 175, 139, 0.3),
    0 1px 3px rgba(0, 0, 0, 0.1);
}

.step4-cta-button svg {
  width: 20px;
  height: 20px;
}

/* Confetti Container */
.step4-confetti {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}

/* Confetti Particle */
.step4-confetti-particle {
  position: absolute;
  top: -20px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0deg) scale(1);
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg) scale(0.5);
    opacity: 0;
  }
}

/* Confetti Burst */
@keyframes confettiBurst {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(30vh) translateX(var(--drift)) rotate(360deg);
    opacity: 0;
  }
}

/* Sparkle Effect */
.step4-sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--color-accent);
  border-radius: 50%;
  animation: sparkle 0.6s ease-out forwards;
}

@keyframes sparkle {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  50% {
    transform: scale(1.5);
  }
  100% {
    transform: scale(0);
    opacity: 0;
  }
}

/* Discount Scale Animation */
@keyframes discountPop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  60% {
    transform: scale(1.15);
    opacity: 1;
  }
  80% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.step4-card-back-discount {
  opacity: 0;
}

.step4-card.flipped .step4-card-back-discount {
  animation: discountPop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s forwards;
}

/* Badge Animation */
@keyframes badgeSlide {
  0% {
    transform: translateY(-10px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.step4-card-back-badge {
  opacity: 0;
}

.step4-card.flipped .step4-card-back-badge {
  animation: badgeSlide 0.4s ease 0.3s forwards;
}

/* Back Text Animation */
@keyframes textFadeIn {
  0% {
    transform: translateY(10px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.step4-card-back-text {
  opacity: 0;
}

.step4-card.flipped .step4-card-back-text {
  animation: textFadeIn 0.4s ease 0.7s forwards;
}

/* Card Reveal Animation */
@keyframes cardReveal {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.step4-card-container.revealed .step4-card {
  animation: cardReveal 0.5s ease;
}

/* Animation Classes */
.step4-anim {
  opacity: 0;
  transform: translateY(14px);
}

.step4-anim.step4-visible {
  animation: step4FadeIn 0.6s ease forwards;
}

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

.step4-delay-1 { animation-delay: 0.1s !important; }
.step4-delay-2 { animation-delay: 0.3s !important; }
.step4-delay-3 { animation-delay: 0.5s !important; }
.step4-delay-4 { animation-delay: 0.7s !important; }
.step4-delay-5 { animation-delay: 0.9s !important; }
