/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Blue + green gradient palette */
  --blue-50:  #D4E6F2;
  --blue-100: #A6CFE5;
  --blue-200: #6BB1D5;
  --blue-300: #2F8FBA;
  --blue-400: #156A92;
  --blue-500: #0E4F73;
  --blue-700: #0A3A56;

  --green-50:  #E6F7EE;
  --green-100: #C2EBD3;
  --green-200: #8DD9B0;
  --green-300: #4FC58B;
  --green-400: #22A06A;
  --green-500: #157F52;
  --green-700: #0E5A39;

  /* Active brand tokens used by the UI */
  --accent:         var(--blue-500);
  --accent-hover:   var(--blue-700);
  --accent-soft:    var(--blue-100);
  --secondary:      var(--green-500);
  --secondary-soft: var(--green-100);

  --bg: #ffffff;
  --text: #0e2030;
  --text-muted: #4a6b7d;
  --border: #cfe4ec;
  --radius-pill: 999px;
  --radius-card: 20px;
}

/* ===== BACKGROUND BLOBS ===== */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
  background: linear-gradient(135deg, var(--blue-400) 0%, var(--green-400) 100%);
  color: #fff;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px 48px;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.45;
}
.blob-1 {
  width: 360px; height: 360px;
  background: var(--blue-200);
  top: -120px; right: -100px;
}
.blob-2 {
  width: 420px; height: 420px;
  background: var(--green-300);
  bottom: -160px; left: -120px;
  opacity: 0.35;
}
.blob-3 {
  width: 240px; height: 240px;
  background: var(--accent-soft);
  top: 40%; right: 10%;
  opacity: 0.3;
}

.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
}

/* ===== HEADER ===== */
.header { text-align: center; margin-bottom: 24px; padding-top: 8px; }
.logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
  display: inline-block;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-pill);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.logo span { color: #fff; }

/* ===== VIEWS ===== */
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.4s ease-out; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== HERO ===== */
.hero {
  text-align: center;
  margin-bottom: 28px;
  padding: 12px 0 8px;
}
.hero h1 {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: -1.5px;
  line-height: 1.0;
  color: #fff;
  text-transform: uppercase;
  margin-bottom: 8px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
.hero-sub {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 500;
}
.hero-sub strong { font-weight: 800; }

.ref-badge {
  display: inline-block;
  margin-top: 12px;
  padding: 5px 14px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--accent);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ===== FORM (pill inputs) ===== */
.field { margin-bottom: 14px; position: relative; }
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 0 0 8px 20px;
}
.field input,
.field select {
  width: 100%;
  padding: 16px 20px;
  font-size: 16px;
  background: #fff;
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s, transform .08s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  font-weight: 500;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
}
.field input::placeholder {
  color: #7a96a6;
  font-weight: 400;
}
.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 0 0 4px rgba(255, 255, 255, 0.25);
}
.field input.has-error,
.field select.has-error {
  border-color: #fff;
  box-shadow: 0 0 0 2px #fff, 0 4px 16px rgba(14, 79, 115, 0.40);
}
.field select {
  /* Chevron on the right */
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%231B6FA0' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 22px center;
  padding-right: 48px;
  cursor: pointer;
}
.field .error {
  display: block;
  font-size: 12px;
  color: #fff;
  background: rgba(0, 0, 0, 0.18);
  padding: 6px 14px;
  margin-top: 6px;
  margin-left: 16px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  min-height: 0;
  opacity: 0;
  transition: opacity .2s;
}
.field .error:not(:empty) {
  opacity: 1;
}

/* ===== BUTTONS ===== */
.btn-primary {
  position: relative;
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 16px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: transform .08s, box-shadow .15s, background .15s;
  background: linear-gradient(135deg, var(--accent), var(--secondary));
  color: #fff;
  margin-top: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
}
.btn-primary:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}
.btn-primary:active { transform: scale(0.99); }
.btn-primary:disabled { opacity: 0.85; cursor: not-allowed; transform: none; }

.btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2.5px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn-primary.loading .btn-spinner { display: inline-block; }
.btn-primary.loading .btn-text { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-ghost {
  width: 100%;
  padding: 14px 20px;
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-pill);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  cursor: pointer;
  margin-top: 12px;
  transition: background .15s, border-color .15s;
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: #fff;
}

/* ===== WHY PANEL (expandable) ===== */
.why-panel {
  margin-top: 16px;
  padding: 18px 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.25s ease-out;
}
.why-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 12px;
  color: #fff;
  font-size: 14px;
}
.why-row strong { font-weight: 800; }
.why-row small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}
.why-icon {
  font-size: 22px;
  width: 36px;
  text-align: center;
  flex-shrink: 0;
}

/* ===== DEMO BANNER ===== */
.demo-banner {
  display: block;
  text-align: center;
  margin-top: 16px;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

/* ============================================
   RECEIPT (kept clean & white, contrasts hero)
   ============================================ */
.receipt-card {
  background: #fff;
  border-radius: var(--radius-card);
  padding: 32px 24px 28px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  color: var(--text);
}

.receipt-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.logo-mark {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--secondary));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  box-shadow: 0 4px 12px rgba(14, 79, 115, 0.30);
}

.receipt-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #ecfdf5;
  color: #16a34a;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 20px;
  border: 1px solid #a7f3d0;
}

.info-card {
  background: #f5eded;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 24px;
  text-align: left;
}
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.info-label { font-size: 15px; color: var(--text-muted); }
.info-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.info-divider {
  height: 1px;
  background: #e0d0d0;
  margin: 14px 0;
}
.info-row:last-child .info-label { font-size: 16px; color: var(--text); }
.info-row:last-child .info-value { font-size: 18px; }

.total-section {
  font-size: 36px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 24px;
  letter-spacing: -1px;
}
.total-label { color: var(--text); margin-right: 4px; }
.total-amount { color: var(--text); }

.receipt-meta {
  text-align: left;
  margin-bottom: 20px;
  padding: 16px 4px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 7px 0;
  font-size: 13px;
}
.meta-row--date { display: none; }
.meta-label { color: var(--text-muted); }
.meta-value {
  font-weight: 600;
  color: var(--text);
  text-align: right;
  word-break: break-word;
  font-variant-numeric: tabular-nums;
}

.receipt-footer-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  font-size: 14px;
  margin-bottom: 16px;
}
.receipt-footer-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.receipt-footer-links a:hover { text-decoration: underline; }
.receipt-footer-links .separator { color: #d4b8b8; }

.receipt-brand {
  font-size: 11px !important;
  color: var(--text-muted) !important;
  font-weight: 600;
  margin-top: 8px;
  letter-spacing: 0.2px;
}

@media (max-width: 400px) {
  body { padding: 16px 12px 32px; }
  .hero h1 { font-size: 36px; }
  .total-section { font-size: 30px; }
  .info-value { font-size: 19px; }
}

@media print {
  body { background: #fff; padding: 0; overflow: visible; }
  .bg-blobs, .header, #formView, #newPaymentBtn, .receipt-footer-links { display: none !important; }
  .receipt-card {
    box-shadow: none;
    border: 1px solid #000;
    border-radius: 0;
    max-width: 100%;
  }
}
