/* collection.css — owned/painted tracker: card dots, detail widget, army progress, chips, dashboard. */

/* ── status colors (shared variables) ───────────────────────────────── */
:root {
  --coll-unpainted: #8a8a8a;
  --coll-primed:    #e8e8e8;
  --coll-painting:  #e6c7a8;
  --coll-done:      #a8e6b7;
}

/* ── card badge: tiny dot top-right of each unit card ───────────────── */
.unit-card {
  position: relative; /* badge is absolutely positioned relative to card */
}
.unit-card.collection-none::after { content: none; }
.unit-card.collection-unpainted::after,
.unit-card.collection-primed::after,
.unit-card.collection-painting::after,
.unit-card.collection-done::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.35), 0 0 3px rgba(0,0,0,0.45);
  pointer-events: none;
  z-index: 2;
}
.unit-card.collection-unpainted::after { background: var(--coll-unpainted); }
.unit-card.collection-primed::after    { background: var(--coll-primed);    }
.unit-card.collection-painting::after  { background: var(--coll-painting);  }
.unit-card.collection-done::after      { background: var(--coll-done);      }

/* ── BUILD-mode cleanup ─────────────────────────────────────────────
   Hide collection-only UI in BUILD mode. The user opts back into the
   card status dots via Settings → "Show painting status badges on
   cards" (which sets body.yaab-build-badges-on via collection.js).
   COLLECT mode is a separate <section> so these rules never apply
   there. The detail-panel widget (.collection-detail-widget) is
   intentionally excluded — it's only visible per selected unit and
   is useful while building. */
body[data-mode="build"]:not(.yaab-build-badges-on) .unit-card.collection-unpainted::after,
body[data-mode="build"]:not(.yaab-build-badges-on) .unit-card.collection-primed::after,
body[data-mode="build"]:not(.yaab-build-badges-on) .unit-card.collection-painting::after,
body[data-mode="build"]:not(.yaab-build-badges-on) .unit-card.collection-done::after {
  content: none;
}

/* Belt-and-suspenders for chips/notes/progress — collection.js also
   skips creating these in BUILD, but if a stale node is mid-tear-down
   (or if a future code path mounts them), CSS keeps BUILD clean. */
body[data-mode="build"] .filter-chip.collection-chip,
body[data-mode="build"] .collection-progress,
body[data-mode="build"] #collection-backlog-note {
  display: none !important;
}

/* ── detail panel: status widget ────────────────────────────────────── */
.collection-detail-widget {
  margin: 10px 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: var(--radius, 6px);
  background: rgba(255,255,255,0.02);
}
.collection-detail-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted, #9a9a9a);
  margin-bottom: 8px;
}
.collection-detail-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ── status buttons (shared: detail panel + dashboard rows) ─────────── */
.collection-status-btn {
  flex: 1 1 auto;
  min-width: 60px;
  padding: 5px 10px;
  font-size: 12px;
  background: transparent;
  color: var(--text, #ddd);
  border: 1px solid var(--border, rgba(255,255,255,0.18));
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  line-height: 1.2;
}
.collection-status-btn:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.3);
}
.collection-status-btn.active {
  color: #111;
  font-weight: 600;
}
.collection-status-btn.collection-status-none.active {
  background: #ccc;
  border-color: #aaa;
}
.collection-status-btn.collection-status-unpainted.active {
  background: var(--coll-unpainted);
  border-color: var(--coll-unpainted);
  color: #fff;
}
.collection-status-btn.collection-status-primed.active {
  background: var(--coll-primed);
  border-color: var(--coll-primed);
}
.collection-status-btn.collection-status-painting.active {
  background: var(--coll-painting);
  border-color: var(--coll-painting);
}
.collection-status-btn.collection-status-done.active {
  background: var(--coll-done);
  border-color: var(--coll-done);
}

/* ── roster chip row additions ──────────────────────────────────────── */
.filter-chip.collection-chip {
  /* inherits base .filter-chip styling; we tint the active states */
}
.filter-chip.collection-chip-owned.active {
  background: rgba(230,199,168,0.15);
  border-color: var(--coll-painting);
  color: #f2dcc2;
}
.filter-chip.collection-chip-needs.active {
  background: rgba(138,138,138,0.18);
  border-color: #b5b5b5;
  color: #e2e2e2;
}
.filter-chip.collection-chip-painted.active {
  background: rgba(168,230,183,0.18);
  border-color: var(--coll-done);
  color: #d7f2df;
}

/* ── army-panel painting progress bar ───────────────────────────────── */
.collection-progress {
  margin: 8px 0 10px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: var(--radius, 6px);
  font-size: 12px;
}
.collection-progress.is-empty {
  opacity: 0.55;
}
.collection-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}
.collection-progress-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted, #9a9a9a);
}
.collection-progress-count {
  color: var(--text, #ddd);
  flex: 1 1 auto;
  text-align: center;
}
.collection-progress-pct {
  font-weight: 600;
  color: var(--coll-done);
  min-width: 38px;
  text-align: right;
}
.collection-progress-bar-wrap {
  width: 100%;
  height: 5px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}
.collection-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--coll-painting), var(--coll-done));
  transition: width 0.25s ease;
}
.collection-progress.is-complete .collection-progress-bar {
  background: var(--coll-done);
}

/* ── selection backlog note above the roster ────────────────────────── */
.collection-backlog-note {
  margin: 0 0 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-muted, #bbb);
  background: rgba(255,255,255,0.02);
  border: 1px dashed var(--border, rgba(255,255,255,0.12));
  border-radius: 4px;
}
.collection-backlog-note[hidden] { display: none; }

/* ── dashboard modal ────────────────────────────────────────────────── */
.collection-modal {
  max-width: 820px;
  width: 92vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}
.collection-modal-body {
  overflow-y: auto;
  padding: 14px 18px;
}
.collection-dash-section {
  margin-bottom: 18px;
}
.collection-dash-section h4 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted, #9a9a9a);
}
.collection-dash-totals {
  padding: 10px 12px;
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: var(--radius, 6px);
  background: rgba(255,255,255,0.02);
}
.collection-dash-total-line {
  font-size: 15px;
  color: var(--text, #eee);
}
.collection-dash-total-line strong {
  color: var(--coll-done);
  font-size: 18px;
}
.collection-dash-total-sub {
  font-size: 12px;
  margin-top: 4px;
}

/* per-faction rows */
.collection-dash-faction-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.collection-dash-faction {
  display: grid;
  grid-template-columns: 1.6fr 0.9fr 1.4fr 0.8fr;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
  font-size: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.collection-dash-faction-name {
  color: var(--text, #ddd);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.collection-dash-faction-count {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted, #bbb);
}
.collection-dash-faction-bar-wrap {
  height: 5px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
}
.collection-dash-faction-bar {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--coll-painting), var(--coll-done));
}
.collection-dash-faction-painted {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* filters + unit rows */
.collection-dash-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.collection-dash-filter {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #9a9a9a);
}
.collection-dash-filter select {
  background: var(--bg-alt, #1a1a1a);
  color: var(--text, #ddd);
  border: 1px solid var(--border, rgba(255,255,255,0.18));
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
}
.collection-dash-unit-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.collection-dash-unit {
  padding: 8px 10px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 4px;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.015);
}
.collection-dash-unit-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.collection-dash-unit-name {
  font-weight: 500;
  color: var(--text, #eee);
}
.collection-dash-unit-faction {
  font-size: 11px;
}
.collection-dash-unit-controls {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.collection-dash-empty {
  padding: 20px;
  text-align: center;
  font-style: italic;
}

/* mobile tightening */
@media (max-width: 640px) {
  .collection-dash-faction {
    grid-template-columns: 1fr 1fr;
  }
  .collection-dash-faction-bar-wrap,
  .collection-dash-faction-painted {
    grid-column: 1 / -1;
  }
}
