/* ============================================================
   WELLERDEVELER CHECKOUT MODAL
   Reusable, themeable payment modal for all WellerDeveler sites.
   ============================================================ */

/* ---- Overlay ---- */
.wdv-co-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
}

.wdv-co-overlay.wdv-co-open {
  opacity: 1;
  visibility: visible;
}

/* ---- Backdrop ---- */
.wdv-co-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ---- Modal ---- */
.wdv-co-modal {
  position: relative;
  width: 94%;
  max-width: 480px;
  max-height: 92vh;
  overflow-y: auto;
  background: #111118;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 120px rgba(236, 72, 153, 0.08),
    0 0 120px rgba(139, 92, 246, 0.06);
  transform: translateY(20px) scale(0.95);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 0;
}

.wdv-co-open .wdv-co-modal {
  transform: translateY(0) scale(1);
}

/* Scrollbar */
.wdv-co-modal::-webkit-scrollbar { width: 6px; }
.wdv-co-modal::-webkit-scrollbar-track { background: transparent; }
.wdv-co-modal::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

/* ---- Close button ---- */
.wdv-co-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #a1a1aa;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}

.wdv-co-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #f4f4f5;
  transform: scale(1.1);
}

/* ---- Header / Brand ---- */
.wdv-co-header {
  padding: 24px 28px 0;
}

.wdv-co-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wdv-co-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
}

.wdv-co-brand-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #a1a1aa;
  letter-spacing: 0.01em;
}

/* ---- Stage: Select ---- */
.wdv-co-stage {
  padding: 20px 28px 28px;
}

.wdv-co-title {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: #f4f4f5;
  margin-bottom: 4px;
}

.wdv-co-subtitle {
  color: #71717a;
  font-size: 0.95rem;
  margin-bottom: 20px;
}

/* ---- Amount buttons ---- */
.wdv-co-amounts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.wdv-co-amt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  color: #f4f4f5;
}

.wdv-co-amt:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.wdv-co-amt-active {
  background: rgba(139, 92, 246, 0.15) !important;
  border-color: #8b5cf6 !important;
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.2);
  transform: translateY(-2px) scale(1.02);
}

.wdv-co-amt-pop {
  position: relative;
}

.wdv-co-amt-pop::before {
  content: 'Popular';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: #fff;
  white-space: nowrap;
}

.wdv-co-amt-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.wdv-co-amt-price {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
}

.wdv-co-amt-label {
  font-size: 0.7rem;
  color: #71717a;
  font-weight: 500;
}

/* ---- Custom amount ---- */
.wdv-co-custom-row {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.wdv-co-custom-row:focus-within {
  border-color: #8b5cf6;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.15);
}

.wdv-co-custom-currency {
  padding: 0 4px 0 16px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: #71717a;
}

.wdv-co-custom-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 14px 16px 14px 4px;
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #f4f4f5;
  -moz-appearance: textfield;
}

.wdv-co-custom-input::placeholder {
  color: #52525b;
  font-weight: 400;
}

.wdv-co-custom-input::-webkit-outer-spin-button,
.wdv-co-custom-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ---- Pay button ---- */
.wdv-co-pay-btn {
  width: 100%;
  padding: 16px 24px;
  border-radius: 16px;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: #fff;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
  margin-bottom: 16px;
}

.wdv-co-pay-btn:not(:disabled):hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 30px rgba(139, 92, 246, 0.45);
}

.wdv-co-pay-btn:not(:disabled):active {
  transform: translateY(1px) scale(0.98);
}

.wdv-co-pay-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.wdv-co-pay-amount {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.95rem;
}

/* ---- Trust badges ---- */
.wdv-co-trust {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.wdv-co-trust-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #52525b;
  letter-spacing: 0.02em;
}

.wdv-co-trust-item svg {
  opacity: 0.6;
}

/* ---- Stage: Payment ---- */
.wdv-co-stage-pay {
  min-height: 400px;
}

.wdv-co-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: #71717a;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  margin-bottom: 12px;
  transition: color 0.2s;
}

.wdv-co-back:hover {
  color: #f4f4f5;
}

.wdv-co-stripe-mount {
  min-height: 300px;
}

/* ---- Loading spinner ---- */
.wdv-co-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 0;
  color: #71717a;
  font-size: 0.9rem;
}

.wdv-co-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-top-color: #8b5cf6;
  border-radius: 50%;
  animation: wdvSpin 0.8s linear infinite;
}

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

/* ---- Stage: Success ---- */
.wdv-co-stage-success {
  text-align: center;
  padding: 48px 28px;
}

.wdv-co-success-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  animation: wdvBounceIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes wdvBounceIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.wdv-co-success-detail {
  color: #a1a1aa;
  font-size: 0.9rem;
  margin-top: 8px;
  margin-bottom: 24px;
}

.wdv-co-done-btn {
  padding: 14px 32px;
  border-radius: 14px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  border: none;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3);
}

.wdv-co-done-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 30px rgba(34, 197, 94, 0.4);
}

/* ---- Stage: Error ---- */
.wdv-co-stage-error {
  text-align: center;
  padding: 48px 28px;
}

.wdv-co-error-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

/* ---- Mobile ---- */
@media (max-width: 480px) {
  .wdv-co-modal {
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    border-radius: 20px 20px 0 0;
    position: fixed;
    bottom: 0;
    transform: translateY(100%);
  }

  .wdv-co-open .wdv-co-modal {
    transform: translateY(0);
  }

  .wdv-co-amounts {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }

  .wdv-co-amt {
    padding: 12px 4px;
  }

  .wdv-co-amt-price {
    font-size: 1.1rem;
  }

  .wdv-co-amt-pop::before {
    font-size: 0.55rem;
    padding: 1px 6px;
  }

  .wdv-co-stage {
    padding: 16px 20px 24px;
  }

  .wdv-co-header {
    padding: 20px 20px 0;
  }
}
