/**
 * Marketing Popup Styles
 */

/* Overlay */
.marketing-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #D9D9D980;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  padding: 20px;
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.marketing-popup-overlay.is-visible {
  display: flex;
}

.marketing-popup-overlay.is-active {
  opacity: 1;
}

/* Container */
.marketing-popup-container {
  background: #FFFCE1;
  border-radius: 37px;
  max-width: 940px;
  max-height: 560px;
  width: 100%;
  height: 100%;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  transform: translateY(20px);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.marketing-popup-container:focus-visible {
  outline: none;
}

.marketing-popup-overlay.is-active .marketing-popup-container {
  transform: translateY(0);
}

/* Close Button */
.marketing-popup-close {
  position: absolute;
  top: 30px;
  right: 30px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 15;
  transition: opacity 0.2s ease;
}

.marketing-popup-close:hover {
  opacity: 0.7;
}

.marketing-popup-close svg {
  width: 43px;
  height: 42px;
  display: block;
}

/* Content Layout */
.marketing-popup-content {
  display: flex;
  height: 100%;
}

/* Form Section */
.marketing-popup-form {
  flex: 1;
  padding: 70px 50px 70px 70px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.popup-title {
  font-size: 36px;
  font-weight: 600;
  line-height: 1.2;
  color: #2a402f;
  margin: 0 0 20px 0;
  font-family: var(--wp--preset--font-family--epilogue, "Epilogue", sans-serif);
}

.popup-description {
  font-size: 18px;
  line-height: 1.5;
  color: #000000;
  margin: 0 0 30px 0;
  font-weight: 500;
}

/* Newsletter Form */
.popup-newsletter-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-field label {
  font-size: 14px;
  font-weight: 500;
  color: #000000;
  opacity: .5;
  margin-bottom: 0;
}

.popup-newsletter-form input[type="text"],
.popup-newsletter-form input[type="email"] {
  padding: 0;
  border: none;
  border-bottom: 4px solid #00000026;
  font-size: 14px;
  background: transparent;
}

.popup-newsletter-form input[type="text"]:focus,
.popup-newsletter-form input[type="email"]:focus {
  outline: none;
  border-color: #f99c28;
}

/* CTA Button Wrapper */
.popup-cta-wrapper {
  margin-top: 35px;
}

.popup-cta-wrapper .cta-button {
  width: 100%;
  justify-content: space-between;
  font-size: 18px;
  font-weight: 600;
}

/* Form Message */
.popup-form-message {
  margin-top: 20px;
  padding: 15px;
  border-radius: 8px;
  font-size: 16px;
  text-align: center;
}

.popup-form-message.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.popup-form-message.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Image Section */
.marketing-popup-image {
  flex: 1;
  position: relative;
  overflow: hidden;
  border-radius: 0 37px 37px 0;
}

.popup-featured-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Stickers - positioned over entire popup container */
.popup-stickers {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.popup-sticker {
  position: absolute;
  top: var(--desktop-top);
  right: var(--desktop-right);
  bottom: var(--desktop-bottom);
  left: var(--desktop-left);
  transform: var(--desktop-transform);
  z-index: 10;
}

.popup-sticker img {
  width: var(--desktop-width);
  height: auto;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.15));
}

/* Sticker positioning helpers */
.popup-sticker.sticker-1 {
  z-index: 13;
}

.popup-sticker.sticker-2 {
  z-index: 12;
}

.popup-sticker.sticker-3 {
  z-index: 11;
}

.popup-sticker.sticker-4 {
  z-index: 14;
}

/* Custom Form Support */
.popup-custom-form {
  margin-top: 20px;
}

.popup-custom-form form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .marketing-popup-container {
    max-width: calc(100% - 40px);
    max-height: 650px;
    margin: 20px;
  }

  .marketing-popup-overlay {
    padding: 0;
  }

  .marketing-popup-content {
    flex-direction: column;
    min-height: auto;
  }

  .marketing-popup-form {
    padding: 25px 30px;
  }

  .popup-title {
    font-size: 28px;
  }

  .popup-description {
    font-size: 16px;
  }

  .marketing-popup-image {
    border-radius: 0;
    height: 300px;
    order: -1; /* Move image to top on mobile */
  }

  .popup-cta-wrapper {
    margin-top: 0;
  }

  /* Mobile sticker positions */
  .popup-sticker {
    top: var(--mobile-top);
    right: var(--mobile-right);
    bottom: var(--mobile-bottom);
    left: var(--mobile-left);
    transform: var(--mobile-transform);
  }

  .popup-sticker img {
    width: var(--mobile-width);
  }

  .marketing-popup-close {
    top: 34px;
    right: 30px;
  }

  .popup-featured-image {
    object-position: 50% 30%;
  }
}

/* Accessibility */
.marketing-popup-overlay[aria-hidden="true"] {
  pointer-events: none;
}

.marketing-popup-overlay[aria-hidden="false"] {
  pointer-events: auto;
}

/* Loading state */
.popup-newsletter-form.is-loading {
  pointer-events: none;
  opacity: 0.6;
}

.popup-newsletter-form.is-loading .cta-button {
  position: relative;
}

.popup-newsletter-form.is-loading .cta-button::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spinner 0.8s linear infinite;
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}
