:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --accent: #10b981;
  --accent-glow: rgba(16, 185, 129, 0.3);
  --bg-dark: #090d16;
  --card-bg: rgba(22, 30, 46, 0.82);
  --card-border: rgba(255, 255, 255, 0.12);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --input-bg: rgba(13, 19, 33, 0.7);
  --input-border: rgba(255, 255, 255, 0.15);
  --radius-lg: 24px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
  width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
  padding: 16px;
  -webkit-font-smoothing: antialiased;
}

/* Locked scroll when modal is open */
body.modal-open {
  overflow: hidden !important;
  touch-action: none;
}

/* Background Wrapper - Fixed to prevent any body scrollbars */
.bg-wrapper {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

/* Background Animated Blobs */
.bg-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.45;
  animation: float 18s ease-in-out infinite alternate;
}

.shape-1 {
  width: 380px;
  height: 380px;
  background: #4f46e5;
  top: -80px;
  left: -80px;
}

.shape-2 {
  width: 340px;
  height: 340px;
  background: #06b6d4;
  bottom: -80px;
  right: -50px;
  animation-delay: -6s;
}

.shape-3 {
  width: 280px;
  height: 280px;
  background: #ec4899;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.2;
}

@keyframes float {
  0% {
    transform: translateY(0) scale(1);
  }
  100% {
    transform: translateY(35px) scale(1.08);
  }
}

/* Container */
.app-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  margin: auto;
}

/* Payment Card */
.payment-card {
  background: var(--card-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-header {
  text-align: center;
  margin-bottom: 22px;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(99, 102, 241, 0.08));
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #818cf8;
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.card-header h1 {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  color: #ffffff;
}

.card-header .subtitle {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

/* UPI Logos Strip */
.upi-apps-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 30px;
}

.upi-tag-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
}

.upi-tag-item i {
  font-size: 13px;
  color: #818cf8;
}

.upi-divider {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}

/* Form Styling */
.payment-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
}

.currency-tag,
.optional-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.currency-tag {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.optional-tag {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
}

/* Amount Input Box */
.amount-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.currency-symbol {
  position: absolute;
  left: 18px;
  font-size: 26px;
  font-weight: 700;
  color: #818cf8;
  pointer-events: none;
  user-select: none;
}

.amount-input-wrapper input {
  width: 100%;
  background: var(--input-bg);
  border: 2px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: 14px 18px 14px 48px;
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-main);
  outline: none;
  transition: all 0.25s ease;
}

.amount-input-wrapper input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
  background: rgba(15, 23, 42, 0.9);
}

.amount-input-wrapper input::placeholder {
  color: #475569;
}

/* Input with Icon */
.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon i {
  position: absolute;
  left: 16px;
  color: var(--text-muted);
  font-size: 15px;
  pointer-events: none;
}

.input-with-icon input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px 12px 42px;
  font-size: 14px;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
}

.input-with-icon input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Quick Amounts */
.quick-amounts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  text-align: center;
}

.chip:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
  color: #ffffff;
}

.chip.active {
  background: rgba(99, 102, 241, 0.25);
  border-color: #818cf8;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.35);
}

/* Pay Button */
.pay-button {
  width: 100%;
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 15px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px -4px var(--primary-glow);
  transition: all 0.25s ease;
  margin-top: 6px;
}

.pay-button:hover {
  background: linear-gradient(135deg, #818cf8 0%, #4338ca 100%);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -4px var(--primary-glow);
}

.pay-button:active {
  transform: translateY(0);
}

/* Spinner */
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.hidden {
  display: none !important;
}

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

/* Card Footer */
.card-footer {
  margin-top: 20px;
  text-align: center;
}

.security-badge {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Modal Overlay & Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(8, 12, 22, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  overflow-y: auto;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-card {
  position: relative;
  background: #182234;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

@keyframes slideUp {
  from {
    transform: translateY(25px) scale(0.96);
  }
  to {
    transform: translateY(0) scale(1);
  }
}

.close-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.modal-header {
  margin-bottom: 16px;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(52, 211, 153, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
  }
}

.modal-header h2 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.display-amount {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 800;
  color: #818cf8;
}

.qr-timer-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

/* QR Code Box */
.qr-display-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 14px 0;
}

.qr-frame {
  position: relative;
  background: #ffffff;
  padding: 12px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.qr-frame img {
  width: 200px;
  height: 200px;
  display: block;
  border-radius: 8px;
}

.qr-scan-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #6366f1, transparent);
  animation: scan 2.5s ease-in-out infinite alternate;
}

@keyframes scan {
  0% {
    top: 0;
  }
  100% {
    top: 100%;
  }
}

.qr-instruction {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
  line-height: 1.4;
}

.pay-now-direct-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  width: 100%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  transition: all 0.2s ease;
}

.pay-now-direct-btn:hover {
  background: linear-gradient(135deg, #34d399 0%, #047857 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
}

/* Modal Actions Grid */
.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 8px;
  width: 100%;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-done {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 4px;
}

.btn-done:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}

/* Receipt Modal Styling */
.receipt-card {
  max-width: 440px;
  background: #0d1526;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.receipt-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 14px;
}

.success-icon-badge {
  font-size: 50px;
  color: #10b981;
  margin-bottom: 6px;
  animation: bounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.receipt-header h2 {
  font-family: var(--font-heading);
  font-size: 22px;
  color: #f8fafc;
}

.receipt-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.receipt-amount-display {
  font-family: var(--font-heading);
  font-size: 34px;
  font-weight: 800;
  color: #34d399;
  margin-top: 8px;
}

.receipt-body {
  background: rgba(22, 32, 51, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.receipt-divider {
  height: 1px;
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
  margin: 4px 0;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.receipt-row .lbl {
  color: var(--text-muted);
}

.receipt-row .val {
  color: var(--text-main);
  font-weight: 600;
}

.highlight-utr {
  font-family: monospace;
  font-size: 13px;
  letter-spacing: 0.5px;
  color: #38bdf8 !important;
  background: rgba(56, 189, 248, 0.12);
  padding: 2px 8px;
  border-radius: 4px;
}

.status-paid-badge {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399 !important;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.receipt-footer-stamp {
  font-size: 11px;
  color: #10b981;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
}

/* Mobile View Optimizations */
@media (max-width: 600px) {
  body {
    padding: 12px;
    align-items: center;
  }

  .payment-card {
    padding: 24px 20px;
    border-radius: 20px;
  }

  .card-header {
    margin-bottom: 18px;
  }

  .card-header h1 {
    font-size: 22px;
  }

  .card-header .subtitle {
    font-size: 12px;
  }

  .amount-input-wrapper input {
    font-size: 24px;
    padding: 12px 14px 12px 42px;
  }

  .currency-symbol {
    font-size: 22px;
    left: 14px;
  }

  .quick-amounts {
    gap: 6px;
  }

  .chip {
    padding: 7px 6px;
    font-size: 12px;
  }

  .pay-button {
    padding: 14px;
    font-size: 15px;
  }

  .modal-card {
    padding: 22px 18px;
    border-radius: 20px;
  }

  .qr-frame img {
    width: 170px;
    height: 170px;
  }
}

/* Mobile Small Screen Heights (e.g. iPhone SE / < 700px height) */
@media (max-height: 700px) and (max-width: 600px) {
  body {
    padding: 8px;
  }

  .payment-card {
    padding: 20px 16px;
  }

  .card-header {
    margin-bottom: 14px;
  }

  .brand-badge {
    margin-bottom: 8px;
    padding: 4px 10px;
    font-size: 12px;
  }

  .card-header h1 {
    font-size: 20px;
  }

  .upi-apps-strip {
    margin-top: 8px;
    padding: 6px 10px;
  }

  .payment-form {
    gap: 14px;
  }

  .card-footer {
    margin-top: 14px;
  }
}

/* Print Styling */
@media print {
  body * {
    visibility: hidden;
  }

  #printableReceipt,
  #printableReceipt * {
    visibility: visible;
  }

  #printableReceipt {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    color: #000;
    background: #fff;
  }
}