/* ==========================================================================
   XPROTECT MODALS & DIALOGS STYLES
   ========================================================================== */

/* Modal Backdrop */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 18, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  z-index: 99990;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Modal Card */
.modal-container {
  background: #0d121f;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), var(--shadow-glow-blue);
  width: 100%;
  max-width: 600px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(15px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-container {
  transform: translateY(0) scale(1);
}

/* Terms & Privacy modals use normal solid window shadow without glow */
#terms-modal .modal-container,
#privacy-modal .modal-container {
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.85);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
}

.modal-title i {
  color: var(--accent-blue);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  color: #cbd5e1;
  font-size: 0.92rem;
  line-height: 1.65;
}

.modal-body h4 {
  color: #ffffff;
  font-size: 1.05rem;
  margin: 18px 0 8px;
}

.modal-body h4:first-child {
  margin-top: 0;
}

.modal-body p {
  margin-bottom: 12px;
}

.modal-body ul {
  padding-left: 20px;
  margin-bottom: 14px;
}

.modal-body li {
  margin-bottom: 6px;
}

.modal-highlight-box {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-left: 4px solid var(--accent-blue);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 16px 0;
  color: #e2e8f0;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: flex-end;
  background: rgba(255, 255, 255, 0.02);
}

/* Token / Credits Modal Specifics */
.packages-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.package-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.package-card:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--accent-blue);
  transform: translateY(-2px);
}

.package-amount {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}

.package-tag {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.package-price {
  background: var(--accent-blue);
  color: #ffffff;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}

#auth-modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-width: 100vw !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)) !important;
  box-sizing: border-box !important;
  z-index: 999999 !important;
  background: rgba(0, 0, 0, 0.68) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

#auth-modal-overlay.hidden {
  display: none !important;
}

#auth-modal-overlay .auth-card-dark {
  width: 100% !important;
  max-width: 440px !important;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: 0 auto !important;
  position: relative !important;
  left: auto !important;
  right: auto !important;
  transform: none !important;
  box-sizing: border-box !important;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

html,
body {
  overflow-x: hidden !important;
  max-width: 100% !important;
}

.auth-card-dark {
  background: #0d121f;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 20px;
  width: 440px;
  max-width: 94vw;
  padding: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75);
  font-family: 'Outfit', sans-serif;
  color: #f8fafc;
  margin: auto !important;
  box-sizing: border-box;
}

.auth-verify-header {
  margin-bottom: 18px;
}

.auth-signout-pill {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: #fca5a5;
  padding: 7px 12px;
  min-height: 34px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.12s;
}

@media (hover: hover) and (pointer: fine) {
  .auth-signout-pill:hover {
    background: rgba(248, 113, 113, 0.18);
    border-color: rgba(248, 113, 113, 0.45);
    color: #fecaca;
  }
}

.auth-signout-pill:active {
  transform: scale(0.95);
  background: rgba(248, 113, 113, 0.22);
}

.auth-steps-panel {
  background: #161d2f;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  padding: 16px;
}

.auth-title-dark {
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.auth-step-dark {
  display: flex;
  align-items: flex-start;
  margin-top: 0;
  color: #94a3b8;
  font-size: 15px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.auth-step-dark.active {
  color: #f8fafc !important;
  font-weight: 600 !important;
}

.auth-step-dark.completed {
  color: #f8fafc !important;
  font-weight: 600 !important;
}

.auth-step-body {
  flex: 1;
  min-width: 0;
}

.auth-step-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 24px;
  line-height: 1.3;
}

.auth-step-sublabel {
  font-size: 12px;
  font-weight: 400;
  color: #94a3b8;
  margin-top: 3px;
  line-height: 1.35;
}

.auth-actor-pill,
.auth-network-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-actor-pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: rgba(167, 139, 250, 0.14);
  border: 1px solid rgba(167, 139, 250, 0.32);
  color: #c4b5fd;
}

.auth-network-pill {
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

.step-icon-dark {
  margin-right: 12px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 17px;
}

.step-line-dark {
  margin-left: 11px;
  border-left: 2px solid rgba(148, 163, 184, 0.22);
  height: 16px;
  margin-top: 4px;
  margin-bottom: 4px;
  transition: border-color 0.2s ease;
}

.step-line-dark.completed {
  border-left-color: #10b981;
}

.auth-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.2px solid rgba(167, 139, 250, 0.25);
  border-top-color: #a78bfa;
  display: inline-block;
  animation: xprotectAuthSpin 0.65s linear infinite;
}

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

.auth-error-banner {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 11px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.32);
  color: #fca5a5;
  font-size: 12.5px;
  line-height: 1.4;
}

.auth-error-banner.hidden {
  display: none !important;
}

.auth-btn-premium {
  background: linear-gradient(135deg, #7c62db 0%, #5a42b3 100%);
  color: #ffffff;
  width: 100%;
  min-height: 50px;
  padding: 14px 18px;
  border-radius: 13px;
  font-weight: 700;
  font-size: 15.5px;
  font-family: inherit;
  margin-top: 16px;
  border: 1px solid rgba(167, 139, 250, 0.28);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
  .auth-btn-premium:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(124, 98, 219, 0.42);
  }
}

.auth-btn-premium:active:not(:disabled) {
  transform: scale(0.985);
}

.auth-btn-premium:disabled {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

.auth-btn-premium.is-verified,
.auth-btn-premium.is-verified:disabled {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  border-color: rgba(16, 185, 129, 0.45) !important;
  color: #ffffff !important;
  cursor: default;
}

.status-check-green {
  color: #10b981 !important;
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
}

.status-circle-pending {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(167, 139, 250, 0.6);
  background: rgba(167, 139, 250, 0.1);
  border-radius: 50%;
}

@media (max-width: 480px) {
  #auth-modal-overlay {
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)) !important;
  }

  #auth-modal-overlay .auth-card-dark {
    max-width: 100% !important;
    max-height: calc(100dvh - 24px);
    padding: 18px 16px !important;
    border-radius: 18px !important;
  }

  .auth-verify-header {
    margin-bottom: 14px;
  }

  .auth-signout-pill {
    padding: 6px 10px;
    font-size: 12px;
  }

  .auth-steps-panel {
    padding: 13px 13px;
    border-radius: 13px;
  }

  .auth-step-dark {
    font-size: 14px;
  }

  .auth-step-sublabel {
    font-size: 11.5px;
  }

  .auth-btn-premium {
    min-height: 48px;
    padding: 13px 16px;
    font-size: 15px;
    margin-top: 14px;
    border-radius: 12px;
  }
}

@media (max-width: 360px) {
  #auth-modal-overlay .auth-card-dark {
    padding: 16px 13px !important;
  }

  .auth-steps-panel {
    padding: 11px 11px;
  }

  .auth-actor-pill,
  .auth-network-pill {
    font-size: 10.5px;
    padding: 2px 6px;
    max-width: 130px;
  }
}

.auth-step {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
}

.auth-step.active {
  color: #ffffff;
}

.auth-step.completed {
  color: var(--accent-green);
}

.auth-step-line {
  margin-left: 11px;
  border-left: 2px solid rgba(255, 255, 255, 0.1);
  height: 20px;
}

.auth-step-line.completed {
  border-left-color: var(--accent-green);
}


/* Toast Notifications */
.reward-toast {
  position: fixed;
  top: 24px;
  right: -420px;
  width: 340px;
  background: rgba(17, 24, 39, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 16px;
  color: #ffffff;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
  z-index: 100000;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.reward-toast.show {
  right: 24px;
}

.reward-icon {
  background: linear-gradient(135deg, #7c62db 0%, #5a42b3 100%);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: 0 4px 15px rgba(124, 98, 219, 0.4);
}

.reward-content h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.reward-content p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.reward-close {
  position: absolute;
  top: 10px;
  right: 14px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.2rem;
  transition: color 0.2s;
}

.reward-close:hover {
  color: #ffffff;
}

@media (max-width: 480px) {
  .reward-toast {
    right: 16px;
    left: 16px;
    width: auto;
    top: auto;
    bottom: -150px;
    transition: bottom 0.4s ease;
  }

  .reward-toast.show {
    top: auto;
    bottom: 20px;
    right: 16px;
    left: 16px;
  }
}

/* Wallet Selector Modal */
#wallet-selector-overlay {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100vh !important;
  height: 100dvh !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)) !important;
  box-sizing: border-box !important;
  z-index: 999998 !important;
  background: rgba(0, 0, 0, 0.68) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

#wallet-selector-overlay.hidden {
  display: none !important;
}

.wallet-selector-card {
  width: 100% !important;
  max-width: 440px !important;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 24px !important;
  background: #0d121f !important;
  border: 1px solid rgba(148, 163, 184, 0.18) !important;
  border-radius: 20px !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75) !important;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.wallet-selector-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.wallet-selector-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.wallet-selector-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
}

.wallet-selector-title {
  font-size: 19px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.25;
}

.wallet-selector-subtitle {
  font-size: 12.5px;
  color: #94a3b8;
  margin-top: 2px;
  line-height: 1.35;
}

.wallet-selector-close {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.12s;
}

@media (hover: hover) and (pointer: fine) {
  .wallet-selector-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.22);
  }
}

.wallet-selector-close:active {
  transform: scale(0.94);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.wallet-selector-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wallet-choice-card {
  width: 100%;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #161d2f;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  color: #f3f4f6;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .wallet-choice-card:hover {
    background: #1c263d;
    border-color: rgba(124, 98, 219, 0.75);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.45), 0 0 0 1px rgba(124, 98, 219, 0.35);
    transform: translateY(-1px);
  }

  .wallet-choice-card:hover .wallet-choice-arrow {
    color: #c084fc;
    transform: translateX(2px);
  }
}

.wallet-choice-card:focus-visible {
  outline: none;
  background: #1c263d;
  border-color: rgba(124, 98, 219, 0.75);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.45), 0 0 0 1px rgba(124, 98, 219, 0.35);
}

.wallet-choice-card:active {
  transform: scale(0.985);
  background: #1c263d;
  border-color: rgba(124, 98, 219, 0.85);
}

.wallet-choice-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wallet-choice-icon--webauth {
  background: rgba(124, 98, 219, 0.16);
  border: 1px solid rgba(124, 98, 219, 0.35);
}

.wallet-choice-icon--webauth img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.wallet-choice-icon--anchor {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #60a5fa;
}

.wallet-choice-info {
  flex: 1;
  min-width: 0;
}

.wallet-choice-name {
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  line-height: 1.25;
}

.wallet-choice-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  white-space: nowrap;
}

.wallet-choice-desc {
  font-size: 12.5px;
  color: #94a3b8;
  margin-top: 3px;
  line-height: 1.35;
}

.wallet-choice-arrow {
  color: #64748b;
  font-size: 13px;
  flex-shrink: 0;
  transition: transform 0.2s, color 0.2s;
}

.wallet-selector-footer {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: #94a3b8;
  text-align: center;
}

.wallet-selector-footer a {
  color: #60a5fa;
  font-weight: 600;
  text-decoration: none;
  padding: 4px 2px;
  touch-action: manipulation;
}

.wallet-selector-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 480px) {
  #wallet-selector-overlay {
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)) !important;
  }

  .wallet-selector-card {
    max-width: 100% !important;
    max-height: calc(100dvh - 24px);
    padding: 18px 16px !important;
    border-radius: 18px !important;
  }

  .wallet-selector-header {
    margin-bottom: 16px;
    gap: 10px;
  }

  .wallet-selector-logo {
    width: 32px;
    height: 32px;
  }

  .wallet-selector-title {
    font-size: 17.5px;
  }

  .wallet-selector-subtitle {
    font-size: 12px;
  }

  .wallet-selector-options {
    gap: 9px;
  }

  .wallet-choice-card {
    padding: 12px 13px;
    gap: 12px;
    min-height: 60px;
    border-radius: 13px;
  }

  .wallet-choice-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .wallet-choice-icon--webauth img {
    width: 22px;
    height: 22px;
  }

  .wallet-choice-name {
    font-size: 14.5px;
    gap: 6px;
  }

  .wallet-choice-desc {
    font-size: 12px;
  }

  .wallet-selector-footer {
    margin-top: 14px;
    padding-top: 12px;
    font-size: 12px;
    gap: 6px;
  }
}

@media (max-width: 360px) {
  .wallet-selector-card {
    padding: 16px 13px !important;
  }

  .wallet-choice-card {
    padding: 11px 11px;
    gap: 10px;
  }

  .wallet-choice-icon {
    width: 36px;
    height: 36px;
  }

  .wallet-choice-name {
    font-size: 14px;
  }

  .wallet-choice-badge {
    font-size: 10px;
    padding: 1px 6px;
  }
}
