/**
 * Newsletter form states + result popup
 *
 * @package coursepree
 */

/* Spam trap: invisible to people, filled in by bots */
.cp-newsletter-trap {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Loading state on the submit button */
.sp-newsletter-form {
  position: relative;
}

.sp-newsletter-form.is-loading [type="submit"] {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.sp-newsletter-form.is-loading [type="submit"]::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: cp-nl-spin 0.7s linear infinite;
}

@keyframes cp-nl-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Popup */
body.cp-nl-popup-open {
  overflow: hidden;
}

.cp-nl-popup {
  --cp-nl-accent: #22b07d;
  position: fixed;
  inset: 0;
  z-index: 100001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background-color: rgba(40, 47, 62, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.cp-nl-popup[hidden] {
  display: none;
}

.cp-nl-popup.is-open {
  opacity: 1;
}

.cp-nl-popup[data-type="info"] {
  --cp-nl-accent: #33a1fd;
}

.cp-nl-popup[data-type="error"] {
  --cp-nl-accent: #f0506e;
}

.cp-nl-popup__dialog {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 40px 32px 32px;
  border-radius: 24px;
  text-align: center;
  background-color: #fff;
  box-shadow: 0 24px 80px rgba(40, 47, 62, 0.25);
  transform: translateY(16px) scale(0.96);
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.cp-nl-popup.is-open .cp-nl-popup__dialog {
  transform: none;
}

.cp-nl-popup__dialog::before {
  content: "";
  position: absolute;
  top: 0;
  right: 50%;
  width: 48px;
  height: 3px;
  transform: translateX(50%);
  border-radius: 0 0 3px 3px;
  background-color: #f9bf22;
}

.cp-nl-popup__close {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  font-size: 22px;
  line-height: 1;
  color: #8d9bb6;
  background-color: #f7f8fe;
  transition: all 0.2s ease;
}

.cp-nl-popup__close:hover {
  color: #282f3e;
  background-color: #ebecf2;
}

.cp-nl-popup__icon {
  width: 84px;
  height: 84px;
  margin: 0 auto 20px;
  padding: 10px;
  border-radius: 50%;
  color: var(--cp-nl-accent);
  background-color: #f2f6fa;
  background-color: color-mix(in srgb, var(--cp-nl-accent) 12%, #fff);
}

.cp-nl-popup__icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cp-nl-popup__ring {
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
}

.cp-nl-popup__check {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
}

.cp-nl-popup.is-open .cp-nl-popup__ring {
  animation: cp-nl-draw 0.6s ease-out 0.1s forwards;
}

.cp-nl-popup.is-open .cp-nl-popup__check {
  animation: cp-nl-draw 0.4s ease-out 0.6s forwards;
}

@keyframes cp-nl-draw {
  to {
    stroke-dashoffset: 0;
  }
}

.cp-nl-popup__title {
  margin: 0 0 10px;
  font-size: 20px;
  line-height: 1.5;
  color: #282f3e;
}

.cp-nl-popup__text {
  margin: 0 0 28px;
  font-size: 14px;
  line-height: 1.9;
  color: #586889;
  overflow-wrap: anywhere;
}

.cp-nl-popup__ok {
  min-width: 140px;
  padding: 12px 32px;
}

@media only screen and (max-width: 575px) {
  .cp-nl-popup__dialog {
    padding: 36px 20px 24px;
    border-radius: 20px;
  }

  .cp-nl-popup__icon {
    width: 72px;
    height: 72px;
  }

  .cp-nl-popup__title {
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cp-nl-popup,
  .cp-nl-popup__dialog {
    transition: none;
  }

  .cp-nl-popup__ring,
  .cp-nl-popup__check {
    stroke-dashoffset: 0;
    animation: none !important;
  }
}
