/* collect.ltc.cards shared styles.
   Functional first: the palette and card treatment follow the marketplace
   (black, #1f7aff, the dark panels on index.html and search.html) so the two
   sites read as one brand until the collector design pass. */

:root {
  --bg: #000;
  --panel: rgba(16, 20, 27, 0.86);
  --panel-solid: #10141b;
  --panel-2: #0c1016;
  --border: rgba(255, 255, 255, 0.08);
  --border-2: rgba(255, 255, 255, 0.14);
  --text: #f2f5ff;
  --muted: rgba(242, 245, 255, 0.70);
  --muted-2: rgba(242, 245, 255, 0.52);
  --blue: #1f7aff;
  --blue-soft: rgba(31, 122, 255, 0.16);
  --good: #4cc38a;
  --bad: #ff6b7d;
  --radius: 12px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 15% -10%, rgba(31, 122, 255, 0.12), transparent 55%),
    radial-gradient(900px 600px at 95% 0%, rgba(31, 122, 255, 0.07), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; min-width: 0; }
main { flex: 1 0 auto; width: 100%; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.wrap { width: min(1320px, calc(100% - 32px)); margin: 0 auto; }

/* ── buttons and fields ─────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 8px 14px;
  border: 1px solid var(--border-2); border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: rgba(31, 122, 255, 0.6); }
.btn:focus-visible, .field:focus-visible, .chip:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: #3a8bff; }
.btn-danger { color: var(--bad); }
.btn-danger:hover { border-color: rgba(255, 107, 125, 0.6); }
.btn-small { min-height: 30px; padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: 0.55; cursor: default; }

.field {
  width: 100%; min-height: 40px; padding: 8px 11px;
  background: rgba(7, 9, 12, 0.92);
  border: 1px solid var(--border-2); border-radius: 10px; outline: none;
}
.field:focus { border-color: rgba(31, 122, 255, 0.75); box-shadow: 0 0 0 3px rgba(31, 122, 255, 0.14); }
select.field { cursor: pointer; }
select.field option { background: var(--panel-2); color: var(--text); }
.label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; }

/* ── top bar ────────────────────────────────────────────────────────────── */

.cx-top {
  position: sticky; top: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.82);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.cx-top-inner {
  display: flex; align-items: center; gap: 16px;
  width: min(1320px, calc(100% - 32px)); margin: 0 auto; min-height: 64px;
}
.cx-brand { display: inline-flex; align-items: baseline; gap: 6px; font-weight: 850; font-size: 22px; letter-spacing: 0.06em; white-space: nowrap; }
.cx-brand span { color: var(--blue); font-weight: 700; font-size: 15px; letter-spacing: 0.22em; text-transform: uppercase; }
.cx-search { display: flex; flex: 1; gap: 8px; min-width: 0; max-width: 560px; }
.cx-search .field { min-height: 40px; }
.cx-nav { display: flex; align-items: center; gap: 10px; margin-left: auto; }
/* The search box gives way first; nav items keep their full text. */
.cx-nav > * { flex: 0 0 auto; }
.cx-nav a.cx-link { padding: 8px 4px; font-size: 14px; font-weight: 650; color: var(--muted); white-space: nowrap; }
.cx-nav a.cx-link:hover, .cx-nav a.cx-link[aria-current="page"] { color: var(--text); }
/* width:auto, not .field's 100%: a percentage width counts as zero when the nav
   measures its own size, so the nav came up 190px short and overflowed. */
.cx-profile { width: auto; max-width: 190px; min-height: 36px; padding: 6px 10px; font-size: 14px; }
.cx-user { font-size: 13px; color: var(--muted-2); white-space: nowrap; }

@media (max-width: 1200px) {
  .cx-user { display: none; }
}
@media (max-width: 900px) {
  .cx-top-inner { flex-wrap: wrap; gap: 10px; padding: 10px 0; }
  .cx-search { order: 3; flex-basis: 100%; max-width: none; }
  .cx-nav { gap: 8px; }
  .cx-user { display: none; }
}
@media (max-width: 520px) {
  .cx-nav a.cx-market { display: none; }
  .cx-profile { max-width: 140px; }
}

/* ── card tiles (feed, search results) ──────────────────────────────────── */

.tile-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 16px; margin: 0; padding: 0; list-style: none;
}
.tile {
  position: relative; display: flex; flex-direction: column; height: 100%;
  overflow: hidden; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
}
.tile:hover { border-color: rgba(31, 122, 255, 0.5); }
.tile-art { position: relative; display: block; aspect-ratio: 5 / 7; background: var(--panel-2); }
.tile-art img { position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); object-fit: contain; }
.tile-body { display: flex; flex: 1; flex-direction: column; gap: 3px; padding: 10px 12px 12px; }
.tile-name {
  display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  font-size: 14px; font-weight: 650; line-height: 1.3;
}
.tile-meta { overflow: hidden; font-size: 12px; color: var(--muted-2); white-space: nowrap; text-overflow: ellipsis; }
.tile-prices { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: auto; padding-top: 8px; }
.tile-price { min-width: 0; }
.tile-price b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-price small { font-size: 11px; color: var(--muted-2); }
.tile-psa { margin-top: 4px; font-size: 12px; color: var(--muted); }
.tile-psa b { color: var(--text); font-variant-numeric: tabular-nums; }
.tile-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.tile-actions .btn { flex: 1; }
.owned-badge {
  position: absolute; top: 8px; left: 8px; z-index: 1;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(76, 195, 138, 0.18); border: 1px solid rgba(76, 195, 138, 0.55);
  color: #bff0d6; font-size: 11px; font-weight: 800;
}
.is-empty { color: var(--muted-2); font-weight: 500; }

@media (max-width: 520px) {
  .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile-body { padding: 8px 9px 10px; }
  .tile-prices { grid-template-columns: 1fr; }
}

/* ── add-to-collection dialog ───────────────────────────────────────────── */

.cx-dialog {
  width: min(460px, calc(100% - 24px)); max-height: calc(100vh - 24px); padding: 0;
  color: var(--text); background: var(--panel-solid);
  border: 1px solid var(--border-2); border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
}
.cx-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.cx-dialog form { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.cx-dialog-head { display: flex; gap: 12px; align-items: center; }
.cx-dialog-head img { width: 56px; height: 78px; object-fit: contain; border-radius: 6px; background: var(--panel-2); flex: 0 0 auto; }
.cx-dialog-head h2 { margin: 0 0 4px; font-size: 17px; line-height: 1.25; }
.cx-dialog-head p { margin: 0; font-size: 13px; color: var(--muted-2); }
.cx-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cx-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cx-seg label { position: relative; cursor: pointer; }
.cx-seg input { position: absolute; opacity: 0; pointer-events: none; }
.cx-seg span {
  display: flex; align-items: center; justify-content: center; min-height: 38px;
  border: 1px solid var(--border-2); border-radius: 10px; font-weight: 750; font-size: 14px; color: var(--muted);
}
.cx-seg input:checked + span { color: var(--text); background: var(--blue-soft); border-color: rgba(31, 122, 255, 0.6); }
.cx-seg input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.cx-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; }
.form-error { margin: 0; color: var(--bad); font-size: 13px; }

/* ── toast ──────────────────────────────────────────────────────────────── */

.cx-toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 100; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 11px 16px;
  background: #11161e; border: 1px solid rgba(31, 122, 255, 0.55); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6); font-size: 14px; font-weight: 600;
}
.cx-toast.is-error { border-color: rgba(255, 107, 125, 0.6); }
.cx-toast a { color: #8fbaff; text-decoration: underline; margin-left: 6px; }

#footer-container { width: 100%; margin-top: 32px; }
