/* ============================================================
   NexPay — CashApp Style Light Theme
   ============================================================ */

:root {
  --bg-page: #f3f4f6;
  --bg-card: #ffffff;
  --color-primary: #00d632;
  --color-primary-hover: #00c02c;
  --color-text: #111827;
  --color-text-secondary: #6b7280;
  --color-text-muted: #9ca3af;
  --bg-section-green: #f0fdf4;
  --bg-badge-green: #dcfce7;
  --color-badge-text: #15803d;
  --border-color: #e5e7eb;

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition-base: 200ms ease;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.container {
  width: 100%;
  max-width: 420px;
  background-color: var(--bg-card);
  border-radius: 24px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
  padding: 20px 24px 32px;
  position: relative;
  overflow: hidden;
}

/* Card Handle */
.card-handle {
  width: 48px;
  height: 4px;
  background-color: #d1d5db;
  border-radius: 4px;
  margin: 0 auto 20px;
}

/* Header */
.header-section {
  text-align: center;
  margin-bottom: 24px;
}

.header-section h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.badge-secure {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-badge-green);
  color: var(--color-badge-text);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 100px;
}

/* Payment Method Box */
.payment-method-box {
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  margin-bottom: 24px;
}

.cashapp-icon {
  width: 48px;
  height: 48px;
  background-color: var(--color-primary);
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 12px;
}

.cashapp-icon span {
  color: white;
  font-size: 24px;
  font-weight: bold;
}

.method-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.method-status {
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* Amount Selection Area */
.amount-section {
  background-color: var(--bg-section-green);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
}

.amount-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--color-primary);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.amount-grid-top {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.preset-btn {
  background-color: white;
  border: 2px solid var(--color-primary);
  color: var(--color-text);
  font-size: 16px;
  font-weight: 700;
  padding: 12px 0;
  border-radius: 100px;
  cursor: pointer;
  transition: var(--transition-base);
  font-family: inherit;
}

.preset-btn:hover {
  background-color: #f8fafc;
}

.preset-btn.selected {
  background-color: var(--color-primary);
  color: white;
}

.toggle-amounts-btn {
  width: 100%;
  background-color: #d1fae5;
  color: #059669;
  border: none;
  padding: 10px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-family: inherit;
  transition: background-color var(--transition-base);
}

.toggle-amounts-btn:hover {
  background-color: #a7f3d0;
}

.toggle-icon {
  transition: transform var(--transition-base);
}

.toggle-icon.collapsed {
  transform: rotate(180deg);
}

.amount-grid-expanded {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
  overflow: hidden;
  max-height: 500px;
  opacity: 1;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
}

.amount-grid-expanded.hidden {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
}

.amount-grid-expanded .preset-btn {
  font-size: 15px;
  padding: 10px 0;
}

.custom-amount-wrapper {
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  height: 48px;
}

.custom-amount-wrapper:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(0, 214, 50, 0.2);
}

.input-prefix {
  color: var(--color-primary);
  font-weight: 700;
  font-size: 18px;
  margin-right: 8px;
}

.custom-amount-input {
  border: none;
  outline: none;
  width: 100%;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  font-family: inherit;
  background: transparent;
}

.custom-amount-input::placeholder {
  color: var(--color-text-muted);
  font-weight: 500;
}

/* Remove arrows from number input */
.custom-amount-input::-webkit-outer-spin-button,
.custom-amount-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.custom-amount-input[type=number] {
  -moz-appearance: textfield;
}

/* Pay Action */
.pay-btn {
  width: 100%;
  background-color: var(--color-primary);
  color: white;
  border: none;
  border-radius: 100px;
  padding: 16px;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background-color var(--transition-base), transform var(--transition-base);
  font-family: inherit;
}

.pay-btn:hover:not(:disabled) {
  background-color: var(--color-primary-hover);
}

.pay-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.pay-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Footer */
.footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--color-text-muted);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.footer-icon {
  width: 12px;
  height: 12px;
  border: 1px solid var(--color-text-muted);
  border-radius: 50%;
}

/* General States */
.state {
  display: none;
}

.state.active {
  display: block;
}

/* QR Code State Adaptation */
.timer-badge {
  background-color: #fefce8;
  border: 1px solid #fef08a;
  color: #b45309;
  border-radius: 100px;
  padding: 10px 16px;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  margin-bottom: 24px;
}

.timer-badge.expiring {
  background-color: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
  animation: pulse 1s ease-in-out infinite;
}

.amount-due-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.paying-amount-large {
  font-size: 48px;
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: 4px;
  line-height: 1;
  letter-spacing: -1px;
}

.scan-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.qr-frame-link {
  display: block;
  text-decoration: none;
  margin-bottom: 24px;
  position: relative;
}

.qr-frame {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.qr-frame img {
  width: 320px;
  height: 280px;
  border-radius: 8px;
}

.qr-cashapp-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 8px;
  border-radius: 8px;
}

.qr-cashapp-logo span {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 48px;
  height: 48px;
  background-color: var(--color-primary);
  border-radius: 10px;
  color: white;
  font-size: 24px;
  font-weight: bold;
}

.invoice-details-box {
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 24px;
  background: #f9fafb;
}

.detail-label-small {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.detail-value-bold {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
}

.detail-value-mono {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.badge-awaiting {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: #fefce8;
  border: 1px solid #fef08a;
  color: #b45309;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 100px;
  letter-spacing: 0.5px;
}

.btn-cashapp-icon {
  background-color: white;
  border-radius: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.btn-cashapp-icon span {
  color: var(--color-primary);
  font-weight: 800;
  font-size: 16px;
  border: 4px solid white;
  border-radius: 6px;
}

.copy-invoice-btn {
  width: 100%;
  background: none;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 12px;
  margin-bottom: 12px;
  font-family: inherit;
}

.copy-invoice-btn:hover {
  color: var(--color-text);
}

.state-success {
  text-align: center;
}

.success-circle {
  width: 80px;
  height: 80px;
  background: var(--color-primary);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 24px;
  color: white;
}

.success-title {
  color: var(--color-text);
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 8px;
}

.success-subtitle {
  color: var(--color-text-secondary);
  font-size: 16px;
  margin-bottom: 32px;
}

.success-details {
  background: var(--bg-page);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 32px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  color: var(--color-text-secondary);
  font-weight: 500;
}

.detail-value {
  font-weight: 600;
  color: var(--color-text);
}

.status-paid {
  color: var(--color-primary);
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.loading-overlay.active {
  display: flex;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

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

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--color-text);
  color: white;
  padding: 12px 24px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 14px;
  transition: transform 0.3s ease;
  z-index: 1000;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* Error Banner */
.error-banner {
  background-color: #fee2e2;
  color: #b91c1c;
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 24px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  border: 1px solid #fca5a5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.error-banner.hidden {
  display: none;
}