/**
 * Xaman wallet connect QR / deep-link (#wallet-modal) – shared profile + gifts login.
 * Loaded site-wide via partials/head.ejs
 */

/* Backdrop (#wallet-modal reuses global .modal; we layer polish when open). */
#wallet-modal.modal {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background-color: rgba(6, 9, 15, 0.85);
}

#wallet-modal .modal-content {
  margin: auto;
  padding: 0;
  width: min(440px, 92vw);
  max-height: calc(100vh - 3rem - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    radial-gradient(circle at 12% -10%, rgba(76, 110, 245, 0.18), transparent 48%),
    radial-gradient(circle at 92% 110%, rgba(52, 152, 219, 0.12), transparent 44%),
    linear-gradient(160deg, #151a24 0%, var(--dark-color, #121212) 45%, #0f1218 100%);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow-x: hidden;
}

/* Close control */
#wallet-modal .xaman-connect-close.close-modal {
  top: 0.85rem;
  right: 0.95rem;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

#wallet-modal .xaman-connect-close.close-modal:hover {
  color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
}

#wallet-modal .xaman-connect {
  padding: 2rem clamp(1.25rem, 4vw, 2rem) 1.65rem;
  padding-top: 2.85rem;
}

#wallet-modal .xaman-connect__head {
  text-align: center;
  margin-bottom: 1.35rem;
}

#wallet-modal .xaman-connect__eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
  margin: 0 0 0.5rem;
}

#wallet-modal .xaman-connect__title-row {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 0.5rem;
}

#wallet-modal .xaman-connect__brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #eaf2ff;
  background: linear-gradient(135deg, rgba(53, 128, 255, 0.35), rgba(30, 64, 175, 0.25));
  border: 1px solid rgba(99, 140, 248, 0.35);
  border-radius: 8px;
  padding: 0.25rem 0.65rem;
  line-height: 1;
}

#wallet-modal .xaman-connect__title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.96);
  letter-spacing: -0.02em;
}

#wallet-modal .xaman-connect__subtitle {
  margin: 0 auto;
  max-width: 20rem;
  font-size: 0.9125rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.56);
}

#wallet-modal .xaman-connect__mobile-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#wallet-modal .xaman-connect__error-text.xaman-connect__subtitle {
  color: rgba(255, 200, 200, 0.92);
  max-width: none;
  white-space: pre-wrap;
}

#wallet-modal .xaman-connect__error-actions {
  margin-top: 0.65rem;
  width: 100%;
}

#wallet-modal .xaman-connect__qr-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.15rem;
}

#wallet-modal .xaman-connect__qr-frame {
  padding: clamp(14px, 3vw, 18px);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.06),
    0 12px 36px rgba(0, 0, 0, 0.45);
}

#wallet-modal .xaman-connect__qr-img {
  display: block;
  width: clamp(216px, 58vw, 260px);
  height: auto;
  border-radius: 8px;
  vertical-align: middle;
}

#wallet-modal .xaman-connect__qr-error {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: rgba(231, 76, 60, 0.12);
  border: 1px solid rgba(231, 76, 60, 0.35);
  color: rgba(255, 200, 200, 0.95);
  font-size: 0.875rem;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}

#wallet-modal .xaman-connect__qr-error a {
  color: var(--secondary-color, #3498db);
}

#wallet-modal .xaman-connect__scan-hint {
  margin: 0 0 1rem;
  text-align: center;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
}

#wallet-modal .xaman-connect__scan-hint i {
  opacity: 0.55;
  margin-right: 0.35rem;
}

#wallet-modal .xaman-connect__scan-hint strong {
  color: rgba(255, 255, 255, 0.92);
  font-weight: 600;
}

#wallet-modal .xaman-connect__mobile-tip {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

#wallet-modal .xaman-connect__mobile-tip i {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(46, 196, 182, 0.18);
  border: 1px solid rgba(46, 196, 182, 0.28);
}

#wallet-modal .xaman-connect__mobile-tip-body {
  font-size: 0.8875rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.76);
}

#wallet-modal .xaman-connect__mobile-tip a {
  font-weight: 600;
  color: var(--secondary-color, #52c8ea);
  text-decoration: none;
  border-bottom: 1px solid rgba(116, 192, 252, 0.5);
}

#wallet-modal .xaman-connect__mobile-tip a:hover {
  color: rgba(179, 220, 255, 0.98);
  border-bottom-color: rgba(179, 220, 255, 0.75);
}

#wallet-modal .xaman-connect__status {
  margin-top: 1.15rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.8375rem;
  text-align: center;
  letter-spacing: 0.015em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.65rem;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.62);
}

#wallet-modal .xaman-connect__status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(46, 214, 190, 0.75);
  box-shadow: 0 0 0 4px rgba(46, 214, 190, 0.12);
  animation: xaman-connect-pulse 1.55s ease-in-out infinite;
}

#wallet-modal .xaman-connect__status-msg {
  flex: 1;
  min-width: 0;
  text-align: center;
}

#wallet-modal .xaman-connect__status:not(.is-waiting) .xaman-connect__status-dot {
  display: none;
}

@keyframes xaman-connect-pulse {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(0.94);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

/* Success / idle / error tone */
#wallet-modal .xaman-connect__status.is-success {
  border-color: rgba(46, 204, 113, 0.35);
  background: rgba(46, 204, 113, 0.1);
  color: rgba(190, 255, 218, 0.94);
}

#wallet-modal .xaman-connect__status.is-error {
  border-color: rgba(231, 76, 60, 0.35);
  background: rgba(231, 76, 60, 0.1);
  color: rgba(255, 200, 200, 0.95);
}

#wallet-modal .xaman-connect__mobile-hero i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  border-radius: 20px;
  font-size: 1.85rem;
  margin-bottom: 1rem;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(76, 110, 245, 0.22);
  border: 1px solid rgba(99, 140, 248, 0.35);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
}

#wallet-modal .xaman-connect .xaman-connect__mobile-body {
  text-align: center;
  margin-bottom: 1.25rem;
  font-size: 0.9275rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.74);
}

#wallet-modal .xaman-connect-btn {
  width: 100%;
  cursor: pointer;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.015em;
  padding: 0.95rem 1.25rem;
  margin-bottom: 0.85rem;
  border: none;
  font-family: inherit;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  display: inline-flex;
  transition:
    transform 0.18s ease,
    filter 0.18s ease;
  color: #fff;
  background: linear-gradient(135deg, #3b71f9 0%, #2563eb 55%, #1d4ed8 100%);
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.45);
}

#wallet-modal .xaman-connect-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

#wallet-modal .xaman-connect-btn:active {
  transform: translateY(0);
}

#wallet-modal .xaman-connect__note-inline {
  text-align: left;
}

#wallet-modal .xaman-connect__error-msg {
  text-align: center;
  padding: 0.5rem 0 1rem;
  color: rgba(255, 200, 200, 0.95);
}

#wallet-modal .xaman-connect-retry-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  cursor: pointer;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.925rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.92);
  transition:
    background 0.18s ease,
    border-color 0.18s ease;
}

#wallet-modal .xaman-connect-retry-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}

/* Legacy / QR helper (outside wallet modal scratch flows may still reference) */
.login-status,
.credit-status {
  text-align: center;
  padding: 10px;
  margin: 10px 0;
  border-radius: 4px;
}

#credit-modal .modal-content {
  max-width: 400px;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

.token-radio-group {
  display: flex;
  gap: 15px;
}

.token-radio-group label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: normal;
}

.token-radio-group input[type='radio'] {
  margin-right: 5px;
}

input[type='number'] {
  width: 100%;
  padding: 8px;
  border-radius: 4px;
  font-size: 16px;
}

.submit-btn,
.cancel-btn {
  border-radius: 4px;
  padding: 10px 15px;
  cursor: pointer;
  font-size: 16px;
  width: 100%;
  transition: filter 0.2s;
}

.submit-btn:hover,
.cancel-btn:hover {
  filter: brightness(1.06);
}

.token-details {
  margin-top: 10px;
  padding: 5px 0;
}

.detail-item {
  margin-top: 5px;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.connected-wallet {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(0, 240, 125, 0.3);
}

.wallet-indicator {
  font-size: 14px;
  font-weight: 500;
}
