/**
 * @file
 * GoFundMe Popup styles.
 */

/* Overlay */
.gofundme-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Visible state */
.gofundme-popup-overlay.gofundme-popup--visible {
  opacity: 1;
  visibility: visible;
}

/* Hidden state */
.gofundme-popup-overlay.gofundme-popup--hidden {
  opacity: 0;
  visibility: hidden;
}

/* Popup container */
.gofundme-popup {
  position: relative;
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  margin: 20px;
  display: flex;
  flex-direction: column;
}

/* Close button */
.gofundme-popup__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  background-color: #21212A;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.2s ease;
}

.gofundme-popup__close:hover {
  background-color: #11853D;
}

.gofundme-popup__close::before,
.gofundme-popup__close::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 2px;
  background-color: #ffffff;
}

.gofundme-popup__close::before {
  transform: rotate(45deg);
}

.gofundme-popup__close::after {
  transform: rotate(-45deg);
}

/* Content area */
.gofundme-popup__content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* Ensure iframe takes full width */
.gofundme-popup__content iframe {
  width: 100%;
  min-height: 500px;
  border: none;
}

/* Responsive styles */
@media screen and (max-width: 850px) {
  .gofundme-popup {
    max-width: calc(100% - 40px);
    margin: 20px;
  }
}

@media screen and (max-width: 600px) {
  .gofundme-popup {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
  }

  .gofundme-popup__close {
    top: 15px;
    right: 15px;
  }

  .gofundme-popup__content {
    padding: 15px;
    padding-top: 60px;
  }

  .gofundme-popup__content iframe {
    min-height: 400px;
  }
}

/* Classy embed specific styles (GoFundMe uses Classy) */
.gofundme-popup__content .classy-inline-embed {
  width: 100%;
  min-height: 500px;
}

/* ========================================
   LOADING STATE STYLES
   ======================================== */

/* Loading container */
.gofundme-popup__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: 40px 20px;
  text-align: center;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.gofundme-popup__loading.fade-out {
  opacity: 0;
}

/* CSS-only spinner */
.gofundme-popup__spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #11853D; /* IPA green color */
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Loading text */
.gofundme-popup__loading-text {
  font-size: 16px;
  color: #333333;
  margin: 0;
  font-weight: 500;
}

/* Form container - starts invisible but in DOM so Classy SDK can render */
.gofundme-popup__form-container {
  transition: opacity 0.4s ease;
}

.gofundme-popup__form-container.fade-in {
  opacity: 1 !important;
}

/* ========================================
   ERROR STATE STYLES
   ======================================== */

.gofundme-popup__error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: 40px 20px;
  text-align: center;
}

.gofundme-popup__error-text {
  font-size: 16px;
  color: #d32f2f;
  margin: 0 0 20px 0;
  font-weight: 500;
}

.gofundme-popup__error-close {
  padding: 10px 24px;
  background-color: #11853D;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.gofundme-popup__error-close:hover {
  background-color: #0d6a31;
}

.gofundme-popup__error-close:focus {
  outline: 2px solid #11853D;
  outline-offset: 2px;
}

/* ========================================
   DEFAULT POPUP STYLES
   ======================================== */

.gofundme-popup__default-content {
  display: flex;
  flex-direction: row;
  gap: 30px;
  width: 100%;
  align-items: flex-start;
}

.gofundme-popup__image-wrapper {
  flex: 0 0 45%;
  max-width: 45%;
}

.gofundme-popup__image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  border-radius: 8px;
  max-height: 400px;
}

.gofundme-popup__text-content {
  flex: 1;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* When there's no image, center the text content */
.gofundme-popup__default-content:not(:has(.gofundme-popup__image-wrapper)) .gofundme-popup__text-content {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.gofundme-popup__default-content:not(:has(.gofundme-popup__image-wrapper)) .gofundme-popup__button {
  margin: 0 auto;
}

.gofundme-popup__title {
  font-size: 28px;
  font-weight: 700;
  color: #21212A;
  margin: 0 0 20px 0;
  line-height: 1.3;
}

.gofundme-popup__text {
  font-size: 16px;
  line-height: 1.6;
  color: #333333;
  margin: 0 0 30px 0;
}

.gofundme-popup__button {
  display: inline-block;
  padding: 14px 40px;
  background-color: #21212A;
  color: #ffffff;
  text-decoration: none;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  transition: background-color 0.2s ease, transform 0.1s ease;
  cursor: pointer;
  border: none;
}

.gofundme-popup__button:hover {
  background-color: #11853D;
  color: #ffffff;
  transform: translateY(-1px);
}

.gofundme-popup__button:active {
  transform: translateY(0);
}

.gofundme-popup__button:focus {
  outline: 2px solid #11853D;
  outline-offset: 2px;
}

/* Responsive styles for default popup */
/* Tablet: Stack vertically on medium screens */
@media screen and (max-width: 768px) {
  .gofundme-popup__default-content {
    flex-direction: column;
    gap: 20px;
  }

  .gofundme-popup__image-wrapper {
    flex: 0 0 auto;
    max-width: 100%;
    width: 100%;
  }

  .gofundme-popup__image {
    max-height: 300px;
  }

  .gofundme-popup__text-content {
    flex: 1;
  }
}

/* Mobile: Further adjustments for small screens */
@media screen and (max-width: 600px) {
  .gofundme-popup__default-content {
    gap: 15px;
  }

  .gofundme-popup__image-wrapper {
    margin: 0;
  }

  .gofundme-popup__image {
    max-height: 250px;
  }

  .gofundme-popup__text-content {
    padding: 0;
  }

  .gofundme-popup__title {
    font-size: 22px;
    margin-bottom: 15px;
  }

  .gofundme-popup__text {
    font-size: 14px;
    margin-bottom: 20px;
  }

  .gofundme-popup__button {
    width: 100%;
    padding: 12px 30px;
  }
}

