/*
  Reusable submit success popup.

  To use on any form:
  1. Add data-im-submit-effect to the form.
  2. Make sure the form has a submit button.
  3. Optional: add data-im-submit-success-title and data-im-submit-success-message.
  4. Plane animation is disabled by default. Add data-im-submit-plane="true" to re-enable later.
*/

.im-submit-effect-plane {
  position: fixed;
  top: var(--im-plane-start-y, calc(100vh - 6rem));
  left: var(--im-plane-start-x, calc(100vw - 8rem));
  z-index: 100005;
  display: grid;
  width: 1.5rem;
  height: 1.5rem;
  place-items: center;
  filter: drop-shadow(0 18px 24px rgba(15, 23, 42, 0.3));
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: imSubmitPlaneFly 1.25s cubic-bezier(0.18, 0.78, 0.2, 1) forwards;
}

.im-submit-effect-frame {
  position: absolute;
  width: 0;
  height: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.im-submit-effect-plane::before {
  content: "";
  width: 100%;
  height: 100%;
  background: #ffffff;
  clip-path: polygon(4% 48%, 96% 5%, 62% 95%, 48% 58%, 4% 48%, 42% 52%, 74% 22%, 50% 58%);
  transform: rotate(-18deg);
}

@keyframes imSubmitPlaneFly {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5) rotate(8deg);
  }

  12% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.95) rotate(-8deg);
  }

  55% {
    opacity: 1;
    transform: translate(calc(-50% - 32vw), calc(-50% - 20vh)) scale(2.4) rotate(-18deg);
  }

  100% {
    opacity: 0;
    transform: translate(calc(-50% - 112vw), calc(-50% - 54vh)) scale(3.7) rotate(-24deg);
  }
}

.im-submit-success-popup {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 100006;
  display: grid;
  width: min(22rem, calc(100vw - 2rem));
  gap: 0.2rem;
  padding: 1rem 2.75rem 1rem 1.1rem;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 0.85rem;
  background: #ffffff;
  color: #111827;
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.7rem) scale(0.96);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.im-submit-success-popup.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.im-submit-success-popup strong {
  color: #2563eb;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.2;
}

.im-submit-success-popup span {
  color: #475569;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
}

.im-submit-success-close {
  position: absolute;
  top: 0.5rem;
  right: 0.55rem;
  display: grid;
  width: 1.8rem;
  height: 1.8rem;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: #f0f4ff;
  color: #2563eb;
  cursor: pointer;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
  padding: 0;
}

.im-submit-success-close:hover {
  background: #2563eb;
  color: #ffffff;
}

@media (max-width: 759px) {
  .im-submit-effect-plane {
    width: 2rem;
    height: 2rem;
  }

  .im-submit-success-popup {
    right: 0.75rem;
    bottom: 0.75rem;
    width: calc(100vw - 1.5rem);
  }
}
