@import url("theme.css");

/* ===== Platform background ===== */
.platform-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.platform-bg__grid {
  position: absolute;
  inset: -50%;
  background-image:
    linear-gradient(rgba(99, 102, 241, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  transform: rotate(-8deg);
  animation: grid-drift 40s linear infinite;
}
@keyframes grid-drift {
  to { transform: rotate(-8deg) translate(48px, 48px); }
}
.platform-bg__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
}
.platform-bg__glow--1 {
  width: 320px; height: 320px;
  top: -80px; left: -60px;
  background: #6366f1;
  animation: glow-pulse 8s ease-in-out infinite;
}
.platform-bg__glow--2 {
  width: 280px; height: 280px;
  bottom: 10%; right: -40px;
  background: #8b5cf6;
  animation: glow-pulse 10s ease-in-out infinite reverse;
}
@keyframes glow-pulse {
  0%, 100% { opacity: 0.25; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(1.1); }
}

.app { position: relative; z-index: 1; }

.topbar {
  position: relative;
  z-index: 50;
}
.wallet-icon-btn {
  position: relative;
  z-index: 51;
  touch-action: manipulation;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
#balance-pill {
  cursor: pointer;
  touch-action: manipulation;
}

/* ===== Wallet icon in header ===== */
.wallet-icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(139,92,246,0.15));
  color: #a5b4fc;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}
.wallet-icon-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
  border-color: rgba(167, 139, 250, 0.7);
  animation: wallet-pulse 1.5s ease-in-out infinite;
}
@keyframes wallet-pulse {
  0%, 100% { box-shadow: 0 0 12px rgba(139, 92, 246, 0.35); }
  50% { box-shadow: 0 0 24px rgba(139, 92, 246, 0.65); }
}
.wallet-icon-btn__svg { width: 22px; height: 22px; }
.wallet-icon-btn__badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  font-size: 8px;
  font-weight: 800;
  background: var(--brand-gradient);
  color: #fff;
  padding: 1px 4px;
  border-radius: 6px;
  line-height: 1.2;
}

/* ===== Wallet root overlay ===== */
.wallet-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: opacity 0.3s;
}
.wallet-root.hidden {
  display: none !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.wallet-root:not(.hidden) {
  display: flex;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.wallet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 12, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.wallet-panel {
  position: relative;
  width: 100%;
  max-width: 500px;
  max-height: 92vh;
  max-height: 92dvh;
  background: var(--bg-glass-strong);
  backdrop-filter: var(--blur-modal);
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px var(--glass-border-in), var(--neon-strong);
  border-radius: 24px 24px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(0);
  animation: panel-slide-up 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes panel-slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.wallet-root.wallet-root--fullscreen {
  align-items: stretch;
  justify-content: stretch;
}
.wallet-root.wallet-root--fullscreen .wallet-backdrop {
  background: rgba(5, 7, 12, 0.92);
}
.wallet-panel--fullscreen {
  max-width: none;
  width: 100%;
  max-height: 100vh;
  max-height: 100dvh;
  border-radius: 0;
  height: 100%;
  border-left: none;
  border-right: none;
}
.wallet-panel--fullscreen .wallet-panel__body {
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0));
}
.wallet-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.wallet-panel__title {
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, #c4b5fd, #818cf8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.wallet-close {
  width: 36px; height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
}
.wallet-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px calc(20px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}
.wallet-view {
  animation: view-fade 0.28s ease;
}
@keyframes view-fade {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Balance cards */
.wallet-balances {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}
.wallet-loading {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
  font-size: 14px;
}

.wallet-kyc-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(167, 139, 250, 0.35);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.06));
}
.wallet-kyc-badge {
  display: inline-flex;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}
.wallet-kyc-badge--approved {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.4);
}
.wallet-kyc-badge--pending {
  background: rgba(139, 92, 246, 0.25);
  color: #c4b5fd;
  border: 1px solid rgba(196, 181, 253, 0.35);
}
.wallet-kyc-badge--none {
  background: rgba(251, 191, 36, 0.12);
  color: #fcd34d;
  border: 1px solid rgba(251, 191, 36, 0.35);
}
.wallet-kyc-hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.wallet-balance-card {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
}
.wallet-balance-card--bonus {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.2);
}
.wallet-balance-card__label { font-size: 11px; color: var(--muted); font-weight: 600; }
.wallet-balance-card__value {
  font-size: 26px;
  font-weight: 800;
  margin-top: 4px;
  background: linear-gradient(135deg, #e0e7ff, #a5b4fc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.wallet-balance-card__sub { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Buttons */
.wallet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.wallet-btn {
  padding: 14px;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.wallet-btn--primary {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #3b82f6 100%);
  color: #fff;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.45);
}
.wallet-btn--primary:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 28px rgba(139, 92, 246, 0.55);
}
.wallet-btn--ghost {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
}
.wallet-btn--ghost:hover { background: rgba(255,255,255,0.1); transform: scale(1.02); }
.wallet-btn--sm { padding: 10px 14px; font-size: 13px; }
.wallet-btn:disabled { opacity: 0.5; pointer-events: none; }

/* Method cards */
.wallet-methods { display: grid; gap: 12px; }
.wallet-method-card {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  text-align: left;
}
.wallet-method-card:hover {
  border-color: rgba(139, 92, 246, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.2);
}
.wallet-method-card__icon { font-size: 28px; margin-bottom: 8px; }
.wallet-method-card__title { font-size: 16px; font-weight: 700; }
.wallet-method-card__desc { font-size: 12px; color: var(--muted); margin-top: 4px; }

.wallet-cryptobot-guide .wallet-steps {
  margin: 12px 0 0;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}
.wallet-cryptobot-guide .wallet-steps li { margin-bottom: 8px; }
.wallet-cryptobot-guide a {
  color: #c4b5fd;
  text-decoration: underline;
}

/* Forms */
.wallet-field { margin-bottom: 14px; }
.wallet-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.wallet-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
}
.wallet-input:focus {
  outline: none;
  border-color: rgba(139, 92, 246, 0.6);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.wallet-copy-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.wallet-copy-row .wallet-input { flex: 1; font-size: 13px; }
.wallet-copy-btn {
  flex-shrink: 0;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(139, 92, 246, 0.4);
  background: rgba(99, 102, 241, 0.15);
  color: #c4b5fd;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
}
.wallet-copy-btn.copied {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--up);
  color: var(--up);
}

/* Crypto info card */
.wallet-info-card {
  padding: 14px;
  border-radius: 14px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
}
.wallet-info-card strong { color: #93c5fd; }

/* Spinner */
.wallet-spinner-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  text-align: center;
}
.wallet-spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent, #8b5cf6, #6366f1, #3b82f6, transparent);
  animation: spin 1s linear infinite;
  position: relative;
}
.wallet-spinner::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--bg-elevated);
}
@keyframes spin { to { transform: rotate(360deg); } }
.wallet-spinner-text {
  margin-top: 20px;
  font-size: 14px;
  color: var(--muted);
  max-width: 260px;
  line-height: 1.5;
}
.wallet-spinner-hint {
  margin-top: 8px;
  font-size: 11px;
  color: rgba(139, 92, 246, 0.85);
}
.wallet-active-dep {
  margin-bottom: 14px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(99, 102, 241, 0.14);
  border: 1px solid rgba(139, 92, 246, 0.45);
}
.wallet-active-dep__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.wallet-active-dep__title {
  font-size: 13px;
  font-weight: 700;
  color: #e9d5ff;
}
.wallet-active-dep__timer {
  font-size: 12px;
  font-weight: 700;
  color: #a78bfa;
  font-variant-numeric: tabular-nums;
}
.wallet-active-dep__status {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 6px;
  line-height: 1.4;
}
.wallet-active-dep__amount {
  font-size: 13px;
  margin: 0 0 12px;
}

.wallet-p2p-timer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.35);
}
.wallet-p2p-timer__label {
  font-size: 12px;
  color: var(--muted);
}
.wallet-p2p-timer__value {
  font-size: 20px;
  font-weight: 800;
  color: #a78bfa;
  font-variant-numeric: tabular-nums;
}

/* P2P payment page */
.wallet-pay-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: calc(100dvh - 120px);
  padding-bottom: 8px;
}
.wallet-req-card {
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.18), rgba(5, 150, 105, 0.08));
  border: 1px solid rgba(52, 211, 153, 0.55);
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.12);
}
.wallet-req-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.wallet-req-card__title {
  font-size: 13px;
  font-weight: 800;
  color: #6ee7b7;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.wallet-copy-btn {
  flex-shrink: 0;
  padding: 8px 12px;
  border: none;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  color: #ecfdf5;
  background: rgba(16, 185, 129, 0.35);
  cursor: pointer;
}
.wallet-copy-btn:active {
  transform: scale(0.97);
}
.wallet-req-card__body {
  margin: 0;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.55;
  color: #ecfdf5;
  white-space: pre-wrap;
  word-break: break-word;
}
.wallet-note-card {
  padding: 14px;
  border-radius: 14px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.35);
}
.wallet-note-card__title {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #c4b5fd;
  margin-bottom: 8px;
}
.wallet-note-card__body {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
}
.wallet-pay-footer {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 8px;
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, transparent, rgba(15, 17, 26, 0.95) 24%);
}
.wallet-pay-footer__btn {
  width: 100%;
  min-height: 48px;
  font-size: 14px;
}
.wallet-btn--danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.45);
  color: #fca5a5;
}
.wallet-btn--danger:active {
  background: rgba(239, 68, 68, 0.28);
}

/* Success check */
.wallet-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  text-align: center;
  animation: view-fade 0.4s ease;
}
.wallet-check {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: #fff;
  box-shadow: 0 0 40px rgba(16, 185, 129, 0.5);
  animation: check-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes check-pop {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.wallet-success p {
  margin-top: 20px;
  font-size: 15px;
  line-height: 1.5;
  color: #a7f3d0;
  max-width: 280px;
}

/* Transactions */
.wallet-tx-list { list-style: none; }
.wallet-tx-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 13px;
}
.wallet-tx-item__type { font-weight: 600; }
.wallet-tx-item__type.deposit { color: var(--up); }
.wallet-tx-item__type.withdraw { color: #f87171; }
.wallet-tx-item__amt { font-weight: 700; }
.wallet-tx-item__date { font-size: 11px; color: var(--muted); }

/* Receipt upload */
.wallet-file-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  border: 2px dashed rgba(139, 92, 246, 0.35);
  border-radius: 14px;
  cursor: pointer;
  margin-bottom: 14px;
  transition: border-color 0.2s, background 0.2s;
}
.wallet-file-label:hover {
  border-color: rgba(167, 139, 250, 0.6);
  background: rgba(99, 102, 241, 0.06);
}
.wallet-file-label input { display: none; }
.wallet-file-preview {
  max-width: 100%;
  max-height: 160px;
  border-radius: 10px;
  margin-top: 10px;
  object-fit: contain;
}

/* Toast */
.wallet-toast {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  padding: 12px 20px;
  border-radius: 14px;
  background: rgba(21, 24, 33, 0.95);
  border: 1px solid rgba(139, 92, 246, 0.4);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  font-size: 14px;
  font-weight: 600;
  max-width: 90%;
  text-align: center;
  animation: toast-in 0.35s ease;
}
.wallet-toast.hidden { display: none; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.wallet-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  margin-bottom: 14px;
  padding: 0;
}
.wallet-back-link:hover { color: #a5b4fc; }

.wallet-commission-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  font-size: 12px;
  color: #fcd34d;
  line-height: 1.45;
}
.wallet-net-preview {
  font-size: 13px;
  font-weight: 700;
  color: #a5b4fc;
  margin-top: 8px;
}

@media (min-width: 520px) {
  .wallet-root { align-items: center; }
  .wallet-panel {
    max-height: 85vh;
    border-radius: 20px;
    margin-bottom: 24px;
  }
}

body.wallet-open .app {
  overflow: hidden;
  touch-action: none;
}
.wallet-panel--steady {
  animation: none !important;
}

@media (max-width: 480px) {
  .wallet-panel--fullscreen { border-radius: 0; }
}

.wallet-policy-modal__box {
  max-width: 360px;
}
.wallet-policy-modal__text {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted, #94a3b8);
  white-space: pre-wrap;
}
