/* ============================================
   BUY PAGE — banner + listing cards
   ============================================ */

/* Banner under nav (token name + key stats) */
.buy-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
  padding: 28px 0;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.buy-banner-left {
  display: flex;
  align-items: center;
  gap: 24px;
}
.buy-banner-ticker {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.buy-banner-tag {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.buy-banner-stats {
  display: flex;
  gap: 36px;
  flex-wrap: wrap;
}
.buy-banner-stats > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.buy-banner-stats span {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.buy-banner-stats strong {
  display: block;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}
.stat-usd {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-dim);
  margin-top: 2px;
}

/* "+ List for sale" CTA. Inlined into the banner row next to the
   ticker. Primary button so it stands out — listing is the main
   "active" action holders take on this page. */
.buy-list-btn {
  padding: 8px 14px;
  font-size: 12px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ============================================
   List-for-sale modal
   ============================================ */
.list-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.list-modal-backdrop[hidden] { display: none; }

.list-modal {
  background: var(--bg-elev);
  border: 1px solid var(--line-2);
  border-radius: 2px;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  font-family: var(--sans);
  color: var(--text);
}

.list-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.list-modal-head h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.list-modal-close {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}
.list-modal-close:hover { color: var(--text); }

.list-modal-body {
  padding: 18px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lm-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  display: block;
}
.lm-balance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--line-2);
  border-radius: 2px;
  margin-bottom: 4px;
}
.lm-balance-row .lm-label { margin: 0; }
.lm-balance-row strong {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--accent);
}

.lm-amount-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lm-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--line-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 2px;
  outline: none;
  transition: border-color 0.15s ease;
}
.lm-input:focus { border-color: var(--accent); }
.lm-max {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--text-dim);
  padding: 9px 14px;
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.lm-max:hover { color: var(--accent); border-color: var(--accent); }
.lm-unit {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  padding: 0 4px;
}

.lm-breakdown {
  background: var(--bg-card);
  border: 1px solid var(--line-2);
  border-radius: 2px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.lm-bd-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 12px;
}
.lm-bd-row span { color: var(--text-dim); }
.lm-bd-row strong { color: var(--text); font-weight: 500; }
.lm-bd-net {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-top: 2px;
}
.lm-bd-net strong { color: var(--accent); font-size: 13px; }

.lm-error {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--red);
  letter-spacing: 0.02em;
  min-height: 14px;
}

/* Lot picker: shows existing transfer-inscriptions as selectable
   tiles. Each is a fixed-qty atomic lot the seller can either
   list as-is (with a chosen price) or, if none exist, create. */
.lm-section-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 4px;
}
.lm-lot-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 8px;
  background: var(--bg-card);
}
.lm-lot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--line-2);
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.lm-lot:hover { border-color: var(--accent); }
.lm-lot.selected {
  border-color: var(--accent);
  background: rgba(244, 183, 40, 0.08);
}
.lm-lot.listed {
  opacity: 0.5;
  cursor: not-allowed;
}
.lm-lot.listed:hover { border-color: var(--line-2); }
.lm-lot-qty {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.lm-lot-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.lm-lot-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.lm-lot-empty {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  padding: 16px 8px;
}

.lm-create-toggle {
  background: transparent;
  border: 1px dashed var(--line-2);
  color: var(--text-dim);
  padding: 8px 12px;
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.lm-create-toggle:hover { border-color: var(--accent); color: var(--accent); }
.lm-create-toggle.active {
  border-color: var(--accent);
  color: var(--accent);
  border-style: solid;
}
.lm-create-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--line-2);
  border-radius: 2px;
}
.lm-create-panel[hidden] { display: none; }
.lm-create-hint {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.5;
  letter-spacing: 0.02em;
}

/* Price head: label on the left, ZEC/USD toggle on the right. */
.lm-price-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.lm-unit-toggle {
  display: inline-flex;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  overflow: hidden;
}
.lm-unit-btn {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.lm-unit-btn:hover { color: var(--text); }
.lm-unit-btn.active {
  background: var(--accent);
  color: var(--bg);
}
.lm-price-hint {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  min-height: 14px;
  margin-top: -4px;
}
.lm-price-hint.stale {
  color: var(--text-dim);
  opacity: 0.7;
}
.lm-bd-row .lm-bd-sub {
  color: var(--text-muted);
  font-size: 11px;
  margin-left: 6px;
}

/* ============================================
   Listed / Activity tabs (above the grid)
   ============================================ */
.bp-tabs {
  display: flex;
  gap: 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.bp-tab {
  background: transparent;
  border: 0;
  padding: 12px 2px;
  margin-bottom: -1px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.bp-tab:hover { color: var(--text); }
.bp-tab-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Activity feed (mirrors Magic Eden's Activity table) */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.activity-empty {
  padding: 56px 24px;
  text-align: center;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 13px;
}

/* Sale rows — shared grid for header + data rows */
.sale-head,
.sale-row {
  display: grid;
  grid-template-columns: 60px 110px 130px 130px 1fr 1fr 72px 36px;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 13px;
}
.sale-head {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 10px 20px;
}
.sale-row:last-child { border-bottom: 0; }
.sale-row { transition: background 0.15s; }
.sale-row:hover { background: rgba(255,255,255,0.03); }

.sale-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: rgba(92,193,106,0.12);
  color: var(--green, #5cc16a);
}

.sale-qty {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.sale-tick {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-dim);
  margin-left: 4px;
}

.sale-total {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sale-zec {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.sale-usd {
  font-size: 11px;
  color: var(--text-muted);
}

.sale-addr {
  font-size: 12px;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-time {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}

.sale-tx { text-align: center; }
.sale-tx-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  transition: border-color 0.15s, color 0.15s;
}
.sale-tx-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 900px) {
  .sale-head,
  .sale-row {
    grid-template-columns: 50px 90px 110px 1fr 1fr 60px 28px;
    gap: 8px;
    padding: 10px 14px;
  }
  .sale-head > div:nth-child(4),
  .sale-row > div:nth-child(4) { display: none; }
}
@media (max-width: 600px) {
  .sale-head,
  .sale-row {
    grid-template-columns: 50px 1fr 1fr 50px;
    gap: 6px;
    padding: 10px 12px;
    font-size: 12px;
  }
  .sale-head > div:nth-child(n+4),
  .sale-row > div:nth-child(n+4) { display: none; }
  .sale-head > div:nth-child(7),
  .sale-row > div:nth-child(7) { display: block; }
  .sale-head > div:nth-child(8),
  .sale-row > div:nth-child(8) { display: none; }
}

/* ============================================
   Listing card v3 — modeled on Magic-Eden's BRC-20 marketplace card.
   No hero image (we're fungibles); the quantity IS the visual.

     ZERO              <- ticker, top-left, muted small

        1,000          <- BIG quantity, centered, white

     0.45 ZEC/ZERO     <- per-unit price, prominent accent
        $0.0004        <- USD sub
   ┌──────────────────┐
   │ #2905134c        │  <- inscription id in accent (top of box)
   │ ──────────────   │
   │ ⓩ 0.000192  $X.XX│  <- total row at bottom of box
   └──────────────────┘
   [       Buy       ]
   ============================================ */

/* Override the parent grid to target ~5-6 cards per row. 230px
   minmax balances "fits 6 across at desktop widths" with "stays
   legible on a 14-inch laptop." */
#listingsGrid {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.listing-card-v2 {
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  transition: border-color 0.15s ease;
}
.listing-card-v2:hover { border-color: var(--accent); }

.lc-ticker {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.lc-yours {
  font-size: 9px;
  letter-spacing: 0.14em;
  padding: 2px 5px;
  background: rgba(244, 183, 40, 0.12);
  border: 1px solid rgba(244, 183, 40, 0.4);
  color: var(--accent);
  border-radius: 2px;
  margin-left: 6px;
}

.lc-qty {
  font-family: var(--mono);
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 700;
  color: var(--text);
  text-align: center;
  letter-spacing: -0.01em;
  line-height: 1.1;
  padding: 12px 0 3px;
}

.lc-unit-price {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  text-align: center;
  letter-spacing: 0;
}
.lc-unit-usd {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  letter-spacing: 0.04em;
  margin-bottom: 5px;
}

.lc-total-box {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 3px;
}
.lc-inscid {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.04em;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.lc-total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.lc-total-zec {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.02em;
}
.lc-total-usd {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

.lc-cta {
  display: block;
  width: 100%;
  margin-top: 3px;
  padding: 9px 11px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.lc-cta-buy:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #0a0a0a;
}
.lc-cta-cancel:hover {
  color: var(--red);
  border-color: var(--red);
}
.lc-cta-disabled {
  color: var(--text-dim);
  cursor: not-allowed;
  opacity: 0.55;
}

/* "Your listing" gets an outer accent border so the maker can spot
   their own lots in a long grid. */
.listing-card-v2-mine {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(244, 183, 40, 0.18) inset;
}

/* Empty state when no listings exist for this ticker */
.empty-listings {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 24px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: var(--bg-elev);
}
.empty-listings-mark {
  font-size: 56px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1;
}
.empty-listings h3 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}
.empty-listings p {
  font-size: 14px;
  color: var(--text-dim);
  max-width: 480px;
  margin: 0 auto 24px;
  line-height: 1.55;
}

@media (max-width: 720px) {
  .buy-banner { flex-direction: column; align-items: flex-start; gap: 16px; }
  .buy-banner-stats { gap: 20px; }
}

/* Phone: activity rows have 10px column-header labels (uppercase tracking)
   that are unreadable. Bump up to 11.5px and tighten padding so the
   3-column collapsed grid (set at 720px above) still feels readable. */
@media (max-width: 480px) {
  .activity-row { padding: 10px 12px; font-size: 12px; }
  .activity-row-head { font-size: 11.5px; padding: 9px 12px; letter-spacing: 0.06em; }
  .activity-op { font-size: 11.5px; }
}
