/* Track-parts catalog — dark theme, namespaced `tp-` so it never collides with
   the global home.css or the eBay tool's `eb-` classes. Tokens (--primary-color,
   --primary-hover, --darker-bg, --text-light, --transition) come from home.css;
   the dark surface vars mirror the eBay tool for a consistent redesign look. */

.tp-page {
  min-height: calc(100vh - 73px);
  padding: 2.5rem 1.5rem 5rem;
  color: var(--text-light);
  background:
    radial-gradient(ellipse 55% 40% at 50% 0%, rgba(204, 99, 13, 0.13), transparent 60%),
    linear-gradient(180deg, var(--darker-bg) 0%, #121214 100%);
  --tp-card: rgba(255, 255, 255, 0.04);
  --tp-elev: rgba(255, 255, 255, 0.06);
  --tp-border: rgba(255, 255, 255, 0.1);
  --tp-t2: rgba(255, 255, 255, 0.72);
  --tp-muted: rgba(255, 255, 255, 0.5);
}

/* z-index:0 confines all catalog content to a layer below the sticky nav
   (header is z-index:1000), so it can never paint over the Track Parts dropdown. */
.tp-wrap { max-width: 1340px; margin: 0 auto; width: 100%; position: relative; z-index: 0; }
.tp-page a { text-decoration: none; color: inherit; }

/* ===== Header ===== */
.tp-head { margin-bottom: 22px; }
.tp-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(204, 99, 13, 0.14); color: var(--primary-hover);
  font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(204, 99, 13, 0.3);
}
.tp-h1 { font-size: clamp(28px, 4vw, 42px); font-weight: 800; line-height: 1.05; letter-spacing: -.02em; margin-top: 14px; }
.tp-lede { color: var(--tp-t2); font-size: 15px; line-height: 1.5; margin-top: 10px; max-width: 640px; }

.tp-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 22px; }
.tp-search {
  flex: 1; min-width: 240px; display: flex; align-items: center; gap: 11px;
  background: rgba(0, 0, 0, 0.28); border: 1.5px solid var(--tp-border);
  border-radius: 12px; padding: 0 15px; height: 50px;
}
.tp-search i { color: var(--tp-muted); }
.tp-search input { flex: 1; min-width: 0; border: none; background: transparent; height: 100%; font-family: inherit; font-size: 15px; font-weight: 600; color: var(--text-light); outline: none; }
.tp-search input::placeholder { color: rgba(255, 255, 255, 0.4); }
.tp-search:focus-within { border-color: var(--primary-color); box-shadow: 0 0 0 4px rgba(204, 99, 13, 0.18); }

.tp-sort { display: flex; align-items: center; gap: 8px; color: var(--tp-muted); font-weight: 700; font-size: 13px; }
.tp-sort select {
  height: 50px; border-radius: 12px; border: 1.5px solid var(--tp-border);
  background: rgba(0, 0, 0, 0.28); color: var(--text-light); font-family: inherit;
  font-weight: 700; font-size: 14px; padding: 0 12px; cursor: pointer;
}
.tp-sort select:focus { outline: none; border-color: var(--primary-color); }

.tp-btn-ghost {
  display: inline-flex; align-items: center; gap: 8px; height: 50px; padding: 0 18px;
  background: transparent; color: var(--tp-t2); font-family: inherit; font-weight: 700; font-size: 14px;
  border: 1.5px solid var(--tp-border); border-radius: 12px; cursor: pointer; transition: var(--transition);
}
.tp-btn-ghost:hover { border-color: var(--primary-color); color: #fff; background: rgba(255, 255, 255, 0.04); }

.tp-meta { color: var(--tp-muted); font-size: 13px; font-weight: 600; margin-top: 14px; }

/* Search/sort bar — scrolls away with the page; only the site nav stays fixed. */
.tp-bar {
  margin-bottom: 16px; padding: 14px 0;
  border-bottom: 1px solid var(--tp-border);
}
.tp-bar .tp-controls { margin-top: 0; }

/* ===== List of expandable cards ===== */
.tp-list { display: flex; flex-direction: column; gap: 10px; }

.tp-card { background: var(--tp-card); border: 1px solid var(--tp-border); border-radius: 14px; overflow: hidden; }
.tp-card[open] { border-color: rgba(204, 99, 13, 0.3); }

.tp-sum {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; user-select: none;
}
.tp-sum::-webkit-details-marker { display: none; }
.tp-sum:hover { background: rgba(255, 255, 255, 0.03); }

.tp-thumb {
  flex: 0 0 52px; width: 52px; height: 52px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--tp-border);
  display: grid; place-items: center; overflow: hidden;
}
.tp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tp-thumb i { color: var(--tp-muted); font-size: 20px; }

.tp-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.tp-name { font-weight: 700; font-size: 15px; color: var(--text-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-name b { color: var(--primary-hover); font-weight: 800; }
.tp-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.tp-chip { font-size: 11.5px; color: var(--tp-muted); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--tp-border); border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.tp-chip b { color: var(--tp-t2); font-weight: 700; }

.tp-price { font-weight: 800; font-size: 18px; color: var(--text-light); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tp-price-na { color: var(--tp-muted); font-weight: 700; }

.tp-add {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  background: rgba(204, 99, 13, 0.16); color: var(--primary-hover);
  border: 1px solid rgba(204, 99, 13, 0.3); border-radius: 10px;
  font-family: inherit; font-weight: 700; font-size: 13px; padding: 9px 14px; cursor: pointer; transition: var(--transition);
}
.tp-add:hover { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }

.tp-chev { color: var(--tp-muted); transition: transform .2s ease; flex: 0 0 auto; }
.tp-card[open] .tp-chev { transform: rotate(180deg); }

/* ===== Expanded body ===== */
.tp-body { display: flex; gap: 22px; padding: 6px 18px 22px; border-top: 1px solid var(--tp-border); }
.tp-body-img {
  flex: 0 0 180px; height: 180px; border-radius: 12px; background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--tp-border); display: grid; place-items: center; overflow: hidden;
}
.tp-body-img img { width: 100%; height: 100%; object-fit: contain; padding: 14px; }
.tp-body-img i { color: var(--tp-muted); font-size: 54px; }
.tp-body-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 18px; }

.tp-specgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tp-specrow { display: flex; flex-direction: column; gap: 3px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--tp-border); border-radius: 10px; padding: 9px 12px; }
.tp-specrow span { color: var(--tp-muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.tp-specrow b { color: var(--text-light); font-size: 14.5px; font-weight: 700; }

/* price-history sparkline */
.tp-history { background: rgba(0, 0, 0, 0.22); border: 1px solid var(--tp-border); border-radius: 12px; padding: 14px 16px; }
.tp-history-head { display: flex; align-items: center; gap: 8px; color: var(--tp-t2); font-weight: 700; font-size: 13px; margin-bottom: 10px; }
.tp-history-head i { color: var(--primary-hover); }
.tp-spark { min-height: 40px; }
.tp-spark-empty { color: var(--tp-muted); font-size: 13px; }
.tp-spark-svg { width: 100%; height: 64px; display: block; }
.tp-spark-stats { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; color: var(--tp-muted); font-size: 12.5px; font-weight: 600; }
.tp-spark-stats b { color: var(--text-light); font-weight: 800; font-variant-numeric: tabular-nums; }
.tp-spark-n { margin-left: auto; }

/* ===== Empty state ===== */
.tp-empty { text-align: center; padding: 3.5rem 2rem; background: var(--tp-card); border: 1px dashed var(--tp-border); border-radius: 16px; }
.tp-empty i { font-size: 2.2rem; color: var(--primary-hover); }
.tp-empty p { color: var(--tp-muted); margin-top: 1rem; }

/* ===== Pagination ===== */
.tp-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 26px; }
.tp-plink {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px;
  border: 1.5px solid var(--tp-border); border-radius: 11px; color: var(--tp-t2);
  font-weight: 700; font-size: 14px; transition: var(--transition);
}
.tp-plink:hover { border-color: var(--primary-color); color: #fff; background: rgba(255, 255, 255, 0.04); }
.tp-plink.disabled { opacity: 0.35; pointer-events: none; }
.tp-pginfo { color: var(--tp-muted); font-weight: 700; font-size: 13.5px; font-variant-numeric: tabular-nums; }

/* ===== Add-to-build modal ===== */
.tp-modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(3px); }
.tp-modal[hidden] { display: none; }
.tp-modal-card {
  position: relative; width: 100%; max-width: 420px;
  background: linear-gradient(180deg, #1e1e20, #181819); border: 1px solid var(--tp-border);
  border-radius: 18px; padding: 24px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.tp-modal-x { position: absolute; top: 14px; right: 14px; background: transparent; border: none; color: var(--tp-muted); font-size: 16px; cursor: pointer; }
.tp-modal-x:hover { color: #fff; }
.tp-modal-title { font-size: 18px; font-weight: 800; padding-right: 24px; }
.tp-modal-title span { color: var(--primary-hover); }
.tp-modal-sub { color: var(--tp-muted); font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin: 16px 0 9px; }
.tp-build-list { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; }
.tp-build-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--tp-border); border-radius: 11px;
  color: var(--text-light); font-family: inherit; font-weight: 700; font-size: 14px; padding: 12px 14px; cursor: pointer; transition: var(--transition); text-align: left;
}
.tp-build-opt:hover { border-color: var(--primary-color); background: rgba(204, 99, 13, 0.12); }
.tp-build-price { color: var(--tp-muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.tp-modal-or { display: flex; align-items: center; gap: 12px; color: var(--tp-muted); font-size: 12px; font-weight: 700; margin: 16px 0; }
.tp-modal-or::before, .tp-modal-or::after { content: ""; flex: 1; height: 1px; background: var(--tp-border); }
.tp-newbuild { display: flex; flex-direction: column; gap: 10px; }
.tp-newbuild input {
  height: 46px; border-radius: 11px; border: 1.5px solid var(--tp-border);
  background: rgba(0, 0, 0, 0.3); color: var(--text-light); font-family: inherit; font-weight: 600; font-size: 14px; padding: 0 14px;
}
.tp-newbuild input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(204, 99, 13, 0.18); }
.tp-modal-login { color: var(--tp-t2); font-size: 14px; margin: 16px 0; }

.tp-btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 46px; padding: 0 20px; border: none; border-radius: 11px;
  background: var(--primary-color); color: #fff; font-family: inherit; font-weight: 800; font-size: 14px;
  cursor: pointer; transition: var(--transition);
}
.tp-btn-primary:hover { background: var(--primary-hover); }

/* ===== Sticky "adding to build" banner ===== */
.tp-ctx-banner {
  position: sticky; top: 73px; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 16px; padding: 12px 16px;
  background: rgba(24, 24, 26, 0.92); backdrop-filter: blur(8px);
  border: 1px solid rgba(204, 99, 13, 0.3); border-radius: 12px;
}
.tp-ctx-back { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--tp-border); color: var(--tp-t2); flex: 0 0 auto; }
.tp-ctx-back:hover { color: #fff; border-color: var(--primary-color); }
.tp-ctx-label { flex: 1; min-width: 0; color: var(--tp-t2); font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-ctx-label b { color: #fff; font-weight: 800; }
.tp-ctx-tag { display: inline-block; margin-left: 6px; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--primary-hover); background: rgba(204, 99, 13, 0.14); border: 1px solid rgba(204, 99, 13, 0.35); border-radius: 999px; padding: 2px 8px; vertical-align: middle; }
.tp-ctx-done { height: 40px; padding: 0 18px; flex: 0 0 auto; }

/* Inline "added" confirmation on a catalog Add button (direct-add / build mode) */
.tp-add.added { background: rgba(46, 204, 113, 0.16); color: #6ee7a0; border-color: rgba(46, 204, 113, 0.4); }
.tp-add.added:hover { background: rgba(46, 204, 113, 0.16); color: #6ee7a0; border-color: rgba(46, 204, 113, 0.4); }

/* ===== Toast ===== */
.tp-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 120;
  padding: 13px 20px; border-radius: 12px; font-weight: 700; font-size: 14px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.4); max-width: 90vw;
}
.tp-toast[hidden] { display: none; }
.tp-toast.ok { background: rgba(46, 204, 113, 0.16); color: #6ee7a0; border: 1px solid rgba(46, 204, 113, 0.4); }
.tp-toast.err { background: rgba(231, 87, 75, 0.16); color: #f1a8a0; border: 1px solid rgba(231, 87, 75, 0.4); }

/* ===== Responsive ===== */
@media (max-width: 720px) {
  .tp-sum { flex-wrap: wrap; }
  .tp-add span { display: none; }
  .tp-add { padding: 9px 11px; }
  .tp-body { flex-direction: column; }
  .tp-body-img { flex-basis: auto; width: 100%; height: 200px; }
}
@media (max-width: 480px) {
  .tp-page { padding: 1.5rem 1rem 4rem; }
  .tp-controls { flex-direction: column; align-items: stretch; }
  .tp-sort { justify-content: space-between; }
  .tp-sort select { flex: 1; }
}
