/* ── Riftbound card browser ── */

.rfb-container { max-width: 1280px; }

.btn-back {
  display: inline-block;
  margin-top: .5rem;
  color: var(--accent2);
  text-decoration: none;
  font-size: .88rem;
}
.btn-back:hover { text-decoration: underline; }

/* Layout */
.rfb-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* Sidebar */
.rfb-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}
.rfb-sidebar::-webkit-scrollbar { width: 4px; }
.rfb-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.filter-header h3 { font-size: 1rem; }
.reset-link { color: var(--muted); font-size: .8rem; text-decoration: none; }
.reset-link:hover { color: var(--danger); }

.filter-search {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: .5rem .75rem;
  font-size: .88rem;
  outline: none;
  margin-bottom: 1rem;
}
.filter-search:focus { border-color: var(--accent); }

.filter-group { margin-bottom: .75rem; }
.filter-group-title {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  padding: .35rem 0;
  user-select: none;
}
.filter-group-title:hover { color: var(--text); }
.filter-options {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  padding: .25rem 0 .5rem;
}

.filter-chip {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: .82rem;
  border: 1px solid transparent;
  transition: all .15s;
  color: var(--muted);
}
.filter-chip:hover, .filter-chip.active {
  background: rgba(108,99,255,.12);
  border-color: var(--accent);
  color: var(--text);
}
.filter-chip input { display: none; }
.chip-code { font-weight: 700; color: var(--accent2); font-size: .78rem; }
.chip-name { font-size: .8rem; }

/* Domain colors */
.domain-fury   { --dc: #ef4444; } .domain-fury.active   { border-color: #ef4444; background: rgba(239,68,68,.12); }
.domain-body   { --dc: #22c55e; } .domain-body.active   { border-color: #22c55e; background: rgba(34,197,94,.12); }
.domain-mind   { --dc: #a855f7; } .domain-mind.active   { border-color: #a855f7; background: rgba(168,85,247,.12); }
.domain-calm   { --dc: #06b6d4; } .domain-calm.active   { border-color: #06b6d4; background: rgba(6,182,212,.12); }
.domain-order  { --dc: #f59e0b; } .domain-order.active  { border-color: #f59e0b; background: rgba(245,158,11,.12); }
.domain-chaos  { --dc: #6366f1; } .domain-chaos.active  { border-color: #6366f1; background: rgba(99,102,241,.12); }

/* Rarity colors */
.rarity-epic      { color: #a855f7; }
.rarity-rare      { color: #3b82f6; }
.rarity-uncommon  { color: #10b981; }
.rarity-common    { color: var(--muted); }
.rarity-showcase  { color: #f59e0b; }
.rarity-alternate_art { color: #ec4899; }
.rarity-overnumbered  { color: #6366f1; }

/* Toolbar */
.rfb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: .5rem;
}
.result-count { color: var(--muted); font-size: .9rem; }
.toolbar-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

.btn-sm {
  padding: .4rem .8rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: .85rem;
  cursor: pointer;
  transition: all .15s;
}
.btn-sm:hover { border-color: var(--accent); color: var(--accent2); }

.btn-primary {
  padding: .45rem 1rem;
  border-radius: 6px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: .85; }

/* Card grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: .75rem;
}

.rfb-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, transform .1s, box-shadow .15s;
  position: relative;
  user-select: none;
}
.rfb-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108,99,255,.25);
}
.rfb-card.selected {
  border-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(34,197,94,.3);
}
.rfb-card img {
  width: 100%;
  aspect-ratio: 63/88;
  object-fit: cover;
  display: block;
}
.card-placeholder {
  width: 100%;
  aspect-ratio: 63/88;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  background: var(--surface2);
}
.rfb-card-info {
  padding: .4rem .5rem;
}
.rfb-card-name {
  font-size: .72rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rfb-card-meta {
  display: flex;
  gap: .25rem;
  margin-top: .25rem;
  flex-wrap: wrap;
}
.badge {
  font-size: .6rem;
  padding: .1rem .35rem;
  border-radius: 4px;
  font-weight: 600;
}
.badge-code { background: rgba(108,99,255,.2); color: var(--accent2); }
.badge-num  { background: var(--surface2); color: var(--muted); }
.badge-rarity { }
.badge-rarity.rarity-epic     { background: rgba(168,85,247,.2); color: #a855f7; }
.badge-rarity.rarity-rare     { background: rgba(59,130,246,.2); color: #60a5fa; }
.badge-rarity.rarity-uncommon { background: rgba(16,185,129,.2); color: #34d399; }
.badge-rarity.rarity-common   { background: var(--surface2); color: var(--muted); }
.badge-rarity.rarity-showcase { background: rgba(245,158,11,.2); color: #fbbf24; }

.rfb-card-domains {
  display: flex;
  gap: .2rem;
  flex-wrap: wrap;
  margin-top: .2rem;
}
.domain-dot {
  font-size: .58rem;
  padding: .05rem .3rem;
  border-radius: 3px;
  background: var(--surface2);
  color: var(--muted);
}
.domain-dot.domain-fury  { color: #ef4444; background: rgba(239,68,68,.1); }
.domain-dot.domain-body  { color: #22c55e; background: rgba(34,197,94,.1); }
.domain-dot.domain-mind  { color: #a855f7; background: rgba(168,85,247,.1); }
.domain-dot.domain-calm  { color: #06b6d4; background: rgba(6,182,212,.1); }
.domain-dot.domain-order { color: #f59e0b; background: rgba(245,158,11,.1); }
.domain-dot.domain-chaos { color: #6366f1; background: rgba(99,102,241,.1); }

.card-check {
  position: absolute;
  top: .4rem;
  right: .4rem;
  width: 22px;
  height: 22px;
  background: #22c55e;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.rfb-card.selected .card-check { display: flex; }

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 560px;
  width: 90%;
}
.modal h2 { margin-bottom: .5rem; }
.modal p  { color: var(--muted); font-size: .9rem; margin-bottom: 1rem; }
.modal textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: .75rem;
  font-family: monospace;
  font-size: .8rem;
  resize: none;
  outline: none;
  margin-bottom: 1rem;
}
.modal-actions { display: flex; gap: .75rem; justify-content: flex-end; }

@media (max-width: 768px) {
  .rfb-layout { grid-template-columns: 1fr; }
  .rfb-sidebar { position: static; max-height: none; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}
