/* ============================================================
   SPARK4BRAND — Form Success Overlay
   Apple-grade confirmation animation
   ============================================================ */

/* ── Overlay backdrop ───────────────────────────────────────── */
.s4b-success-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 10, 22, 0.88);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  opacity: 0;
  animation: s4b-overlay-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes s4b-overlay-in {
  to { opacity: 1; }
}

/* ── Card ───────────────────────────────────────────────────── */
.s4b-success-card {
  background: linear-gradient(145deg, rgba(20, 28, 52, 0.95), rgba(12, 18, 36, 0.98));
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 24px;
  padding: 56px 48px 48px;
  max-width: 480px;
  width: calc(100% - 48px);
  text-align: center;
  box-shadow:
    0 40px 80px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: scale(0.88) translateY(24px);
  opacity: 0;
  animation: s4b-card-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.15s forwards;
}

@keyframes s4b-card-in {
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* ── Checkmark circle ───────────────────────────────────────── */
.s4b-success-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 28px;
  position: relative;
}

.s4b-success-icon svg {
  width: 72px;
  height: 72px;
}

/* Circle draw */
.s4b-check-circle {
  fill: none;
  stroke: #FF8C00;
  stroke-width: 2.5;
  stroke-dasharray: 201;
  stroke-dashoffset: 201;
  animation: s4b-draw-circle 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.5s forwards;
}

@keyframes s4b-draw-circle {
  to { stroke-dashoffset: 0; }
}

/* Checkmark draw */
.s4b-check-mark {
  fill: none;
  stroke: #FF8C00;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: s4b-draw-check 0.35s cubic-bezier(0.22, 1, 0.36, 1) 1.0s forwards;
}

@keyframes s4b-draw-check {
  to { stroke-dashoffset: 0; }
}

/* Glow pulse after draw */
.s4b-success-icon::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 107, 0, 0.18) 0%, transparent 70%);
  opacity: 0;
  animation: s4b-glow-pulse 1.2s ease-in-out 1.2s infinite alternate;
}

@keyframes s4b-glow-pulse {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1.1); }
}

/* ── Typography ─────────────────────────────────────────────── */
.s4b-success-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
  opacity: 0;
  transform: translateY(12px);
  animation: s4b-text-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) 1.1s forwards;
}

.s4b-success-body {
  font-size: 1rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.72);
  margin: 0 0 32px;
  opacity: 0;
  transform: translateY(10px);
  animation: s4b-text-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) 1.22s forwards;
}

.s4b-success-note {
  font-size: 0.82rem;
  color: rgba(255, 140, 0, 0.85);
  margin: 0 0 36px;
  opacity: 0;
  animation: s4b-text-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) 1.34s forwards;
}

@keyframes s4b-text-in {
  to { opacity: 1; transform: translateY(0); }
}

/* ── Close button ───────────────────────────────────────────── */
.s4b-success-close {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: linear-gradient(135deg, #FF8C00, #E55A00);
  color: #0a0f1e;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  letter-spacing: 0.01em;
  opacity: 0;
  transform: translateY(8px);
  animation: s4b-text-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) 1.46s forwards;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 8px 24px rgba(255, 107, 0, 0.3);
}

.s4b-success-close:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(255, 107, 0, 0.45);
}

.s4b-success-close:active {
  transform: translateY(0);
  transition-duration: 0.1s;
}

/* ── Dismiss on overlay click ───────────────────────────────── */
.s4b-success-overlay.s4b-dismissing {
  animation: s4b-overlay-out 0.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes s4b-overlay-out {
  to { opacity: 0; }
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  .s4b-success-card {
    padding: 40px 28px 36px;
    border-radius: 20px;
  }

  .s4b-success-title {
    font-size: 1.45rem;
  }
}

/* ── Reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .s4b-success-overlay,
  .s4b-success-card,
  .s4b-check-circle,
  .s4b-check-mark,
  .s4b-success-title,
  .s4b-success-body,
  .s4b-success-note,
  .s4b-success-close {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .s4b-success-icon::after {
    animation: none !important;
    opacity: 0.5 !important;
  }
}
