/* public/css/wallet-project-selector.css */
/* Text-first design — no external image dependencies */
/* Generated color accents + initials avatars + prominent stats */

/* ===== LOADING STATE ===== */
.project-selector-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  min-height: 400px;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #3a3a4a;
  border-top-color: #4a9eff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-spinner.large {
  width: 64px;
  height: 64px;
  border-width: 5px;
}

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

.loading-text {
  margin-top: 1.5rem;
  color: #aaa;
  font-size: 1rem;
  font-weight: 500;
}

/* ===== ERROR STATE ===== */
.project-selector-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  min-height: 400px;
}

.error-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.project-selector-error h3 {
  color: #e0e0e0;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.project-selector-error p {
  color: #aaa;
  font-size: 1rem;
  margin-bottom: 1.5rem;
  max-width: 400px;
}

/* ===== EMPTY STATE ===== */
.project-selector-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  min-height: 400px;
}

.empty-icon {
  font-size: 1.2rem;
  color: #666;
  margin-bottom: 1rem;
}

.project-selector-empty h3 {
  color: #e0e0e0;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.project-selector-empty p {
  color: #aaa;
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

/* ===== PROJECT SELECTOR ===== */
.project-selector {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.project-selector-header {
  text-align: center;
  margin-bottom: 2rem;
}

.project-selector-header h2 {
  font-size: 1.8rem;
  color: #e0e0e0;
  margin-bottom: 0.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.project-selector-header .subtitle {
  color: #888;
  font-size: 1rem;
}

/* ===== PROJECTS GRID ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

/* ===== PROJECT CARD (matches collection card design) ===== */
.project-card {
  background: #2a2a3a;
  border: 2px solid #3a3a4a;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  align-items: stretch;
  gap: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  min-height: 140px;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(74, 158, 255, 0.05) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.project-card:hover {
  border-color: #4a9eff;
  background: #3a3a4a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 158, 255, 0.2);
}

.project-card:hover::before {
  opacity: 1;
}

/* ===== AVATAR (shared between project + collection) ===== */
.project-avatar,
.collection-avatar {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--card-grad-start, rgba(74, 158, 255, 0.2)), var(--card-bg, #2a2a3a));
  border: 1px solid var(--card-border, #3a3a4a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--card-accent, #4a9eff);
  letter-spacing: 0.02em;
  user-select: none;
}

.project-card:hover .project-avatar,
.collection-card:hover .collection-avatar {
  border-color: var(--card-accent, #4a9eff);
}

/* Progressive image overlay — fades in on top of initials when loaded */
.project-avatar .avatar-img,
.collection-avatar .avatar-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.project-avatar .avatar-img.loaded,
.collection-avatar .avatar-img.loaded {
  opacity: 1;
}

/* ===== PROJECT INFO ===== */
.project-info {
  flex: 1;
  min-width: 0;
}

.project-name {
  font-size: 1rem;
  color: #e0e0e0;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  line-height: 1.3;
}

.project-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #888;
  font-size: 0.85rem;
}

.project-meta strong {
  color: #bbb;
  font-weight: 600;
}

.meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #555;
  flex-shrink: 0;
}

.meta-stat {
  white-space: nowrap;
}

/* ===== PROJECT ARROW ===== */
.project-arrow {
  flex-shrink: 0;
  color: #555;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
}

.project-card:hover .project-arrow {
  color: var(--card-accent, #4a9eff);
  transform: translateX(2px);
}

/* ===== COLLECTION SELECTOR ===== */
.collection-selector {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  animation: fadeIn 0.3s ease;
}

.collection-selector-header {
  margin-bottom: 2rem;
  text-align: center;
}

.collection-selector-header h2 {
  font-size: 1.8rem;
  color: #e0e0e0;
  margin-bottom: 0.5rem;
}

.collection-selector-header .subtitle {
  color: #888;
  font-size: 1.1rem;
}

/* ===== COLLECTIONS GRID ===== */
.collections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.collection-card {
  background: #2a2a3a;
  border: 2px solid #3a3a4a;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  align-items: stretch;
  gap: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  min-height: 140px;
}

.collection-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(74, 158, 255, 0.05) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.collection-card:hover {
  border-color: #4a9eff;
  background: #3a3a4a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 158, 255, 0.2);
}

.collection-card:hover::before {
  opacity: 1;
}

/* LARGE ICON - fills height */
.collection-icon {
  flex-shrink: 0;
  align-self: stretch;
  width: 120px;
  border-radius: 8px;
  overflow: hidden;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: #666;
  padding: 0;
}

.collection-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.collection-icon .icon-placeholder {
  font-size: 3rem;
  color: #666;
}

/* ===== COLLECTION INFO ===== */
.collection-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem 0;
}

.collection-name {
  color: #e0e0e0;
  font-weight: 600;
  font-size: 1.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collection-count {
  color: #888;
  font-size: 0.9rem;
}

.collection-address-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.collection-address {
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.8rem;
  color: #666;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #3a3a4a;
}

.copy-address-btn {
  background: transparent;
  border: 1px solid #3a3a4a;
  color: #888;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.copy-address-btn:hover {
  border-color: #4a9eff;
  color: #4a9eff;
  background: rgba(74, 158, 255, 0.1);
}

.copy-address-btn:active {
  transform: scale(0.95);
}

.copy-address-btn.copied {
  border-color: #10b981;
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.collection-arrow {
  font-size: 1.5rem;
  color: #4a9eff;
  flex-shrink: 0;
  align-self: center;
  transition: transform 0.2s ease;
}

.collection-card:hover .collection-arrow {
  transform: translateX(4px);
}

/* ===== BACK BUTTON ===== */
.back-button {
  background: transparent;
  border: 1px solid #3a3a4a;
  color: #4a9eff;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  margin-bottom: 1rem;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.back-button:hover {
  background: #3a3a4a;
  border-color: #4a9eff;
  transform: translateX(-2px);
}

/* ===== BADGES ===== */
.verified-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.unverified-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: rgba(107, 114, 128, 0.2);
  color: #9ca3af;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.collection-type-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: rgba(138, 43, 226, 0.2);
  color: #ba68ff;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.25rem;
  width: fit-content;
}

/* ===== TOP PROJECTS SECTION (collection-style cards) ===== */
.top-projects-section {
  margin-bottom: 1rem;
}

.section-header {
  margin-bottom: 1.5rem;
}

.section-header h2 {
  font-size: 1.6rem;
  color: #e0e0e0;
  margin-bottom: 0.3rem;
  font-weight: 700;
}

.section-header .subtitle {
  color: #888;
  font-size: 0.95rem;
}

.top-projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1rem;
}

/* Top project card — reuses collection-card style */
.top-project-card {
  background: #2a2a3a;
  border: 2px solid #3a3a4a;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  align-items: stretch;
  gap: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  min-height: 120px;
}

.top-project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(74, 158, 255, 0.05) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.top-project-card:hover {
  border-color: #4a9eff;
  background: #3a3a4a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 158, 255, 0.2);
}

.top-project-card:hover::before {
  opacity: 1;
}

.top-project-rank {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(74, 158, 255, 0.2);
  color: #4a9eff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 1;
}

/* Reuse collection-icon/info/arrow for top project cards */
.top-project-card .collection-icon {
  width: 100px;
}

.top-project-card .collection-info {
  padding: 0.5rem 0;
}

.top-project-card .collection-arrow {
  font-size: 1.5rem;
  color: #4a9eff;
  flex-shrink: 0;
  align-self: center;
  transition: transform 0.2s ease;
}

.top-project-card:hover .collection-arrow {
  transform: translateX(4px);
}

/* ===== GLOBAL SEARCH (header) ===== */
.marketplace-search-box {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.global-search-input {
  width: 100%;
  padding: 0.6rem 1rem;
  background: #2a2a3a;
  border: 1px solid #3a3a4a;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.global-search-input:focus {
  outline: none;
  border-color: #4a9eff;
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.15);
}

.global-search-input::placeholder {
  color: #666;
}

.global-search-results {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #1e1e2e;
  border: 1px solid #3a3a4a;
  border-radius: 8px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.search-group-label {
  padding: 8px 12px 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
}

.search-result-item {
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: background 0.1s ease;
}

.search-result-item:hover {
  background: #2a2a3a;
}

.search-result-name {
  color: #e0e0e0;
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-meta {
  color: #666;
  font-size: 0.8rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.search-no-results {
  padding: 16px;
  text-align: center;
  color: #666;
  font-size: 0.9rem;
}

/* ===== NAV OVERRIDES for marketplace ===== */
.nav-logo-img {
  height: 60px;
  width: auto;
}

/* ===== DEPRECATED: Old list-based collection styles ===== */
.collections-list,
.select-all-row,
.collection-row,
.collection-checkbox-label,
.collection-checkbox,
.collection-actions,
#selectedCount {
  display: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .projects-grid,
  .collections-grid,
  .top-projects-grid {
    grid-template-columns: 1fr;
  }

  .marketplace-search-box {
    max-width: none;
  }

  .project-selector,
  .collection-selector {
    padding: 1rem;
  }

  .project-selector-header h2,
  .collection-selector-header h2 {
    font-size: 1.4rem;
  }

  .collection-icon {
    width: 100px;
  }
}

@media (max-width: 480px) {
  .project-avatar {
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
  }

  .project-name {
    font-size: 0.95rem;
  }

  .project-meta {
    font-size: 0.8rem;
  }

  .collection-icon {
    width: 80px;
  }

  .collection-name {
    font-size: 1rem;
  }

  .collection-count {
    font-size: 0.85rem;
  }

  .collection-address {
    font-size: 0.7rem;
  }

  .collection-address-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .copy-address-btn {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
  }
}
