/* ==========================================================================
   Donation Popup — Muhammadiyah Charitable Trust
   Premium modal + floating CTA button
   ========================================================================== */

/* ---------- Overlay ---------- */
#donation-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(11, 79, 54, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
#donation-popup-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ---------- Modal Container ---------- */
#donation-popup-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
#donation-popup-modal.active {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

/* ---------- Modal Card ---------- */
.donation-popup-card {
  position: relative;
  background: #FFFFFF;
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow:
    0 25px 60px -12px rgba(11, 79, 54, 0.25),
    0 8px 24px -8px rgba(0, 0, 0, 0.12);
  max-width: 860px;
  width: 100%;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;

  /* entrance animation */
  transform: translateY(20px) scale(0.96);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
#donation-popup-modal.active .donation-popup-card {
  transform: translateY(0) scale(1);
}

/* ---------- Close Button ---------- */
.donation-popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  color: #17231D;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.donation-popup-close:hover {
  background: #FFFFFF;
  transform: scale(1.08);
}
.donation-popup-close:focus,
.donation-popup-close:focus-visible {
  outline: none !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}
.donation-popup-close svg {
  width: 18px;
  height: 18px;
}

/* ---------- Layout: Desktop (side-by-side) ---------- */
.donation-popup-inner {
  display: flex;
  flex-direction: row;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Image panel */
.donation-popup-image {
  flex: 0 0 44%;
  min-height: 320px;
  position: relative;
  overflow: hidden;
}
.donation-popup-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.donation-popup-image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(11, 79, 54, 0.7) 0%, rgba(11, 79, 54, 0.1) 60%, transparent 100%);
}
.donation-popup-image-badge {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  color: white;
}
.donation-popup-image-badge span {
  display: inline-block;
  background: #D9A928;
  color: #17231D;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.donation-popup-image-badge p {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* Content panel */
.donation-popup-content {
  flex: 1;
  padding: 2.5rem 2.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
}
.donation-popup-eyebrow {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #126B45;
}
.donation-popup-headline {
  font-size: 1.65rem;
  font-weight: 900;
  line-height: 1.18;
  color: #17231D;
}
.donation-popup-text {
  font-size: 0.875rem;
  line-height: 1.65;
  color: #4B5E52;
}
.donation-popup-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  background: #D9A928;
  color: #17231D;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 14px rgba(217, 169, 40, 0.3);
  align-self: flex-start;
}
.donation-popup-cta:hover {
  background: #c49a22;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(217, 169, 40, 0.4);
}
.donation-popup-cta:focus,
.donation-popup-cta:focus-visible {
  outline: none !important;
  box-shadow: 0 4px 18px rgba(217, 169, 40, 0.5) !important;
}
.donation-popup-cta svg {
  width: 16px;
  height: 16px;
}
.donation-popup-trust {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  color: #7A8F82;
  margin-top: 0.25rem;
}
.donation-popup-trust svg {
  width: 14px;
  height: 14px;
  color: #126B45;
  flex-shrink: 0;
}

/* ---------- Floating Donate Button ---------- */
#donation-float-btn {
  position: fixed;
  bottom: 24px;
  right: 72px; /* offset from back-to-top button which is at right:24px */
  z-index: 45;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #126B45, #0B4F36);
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(11, 79, 54, 0.35), 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.25s ease,
              opacity 0.3s ease,
              visibility 0.3s ease;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
}
#donation-float-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
#donation-float-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(11, 79, 54, 0.45), 0 3px 8px rgba(0, 0, 0, 0.12);
}
#donation-float-btn svg {
  width: 15px;
  height: 15px;
}

/* ---------- Mobile Responsive ---------- */
@media (max-width: 768px) {
  #donation-popup-modal {
    padding: 12px;
    align-items: center;
  }

  .donation-popup-card {
    border-radius: 1.25rem;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    max-width: 400px;
    width: 100%;
    overflow: hidden;
  }

  .donation-popup-inner {
    flex-direction: column;
    overflow-y: hidden !important;
  }

  .donation-popup-image {
    flex: none;
    width: 100%;
    aspect-ratio: 1 / 1;
    min-height: 0 !important;
    max-height: 36vh;
    max-height: 36dvh;
    position: relative;
    overflow: hidden;
  }

  .donation-popup-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 22%;
    display: block;
  }

  .donation-popup-content {
    padding: 1.15rem 1.25rem 1.25rem;
    gap: 0.55rem;
  }

  .donation-popup-headline {
    font-size: 1.2rem;
    line-height: 1.25;
  }

  .donation-popup-text {
    font-size: 0.775rem;
    line-height: 1.45;
  }

  .donation-popup-cta {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    outline: none !important;
    box-shadow: 0 4px 14px rgba(217, 169, 40, 0.3) !important;
  }

  .donation-popup-cta:focus,
  .donation-popup-cta:focus-visible {
    outline: none !important;
    box-shadow: 0 4px 18px rgba(217, 169, 40, 0.5) !important;
  }

  .donation-popup-close {
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
  }
  .donation-popup-close svg {
    width: 16px;
    height: 16px;
  }

  .donation-popup-image-badge {
    bottom: 8px;
    left: 12px;
    right: 12px;
  }
  .donation-popup-image-badge span {
    font-size: 0.6rem;
    padding: 2px 8px;
    margin-bottom: 3px;
  }
  .donation-popup-image-badge p {
    font-size: 0.725rem;
    line-height: 1.25;
  }

  /* Float button: smaller on mobile, above back-to-top */
  #donation-float-btn {
    bottom: 72px; /* stack above back-to-top */
    right: 16px;
    padding: 9px 14px;
    font-size: 0.75rem;
  }
}

/* ---------- Tablet ---------- */
@media (min-width: 769px) and (max-width: 1023px) {
  .donation-popup-card {
    max-width: 580px;
  }
  .donation-popup-inner {
    flex-direction: column;
  }
  .donation-popup-image {
    flex: none;
    height: 220px;
  }
  .donation-popup-content {
    padding: 2rem 1.75rem;
  }
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .donation-popup-card {
    transform: none !important;
    transition: none !important;
  }
  #donation-popup-overlay,
  #donation-popup-modal,
  #donation-float-btn {
    transition: opacity 0.15s ease, visibility 0.15s ease !important;
  }
  #donation-float-btn {
    transform: none !important;
  }
}
