/* =========================================================
 * Miracle Voucher CSS v1.2.0
 *
 * Synced with generated voucher render so History view,
 * Generated view, canvas capture, PDF, and Print all use
 * the same voucher layout.
 *
 * All history layout rules are scoped under #mpg-history-wrap
 * so Miracle Theme CSS cannot override them.
 * ========================================================= */

/* ── Scope wrapper ── */
#mpg-history-wrap {
  box-sizing: border-box;
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
}

#mpg-history-wrap *,
#mpg-history-wrap *::before,
#mpg-history-wrap *::after {
  box-sizing: border-box;
}

/* ================= SELECT ALL ROW ================= */
#mpg-history-wrap .mpg-select-all-row {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 8px 10px !important;
  margin: 10px 0 4px !important;
  font-size: 14px !important;
}

/* ================= ACTION BAR ================= */
#mpg-history-wrap .mpg-history-actions {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
  align-items: center !important;
  justify-content: flex-start !important;
  margin: 0 0 14px !important;
  padding: 4px 10px 8px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: none !important;
}

#mpg-history-wrap .mpg-history-actions::-webkit-scrollbar {
  display: none !important;
}

#mpg-history-wrap .mpg-history-actions button {
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  white-space: nowrap !important;
  line-height: 1.4 !important;

  font-size: 13px !important;
  padding: 6px 10px !important;
  border-radius: 6px !important;
  border: 1px solid #ddd !important;
  background: #f9fafb !important;
  color: #111 !important;
  cursor: pointer !important;
  box-shadow: none !important;
  text-decoration: none !important;
  appearance: none !important;
  -webkit-appearance: none !important;
}

#mpg-history-wrap .mpg-history-actions button:disabled {
  opacity: 0.55 !important;
  cursor: not-allowed !important;
}

/* ================= VOUCHER WRAP ================= */
#mpg-history-wrap .mpg-voucher-wrap {
  display: flex !important;
  flex-direction: column !important;
  gap: 24px !important;
  align-items: center !important;
  margin: 30px auto 40px !important;
  padding: 0 8px !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* ================= HISTORY ITEM ================= */
#mpg-history-wrap .mpg-history-item {
  width: 100% !important;
  max-width: 640px !important;
  overflow: visible !important;
  margin: 0 auto !important;
}

/* ================= SELECT ROW PER VOUCHER ================= */
#mpg-history-wrap .mpg-select-row {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  margin: 0 0 8px !important;
  font-size: 14px !important;
}

/* ================= VOUCHER CARD (MATCH GENERATOR) ================= */
#mpg-history-wrap .mpg-voucher-generated {
  position: relative !important;
  display: block !important;
  width: 92vw !important;
  max-width: 600px !important;
  aspect-ratio: 120 / 62 !important;
  margin: 0 auto !important;

  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: contain !important;

  border-radius: 14px !important;
  overflow: hidden !important;

  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
  user-select: none !important;

  transform: none !important;
  box-shadow: 0 4px 18px rgba(0,0,0,.12) !important;
}

#mpg-history-wrap .mpg-voucher-generated img {
  pointer-events: none !important;
  user-select: none !important;
  -webkit-user-drag: none !important;
}

/* ================= VOUCHER ELEMENTS ================= */

/* Top logo */
#mpg-history-wrap .mpg-top-logo {
  position: absolute !important;
  top: 2% !important;
  left: 6% !important;
  width: 11% !important;
  max-width: 64px !important;
  height: auto !important;
  object-fit: contain !important;
}

/* Bottom-right logo */
#mpg-history-wrap .mpg-bottom-logo {
  position: absolute !important;
  bottom: 2% !important;
  right: 3% !important;
  width: 12% !important;
  max-width: 120px !important;
  height: auto !important;
  object-fit: contain !important;
}

/* Main denomination */
#mpg-history-wrap .mpg-denom-main {
  position: absolute !important;
  top: 6% !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  font-size: 7vw !important;
  font-weight: 800 !important;
  color: #4b2e83 !important;
  white-space: nowrap !important;
  line-height: 1 !important;
}

/* Bottom-left denomination */
#mpg-history-wrap .mpg-denom-left {
  position: absolute !important;
  bottom: 5% !important;
  left: 9% !important;
  font-size: 4vw !important;
  font-weight: 700 !important;
  color: #a65c2a !important;
  white-space: nowrap !important;
  line-height: 1 !important;
}

/* Centre denomination */
#mpg-history-wrap .mpg-denom-center {
  position: absolute !important;
  bottom: 34% !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  font-size: 3.8vw !important;
  font-weight: 700 !important;
  color: #6b3f1d !important;
  white-space: nowrap !important;
  line-height: 1 !important;
}

/* Point type */
#mpg-history-wrap .mpg-point-type {
  position: absolute !important;
  bottom: 22% !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  font-size: 2.6vw !important;
  font-weight: 700 !important;
  color: #4b2e83 !important;
  white-space: nowrap !important;
  text-transform: uppercase !important;
  line-height: 1 !important;
}

/* Title */
#mpg-history-wrap .mpg-title {
  position: absolute !important;
  bottom: 10% !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  font-size: 2.4vw !important;
  font-weight: 600 !important;
  color: #4b2e83 !important;
  white-space: nowrap !important;
  line-height: 1 !important;
}

/* Portrait */
#mpg-history-wrap .mpg-portrait {
  position: absolute !important;
  top: 12% !important;
  right: 6% !important;
  width: 28% !important;
  height: 70% !important;
  object-fit: cover !important;
  border-radius: 12px !important;
}

/* QR */
#mpg-history-wrap .mpg-qr {
  position: absolute !important;
  top: 25% !important;
  left: 6% !important;
  width: 21% !important;
  height: auto !important;
  background: #fff !important;
  padding: 5px !important;
  border-radius: 6px !important;
  box-sizing: border-box !important;
  display: block !important;
  box-shadow: 0 1px 3px rgba(0,0,0,.15) !important;
}

/* PIN */
#mpg-history-wrap .mpg-pin {
  position: absolute !important;
  top: 67% !important;
  left: 6% !important;
  width: 21% !important;
  text-align: center !important;
  font-family: monospace !important;
  font-size: clamp(8px, 1.5vw, 12px) !important;
  font-weight: 800 !important;
  letter-spacing: 1px !important;
  color: #111 !important;
  white-space: nowrap !important;
  line-height: 1.2 !important;
  background: rgba(255,255,255,.9) !important;
  padding: 2px 0 !important;
  border-radius: 4px !important;
  box-sizing: border-box !important;
  box-shadow: 0 1px 2px rgba(0,0,0,.08) !important;
}

/* ================= RESTRICTED / DISABLED NOTES ================= */
#mpg-history-wrap .mpg-disabled-note {
  margin-top: 10px !important;
  padding: 10px 12px !important;
  background: #fef2f2 !important;
  border-left: 4px solid #ef4444 !important;
  color: #7f1d1d !important;
  font-size: 13px !important;
  border-radius: 6px !important;
  text-align: center !important;
}

#mpg-history-wrap .mpg-restricted-note {
  max-width: 640px !important;
  margin: 10px auto !important;
  padding: 10px 12px !important;
  background: #fff7ed !important;
  border-left: 4px solid #f59e0b !important;
  color: #7c2d12 !important;
  font-size: 14px !important;
  border-radius: 6px !important;
  text-align: center !important;
}

/* ================= WHATSAPP CARD ================= */
#mpg-history-wrap .mpg-whatsapp-card {
  margin-top: 10px !important;
  padding: 10px 12px !important;
  background: #ecfdf5 !important;
  border-left: 4px solid #22c55e !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

#mpg-history-wrap .mpg-whatsapp-card a {
  color: #065f46 !important;
  font-weight: 700 !important;
  text-decoration: none !important;
}

/* ================= MOBILE TUNING ================= */
@media (max-width: 640px) {
  #mpg-history-wrap .mpg-history-actions {
    justify-content: flex-start !important;
    padding: 6px 10px !important;
  }

  #mpg-history-wrap .mpg-history-actions button {
    flex: 0 0 auto !important;
  }

  #mpg-history-wrap .mpg-voucher-generated {
    width: 92vw !important;
  }
}

/* ================= PRINT ================= */
@media print {
  body * {
    visibility: hidden !important;
  }

  .mpg-voucher-generated,
  .mpg-voucher-generated * {
    visibility: visible !important;
  }

  .mpg-voucher-generated {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 190mm !important;
    max-width: 190mm !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }
}