/* ============================================
   MeData Crypto Exchange - Wallet Connect v2
   Professional Wallet Connection System
   ============================================ */

/* ---------- WC Modal Overlay ---------- */
.wc-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.wc-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* ---------- WC Modal Box ---------- */
.wc-modal {
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  background: #12132a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(30px) scale(0.96);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 120px rgba(139, 92, 246, 0.08);
}

.wc-modal-overlay.open .wc-modal {
  transform: translateY(0) scale(1);
}

/* ---------- WC States ---------- */
.wc-state {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ---------- WC Modal Header ---------- */
.wc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 0;
  flex-shrink: 0;
}

.wc-modal-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.wc-close-btn {
  width: 36px; height: 36px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  cursor: pointer;
}

.wc-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* ---------- WC Search ---------- */
.wc-search-wrap {
  position: relative;
  margin: 16px 24px 8px;
  flex-shrink: 0;
}

.wc-search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.wc-search {
  width: 100%;
  padding: 12px 40px 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-fa);
  outline: none;
  transition: all 0.2s ease;
}

.wc-search::placeholder {
  color: var(--text-muted);
}

.wc-search:focus {
  border-color: rgba(139, 92, 246, 0.4);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* ---------- WC Wallets Container ---------- */
.wc-wallets-wrap {
  padding: 8px 24px 24px;
  overflow-y: auto;
  flex: 1;
  overscroll-behavior: contain;
}

.wc-wallets-wrap::-webkit-scrollbar {
  width: 4px;
}

.wc-wallets-wrap::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 2px;
}

/* ---------- WC Section Label ---------- */
.wc-section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 0 8px;
}

.wc-section-label i {
  font-size: 0.7rem;
}

.wc-section-label:first-child {
  padding-top: 4px;
}

/* ---------- WC Wallet Grid ---------- */
.wc-wallets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

/* ---------- WC Wallet Card ---------- */
.wc-wallet-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  min-height: 90px;
}

.wc-wallet-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(59, 130, 246, 0.05));
  opacity: 0;
  transition: opacity 0.2s ease;
}

.wc-wallet-card:hover {
  border-color: rgba(139, 92, 246, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 20px rgba(139, 92, 246, 0.08);
}

.wc-wallet-card:hover::before {
  opacity: 1;
}

.wc-wallet-card:active {
  transform: translateY(0);
}

/* Wallet Icon */
.wc-wallet-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  overflow: hidden;
  flex-shrink: 0;
}

.wc-wallet-icon img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 4px;
}

.wc-wallet-icon svg {
  width: 24px;
  height: 24px;
}

/* Fallback letter icon */
.wc-wallet-icon .wc-icon-fallback {
  font-size: 0.75rem;
  font-weight: 800;
  font-family: 'Inter', system-ui, sans-serif;
  color: #fff;
}

/* Wallet Name */
.wc-wallet-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.3;
  position: relative;
  z-index: 1;
  transition: color 0.2s ease;
}

.wc-wallet-card:hover .wc-wallet-name {
  color: var(--text-primary);
}

/* Installed badge */
.wc-wallet-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-green);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.wc-wallet-badge i {
  font-size: 0.5rem;
  color: #fff;
}

/* No results */
.wc-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 30px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.wc-no-results i {
  display: block;
  font-size: 2rem;
  margin-bottom: 10px;
  opacity: 0.4;
}

/* ---------- WC Connecting State ---------- */
.wc-connecting {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 32px 32px;
}

.wc-connecting-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  position: relative;
}

.wc-connecting-icon img,
.wc-connecting-icon svg {
  width: 36px;
  height: 36px;
}

.wc-connecting-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.wc-connecting-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

/* Spinner */
.wc-connecting-spinner {
  position: relative;
  width: 48px;
  height: 48px;
  margin-bottom: 24px;
}

.spinner-ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--accent-purple);
  animation: wcSpin 0.9s linear infinite;
}

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

.wc-cancel-btn {
  padding: 10px 28px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font-fa);
  cursor: pointer;
  transition: all 0.2s ease;
}

.wc-cancel-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* ---------- WC Connected State ---------- */
.wc-connected {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 32px 32px;
  position: relative;
}

.wc-connected-check {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-green), #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: -18px;
  z-index: 2;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
  animation: wcPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wc-connected-check i {
  font-size: 1.4rem;
  color: #fff;
}

@keyframes wcPopIn {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

.wc-connected-avatar {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  border: 3px solid #12132a;
}

.wc-connected-avatar img,
.wc-connected-avatar svg {
  width: 32px;
  height: 32px;
}

.wc-connected-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.wc-connected-address {
  font-family: 'Inter', monospace;
  font-size: 0.88rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 12px;
  direction: ltr;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.wc-connected-address:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.wc-connected-balance {
  font-family: 'Inter', system-ui;
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, #8b5cf6, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.wc-connected-network {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wc-connected-network .wc-net-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.wc-connected-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}

.wc-copy-btn,
.wc-disconnect-btn {
  flex: 1;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-fa);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.wc-copy-btn {
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.2);
  color: var(--accent-purple);
}

.wc-copy-btn:hover {
  background: rgba(139, 92, 246, 0.2);
}

.wc-copy-btn.copied {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.2);
  color: var(--accent-green);
}

.wc-disconnect-btn {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
}

.wc-disconnect-btn:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* ---------- WC Error State ---------- */
.wc-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 32px 32px;
}

.wc-error-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  color: var(--accent-red);
  font-size: 1.5rem;
}

.wc-error-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.wc-error-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.7;
}

.wc-retry-btn {
  padding: 10px 28px;
  border-radius: 12px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.2);
  color: var(--accent-purple);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font-fa);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wc-retry-btn:hover {
  background: rgba(139, 92, 246, 0.2);
}

/* ---------- WC Responsive ---------- */
@media (max-width: 480px) {
  .wc-modal {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 20px;
  }

  .wc-wallets-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .wc-wallet-card {
    padding: 12px 6px;
    min-height: 78px;
    border-radius: 12px;
  }

  .wc-wallet-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .wc-wallet-icon img,
  .wc-wallet-icon svg {
    width: 20px;
    height: 20px;
  }

  .wc-wallet-name {
    font-size: 0.65rem;
  }

  .wc-connected-balance {
    font-size: 1.5rem;
  }

  .wc-connected-actions {
    flex-direction: column;
  }
}
