/* ==========================================================================
   Landing View — Full-screen landing page with live feed + search
   Visible when body has .view-landing class
   Animations: visibility+opacity (display:none can't animate)
   ========================================================================== */

/* ---------------------------------------------------------------------------
   Landing overlay — ALWAYS display:flex, hidden via opacity+visibility
   --------------------------------------------------------------------------- */
.landing-view {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.98);
  pointer-events: none;
  transition:
    opacity 400ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)),
    transform 400ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)),
    visibility 0ms linear 400ms;
}

.view-landing .landing-view {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  pointer-events: auto;
  transition:
    opacity 400ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)),
    transform 400ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)),
    visibility 0ms linear 0ms;
}

/* ---------------------------------------------------------------------------
   Trading elements: directional transitions in landing mode
   --------------------------------------------------------------------------- */
.view-landing .auto-snipe-sidebar {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-20px);
}

.view-landing .content-area {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

.view-landing .collection-input,
.view-landing .collection-stats {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px);
  transition:
    opacity 300ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)),
    transform 300ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)),
    visibility 0ms linear 300ms;
}

.view-trading .collection-input,
.view-trading .collection-stats {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition:
    opacity 300ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)),
    transform 300ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)),
    visibility 0ms linear 0ms;
}

/* ---------------------------------------------------------------------------
   Header search (always visible; bigger in landing mode)
   --------------------------------------------------------------------------- */
.landing-header-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 0 1 420px;
  min-width: 0;
}

.view-landing .landing-header-search {
  flex: 1;
  max-width: 640px;
}

/* Hide refresh button on landing (not monitoring yet) */
.view-landing .refresh-btn { display: none; }

/* Back button: hidden on landing, visible on trading */
.view-landing .header-back-btn { display: none; }
.header-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}
.header-back-btn:hover { color: var(--accent); }

/* Hide search button when in trading mode (already monitoring) */
.view-trading #landingHeaderStartBtn { display: none; }

.landing-header-search .input {
  flex: 1;
  min-width: 140px;
  font-size: var(--text-base);
  padding: var(--space-2) var(--space-4);
}

.view-landing .landing-header-search .input {
  font-size: var(--text-base);
  padding: var(--space-3) var(--space-5);
}

/* ---------------------------------------------------------------------------
   Live dot indicator (reused in landing headers)
   --------------------------------------------------------------------------- */
.landing-feed-header .live-dot,
.market-stats-header .live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-error);
  vertical-align: middle;
  animation: live-dot-pulse 1.5s ease-in-out infinite;
}

/* ---------------------------------------------------------------------------
   Three-column body (sidebar + feed + stats)
   --------------------------------------------------------------------------- */
.landing-body {
  flex: 1;
  display: flex;
  width: 100%;
  overflow: hidden;
  min-height: 0;
}

/* ---------------------------------------------------------------------------
   Left sidebar: Top Collections
   --------------------------------------------------------------------------- */
.landing-sidebar {
  width: 260px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-muted);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-surface);
}

/* ---------------------------------------------------------------------------
   Feed area (fills remaining space in landing-body)
   --------------------------------------------------------------------------- */
.landing-feed-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.landing-feed-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-muted);
  flex-shrink: 0;
  background: var(--bg-surface);
}

/* Feed controls: price filter + scale slider */
.feed-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
}

.feed-price-filter {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

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

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

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

.feed-filter-label, .feed-filter-unit {
  font-size: 9px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.feed-scale-slider {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.feed-scale-icon {
  color: var(--text-disabled);
  flex-shrink: 0;
}

.feed-scale-range {
  -webkit-appearance: none;
  width: 56px;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.feed-scale-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-surface);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
  cursor: grab;
  transition: transform 100ms ease;
}

.feed-scale-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.feed-scale-range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-surface);
  cursor: grab;
}

.landing-feed-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  letter-spacing: 0.08em;
}

.landing-feed-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

/* Reuse livefeed table styles inside landing container */
.landing-feed-container .livefeed-table {
  width: 100%;
}

/* ---------------------------------------------------------------------------
   Top Collections — sidebar mode
   --------------------------------------------------------------------------- */
.landing-top-collections {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

/* Widget header */
.top-coll-header {
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--border-muted);
  flex-shrink: 0;
  background: var(--bg-surface);
}

.top-coll-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  margin-bottom: var(--space-2);
}

/* Segmented control */
.top-coll-tabs {
  display: flex;
  position: relative;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 2px;
}

.top-coll-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: 6px 0;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: color 200ms ease;
}

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

.top-coll-tab.is-active {
  color: var(--text-primary);
}

.top-coll-indicator {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 25%;
  background: var(--bg-overlay);
  border-radius: calc(var(--radius-md) - 2px);
  transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Widget list */
.top-coll-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: var(--space-1) 0;
}

.top-coll-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  transition: background 150ms ease, transform 100ms ease, border-color 150ms ease;
  border-radius: 0;
  border-left: 2px solid transparent;
  position: relative;
}

.top-coll-item:hover {
  background: var(--bg-elevated);
  border-left-color: var(--accent);
}

/* Arrow indicator on hover */
.top-coll-item::after {
  content: '\203A';
  position: absolute;
  right: var(--space-2);
  font-size: var(--text-md);
  color: var(--text-disabled);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.top-coll-item:hover::after {
  opacity: 1;
  transform: translateX(0);
}

.top-coll-item:active {
  transform: scale(0.99);
}

.top-coll-rank {
  width: 18px;
  font-size: 10px;
  font-weight: var(--weight-semibold);
  color: var(--text-disabled);
  text-align: right;
  flex-shrink: 0;
}

.top-coll-item:nth-child(1) .top-coll-rank { color: var(--accent); }
.top-coll-item:nth-child(2) .top-coll-rank { color: var(--text-muted); }
.top-coll-item:nth-child(3) .top-coll-rank { color: var(--text-muted); }

.top-coll-thumb {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-elevated);
}

.top-coll-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-elevated) 0%,
      color-mix(in srgb, var(--accent) 10%, var(--bg-elevated)) 100%);
  color: var(--text-disabled);
}

.top-coll-info {
  flex: 1;
  min-width: 0;
}

.top-coll-name {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.top-coll-volume {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.top-coll-count {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--accent);
  flex-shrink: 0;
  min-width: 24px;
  text-align: right;
  font-family: var(--font-mono);
}

/* Fade transition for list content swap */
.top-coll-list-fade {
  opacity: 0;
  transition: opacity 200ms ease;
}

.top-coll-list-fade.is-visible {
  opacity: 1;
}

/* Empty state */
.top-coll-empty {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-disabled);
}

/* Clickable collection names in live feed */
.livefeed-collection-link {
  cursor: pointer;
  transition: color 150ms ease;
}
.livefeed-collection-link:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------------------------------------------------------------------------
   Market Stats sidebar (right column)
   --------------------------------------------------------------------------- */
.landing-stats {
  width: 260px;
  flex-shrink: 0;
  border-left: 1px solid var(--border-muted);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-surface);
}

.market-stats-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--border-muted);
  flex-shrink: 0;
  background: var(--bg-surface);
}

.market-stats-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  letter-spacing: 0.08em;
}

.market-stats-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2) var(--space-3);
  min-height: 0;
}

/* Stat rows */
.market-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border-muted) 50%, transparent);
  gap: var(--space-2);
}

.market-stat-row:last-of-type {
  border-bottom: none;
}

.market-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.market-stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--accent);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Sections (Highest Sale, Most Active) */
.market-stat-section {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid color-mix(in srgb, var(--border-muted) 50%, transparent);
}

.market-stat-section-title {
  font-size: 9px;
  font-weight: var(--weight-bold);
  color: var(--text-disabled);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-2);
}

.market-stat-highlight {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--border-muted) 40%, transparent);
  transition: border-color 200ms ease;
}

.market-stat-highlight:hover {
  border-color: var(--border-muted);
}

.market-stat-highlight-thumb {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-base);
}

.market-stat-highlight-info {
  flex: 1;
  min-width: 0;
}

.market-stat-highlight-name {
  font-size: 11px;
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.market-stat-highlight-detail {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.market-stats-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6) var(--space-3);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-disabled);
}

.market-stat-columns-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid color-mix(in srgb, var(--border-muted) 30%, transparent);
  margin-bottom: 4px;
}

.market-stat-columns-header span {
  font-size: 9px;
  font-weight: var(--weight-bold);
  color: var(--text-disabled);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.market-stat-col-rank {
  min-width: 16px; text-align: center; flex-shrink: 0;
}

.market-stat-col-thumb-spacer {
  width: 28px; flex-shrink: 0;
}

.market-stat-col-collection {
  flex: 1; min-width: 0;
}

.market-stat-col-sales {
  flex-shrink: 0; min-width: 40px; text-align: center;
}

/* Collection row variant (Tensor trending) */
.market-stat-coll-row {
  margin-bottom: 2px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 150ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.market-stat-coll-row:hover {
  border-color: var(--accent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 25%, transparent);
}

.market-stat-rank {
  font-size: 10px;
  font-weight: var(--weight-bold);
  color: var(--text-disabled);
  min-width: 16px;
  text-align: center;
  flex-shrink: 0;
  font-family: var(--font-mono);
}

.market-stat-sales-badge {
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: var(--weight-semibold);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   Responsive: hide sidebars on narrow screens
   --------------------------------------------------------------------------- */
@media (max-width: 1279px) {
  .landing-stats {
    display: none;
  }
}

@media (max-width: 1023px) {
  .landing-sidebar {
    display: none;
  }
}

/* ---------------------------------------------------------------------------
   Reduced motion
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .landing-view,
  .auto-snipe-sidebar,
  .content-area,
  .collection-input,
  .collection-stats {
    transition-duration: 0ms !important;
    transition-delay: 0ms !important;
  }
  .top-coll-indicator {
    transition: none;
  }
  .top-coll-list-fade {
    transition: none;
  }
  .top-coll-item,
  .top-coll-item::after,
  .livefeed-collection-link,
  .market-stat-highlight {
    transition: none;
  }
}
