/**
 * 📚 COLLECTION ZONE v2 - Steve Jobs Audit Fix
 * Clean, scrollable, YOUR stuff
 */

/* ==================== COLLECTION LAYOUT ==================== */
.collection-zone {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  animation: collection-fade-in 0.3s ease-out;
}

@keyframes collection-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== COLLECTION HEADER ==================== */
.collection-header-v2 {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.collection-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.collection-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.collection-title-icon {
  font-size: 28px;
}

/* Stats Row - Minimal, contextual */
.collection-stats-row {
  display: flex;
  gap: 24px;
}

.collection-stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.collection-stat-value {
  font-family: 'Space Mono', monospace;
  font-size: 20px;
  font-weight: 700;
  color: #00ffc8;
}

.collection-stat-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Hide zero stats - they're depressing */
.collection-stat[data-value="0"] {
  display: none;
}

/* But show at least one if all are zero */
.collection-stats-row:has(.collection-stat[data-value="0"]:only-child) .collection-stat,
.collection-stats-row:not(:has(.collection-stat:not([data-value="0"]))) .collection-stat:first-child {
  display: flex;
  opacity: 0.4;
}

/* ==================== FILTER CHIPS v2 ==================== */
.collection-filters-v2 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip-v2 {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-chip-v2:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.filter-chip-v2.is-active {
  background: rgba(0, 255, 200, 0.15);
  border-color: rgba(0, 255, 200, 0.4);
  color: #00ffc8;
}

.filter-chip-v2 .chip-icon {
  font-size: 14px;
}

.filter-chip-v2 .chip-count {
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.filter-chip-v2.is-active .chip-count {
  background: rgba(0, 255, 200, 0.2);
}

/* Sort Dropdown */
.collection-sort {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.collection-sort-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

.collection-sort-select {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}

.collection-sort-select:focus {
  outline: none;
  border-color: #00ffc8;
}

/* ==================== CARD GRID v2 ==================== */
.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

@media (min-width: 768px) {
  .collection-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
  }
}

@media (min-width: 1200px) {
  .collection-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

/* ==================== EMPTY STATE v2 ==================== */
.collection-empty-v2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px;
  min-height: 400px;
}

.empty-illustration {
  font-size: 64px;
  margin-bottom: 24px;
  opacity: 0.8;
  animation: empty-float 3s ease-in-out infinite;
}

@keyframes empty-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.empty-title-v2 {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 8px;
}

.empty-text-v2 {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  margin: 0 0 24px;
  max-width: 300px;
}

.empty-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #00ffc8 0%, #00c8ff 100%);
  border: none;
  border-radius: 12px;
  color: #0a0a0f;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.empty-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 255, 200, 0.3);
}

/* ==================== COLLECTION CARD VARIANT ==================== */
/* Owned items feel different - warmer, personal */
.collection-grid .card {
  border-color: rgba(212, 175, 55, 0.2);
  background: linear-gradient(135deg, rgba(26, 22, 16, 0.9) 0%, rgba(15, 12, 8, 0.95) 100%);
}

.collection-grid .card:hover {
  border-color: #d4af37;
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.25), 0 0 0 1px rgba(212, 175, 55, 0.1);
}

/* Owned badge */
.collection-grid .card::after {
  content: '✓';
  position: absolute;
  bottom: 8px;
  left: 8px;
  width: 20px;
  height: 20px;
  background: rgba(212, 175, 55, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #1a1610;
  font-weight: bold;
  z-index: 5;
}

/* Upload source indicator */
.collection-grid .card[data-source="upload"]::after {
  content: '⬆';
  background: rgba(0, 255, 200, 0.9);
  color: #0a0a0f;
}

/* Purchased source indicator */
.collection-grid .card[data-source="purchased"]::after,
.collection-grid .card[data-source="pack"]::after {
  content: '💎';
  background: rgba(168, 85, 247, 0.9);
  font-size: 10px;
}

/* Favorite animation */
.card-fav {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.7);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}

.card-fav:hover {
  background: rgba(0, 0, 0, 0.8);
  color: #ffd700;
  transform: scale(1.1);
}

.card-fav.is-active {
  color: #ffd700;
  animation: fav-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes fav-pop {
  0% { transform: scale(1); }
  25% { transform: scale(1.4) rotate(-10deg); }
  50% { transform: scale(0.9) rotate(5deg); }
  75% { transform: scale(1.15) rotate(-3deg); }
  100% { transform: scale(1) rotate(0); }
}

/* Particle burst on favorite */
.card-fav.is-active::before,
.card-fav.is-active::after {
  content: '✦';
  position: absolute;
  font-size: 10px;
  color: #ffd700;
  animation: fav-particle 0.6s ease-out forwards;
  pointer-events: none;
}

.card-fav.is-active::before {
  animation-name: fav-particle-left;
}

.card-fav.is-active::after {
  animation-name: fav-particle-right;
}

@keyframes fav-particle-left {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(-20px, -15px) scale(0.5); }
}

@keyframes fav-particle-right {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(20px, -15px) scale(0.5); }
}

/* ==================== LOADING STATE ==================== */
.collection-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
}

.collection-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #00ffc8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ==================== SELECT MODE & BULK ACTIONS ==================== */
.collection-select-btn {
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.collection-select-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.collection-select-btn.is-active {
  background: rgba(0, 255, 200, 0.15);
  border-color: rgba(0, 255, 200, 0.4);
  color: #00ffc8;
}

/* Bulk Actions Bar */
.collection-bulk-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: rgba(0, 255, 200, 0.1);
  border: 1px solid rgba(0, 255, 200, 0.3);
  border-radius: 12px;
  margin-top: 12px;
}

.collection-bulk-bar.hidden {
  display: none;
}

.bulk-count {
  font-size: 13px;
  color: #00ffc8;
  font-weight: 600;
}

.bulk-actions {
  display: flex;
  gap: 8px;
  flex: 1;
}

.bulk-btn {
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bulk-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.bulk-btn--danger {
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

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

.bulk-cancel {
  padding: 8px 14px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  cursor: pointer;
}

.bulk-cancel:hover {
  color: #fff;
}

/* Card selection checkbox */
.card-select {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  display: none;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
}

.select-mode .card-select {
  display: flex;
}

.card-select.is-selected {
  background: #00ffc8;
  border-color: #00ffc8;
  color: #0a0a0f;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 640px) {
  .collection-zone {
    padding: 16px;
  }
  
  .collection-title-row {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .collection-stats-row {
    width: 100%;
    justify-content: space-between;
  }
  
  .collection-filters-v2 {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
  }
  
  .collection-sort {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
  }
  
  .collection-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}
