/* BlitzKey — Catalog (Game List) redesign
   Class names match catalog-page.jsx exactly. */

/* ── LAYOUT ─────────────────────────────────────────── */
.cat-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px 70px;
}

/* breadcrumb */
.cat-wrap .crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-3);
  font-size: 13px;
  padding: 24px 0 14px;
  flex-wrap: wrap;
}
.cat-wrap .crumb a:hover { color: var(--fg-2); }
.cat-wrap .crumb .sep { opacity: .5; }
.cat-wrap .crumb .cur { color: var(--fg-2); }

/* page heading */
.cat-wrap .page-h {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}
.cat-wrap .page-h h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.cat-wrap .page-h .count {
  color: var(--fg-3);
  font-size: 14px;
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* main grid */
.cat {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}
@media (max-width: 900px) { .cat { grid-template-columns: 1fr; } }

/* ── FILTERS SIDEBAR — .filters (matches design) ────── */
.filters {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 84px;
}
@media (max-width: 900px) {
  .filters { position: static; display: none; }
  .filters.open { display: flex; }
}

/* mobile toggle */
.filters-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--fg-2);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 14px;
  cursor: pointer;
  margin-bottom: 14px;
  width: 100%;
  transition: .13s;
}
.filters-toggle:hover { color: var(--fg); border-color: var(--line-strong); }
.filters-toggle .cnt {
  display: inline-flex;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--blurple);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
}
@media (max-width: 900px) { .filters-toggle { display: flex; } }

/* ── FILTER CARDS ─────────────────────────────────── */
.fcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 15px 16px;
}
.fcard .fh {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  white-space: nowrap;
}
.fcard .fh i, .fcard .fh svg { color: var(--fg-3); }

/* filter option — .fopt matches design */
.fopt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--fg-2);
  user-select: none;
}
.fopt:hover { color: var(--fg); }
.fopt .box {
  width: 17px;
  height: 17px;
  border-radius: 5px;
  border: 1.5px solid var(--line-strong);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background .12s, border-color .12s;
}
.fopt.on { color: var(--fg); }
.fopt.on .box { background: var(--blurple); border-color: var(--blurple); }
/* .fc = count badge at right — matches design */
.fopt .fc {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
}

/* price range — .frange matches design */
.frange {
  display: flex;
  align-items: center;
  gap: 8px;
}
.frange input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
  text-align: center;
}
.frange input:focus { border-color: var(--blurple); }
.frange span { color: var(--fg-3); flex-shrink: 0; }

/* reset — .fclear matches design */
.fclear {
  width: 100%;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--fg-2);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  padding: 9px;
  cursor: pointer;
  transition: .13s;
}
.fclear:hover { color: #fff; border-color: var(--blurple); }

/* ── TOOLBAR — .toolbar .tl .sort .applied matches design ── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar .tl { color: var(--fg-3); font-size: 12.5px; flex-shrink: 0; }

.sort {
  appearance: none;
  border: 0;
  background: none;
  color: var(--fg-3);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 11px;
  border-radius: 8px;
  transition: .13s;
  white-space: nowrap;
}
.sort.on { background: var(--surface-2); color: var(--fg); }
.sort:hover:not(.on) { color: var(--fg); background: var(--surface-2); }

.applied {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.applied:empty { display: none; }
.tagx {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
  transition: .13s;
}
.tagx:hover { color: #fff; border-color: var(--line-strong); }
.tagx-clear {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-3);
  background: none;
  border: none;
  padding: 4px 6px;
  cursor: pointer;
  transition: color .13s;
  font-family: var(--font-ui);
}
.tagx-clear:hover { color: var(--fg); }

/* ── VIEW TOGGLE ─────────────────────────────────────── */
.viewtoggle {
  display: flex;
  gap: 2px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 2px;
  flex-shrink: 0;
  margin-left: auto;
}
.viewtoggle .vt {
  display: grid;
  place-items: center;
  width: 30px;
  height: 26px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--fg-3);
  cursor: pointer;
  transition: .13s;
}
.viewtoggle .vt:hover { color: var(--fg-2); }
.viewtoggle .vt.on { background: var(--surface-2); color: var(--fg); }

/* ── GAME CARDS GRID — .cards .gcard matches design ──── */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 1080px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px)  { .cards { grid-template-columns: repeat(2, 1fr); } }

/* .gcard — matches design */
.gcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform .15s, border-color .15s;
}
.gcard:hover { transform: translateY(-3px); border-color: var(--line-strong); }

/* .cov — cover area — matches design */
.gcard .cov {
  position: relative;
  aspect-ratio: 460/215;
  background: var(--surface-2);
  overflow: hidden;
}
.gcard .cov img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* .dbadge — discount badge — matches design */
.gcard .cov .dbadge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--fg);
  background: rgba(30,31,34,.85);
  backdrop-filter: blur(4px);
  border-radius: 6px;
  padding: 3px 7px;
}
/* .lowbadge — historical low badge */
.gcard .cov .lowbadge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: block;
  line-height: 0;
}

/* .gi-body — card body — matches design */
.gcard .gi-body { padding: 10px 12px 12px; }

/* .gn — game name — matches design */
.gcard .gn {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

/* .gg — genre + platforms stacked */
.gcard .gg {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 8px;
}
/* .gg-genre — plain genre text */
.gcard .gg .gg-genre {
  font-size: 11px;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* .gg-plats — platform icons container — matches design */
.gcard .gg .gg-plats {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
/* .plat — platform chip (gcard + grow) */
.gcard .plat,
.grow .plat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  color: var(--fg-2);
  background: var(--neutral-bg);
  border-radius: 5px;
  padding: 2px 6px 2px 5px;
  white-space: nowrap;
}
.gcard .plat svg,
.grow .plat svg {
  width: 12px;
  height: 12px;
  display: block;
  flex-shrink: 0;
}

/* .gp — price row */
.gcard .gp {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: nowrap;
}
.gcard .gp .from {
  font-size: 10px;
  color: var(--fg-3);
  font-family: var(--font-mono);
  text-transform: uppercase;
  flex-shrink: 0;
}
.gcard .gp .now {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 18px;
  white-space: nowrap;
  flex-shrink: 0;
}
.gcard .gp .old {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-3);
  text-decoration: line-through;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gcard .gp .disc {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-2);
  background: var(--neutral-bg);
  border-radius: 5px;
  padding: 1px 5px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

/* ── EMPTY STATE ──────────────────────────────────── */
.cat-empty {
  grid-column: 1 / -1;
  padding: 60px 20px;
  text-align: center;
  color: var(--fg-3);
  font-size: 14px;
  line-height: 1.7;
}
.cat-empty a {
  color: var(--blurple-2);
  text-decoration: underline;
}

/* ── LOAD MORE ──────────────────────────────────── */
.loadmore {
  display: flex;
  justify-content: center;
  margin-top: 26px;
}
.loadmore button {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 28px;
  cursor: pointer;
  transition: transform .15s;
}
.loadmore button:hover { transform: translateY(-3px); }

/* cards fading during AJAX load */
.cards--loading { opacity: .45; pointer-events: none; }

/* ── LIST VIEW ───────────────────────────────────────────── */
#catGrid .grow { display: none; }
#catGrid.listview { grid-template-columns: 1fr; gap: 8px; }
#catGrid.listview .gcard { display: none; }
#catGrid.listview .grow { display: flex; }

.grow {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 16px 10px 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color .14s, background .14s;
}
.grow:hover { border-color: var(--line-strong); background: var(--surface-2); }
.grow .rcov {
  position: relative;
  width: 128px;
  flex-shrink: 0;
  aspect-ratio: 460/215;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
}
.grow .rcov img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grow .rmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.grow .rn-row { display: flex; align-items: center; gap: 9px; min-width: 0; }
.grow .rn {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.grow .rg { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grow .rg .gg-genre {
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.grow .rg .gdiv { width: 1px; height: 11px; background: var(--line-strong); }
.grow .rg .gg-plats { display: flex; gap: 5px; flex-wrap: wrap; }
.grow .rprice {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 108px;
  align-self: stretch;
  flex-wrap: nowrap;
}
.grow .rprice .gp { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.grow .rprice .gp .from { font-size: 10px; color: var(--fg-3); font-family: var(--font-mono); text-transform: uppercase; }
.grow .rprice .gp .now { font-family: var(--font-mono); font-weight: 700; font-size: 17px; }
.grow .rprice-sub { display: flex; align-items: center; gap: 7px; }
.grow .rprice-sub .old { font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-3); text-decoration: line-through; }
.grow .rprice-sub .disc { font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; color: var(--fg-2); background: var(--neutral-bg); border-radius: 5px; padding: 1px 5px; }
.grow .rgo {
  color: var(--fg-3);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  opacity: .5;
  transition: opacity .14s, transform .14s;
}
.grow:hover .rgo { opacity: 1; transform: translateX(2px); }

@media (max-width: 640px) {
  .grow { gap: 12px; }
  .grow .rcov { width: 96px; }
  .grow .rgo { display: none; }
  .grow .rprice { min-width: 0; }
}

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 500px) {
  .cat-wrap { padding: 0 16px 60px; }
  .cat-wrap .page-h h1 { font-size: 22px; }
  .cards { gap: 10px; }
  .gcard .gn { font-size: 12.5px; }
  .gcard .gp .now { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .gcard { transition: none; }
}
