/* ============================================
   3D ANIMATED SUCCESS ICON
   ============================================ */

/* Container for 3D perspective */
.success-icon-3d {
  width: 60px;
  height: 60px;
  position: relative;
  perspective: 1000px;
  margin: 0 auto;
}

/* Circle background with 3D transform */
.success-circle-3d {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  animation: successCirclePop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Front circle with gradient */
.success-circle-front {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 
    0 8px 16px rgba(16, 185, 129, 0.3),
    0 4px 6px rgba(0, 0, 0, 0.2),
    inset 0 2px 4px rgba(255, 255, 255, 0.3);
  transform: translateZ(20px);
}

/* Side depth ring */
.success-circle-side {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(180deg, #059669 0%, #047857 100%);
  transform: translateZ(0px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Checkmark container */
.success-checkmark-3d {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translateZ(30px);
  width: 50%;
  height: 50%;
  animation: checkmarkDraw 0.5s cubic-bezier(0.65, 0, 0.45, 1) 0.4s forwards;
  opacity: 0;
}

/* Checkmark path animation */
.success-checkmark-check {
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: successStroke 0.4s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

/* Confetti particles */
.success-confetti {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  opacity: 0;
}

.success-confetti:nth-child(1) {
  background: #fbbf24;
  top: 20%;
  left: 10%;
  animation: successConfettiBurst1 1s ease-out 0.8s forwards;
}

.success-confetti:nth-child(2) {
  background: #ef4444;
  top: 20%;
  right: 10%;
  animation: successConfettiBurst2 1s ease-out 0.85s forwards;
}

.success-confetti:nth-child(3) {
  background: #3b82f6;
  top: 40%;
  left: 5%;
  animation: successConfettiBurst3 1s ease-out 0.9s forwards;
}

.success-confetti:nth-child(4) {
  background: #a855f7;
  top: 40%;
  right: 5%;
  animation: successConfettiBurst4 1s ease-out 0.95s forwards;
}

.success-confetti:nth-child(5) {
  background: #10b981;
  bottom: 30%;
  left: 15%;
  animation: successConfettiBurst5 1s ease-out 1s forwards;
}

.success-confetti:nth-child(6) {
  background: #f97316;
  bottom: 30%;
  right: 15%;
  animation: successConfettiBurst6 1s ease-out 1.05s forwards;
}

/* Glow pulse effect */
.success-glow {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.4) 0%, transparent 70%);
  animation: successGlow 2s ease-in-out infinite;
  transform: translateZ(10px);
}

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */

/* Circle pop in with 3D rotation */
@keyframes successCirclePop {
  0% {
    transform: scale(0) rotateY(-180deg) rotateX(-30deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.1) rotateY(-10deg) rotateX(-5deg);
  }
  100% {
    transform: scale(1) rotateY(0deg) rotateX(0deg);
    opacity: 1;
  }
}

/* Checkmark draw in */
@keyframes checkmarkDraw {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) translateZ(30px) scale(0.5);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) translateZ(30px) scale(1);
  }
}

/* Checkmark stroke animation */
@keyframes successStroke {
  0% {
    stroke-dashoffset: 48;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

/* Glow pulse */
@keyframes successGlow {
  0%, 100% {
    opacity: 0.6;
    transform: translateZ(10px) scale(1);
  }
  50% {
    opacity: 1;
    transform: translateZ(10px) scale(1.1);
  }
}

/* Confetti burst animations */
@keyframes successConfettiBurst1 {
  0%, 75% { opacity: 0; }
  75% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(-60px, -80px) rotate(180deg);
  }
}

@keyframes successConfettiBurst2 {
  0%, 75% { opacity: 0; }
  75% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(60px, -80px) rotate(-180deg);
  }
}

@keyframes successConfettiBurst3 {
  0%, 75% { opacity: 0; }
  75% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(-80px, -40px) rotate(90deg);
  }
}

@keyframes successConfettiBurst4 {
  0%, 75% { opacity: 0; }
  75% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(80px, -40px) rotate(-90deg);
  }
}

@keyframes successConfettiBurst5 {
  0%, 75% { opacity: 0; }
  75% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(-50px, 60px) rotate(270deg);
  }
}

@keyframes successConfettiBurst6 {
  0%, 75% { opacity: 0; }
  75% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(50px, 60px) rotate(-270deg);
  }
}

/* 3D Effect for Success Container */
.success-circle-container {
  perspective: 1000px;
  transform-style: preserve-3d;
}

/* Responsive Design */
@media (max-width: 640px) {
  .success-icon-3d {
    width: 50px;
    height: 50px;
  }
}

/* Success Modal Fade In */
@keyframes successModalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Apply to modal when shown */
#success-modal:not(.hidden) > div > div {
  animation: successModalFadeIn 0.3s ease-out forwards;
}

#edit-success-modal:not(.hidden) > div > div {
  animation: successModalFadeIn 0.3s ease-out forwards;
}
