
/* ── Overlay ──────────────────────────────────────────────────────────── */
.wallet-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.wallet-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ── Modal card ───────────────────────────────────────────────────────── */
.wallet-modal {
  background: #ffffff;
  border-radius: 20px;
  width: 800px;
  max-width: 96vw;
  max-height: 75vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 25px;
  position: relative;
  transform: translateY(40px);
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.wallet-modal-overlay.active .wallet-modal {
  transform: translateY(0);
  opacity: 1;
  animation: wallet-shake 0.4s ease-in-out;
}

@keyframes wallet-shake {
  0%   { transform: translateY(0) translateX(0); }
  25%  { transform: translateY(0) translateX(-10px); }
  50%  { transform: translateY(0) translateX(10px); }
  75%  { transform: translateY(0) translateX(-6px); }
  100% { transform: translateY(0) translateX(0); }
}

/* ── Layout ───────────────────────────────────────────────────────────── */
@media (min-width: 900px) {
  .wallet-modal { flex-direction: row; }
}

.wallet-modal-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-height: 100%;
  overflow: hidden;
  padding-right: 20px;
}

.wallet-modal-right {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ── Header & subtitle ────────────────────────────────────────────────── */
.wallet-modal-header,
.wallet-modal-subtitle {
  flex-shrink: 0;
  background: #fff;
  padding-bottom: 4px;
  z-index: 1;
}

.wallet-modal-header {
  font-weight: bold;
  font-size: 14px;
  color: #000;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
}

.wallet-modal-header svg {
  display: block;
}

.wallet-modal-subtitle {
  color: #555;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 8px;
  padding: 4px 2px;
  display: inline-block;
}

/* ── Wallet list ──────────────────────────────────────────────────────── */
.wallet-modal-wallet-list {
  overflow-y: auto;
  flex-grow: 1;
  padding-right: 4px;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wallet-modal-wallet-list::-webkit-scrollbar { width: 6px; }
.wallet-modal-wallet-list::-webkit-scrollbar-track { background: transparent; }
.wallet-modal-wallet-list::-webkit-scrollbar-thumb { background-color: rgba(0,0,0,0.10); border-radius: 8px; }

/* ── Wallet item ──────────────────────────────────────────────────────── */
.wallet-modal-wallet-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 20px;
  height: 60px;
  background-color: #fff;
  cursor: pointer;
  transition: background-color 0.25s ease, transform 0.1s ease;
}

.wallet-modal-wallet-item:hover  { background-color: #f3f4f6; }
.wallet-modal-wallet-item:active { transform: scale(0.98); background-color: #e5e7eb; }

.wallet-modal-wallet-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wallet-modal-wallet-info span {
  color: #111;
  font-size: 14px;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.wallet-modal-wallet-info img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background-color: #f3f4f6;
  border: 1px solid #e5e7eb;
  object-fit: contain;
}

/* ── Recommended badge ────────────────────────────────────────────────── */
.wallet-modal-recommended {
  font-size: 10px;
  color: #05c364;
  font-weight: 600;
  background-color: #d7fae2;
  padding: 1px 6px;
  line-height: 18px;
  display: inline-block;
  user-select: none;
  font-family: sans-serif;
  border-radius: 5px;
}

.wallet-modal-recommended.loading {
  background-color: transparent;
  color: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
}

.wallet-modal-recommended.inserted {
  font-size: 10px;
  color: #05c364;
  background-color: #d7fae2;
  border-radius: 5px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Disable pointer events while processing */
.wallet-modal-wallet-list.processing {
  pointer-events: none;
  opacity: 0.85;
}

/* ── Connect box (base + confirm state) ───────────────────────────────── */
.wallet-modal-connect-box {
  width: 100%;
  border-radius: 20px;
  height: 380px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: #666;
  opacity: 0;
  transition: opacity 0.4s ease;
  overflow: hidden;
}

.wallet-modal-overlay.active .wallet-modal-connect-box {
  opacity: 1;
}

/* ── Confirm state ────────────────────────────────────────────────────── */
.wm-confirm-box {
  background: #f3f4f6;
  padding: 20px;
}

.wm-confirm-box svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
}

/* ── QR Panel ─────────────────────────────────────────────────────────── */
.wm-qr-box {
  background: #ffffff;
  border: 1px solid #e8eaed;
  padding: 0;
  justify-content: flex-start;
  box-shadow: 0 2px 16px rgba(0,0,0,0.06);
}

.wm-qr-topbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px 12px;
  border-bottom: 1px solid #f0f2f5;
  flex-shrink: 0;
}

.wm-qr-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: #111;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: -0.01em;
}

.wm-qr-brand svg {
  flex-shrink: 0;
  width: 18px !important;
  height: 12px !important;
  margin-bottom: 0 !important;
  stroke: none !important;
}

.wm-qr-secure {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: #16a34a;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 20px;
  padding: 3px 9px 3px 7px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.wm-qr-secure svg {
  width: 10px !important;
  height: 10px !important;
  margin-bottom: 0 !important;
  stroke: #16a34a !important;
}

.wm-qr-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 18px 16px 20px;
  width: 100%;
}

/* ── QR code frame ────────────────────────────────────────────────────── */
.wm-qr-frame {
  position: relative;
  width: 232px;
  height: 232px;
  border-radius: 16px;
  border: 1.5px solid #e8eaed;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.wm-qr-frame canvas {
  display: block;
  width: 226px !important;
  height: 226px !important;
  border-radius: 14px;
  transition: opacity 0.25s ease;
}

/* QR loading pulse shimmer */
.wm-qr-frame.loading::before {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 12px;
  background: linear-gradient(90deg, #e8eaed 25%, #f5f6f8 50%, #e8eaed 75%);
  background-size: 200% 100%;
  animation: qr-pulse-shimmer 1.4s ease-in-out infinite;
  z-index: 2;
}
.wm-qr-frame.loading canvas {
  opacity: 0;
}
.wm-qr-frame.loading .wm-qr-logo-badge {
  opacity: 0;
  transition: opacity 0.2s;
}
@keyframes qr-pulse-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* WalletConnect logo badge overlaid on QR center */
.wm-qr-logo-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 66px;
  height: 66px;
  background: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.wm-qr-logo-badge img {
  width: 50px !important;
  height: auto !important;
  object-fit: contain;
  display: block;
}

/* ── Hint text ────────────────────────────────────────────────────────── */
.wm-qr-hint {
  font-size: 12px;
  color: #888;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.45;
  margin: 0;
  white-space: nowrap;
}

/* ── Copy link button ─────────────────────────────────────────────────── */
.wm-qr-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #0376c9;
  background: #eff7ff;
  border: 1.5px solid #c9e2fa;
  border-radius: 8px;
  padding: 7px 15px;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1;
}

.wm-qr-copy svg {
  width: 12px !important;
  height: 12px !important;
  margin-bottom: 0 !important;
  stroke: currentColor !important;
  flex-shrink: 0;
}

.wm-qr-copy:hover { background: #ddeefa; border-color: #a8d3f5; }
.wm-qr-copy.wm-qr-copy-ok { color: #16a34a; background: #f0fdf4; border-color: #bbf7d0; }

/* Tap-to-expand hint — desktop: hidden, mobile: shown via media query */
.wm-qr-tap-hint {
  display: none;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #3396FF;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Mobile QR expanded overlay ───────────────────────────────────────── */
.wm-qr-expanded-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.wm-qr-expanded-overlay.active {
  display: flex;
  animation: wmExpandIn 0.22s ease;
}

@keyframes wmExpandIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

.wm-qr-expanded-card {
  background: #ffffff;
  border-radius: 22px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.wm-qr-expanded-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px 14px;
  border-bottom: 1px solid #f0f2f5;
}

.wm-qr-expanded-close {
  background: #f3f4f6;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #555;
  transition: background 0.15s;
  flex-shrink: 0;
}
.wm-qr-expanded-close:hover { background: #e5e7eb; }

.wm-qr-expanded-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px 20px 28px;
}

/* Large QR frame */
.wm-qr-frame-large {
  width: 320px;
  height: 320px;
  border-radius: 20px;
}

.wm-qr-frame-large canvas {
  width: 314px !important;
  height: 314px !important;
  border-radius: 18px;
  transition: opacity 0.25s ease;
}

.wm-qr-frame-large.loading::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 14px;
  background: linear-gradient(90deg, #e8eaed 25%, #f5f6f8 50%, #e8eaed 75%);
  background-size: 200% 100%;
  animation: qr-pulse-shimmer 1.4s ease-in-out infinite;
  z-index: 2;
}
.wm-qr-frame-large.loading canvas { opacity: 0; }
.wm-qr-frame-large.loading .wm-qr-logo-badge-large { opacity: 0; transition: opacity 0.2s; }

.wm-qr-logo-badge-large {
  width: 82px;
  height: 82px;
  background: #fff;
  border-radius: 12px;
}

.wm-qr-logo-badge-large img {
  width: 62px !important;
  height: auto !important;
  object-fit: contain;
  display: block;
}

/* ── Spinner (wallet item) ────────────────────────────────────────────── */
@keyframes wm-spin { to { transform: rotate(360deg); } }

.wallet-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0,0,0,0.12);
  border-top-color: #05c364;
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  animation: wm-spin 0.9s linear infinite;
}

/* ── Pulse animation (right section) ─────────────────────────────────── */
@keyframes fadePulse {
  0%   { opacity: 0.3; }
  50%  { opacity: 1; }
  100% { opacity: 0.3; }
}
.wallet-modal-right.pulsing { animation: fadePulse 2s ease-in-out infinite; }

/* ── Mobile: slide up from bottom ────────────────────────────────────── */
@media (max-width: 800px) {
  .wallet-modal-overlay { align-items: flex-end; }

  .wallet-modal {
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    margin: 0;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 0.4s ease, opacity 0.3s ease;
    animation: none;
  }

  .wallet-modal-overlay.active .wallet-modal {
    transform: translateY(0);
    opacity: 1;
    animation: none;
  }

  .wallet-modal.closing {
    transform: translateY(100%) !important;
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.25s ease;
  }

  .wallet-modal-left  { max-height: 400px; padding-right: 0; margin-bottom: 12px; }
  .wallet-modal-right { padding-top: 0; }
  .wallet-modal-wallet-item { padding: 10px; }

  /* QR panel on mobile: compact row with bigger QR than original */
  .wallet-modal-connect-box { height: 136px; }

  .wm-qr-box {
    flex-direction: row; height: 136px; border-radius: 14px; cursor: pointer;
    animation: wmQrPulseRing 2.4s ease-in-out infinite;
  }
  @keyframes wmQrPulseRing {
    0%, 100% { box-shadow: 0 0 0 0 rgba(51,150,255,0.22); }
    50%       { box-shadow: 0 0 0 7px rgba(51,150,255,0); }
  }
  .wm-qr-topbar { display: none; }
  .wm-qr-body { flex-direction: row; gap: 13px; padding: 13px 15px; justify-content: flex-start; align-items: center; }
  .wm-qr-frame { width: 108px; height: 108px; border-radius: 10px; flex-shrink: 0; }
  .wm-qr-frame canvas { width: 104px !important; height: 104px !important; }
  .wm-qr-logo-badge { width: 34px; height: 34px; border-radius: 7px; }
  .wm-qr-logo-badge img { width: 22px !important; height: 14px !important; }
  .wm-qr-body > .wm-qr-hint { font-size: 11.5px; text-align: left; white-space: nowrap; line-height: 1.4; }
  .wm-qr-copy { display: inline-flex; padding: 5px 12px; font-size: 11.5px; }
  .wm-qr-tap-hint { display: none; }

  /* Right-side column for hint + copy on mobile */
  .wm-qr-body::after { display: none; }

  .wm-confirm-box { height: 120px; border-radius: 14px; }
  .wm-confirm-box svg { width: 34px; height: 34px; margin-bottom: 6px; }
}

/* ── Recently connected section ───────────────────────────────────────── */
.wallet-modal-recent-section {
  display: none;
  margin-bottom: 10px;
}

.wallet-modal-sublabel {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 6px;
  padding: 0 2px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.wallet-modal-recent-item {
  border-color: #d0e8ff !important;
  background: linear-gradient(135deg, #f0f7ff 0%, #fafcff 100%) !important;
  position: relative;
}

.wallet-modal-recent-item:hover {
  background: linear-gradient(135deg, #e0f0ff 0%, #f5faff 100%) !important;
}

.wallet-modal-recent-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  color: #0376c9;
  background: #ddeeff;
  border-radius: 5px;
  padding: 2px 7px;
  white-space: nowrap;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  flex-shrink: 0;
}

/* ── Reown header (main wallet selector) ──────────────────────────────── */
.wm-reown-btn {
  background: #141414;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Inter', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;
  cursor: default;
  line-height: 1;
  height: 28px;
  display: inline-flex;
  align-items: center;
}

.wm-manual-kit {
  font-size: 14px;
  font-weight: 500;
  color: #111;
  font-family: 'Inter', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;
  margin-left: 8px;
}

/* ── Misc helpers ─────────────────────────────────────────────────────── */
.hidden { display: none !important; }
