:root {
  --accent: #111111;
  --accent-dark: #000000;
  --accent-light: #f0f0f0;
  --text: #111111;
  --text-muted: #6b6b6b;
  --border: #e2e2e2;
  --danger: #dc2626;
  --success: #16a34a;
  --bg: #f5f5f5;
  --radius: 14px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.page-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.reg-card {
  width: 100%;
  max-width: 520px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.banner {
  width: 100%;
  aspect-ratio: 16 / 6;
  background: #eef0f4;
}

.banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.banner-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #9aa0ab;
  border: 2px dashed #c7cbd4;
  background: #f7f8fa;
}

.banner-placeholder span {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.reg-body {
  padding: 32px 28px 36px;
}

.reg-body h1 {
  margin: 0 0 4px;
  font-size: 22px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 24px;
}

.form-row {
  margin-bottom: 18px;
}

.form-row.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.field input,
.field select,
.iti input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
  background: #fff;
  color: var(--text);
}

.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' fill-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.field input.invalid {
  border-color: var(--danger);
}

.field input.valid {
  border-color: var(--success);
}

.error-msg {
  display: block;
  color: var(--danger);
  font-size: 12.5px;
  margin-top: 5px;
  min-height: 16px;
}

.honeypot {
  position: absolute;
  left: -9999px;
  top: -9999px;
  height: 0;
  overflow: hidden;
}

.btn-primary {
  width: 100%;
  padding: 13px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background .15s ease, opacity .15s ease;
}

.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }

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

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.btn-link:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

.success-screen {
  text-align: center;
  padding: 20px 0;
}

.success-icon {
  width: 56px;
  height: 56px;
  line-height: 56px;
  border-radius: 50%;
  background: #dcfce7;
  color: var(--success);
  font-size: 28px;
  margin: 0 auto 16px;
}

.reg-number {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  background: var(--accent-light);
  color: var(--accent);
  padding: 10px 18px;
  border-radius: 10px;
  display: inline-block;
  margin: 10px 0;
}

/* ---------------- Modal / OTP ---------------- */
.modal-overlay[hidden] {
  display: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,20,30,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-box {
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 26px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-box h2 { margin: 0 0 6px; font-size: 19px; }

.otp-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 20px 0 6px;
}

.otp-box {
  width: 44px;
  height: 52px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  outline: none;
}

.otp-box:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.otp-resend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

#verifyOtpBtn { margin-top: 18px; }

/* ---------------- Toasts ---------------- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.toast {
  background: #111111;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  max-width: 320px;
  animation: toast-in .2s ease;
}

.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------- Responsive ---------------- */
@media (max-width: 640px) {
  .reg-body { padding: 24px 18px 28px; }
  .form-row.two-col { grid-template-columns: 1fr; gap: 0; }
  .otp-box { width: 38px; height: 46px; font-size: 18px; }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .reg-card { max-width: 560px; }
}

#printReceiptBtn { margin-top: 18px; }

/* ---------------- Thermal receipt (print-only) ---------------- */
#printReceipt { display: none; }

@media print {
  body * { visibility: hidden; }
  #printReceipt, #printReceipt * { visibility: visible; }
  #printReceipt {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
    padding: 4mm;
    font-family: 'Courier New', Courier, monospace;
    color: #000;
    box-sizing: border-box;
  }
}

.receipt-logo {
  max-width: 100%;
  max-height: 18mm;
  display: block;
  margin: 0 auto 6px;
}

.receipt-event-name {
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
}

.receipt-line {
  border-top: 1px dashed #000;
  margin: 6px 0;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  padding: 2px 0;
}

.receipt-row span:first-child { font-weight: 700; }
.receipt-row span:last-child { text-align: right; word-break: break-word; }

.receipt-regno-label {
  text-align: center;
  font-size: 11px;
  margin-top: 4px;
}

.receipt-regno {
  text-align: center;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 1px;
  margin-top: 2px;
}
