/* Single source: payment error modal + processing overlay for all GraceSong checkouts.
   Enqueued via gracesong_funnel_enqueue_payment_error_assets() in functions.php */
.gs-pay-err-modal {
  --gs-pe-cream: #faf6f0;
  --gs-pe-text: #2a1f15;
  --gs-pe-text-soft: #6b5a4a;
  --gs-pe-text-muted: #8a7864;
  --gs-pe-gold: #c4973a;
  --gs-pe-gold-light: #d9b05c;
  --gs-pe-border: #e8ddc8;
  --gs-pe-tip-bg: #f5ecd8;
  --gs-pe-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  font-family: var(--gs-pe-sans);
  -webkit-font-smoothing: antialiased;
}

.gs-pay-err-modal.is-open {
  display: flex;
}

.gs-pay-err-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(42, 31, 21, 0.54);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.gs-pay-err-modal__panel {
  position: relative;
  width: min(100%, 360px);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #fffcf8;
  border: 1px solid var(--gs-pe-border);
  border-radius: 20px;
  padding: 28px 24px 22px;
  box-shadow:
    0 24px 64px rgba(42, 31, 21, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.6) inset;
  text-align: center;
}

.gs-pay-err-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(42, 31, 21, 0.06);
  color: var(--gs-pe-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.gs-pay-err-modal__close svg {
  display: block;
  width: 16px;
  height: 16px;
}

.gs-pay-err-modal__close:hover {
  background: rgba(42, 31, 21, 0.1);
  color: var(--gs-pe-text);
}

.gs-pay-err-modal__close:active {
  transform: scale(0.95);
}

.gs-pay-err-modal__close:focus-visible {
  outline: 2px solid var(--gs-pe-gold);
  outline-offset: 2px;
}

.gs-pay-err-modal__icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f8f0e4 0%, #ede0c8 100%);
  border: 1px solid var(--gs-pe-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gs-pe-gold);
  flex-shrink: 0;
}

.gs-pay-err-modal__icon svg {
  display: block;
  width: 26px;
  height: 26px;
}

.gs-pay-err-modal__title {
  margin: 0 0 12px;
  font-family: var(--gs-pe-sans);
  font-weight: 700;
  font-size: 19px;
  line-height: 1.3;
  color: var(--gs-pe-text);
  letter-spacing: -0.3px;
}

.gs-pay-err-modal__body {
  margin: 0 0 16px;
  font-family: var(--gs-pe-sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.55;
  color: var(--gs-pe-text-soft);
}

.gs-pay-err-modal__tip-wrap {
  margin: 0 0 22px;
  padding: 12px 14px;
  background: var(--gs-pe-tip-bg);
  border-radius: 12px;
  border: 1px solid rgba(196, 151, 58, 0.22);
  text-align: left;
}

.gs-pay-err-modal__tip-wrap.is-hidden {
  display: none;
}

.gs-pay-err-modal__tip {
  margin: 0;
  font-family: var(--gs-pe-sans);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.45;
  color: #5c4523;
}

.gs-pay-err-modal__btn {
  width: 100%;
  border: none;
  border-radius: 100px;
  padding: 16px 20px;
  background: linear-gradient(180deg, var(--gs-pe-gold-light) 0%, var(--gs-pe-gold) 100%);
  color: #fff;
  font-family: var(--gs-pe-sans);
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
  letter-spacing: -0.2px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(196, 151, 58, 0.38);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.gs-pay-err-modal__btn:hover {
  filter: brightness(1.04);
}

.gs-pay-err-modal__btn:active {
  transform: scale(0.98);
}

.gs-pay-err-modal__btn:focus-visible {
  outline: 2px solid var(--gs-pe-gold);
  outline-offset: 3px;
}

body.gs-pay-err-modal-open {
  overflow: hidden;
}

@media (max-width: 380px) {
  .gs-pay-err-modal {
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .gs-pay-err-modal__panel {
    padding: 24px 20px 20px;
    border-radius: 18px;
  }

  .gs-pay-err-modal__title {
    font-size: 18px;
  }
}

/* Payment processing overlay — shared across checkout funnels */
.ms-payment-overlay {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: rgba(36, 24, 16, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.ms-payment-overlay.is-visible,
.ms-payment-overlay[style*='flex'] {
  display: flex;
}

.ms-payment-overlay__card {
  width: 100%;
  max-width: 320px;
  background: #fffcf8;
  border: 1px solid #e8ddc8;
  border-radius: 18px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 12px 48px rgba(61, 43, 31, 0.22);
}

.ms-payment-spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 16px;
  border: 3px solid #e8ddd0;
  border-top-color: #c4973a;
  border-radius: 50%;
  box-sizing: border-box;
  transform-origin: center center;
  animation: gs-payment-spin 0.8s linear infinite;
}

@keyframes gs-payment-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.ms-payment-overlay__title {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #2a1f15;
  margin: 0 0 8px;
  line-height: 1.3;
}

.ms-payment-overlay__sub {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
  color: #8a7864;
  margin: 0;
  line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
  .ms-payment-spinner {
    animation: gs-payment-spin 0.8s linear infinite !important;
  }
}

body.gs-payment-processing-open {
  overflow: hidden;
}
