/* Buy List Analyzer — page-specific styles on top of stream-stats.css.
   Mobile-first: the operator uses this from a phone while scrolling
   Facebook Marketplace, so rows are touch-sized cards and the offer
   calculator is a sticky bottom bar. */

.bl-main { padding-bottom: 140px; } /* room for the sticky offer bar */

.bl-card {
  background: var(--ss-bg-elev);
  border: 1px solid var(--ss-line);
  border-radius: var(--ss-radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}

/* ── Input card ─────────────────────────────────────────────────── */
.bl-input-card { position: relative; }
.bl-input-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.bl-input-head h2 { margin: 0; font-size: 16px; }
.bl-selects { display: flex; gap: 8px; }
.bl-select {
  background: var(--ss-bg-elev-2);
  color: var(--ss-text);
  border: 1px solid var(--ss-line-strong);
  border-radius: var(--ss-radius-sm);
  padding: 7px 10px;
  font-size: 14px;
}
.bl-textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--ss-bg);
  color: var(--ss-text);
  border: 1px solid var(--ss-line-strong);
  border-radius: var(--ss-radius-sm);
  padding: 10px 12px;
  font-size: 15px;
  line-height: 1.45;
  resize: vertical;
}
.bl-textarea:focus { outline: none; border-color: var(--ss-accent); }
.bl-input-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.bl-analyze { font-size: 15px; padding: 10px 18px; }
.bl-hint { font-size: 12px; color: var(--ss-text-dim); }
.bl-status { margin-top: 8px; font-size: 13px; color: var(--ss-text-dim); min-height: 18px; }
.bl-status.error { color: #fca5a5; }
.bl-status.ok { color: #86efac; }

.bl-drop-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(25, 210, 230, 0.12);
  border: 2px dashed var(--ss-accent);
  border-radius: var(--ss-radius);
  color: var(--ss-accent);
  font-weight: 700;
  pointer-events: none;
  z-index: 3;
}

/* ── Recent lists ───────────────────────────────────────────────── */
.bl-recent { display: flex; flex-direction: column; gap: 6px; }
.bl-recent-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ss-bg-elev-2);
  border: 1px solid var(--ss-line);
  border-radius: var(--ss-radius-sm);
  padding: 8px 10px;
}
.bl-recent-open {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  padding: 0;
  color: var(--ss-text);
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}
.bl-recent-open:hover { color: var(--ss-accent); }
.bl-recent-meta { display: block; font-size: 12px; color: var(--ss-text-dim); font-weight: 400; }
.bl-recent-del {
  background: none;
  border: none;
  color: var(--ss-text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
}
.bl-recent-del:hover { color: #fca5a5; }

/* ── Results ────────────────────────────────────────────────────── */
#listTitle { cursor: pointer; }
#listTitle:hover { color: var(--ss-accent); }
.bl-save-state { font-size: 12px; color: var(--ss-text-dim); align-self: center; }
.bl-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.bl-results-head h2 { margin: 0; font-size: 16px; }
.bl-results-tools { display: flex; gap: 8px; }
.bl-coverage {
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: var(--ss-warn);
  border-radius: var(--ss-radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 10px;
}

.bl-items { display: flex; flex-direction: column; gap: 10px; }

.bl-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 10px;
  background: var(--ss-bg-elev-2);
  border: 1px solid var(--ss-line);
  border-radius: var(--ss-radius-sm);
  padding: 10px;
  align-items: start;
}
.bl-row.excluded { opacity: 0.45; }
.bl-row.matching { border-style: dashed; }

.bl-thumb {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  background: var(--ss-ink);
  object-fit: contain;
}
.bl-thumb-empty {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  background: var(--ss-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ss-text-dim);
  font-size: 20px;
}

.bl-row-mid { min-width: 0; }
.bl-row-name { font-weight: 700; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.bl-row-name a { color: var(--ss-text); text-decoration: none; }
.bl-row-name a:hover { color: var(--ss-accent); }
.bl-row-set { font-size: 12px; color: var(--ss-text-dim); margin-top: 1px; }
.bl-row-seller { font-size: 12px; color: var(--ss-text-dim); margin-top: 3px; font-style: italic; overflow-wrap: anywhere; }
.bl-row-catalog {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 4px;
  padding: 1px 6px;
}
.bl-row-error { font-size: 12px; color: #fca5a5; margin-top: 3px; }
.bl-row-actions { display: flex; gap: 10px; margin-top: 6px; }
.bl-row-actions button {
  background: none;
  border: none;
  padding: 0;
  color: var(--ss-accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.bl-row-actions button:hover { text-decoration: underline; }

.bl-row-right { text-align: right; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.bl-money-line { font-size: 13px; color: var(--ss-text-dim); white-space: nowrap; }
.bl-money-line strong { color: var(--ss-text); font-variant-numeric: tabular-nums; }
.bl-qty-input, .bl-ask-input {
  width: 64px;
  background: var(--ss-bg);
  color: var(--ss-text);
  border: 1px solid var(--ss-line-strong);
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 13px;
  text-align: right;
}
.bl-qty-input { width: 44px; }

.bl-deal {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
}
.bl-deal-good { background: rgba(34, 197, 94, 0.16); color: #86efac; }
.bl-deal-fair { background: rgba(251, 191, 36, 0.16); color: var(--ss-warn); }
.bl-deal-high { background: rgba(239, 68, 68, 0.16); color: #fca5a5; }
.bl-deal-none { background: rgba(255, 255, 255, 0.06); color: var(--ss-text-dim); }

/* Candidate picker (expanded under a row) */
.bl-cands {
  grid-column: 1 / -1;
  border-top: 1px solid var(--ss-line);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bl-cand-search { display: flex; gap: 8px; }
.bl-cand-search input {
  flex: 1;
  background: var(--ss-bg);
  color: var(--ss-text);
  border: 1px solid var(--ss-line-strong);
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 13px;
}
.bl-cand {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--ss-bg);
  border: 1px solid var(--ss-line);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  text-align: left;
  color: var(--ss-text);
  font-size: 13px;
  width: 100%;
}
.bl-cand:hover { border-color: var(--ss-accent); }
.bl-cand img { width: 34px; height: 34px; border-radius: 4px; object-fit: contain; background: var(--ss-ink); }
.bl-cand-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.bl-cand-set { color: var(--ss-text-dim); font-size: 11px; display: block; }
.bl-cand-price { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ── Sticky offer bar ───────────────────────────────────────────── */
.bl-offer-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--ss-bg-elev);
  border-top: 1px solid var(--ss-line-strong);
  box-shadow: 0 -8px 26px rgba(0, 0, 0, 0.45);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  z-index: 5;
}
.bl-offer-grid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 18px;
  align-items: center;
}
.bl-offer-stat { display: flex; flex-direction: column; }
.bl-offer-label { font-size: 11px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ss-text-dim); }
.bl-offer-value { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; }
.bl-offer-sub { font-size: 11px; color: var(--ss-text-dim); font-variant-numeric: tabular-nums; }
.bl-offer-final .bl-offer-value { color: var(--ss-accent); }
.bl-offer-slider-wrap { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
.bl-offer-slider-wrap input[type="range"] { width: 100%; accent-color: var(--ss-accent); }
#offerPctLabel { color: var(--ss-accent); }

@media (max-width: 640px) {
  .bl-offer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
  }
  .bl-offer-slider-wrap { grid-column: 1 / -1; order: 3; }
  .bl-offer-value { font-size: 18px; }
  .bl-row { grid-template-columns: 44px 1fr; }
  .bl-thumb, .bl-thumb-empty { width: 44px; height: 44px; }
  .bl-row-right {
    grid-column: 2;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    text-align: left;
    gap: 8px;
  }
}
