/* ==========================================================================
   Component: Live Feed
   Global realtime NFT buy/sell feed.
   ========================================================================== */

/* ---------------------------------------------------------------------------
   Tab bar (ACTIVITY / LIVE FEED)
   --------------------------------------------------------------------------- */
.activity-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-muted);
  flex-shrink: 0;
}

.activity-tab {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  text-align: center;
}

.activity-tab:hover {
  color: var(--text-secondary);
}

.activity-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Live dot indicator */
.activity-tab .live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-error);
  margin-left: var(--space-1);
  vertical-align: middle;
  animation: live-dot-pulse 1.5s ease-in-out infinite;
}

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

/* ---------------------------------------------------------------------------
   Tab content panels
   --------------------------------------------------------------------------- */
.activity-tab-content {
  display: none;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.activity-tab-content.is-active {
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------------------------
   Live Feed Table
   --------------------------------------------------------------------------- */
.livefeed-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
  table-layout: fixed;
}

.livefeed-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-surface);
  padding: var(--space-1) var(--space-2);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border-muted);
  white-space: nowrap;
}

/* Column widths */
.livefeed-table th:nth-child(1),
.livefeed-table td:nth-child(1) { width: 36px; } /* NFT thumb */
.livefeed-table th:nth-child(2),
.livefeed-table td:nth-child(2) { width: auto; } /* Collection */
.livefeed-table th:nth-child(3),
.livefeed-table td:nth-child(3) { width: 56px; } /* Type */
.livefeed-table th:nth-child(4),
.livefeed-table td:nth-child(4) { width: 80px; } /* Price */
.livefeed-table th:nth-child(5),
.livefeed-table td:nth-child(5) { width: 72px; } /* Addr + TX link */
.livefeed-table th:nth-child(6),
.livefeed-table td:nth-child(6) { width: 44px; } /* Time */

.livefeed-table td {
  padding: var(--space-1) var(--space-2);
  border-bottom: 1px solid var(--border-muted);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------------------------------------------------------------------
   Live Feed Row
   --------------------------------------------------------------------------- */
.livefeed-row {
  transition: background-color var(--transition-fast);
}

.livefeed-row:hover {
  background-color: var(--bg-elevated);
}

.livefeed-row.is-new {
  animation: livefeed-enter 0.4s var(--ease-out);
}

@keyframes livefeed-enter {
  from {
    opacity: 0;
    transform: translateY(-4px);
    background-color: var(--accent-subtle);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    background-color: transparent;
  }
}

/* ---------------------------------------------------------------------------
   NFT Thumbnail
   --------------------------------------------------------------------------- */
.livefeed-nft-cell {
  display: flex;
  align-items: center;
}

.livefeed-thumb {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elevated);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.livefeed-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.livefeed-thumb-text {
  font-size: 8px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ---------------------------------------------------------------------------
   Collection + NFT name
   --------------------------------------------------------------------------- */
.livefeed-collection {
  overflow: hidden;
}

.livefeed-collection-inner {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.livefeed-collection-name {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.livefeed-nft-name {
  font-size: 10px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   Price
   --------------------------------------------------------------------------- */
.livefeed-price .price-container {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.livefeed-price .price-value {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

/* ---------------------------------------------------------------------------
   Type badge
   --------------------------------------------------------------------------- */
.livefeed-type-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  font-size: 9px;
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.4;
  white-space: nowrap;
}

.livefeed-type-badge.buy {
  background: color-mix(in srgb, var(--color-success) 18%, transparent);
  color: var(--color-success);
}

.livefeed-type-badge.sale {
  background: color-mix(in srgb, var(--color-sell) 18%, transparent);
  color: var(--color-sell);
}

.livefeed-type-badge.list {
  background: color-mix(in srgb, var(--color-sell) 18%, transparent);
  color: var(--color-sell);
}

.livefeed-type-badge.delist {
  background: color-mix(in srgb, var(--color-error) 18%, transparent);
  color: var(--color-error);
}

.livefeed-type-badge.bid {
  background: color-mix(in srgb, var(--color-info) 18%, transparent);
  color: var(--color-info);
}

.livefeed-type-badge.edit {
  background: color-mix(in srgb, var(--color-warning) 18%, transparent);
  color: var(--color-warning);
}

.livefeed-type-badge.other {
  background: color-mix(in srgb, var(--text-muted) 12%, transparent);
  color: var(--text-muted);
}

/* ---------------------------------------------------------------------------
   Address cells
   --------------------------------------------------------------------------- */
.livefeed-addr {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ---------------------------------------------------------------------------
   TX link (compact hash after address)
   --------------------------------------------------------------------------- */
.livefeed-tx-link {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 3px;
  opacity: 0.8;
  transition: opacity var(--transition-fast), color var(--transition-fast);
}
.livefeed-tx-link:hover {
  opacity: 1;
  color: var(--accent);
  text-decoration: underline;
}

/* ---------------------------------------------------------------------------
   Time cell
   --------------------------------------------------------------------------- */
.livefeed-time {
  font-size: 10px;
  color: var(--text-muted);
  text-align: right;
  overflow: visible;
  text-overflow: clip;
}

/* ---------------------------------------------------------------------------
   Empty state
   --------------------------------------------------------------------------- */
.livefeed__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-4);
  color: var(--text-muted);
  text-align: center;
  font-size: var(--text-sm);
}

/* ---------------------------------------------------------------------------
   Live feed container (scrollable)
   --------------------------------------------------------------------------- */
.livefeed-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

/* ---------------------------------------------------------------------------
   Scale levels (applied via data-scale on .landing-feed-container)
   --------------------------------------------------------------------------- */
.landing-feed-container[data-scale="0"] { --feed-thumb: 20px; --feed-col-width: 28px; }
.landing-feed-container[data-scale="1"] { --feed-thumb: 28px; --feed-col-width: 36px; }
.landing-feed-container[data-scale="2"] { --feed-thumb: 44px; --feed-col-width: 52px; }
.landing-feed-container[data-scale="3"] { --feed-thumb: 64px; --feed-col-width: 72px; }

.landing-feed-container .livefeed-table th:nth-child(1),
.landing-feed-container .livefeed-table td:nth-child(1) {
    width: var(--feed-col-width, 36px);
}

.landing-feed-container .livefeed-thumb,
.landing-feed-container .livefeed-thumb-img {
  width: var(--feed-thumb, 28px);
  height: var(--feed-thumb, 28px);
}

.landing-feed-container .livefeed-thumb-placeholder {
  width: var(--feed-thumb, 28px);
  height: var(--feed-thumb, 28px);
}

/* ---------------------------------------------------------------------------
   Broken image placeholder
   --------------------------------------------------------------------------- */
.livefeed-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-elevated) 0%, color-mix(in srgb, var(--accent) 15%, var(--bg-elevated)) 100%);
  color: var(--text-disabled);
  font-size: 12px;
}

/* ---------------------------------------------------------------------------
   Lucky Buy badge
   --------------------------------------------------------------------------- */
.livefeed-lucky-badge {
  display: inline-block;
  margin-left: 3px;
  font-size: 9px;
  vertical-align: middle;
  color: #4ade80;
  filter: drop-shadow(0 0 2px rgba(74, 222, 128, 0.4));
}

/* ---------------------------------------------------------------------------
   Min price filter bar
   --------------------------------------------------------------------------- */
.livefeed-filter-bar {
  display: flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  border-bottom: 1px solid var(--border-muted);
  flex-shrink: 0;
}

.livefeed-min-price-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  cursor: default;
}

.livefeed-min-price-input {
  width: 56px;
  padding: 2px 4px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}

.livefeed-min-price-input::-webkit-inner-spin-button,
.livefeed-min-price-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.livefeed-min-price-input:focus {
  border-color: var(--accent);
}

/* ---------------------------------------------------------------------------
   Reduced motion
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .livefeed-row,
  .livefeed-row.is-new,
  .live-dot {
    transition: none;
    animation: none;
  }
}
