/* invoice-surprises.css — Payment Pulse, Bill Again, Pay QR */

.invoice-surprise-btn--bill-again {
  background: linear-gradient(135deg, #15803d 0%, #166534 100%);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
}

.invoice-surprise-btn--bill-again:hover {
  filter: brightness(1.06);
  color: #fff;
}

.invoice-bill-again-ready-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  font-size: 0.92rem;
  line-height: 1.45;
}

.invoice-bill-again-ready-banner__dismiss {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: #047857;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}

/* Bill again — highlight invoice date for quick entry */
.invoice-ov-field--bill-again-focus {
  border-radius: 12px;
  padding: 10px 12px !important;
  margin: -2px -4px 6px;
  scroll-margin-top: 100px;
  scroll-margin-bottom: 72px;
  background: linear-gradient(180deg, #ecfdf5 0%, #f0fdf4 100%);
  box-shadow:
    0 0 0 2px rgba(34, 197, 94, 0.45),
    0 10px 24px rgba(34, 197, 94, 0.12);
  animation: invoice-bill-again-field-pulse 1.6s ease-in-out 2;
  transition: background 0.35s ease, box-shadow 0.35s ease;
}

.invoice-ov-field--bill-again-focus .invoice-ov-label {
  color: #047857 !important;
  font-weight: 700 !important;
}

.invoice-ov-edit-input--bill-again-focus,
#invoicesWrap .invoice-ov-edit-input--bill-again-focus {
  background: #fff !important;
  border-color: #22c55e !important;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2) !important;
}

@keyframes invoice-bill-again-field-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 2px rgba(34, 197, 94, 0.45),
      0 10px 24px rgba(34, 197, 94, 0.12);
  }
  50% {
    box-shadow:
      0 0 0 3px rgba(34, 197, 94, 0.65),
      0 14px 28px rgba(34, 197, 94, 0.18);
  }
}

@media (prefers-reduced-motion: reduce) {
  .invoice-ov-field--bill-again-focus {
    animation: none;
  }
}

/* Payment Pulse overlay */
.invoice-payment-pulse-backdrop {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 35%, rgba(34, 197, 94, 0.18), rgba(15, 23, 42, 0.55) 68%);
  opacity: 0;
  transition: opacity 0.32s ease;
}

.invoice-payment-pulse-backdrop--visible {
  opacity: 1;
}

.invoice-payment-pulse-backdrop--closing {
  opacity: 0;
}

/* Full-screen confetti layer — rains over the whole overlay, above the card */
.invoice-payment-pulse__confetti-mount {
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: visible;
  z-index: 3;
}

.invoice-payment-pulse__confetti-piece {
  position: absolute;
  top: -16px;
  left: var(--x);
  width: 10px;
  height: 15px;
  border-radius: 2px;
  opacity: 0;
  transform: translateY(0) rotate(0deg);
  animation: invoice-pulse-confetti-fall var(--duration) linear var(--delay) infinite;
}

@keyframes invoice-pulse-confetti-fall {
  0% {
    opacity: 0;
    transform: translateY(-10px) translateX(0) rotate(0deg) scale(0.7);
  }
  8% {
    opacity: 1;
  }
  100% {
    opacity: 0.85;
    transform: translateY(var(--fall, 100vh)) translateX(var(--drift)) rotate(var(--spin)) scale(1);
  }
}

.invoice-payment-pulse {
  position: relative;
  z-index: 2;
  width: min(100%, 400px);
  overflow: visible;
}

.invoice-payment-pulse__card {
  position: relative;
  background: #fff;
  border-radius: 18px;
  padding: 30px 24px 22px;
  box-shadow:
    0 28px 56px rgba(15, 23, 42, 0.22),
    0 0 0 1px rgba(34, 197, 94, 0.12);
  text-align: center;
  transform: scale(0.92) translateY(12px);
  opacity: 0;
}

.invoice-payment-pulse__card--enter {
  animation: invoice-pulse-card-enter 0.55s cubic-bezier(0.22, 1.12, 0.36, 1) forwards;
}

@keyframes invoice-pulse-card-enter {
  0% {
    transform: scale(0.88) translateY(18px);
    opacity: 0;
  }
  70% {
    transform: scale(1.03) translateY(-2px);
    opacity: 1;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.invoice-payment-pulse__burst {
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.22) 0%, transparent 68%);
  animation: invoice-pulse-burst 1.8s ease-out infinite;
  pointer-events: none;
}

@keyframes invoice-pulse-burst {
  0%, 100% { transform: scale(0.85); opacity: 0.55; }
  50% { transform: scale(1.08); opacity: 0.9; }
}

.invoice-payment-pulse__icon {
  position: relative;
  z-index: 1;
  width: 64px;
  height: 64px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #bbf7d0, #4ade80);
  color: #14532d;
  font-size: 30px;
  font-weight: 800;
  line-height: 64px;
  box-shadow: 0 10px 24px rgba(34, 197, 94, 0.35);
  animation: invoice-pulse-icon-pop 0.7s cubic-bezier(0.22, 1.2, 0.36, 1) 0.12s both;
}

@keyframes invoice-pulse-icon-pop {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.invoice-payment-pulse__kicker {
  position: relative;
  z-index: 1;
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #16a34a;
}

.invoice-payment-pulse__title {
  position: relative;
  z-index: 1;
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
}

.invoice-payment-pulse__message {
  position: relative;
  z-index: 1;
  margin: 0 0 20px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #475569;
}

.invoice-payment-pulse__actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (prefers-reduced-motion: reduce) {
  .invoice-payment-pulse__confetti-piece,
  .invoice-payment-pulse__burst,
  .invoice-payment-pulse__icon,
  .invoice-payment-pulse__card--enter {
    animation: none !important;
  }

  .invoice-payment-pulse__card,
  .invoice-payment-pulse__card--enter {
    transform: none;
    opacity: 1;
  }
}

@media (min-width: 400px) {
  .invoice-payment-pulse__actions {
    flex-direction: row;
    justify-content: center;
  }
}

/* Pay QR modal */
.invoice-pay-qr-backdrop {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.invoice-pay-qr-backdrop--visible {
  opacity: 1;
}

.invoice-pay-qr-modal {
  width: min(100%, 390px);
  max-height: calc(100vh - 24px);
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  padding: 18px 16px 16px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.16);
}

.invoice-pay-qr-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.invoice-pay-qr-modal__title {
  margin: 0;
  font-size: 1.15rem;
  color: #0f172a;
}

.invoice-pay-qr-modal__close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  padding: 4px 8px;
}

.invoice-pay-qr-modal__lede {
  margin: 0 0 14px;
  font-size: 0.92rem;
  line-height: 1.45;
  color: #475569;
}

.invoice-pay-qr-modal__qr-mount {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 168px;
  margin: 0 auto 12px;
  padding: 8px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
}

.invoice-pay-qr__img {
  display: block;
  border-radius: 8px;
}

.invoice-pay-qr__loading,
.invoice-pay-qr__empty {
  font-size: 0.85rem;
  color: #64748b;
}

.invoice-pay-qr-modal__hint {
  margin: 0 0 12px;
  font-size: 0.82rem;
  color: #64748b;
  text-align: center;
}

.invoice-pay-qr-modal__url-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.invoice-pay-qr-modal__url {
  width: 100%;
  font-size: 0.78rem;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #334155;
  background: #f8fafc;
}

@media print {
  .invoice-pay-qr-backdrop {
    position: static;
    background: none;
    padding: 0;
  }

  .invoice-pay-qr-modal__close,
  .invoice-pay-qr-modal__copy,
  .invoice-pay-qr-modal__url-wrap {
    display: none !important;
  }

  .invoice-pay-qr-modal {
    box-shadow: none;
    width: 100%;
    max-width: none;
  }
}
