/* ==========================================================================
   Component: Panels
   Styles for header sub-components, panel headers, search bar, activity
   filter checkboxes, bottom control panel, settings modal, wallet modal,
   and whitelist overlay.
   ========================================================================== */


/* **************************************************************************
   1. HEADER SUB-COMPONENTS
   Classes used inside .header: collection info, wallet info, input group,
   and header actions.
   ************************************************************************** */

/* ---------------------------------------------------------------------------
   Collection Info — logo + name + stat chips
   --------------------------------------------------------------------------- */
.collection-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.collection-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-image {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  object-fit: cover;
  display: block;
}

.collection-name {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  color: var(--accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---------------------------------------------------------------------------
   Collection Stats
   --------------------------------------------------------------------------- */
.collection-stats {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-left: var(--space-2);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--accent);
  line-height: var(--leading-tight);
}

/* Hide stats on small screens */
@media (max-width: 767px) {
  .collection-stats {
    display: none;
  }
}

/* ---------------------------------------------------------------------------
   Wallet Info — balance + address display
   --------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------
   Header Right — wallet info + actions wrapper
   --------------------------------------------------------------------------- */
.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
  flex-shrink: 1;
  min-width: 0;
}

.wallet-info {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.wallet-balance {
  font-family: var(--font-mono);
  font-weight: var(--weight-semibold);
  color: var(--accent);
}

/* Progressive: hide PNL/uPNL labels */
@media (max-width: 1100px) {
  .wallet-info .pnl-label {
    display: none;
  }
  .wallet-info {
    gap: var(--space-1);
  }
}

/* Progressive: hide uPNL + its separator */
@media (max-width: 900px) {
  .wallet-info > :nth-child(2),
  .wallet-info > :nth-child(3) {
    display: none;
  }
}

/* Progressive: hide Balance + its separator */
@media (max-width: 700px) {
  .wallet-info > :nth-child(4),
  .wallet-info > :nth-child(5) {
    display: none;
  }
}

/* Hide wallet info on very small screens */
@media (max-width: 480px) {
  .wallet-info {
    display: none;
  }
}

/* ---------------------------------------------------------------------------
   Collection Input — refresh + text input + start/stop
   --------------------------------------------------------------------------- */
.collection-input {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 1;
  min-width: 0;
}

.collection-input .input {
  min-width: 160px;
  max-width: 420px;
}

.refresh-btn {
  color: var(--text-secondary);
  flex-shrink: 0;
}

.refresh-btn:hover:not(:disabled) {
  color: var(--accent);
}

.refresh-btn:disabled {
  color: var(--text-disabled);
}

/* Spin animation for refresh */
.refresh-btn.is-refreshing svg {
  animation: refresh-spin 800ms linear infinite;
}

@keyframes refresh-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Hide input group on mobile */
@media (max-width: 767px) {
  .collection-input {
    display: none;
  }
}

/* ---------------------------------------------------------------------------
   Header Actions — connect/disconnect area
   --------------------------------------------------------------------------- */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}


/* **************************************************************************
   2. PANEL HEADER
   Reusable header row inside content sections (Listings, Activity, etc.)
   ************************************************************************** */

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--border-muted);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  background-color: var(--bg-surface);
  z-index: var(--z-base);
  min-height: 40px;
}

.panel-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.06em;
}

.panel-subtitle {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: var(--weight-normal);
}

/* ---------------------------------------------------------------------------
   Connection Status — dot + text
   --------------------------------------------------------------------------- */
.connection-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.connection-status .status-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background-color: var(--color-error);
  flex-shrink: 0;
}

.connection-status .status-dot.connected {
  background-color: var(--color-success);
  animation: status-dot-pulse 2s ease-in-out infinite;
}

@keyframes status-dot-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

.connection-status .paused-indicator {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-warning);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}


/* **************************************************************************
   3. SEARCH BAR
   Search input container inside the listings section.
   ************************************************************************** */

.search-bar {
  padding: var(--space-2);
  border-bottom: 1px solid var(--border-muted);
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  padding-left: calc(var(--space-3) + 18px);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: var(--space-3) center;
  background-size: 14px 14px;
}

.search-input:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2348c7ba' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
}


/* **************************************************************************
   4. ACTIVITY FILTER CHECKBOXES
   Custom colored checkbox indicators for List, Delist, Buy, Sale filters.
   ************************************************************************** */

.filter-checkbox {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

.filter-checkbox:hover {
  color: var(--text-primary);
}

/* Hide the native checkbox */
.filter-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Custom checkmark indicator */
.checkmark {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 2px solid var(--text-muted);
  background-color: transparent;
  flex-shrink: 0;
  position: relative;
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast);
}

/* Checked state — show a filled indicator */
.filter-checkbox input[type="checkbox"]:checked + .checkmark {
  border-color: transparent;
}

.filter-checkbox input[type="checkbox"]:checked + .checkmark::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 4px;
  height: 4px;
  border-radius: 1px;
  background-color: var(--bg-base);
}

/* Focus-visible for keyboard navigation */
.filter-checkbox input[type="checkbox"]:focus-visible + .checkmark {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- Color variants --- */

/* List = purple */
.checkmark.list {
  border-color: hsl(270, 60%, 50%);
}

.filter-checkbox input[type="checkbox"]:checked + .checkmark.list {
  background-color: hsl(270, 60%, 60%);
  border-color: hsl(270, 60%, 60%);
}

/* Delist = red */
.checkmark.delist {
  border-color: hsl(0, 60%, 50%);
}

.filter-checkbox input[type="checkbox"]:checked + .checkmark.delist {
  background-color: var(--color-error);
  border-color: var(--color-error);
}

/* Buy = green */
.checkmark.buy {
  border-color: hsl(142, 50%, 42%);
}

.filter-checkbox input[type="checkbox"]:checked + .checkmark.buy {
  background-color: var(--color-success);
  border-color: var(--color-success);
}

/* Sale = yellow/amber */
.checkmark.sale {
  border-color: hsl(42, 70%, 50%);
}

.filter-checkbox input[type="checkbox"]:checked + .checkmark.sale {
  background-color: hsl(42, 80%, 55%);
  border-color: hsl(42, 80%, 55%);
}


/* **************************************************************************
   5. BOTTOM CONTROL PANEL
   Fixed bottom bar with RPC mode selector and settings button.
   ************************************************************************** */

.bottom-control-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--footer-height);
  z-index: var(--z-sticky);
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-muted);
}

.control-panel-content {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 var(--space-4);
}

.control-panel-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

/* ---------------------------------------------------------------------------
   RPC Mode Selector
   --------------------------------------------------------------------------- */
.rpc-mode-selector {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.mode-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.rpc-mode-dropdown {
  appearance: none;
  padding: var(--space-1) var(--space-6) var(--space-1) var(--space-2);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-2) center;
  background-size: 10px;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.rpc-mode-dropdown:hover {
  border-color: var(--text-muted);
}

.rpc-mode-dropdown:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.15);
  outline: none;
}

.jito-tip-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  background: rgba(20, 241, 149, 0.08);
  border: 1px solid rgba(20, 241, 149, 0.2);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  white-space: nowrap;
  letter-spacing: 0.02em;
  transition: opacity 0.15s ease;
}

.jito-tip-badge[hidden] {
  display: none;
}

.jito-tip-value {
  color: var(--color-success);
  font-weight: 600;
}

/* ---------------------------------------------------------------------------
   SOL Price Widget (bottom panel)
   --------------------------------------------------------------------------- */
.sol-price-widget {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.sol-price-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.sol-price-value {
  color: var(--text-primary);
  font-weight: var(--weight-semibold);
}

.sol-price-change {
  font-size: 10px;
  font-weight: var(--weight-medium);
}

.sol-price-change.positive { color: var(--color-success); }
.sol-price-change.negative { color: var(--color-error); }

/* Tip mode toggle in settings */
.jito-tip-mode-switch {
  display: flex;
  gap: var(--space-1);
}

.jito-tip-mode-opt {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.jito-tip-mode-opt input {
  display: none;
}

.jito-tip-mode-opt:has(input:checked) {
  color: var(--text-inverse);
  background: var(--accent);
  border-color: var(--accent);
}

/* ---------------------------------------------------------------------------
   Royalty Toggle — compact inline in listings header
   --------------------------------------------------------------------------- */
.royalty-divider {
  color: var(--text-disabled);
  font-size: var(--text-xs);
  margin: 0 var(--space-1);
  user-select: none;
}

.royalty-toggle-header {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  cursor: pointer;
  user-select: none;
}

.royalty-toggle-header .toggle__track {
  width: 24px;
  height: 14px;
  overflow: hidden;
}

.royalty-toggle-header .toggle__track::after {
  top: 1px;
  left: 1px;
  width: 10px;
  height: 10px;
}

.royalty-toggle-header .toggle__input:checked + .toggle__track::after {
  transform: translateX(10px);
}

.royalty-toggle-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.royalty-toggle-header .toggle__input:checked ~ .royalty-toggle-label {
  color: var(--accent);
}

/* Wallet info separator */
.wallet-info-sep {
  color: var(--text-disabled);
  user-select: none;
}

/* ---------------------------------------------------------------------------
   Modern Settings Button
   --------------------------------------------------------------------------- */
.modern-settings-button {
  color: var(--text-secondary);
  flex-shrink: 0;
}

.modern-settings-button:hover:not(:disabled) {
  color: var(--accent);
}


/* **************************************************************************
   6. SETTINGS MODAL
   Settings-specific inner container, RPC mode toggle, grid layout, etc.
   Uses .modal-overlay from modal.css as the backdrop.
   ************************************************************************** */

.settings-modal {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - var(--space-8));
  max-height: calc(100dvh - var(--space-8));
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95) translateY(8px);
  transition:
    transform var(--transition-base),
    opacity var(--transition-base);
  opacity: 0;
}

.modal-overlay.is-open .settings-modal,
.modal-overlay.show .settings-modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* ---------------------------------------------------------------------------
   Modal Header (settings-specific; pairs with .modal-overlay)
   --------------------------------------------------------------------------- */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-muted);
  flex-shrink: 0;
}

.modal-title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  line-height: var(--leading-tight);
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-lg);
  line-height: 1;
  flex-shrink: 0;
  transition:
    color var(--transition-fast),
    background-color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
  background-color: var(--bg-elevated);
}

.modal-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ---------------------------------------------------------------------------
   Modal Content — scrollable body
   --------------------------------------------------------------------------- */
.modal-content {
  flex: 1;
  padding: var(--space-5);
  overflow-y: auto;
  min-height: 0;
}

.modal-content > * + * {
  margin-top: var(--space-4);
}

/* ---------------------------------------------------------------------------
   Modal Actions — footer with cancel/save
   --------------------------------------------------------------------------- */
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border-muted);
  flex-shrink: 0;
}

/* ---------------------------------------------------------------------------
   RPC Mode Toggle
   --------------------------------------------------------------------------- */
.rpc-mode-toggle {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.rpc-mode-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rpc-mode-switch {
  display: flex;
  gap: var(--space-2);
}

.rpc-mode-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  cursor: pointer;
  user-select: none;
  transition:
    color var(--transition-fast),
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.rpc-mode-option:hover {
  color: var(--text-primary);
  background-color: var(--bg-overlay);
  border-color: var(--text-muted);
}

.rpc-mode-option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.rpc-mode-option.active {
  color: var(--text-inverse);
  background-color: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.rpc-mode-option.active:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* ---------------------------------------------------------------------------
   Settings Section
   --------------------------------------------------------------------------- */
.settings-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.settings-section-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-muted);
}

/* ---------------------------------------------------------------------------
   Settings Grid — 2 columns on desktop, 1 on mobile
   --------------------------------------------------------------------------- */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

@media (max-width: 480px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------------------
   Setting Item — label + input pair
   --------------------------------------------------------------------------- */
.setting-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.setting-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.setting-input {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  min-height: 32px;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.setting-input:hover:not(:disabled):not(:focus) {
  border-color: var(--text-muted);
}

.setting-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.15);
  background-color: var(--bg-surface);
  outline: none;
}

.setting-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: var(--bg-elevated);
}

.setting-input::placeholder {
  color: var(--text-muted);
}

/* Hide number spinner in setting inputs */
.setting-input[type="number"]::-webkit-inner-spin-button,
.setting-input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.setting-input[type="number"] {
  -moz-appearance: textfield;
}


/* **************************************************************************
   7. WALLET SELECT MODAL
   Full-screen overlay with wallet selection grid.
   ************************************************************************** */

.wallet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Show state — toggle via JS setting display:flex */
.wallet-overlay[style*="display: flex"],
.wallet-overlay.is-open {
  display: flex;
}

/* ---------------------------------------------------------------------------
   Wallet Modal Card
   --------------------------------------------------------------------------- */
.wallet-modal {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: calc(100vh - var(--space-8));
  max-height: calc(100dvh - var(--space-8));
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: wallet-modal-enter var(--duration-normal) var(--ease-out);
}

@keyframes wallet-modal-enter {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ---------------------------------------------------------------------------
   Wallet Modal Header
   --------------------------------------------------------------------------- */
.wallet-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-muted);
  flex-shrink: 0;
}

.wallet-modal-title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  line-height: var(--leading-tight);
}

.wallet-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-xl);
  line-height: 1;
  flex-shrink: 0;
  transition:
    color var(--transition-fast),
    background-color var(--transition-fast);
}

.wallet-modal-close:hover {
  color: var(--text-primary);
  background-color: var(--bg-elevated);
}

.wallet-modal-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ---------------------------------------------------------------------------
   Wallet Modal Content
   --------------------------------------------------------------------------- */
.wallet-modal-content {
  flex: 1;
  padding: var(--space-4) var(--space-5);
  overflow-y: auto;
  min-height: 0;
}

/* ---------------------------------------------------------------------------
   Wallet Section (recently used / installed)
   --------------------------------------------------------------------------- */
.wallet-section {
  margin-bottom: var(--space-4);
}

.wallet-section:last-child {
  margin-bottom: 0;
}

.wallet-section h3 {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-3);
}

/* ---------------------------------------------------------------------------
   Wallet Grid — 3 columns on wider modals, 2 on narrow
   --------------------------------------------------------------------------- */
.wallet-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

@media (max-width: 360px) {
  .wallet-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------------------------------------------------------------------------
   Wallet Option — clickable card
   --------------------------------------------------------------------------- */
.wallet-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 80px;
  padding: var(--space-2);
  background-color: var(--bg-base);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
}

.wallet-option:hover {
  background-color: var(--bg-elevated);
  border-color: var(--border-default);
  transform: translateY(-1px);
}

.wallet-option:active {
  transform: translateY(0);
  background-color: var(--bg-overlay);
}

.wallet-option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wallet-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  object-fit: contain;
  flex-shrink: 0;
}

.wallet-name {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

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

/* ---------------------------------------------------------------------------
   Wallet Empty State
   --------------------------------------------------------------------------- */
.wallet-empty {
  padding: var(--space-4);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-normal);
}


/* **************************************************************************
   8. WHITELIST OVERLAY
   Full-screen gate overlay, hidden by default. Add .show class to reveal.
   ************************************************************************** */

.whitelist-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.whitelist-overlay.show {
  display: flex;
}

.whitelist-modal {
  width: 100%;
  max-width: 420px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.whitelist-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-8) var(--space-6);
  gap: var(--space-4);
}

.whitelist-content h2 {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  line-height: var(--leading-tight);
}

.whitelist-content p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
  max-width: 320px;
}

.whitelist-connect-btn {
  margin-top: var(--space-2);
  min-width: 180px;
}


/* **************************************************************************
   9. LISTINGS SCALE SLIDER
   ************************************************************************** */

.listings-scale-slider {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
  margin-right: var(--space-2);
}


/* **************************************************************************
   10. WALLET ADDRESS POPUP
   ************************************************************************** */

/* Wallet address — clickable */
.wallet-address-clickable {
  cursor: pointer;
  position: relative;
  transition: color var(--transition-fast);
}
.wallet-address-clickable:hover {
  color: var(--accent);
}

/* Wallet popup — lives at body level to avoid header overflow:hidden clipping */
.wallet-popup {
  position: fixed;
  display: flex;
  gap: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  padding: 3px;
  box-shadow: var(--shadow-lg);
  z-index: var(--z-modal);
  white-space: nowrap;
}

.wallet-popup-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.wallet-popup-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}


/* **************************************************************************
   11. REDUCED MOTION
   ************************************************************************** */

@media (prefers-reduced-motion: reduce) {
  .refresh-btn.is-refreshing svg,
  .connection-status .status-dot.connected {
    animation: none;
  }

  .wallet-modal {
    animation: none;
  }

  .rpc-mode-option,
  .wallet-option,
  .modal-close,
  .wallet-modal-close,
  .setting-input,
  .rpc-mode-dropdown,
  .filter-checkbox,
  .checkmark {
    transition: none;
  }

  .settings-modal {
    transition: none;
  }
}
