/* ═══════════════════════════════════════════════
   BravoPay PIX Modal — pix-modal.css
   ═══════════════════════════════════════════════ */

/* ── Overlay ── */
#bp-overlay {
  --bp-brand: #d6127d;
  --bp-brand-dark: #b00f68;
  --bp-brand-light: rgba(214, 18, 125, 0.12);
  --bp-brand-glow: rgba(214, 18, 125, 0.35);
  --bp-success: #00c853;
  --bp-success-glow: rgba(0, 200, 83, 0.35);
  --bp-error: #ff3d71;
  --bp-text: #1a1a2e;
  --bp-text-muted: #6b7280;
  --bp-bg: #ffffff;
  --bp-bg-soft: #f8f9fb;
  --bp-border: rgba(0, 0, 0, 0.08);
  --bp-shadow: 0 30px 80px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0,0,0,0.05);
  --bp-radius: 22px;
  --bp-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --bp-ease: cubic-bezier(0.4, 0, 0.2, 1);

  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--bp-ease), visibility 0.3s var(--bp-ease);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
}

#bp-overlay.bp-visible {
  opacity: 1;
  visibility: visible;
}

/* ── Card ── */
#bp-card {
  background: var(--bp-bg);
  border-radius: var(--bp-radius);
  box-shadow: var(--bp-shadow);
  width: 100%;
  max-width: 430px;
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  transform: scale(0.82) translateY(24px);
  transition: transform 0.4s var(--bp-spring);
  scrollbar-width: none;
}

#bp-card::-webkit-scrollbar { display: none; }

#bp-overlay.bp-visible #bp-card {
  transform: scale(1) translateY(0);
}

/* ── Header ── */
#bp-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 22px 0;
}

#bp-logo {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  object-fit: cover;
  border: 2px solid var(--bp-brand-light);
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

#bp-header-text {
  flex: 1;
  min-width: 0;
}

#bp-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--bp-text);
  margin: 0 0 3px;
  letter-spacing: -0.3px;
}

#bp-subtitle {
  font-size: 12px;
  color: var(--bp-text-muted);
  margin: 0;
}

#bp-close {
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: var(--bp-text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 10px;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#bp-close:hover {
  color: var(--bp-text);
  background: rgba(0, 0, 0, 0.06);
}

/* ── Amount Badge ── */
#bp-amount-badge {
  margin: 18px 22px 0;
  background: linear-gradient(135deg, var(--bp-brand) 0%, #f7318a 50%, #ff6bb5 100%);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  position: relative;
  overflow: hidden;
}

#bp-amount-badge::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -10%;
  width: 120px;
  height: 120px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

#bp-amount-badge::after {
  content: '';
  position: absolute;
  bottom: -50%;
  right: 15%;
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 50%;
}

#bp-amount-label {
  font-size: 12px;
  opacity: 0.88;
  font-weight: 500;
  position: relative;
}

#bp-amount-value {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.8px;
  position: relative;
}

/* ── Pix badge inline ── */
#bp-pix-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 4px 10px 4px 4px;
  font-size: 11px;
  font-weight: 600;
  position: relative;
}

/* ── Steps ── */
.bp-step {
  padding: 20px 22px;
}

.bp-step-hint {
  font-size: 13px;
  color: var(--bp-text-muted);
  margin: 0 0 18px;
  text-align: center;
  line-height: 1.5;
}

/* ── Form ── */
.bp-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.bp-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.bp-field label {
  font-size: 11px;
  font-weight: 700;
  color: var(--bp-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.bp-field input {
  padding: 12px 14px;
  border: 1.5px solid var(--bp-border);
  border-radius: 12px;
  font-size: 15px;
  color: var(--bp-text);
  background: var(--bp-bg-soft);
  outline: none;
  transition: border-color 0.2s var(--bp-ease), box-shadow 0.2s var(--bp-ease), background 0.2s;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
  -webkit-appearance: none;
}

.bp-field input:focus {
  border-color: var(--bp-brand);
  box-shadow: 0 0 0 3px var(--bp-brand-light);
  background: #fff;
}

.bp-field input::placeholder {
  color: #c1c7d0;
}

/* ── Primary Button ── */
.bp-btn-primary {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, var(--bp-brand) 0%, #f7318a 100%);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s var(--bp-ease), box-shadow 0.15s var(--bp-ease), opacity 0.15s;
  box-shadow: 0 6px 20px var(--bp-brand-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  letter-spacing: 0.2px;
}

.bp-btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px var(--bp-brand-glow);
}

.bp-btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 4px 12px var(--bp-brand-glow);
}

.bp-btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* ── Spinner ── */
.bp-spinner {
  width: 16px;
  height: 16px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: bp-spin 0.65s linear infinite;
  flex-shrink: 0;
}

@keyframes bp-spin {
  to { transform: rotate(360deg); }
}

/* ── Error message ── */
.bp-error {
  color: var(--bp-error);
  font-size: 12px;
  text-align: center;
  margin: 10px 0 0;
  padding: 10px 14px;
  background: rgba(255, 61, 113, 0.08);
  border-radius: 10px;
  border: 1px solid rgba(255, 61, 113, 0.15);
  line-height: 1.4;
}

/* ── Utility ── */
.bp-error.hidden,
.hidden { display: none !important; }

/* ── QR Wrapper ── */
#bp-qr-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  position: relative;
  width: fit-content;
}

#bp-qr-pulse-ring {
  position: absolute;
  inset: -10px;
  border-radius: 22px;
  border: 2px solid var(--bp-brand);
  opacity: 0.35;
  animation: bp-pulse-ring 2s ease-in-out infinite;
}

@keyframes bp-pulse-ring {
  0%, 100% { transform: scale(1); opacity: 0.35; }
  50% { transform: scale(1.04); opacity: 0.1; }
}

#bp-qr-container {
  border-radius: 18px;
  overflow: hidden;
  padding: 10px;
  background: #fff;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1), 0 0 0 1.5px rgba(214,18,125,0.15);
}

#bp-qr-container img,
#bp-qr-container canvas {
  display: block;
  border-radius: 10px;
}

/* ── Timer ── */
#bp-timer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  color: var(--bp-text-muted);
  margin-bottom: 16px;
}

#bp-timer {
  font-weight: 700;
  color: var(--bp-brand);
  font-variant-numeric: tabular-nums;
  min-width: 38px;
}

/* ── Copy Box ── */
#bp-copy-box {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  background: var(--bp-bg-soft);
  border: 1.5px solid var(--bp-border);
  border-radius: 14px;
  padding: 8px;
  align-items: center;
}

#bp-pix-code {
  flex: 1;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  font-size: 11px;
  color: var(--bp-text-muted);
  background: transparent;
  font-family: 'Courier New', Courier, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  outline: none;
  min-width: 0;
  cursor: text;
}

#bp-btn-copy {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--bp-brand);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  font-family: inherit;
  flex-shrink: 0;
  box-shadow: 0 3px 10px var(--bp-brand-glow);
}

#bp-btn-copy:hover {
  background: var(--bp-brand-dark);
  transform: translateY(-1px);
}

#bp-btn-copy:active {
  transform: translateY(0);
}

#bp-btn-copy.bp-copied {
  background: var(--bp-success);
  box-shadow: 0 3px 10px var(--bp-success-glow);
}

/* ── Polling hint ── */
.bp-polling-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--bp-text-muted);
  margin: 0;
  line-height: 1.5;
}

.bp-dot-anim {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--bp-brand);
  border-radius: 50%;
  flex-shrink: 0;
  animation: bp-dot-pulse 1.5s ease-in-out infinite;
}

@keyframes bp-dot-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.4; }
}

/* ── Success step ── */
#bp-step-success {
  text-align: center;
  padding: 36px 22px 28px;
}

#bp-success-anim {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #00c853 0%, #69f0ae 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 22px;
  animation: bp-success-pop 0.5s var(--bp-spring) both;
  box-shadow: 0 8px 30px var(--bp-success-glow);
}

@keyframes bp-success-pop {
  from { transform: scale(0) rotate(-10deg); opacity: 0; }
  to { transform: scale(1) rotate(0deg); opacity: 1; }
}

#bp-success-checkmark {
  width: 36px;
  height: 36px;
  stroke: #fff;
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: bp-draw-check 0.5s 0.3s var(--bp-ease) forwards;
}

@keyframes bp-draw-check {
  to { stroke-dashoffset: 0; }
}

#bp-success-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--bp-text);
  margin: 0 0 10px;
  letter-spacing: -0.5px;
}

#bp-success-msg {
  font-size: 14px;
  color: var(--bp-text-muted);
  line-height: 1.65;
  margin: 0;
}

#bp-redirect-bar-wrap {
  margin-top: 20px;
  height: 4px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
}

#bp-redirect-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--bp-success), #69f0ae);
  width: 100%;
  border-radius: 4px;
  transform-origin: left;
  animation: bp-redirect-progress 3s linear forwards;
}

@keyframes bp-redirect-progress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* ── Divider ── */
.bp-divider {
  height: 1px;
  background: var(--bp-border);
  margin: 0 22px;
}

/* ── Footer ── */
#bp-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 22px 18px;
  font-size: 11px;
  color: #b0b8c4;
  letter-spacing: 0.2px;
}

/* ── Confetti ── */
.bp-confetti-piece {
  position: fixed;
  top: -12px;
  pointer-events: none;
  z-index: 1000000;
  animation: bp-confetti-fall linear forwards;
}

@keyframes bp-confetti-fall {
  0%   { transform: translateY(0) rotate(0deg) scale(1);   opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateY(110vh) rotate(750deg) scale(0.6); opacity: 0; }
}

/* ── Responsive ── */
@media (max-width: 480px) {
  #bp-overlay { padding: 12px; }

  #bp-card { border-radius: 18px; }

  #bp-amount-value { font-size: 20px; }

  #bp-btn-copy {
    padding: 10px 12px;
    font-size: 12px;
  }
}
