/* ===============================
   TL Tracker — Dark Apple-like UI
   =============================== */

/* --- Color system --- */
:root {
  --bg: #0b0b0c;
  --bg-elev-1: #111214;
  --bg-elev-2: #16181b;
  --card: #15161a;
  --card-hover: #1a1c20;
  --border: #22242a;
  --text: #e7e8eb;
  --text-dim: #a9adb6;
  --accent: #0a84ff;      /* macOS blue */
  --accent-dim: #066ad0;
  --success: #30d158;     /* apple green */
  --danger: #ff453a;      /* apple red */
  --shadow: 0 8px 30px rgba(0,0,0,.45);
  --radius-xl: 18px;
  --radius-lg: 12px;
  --radius-md: 10px;
  --radius-sm: 8px;
}

/* --- Base --- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body.dark {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text",
        "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Top Nav --- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--bg-elev-2) 92%, black 8%);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(10px);
}
.nav-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--success); box-shadow: 0 0 12px var(--success);
}
.nav-links { display: inline-flex; gap: 18px; }
.nav-links a {
  color: var(--text-dim); text-decoration: none; padding: 6px 8px;
  border-radius: 8px; transition: color .2s, background .2s;
}
.nav-links a:hover { color: var(--text); background: var(--bg-elev-2); }

/* --- Layout Container --- */
.container {
  max-width: 1160px;
  margin: 28px auto 80px;
  padding: 0 20px;
}

/* --- Hero --- */
.hero { text-align: center; margin-bottom: 26px; }
.hero h1 { margin: 10px 0 6px; font-size: 34px; letter-spacing: .2px; }
.sub { color: var(--text-dim); margin: 0 0 18px; }

/* --- Search / Filter --- */
.search {
  display: grid; grid-template-columns: 1fr 110px 110px; gap: 10px;
  max-width: 680px; margin: 0 auto 18px;
}
.search input[type="text"],
.search input[type="number"] {
  appearance: none;
  background: var(--bg-elev-1);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  outline: none; transition: border .2s, background .2s, box-shadow .2s;
}
.search input:focus {
  border-color: color-mix(in oklab, var(--accent) 70%, white 0%);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 20%, transparent);
}
.search button {
  border: none; cursor: pointer; border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--accent), var(--accent-dim));
  color: #fff; font-weight: 600; letter-spacing: .2px;
  padding: 12px 14px; transition: filter .15s, transform .05s;
}
.search button:hover { filter: brightness(1.05); }
.search button:active { transform: translateY(1px); }

/* --- Stats --- */
.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin: 18px auto 6px; max-width: 900px;
}
.stat {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 18px;
  box-shadow: var(--shadow);
}
.stat-num { font-size: 28px; font-weight: 700; }
.stat-label { color: var(--text-dim); margin-top: 4px; }

/* --- Section --- */
.section-title { margin: 26px 0 14px; font-size: 18px; color: var(--text); }

/* --- Card Grid --- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 980px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 14px;
  display: grid; grid-template-columns: 84px 1fr; gap: 14px;
  box-shadow: var(--shadow);
  transition: background .2s, transform .08s, border-color .2s;
}
.card:hover { background: var(--card-hover); transform: translateY(-1px); }

.thumb {
  width: 84px; height: 84px; border-radius: 12px; overflow: hidden;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  display: grid; place-items: center;
}
.thumb img {
  width: 100%; height: 100%; object-fit: contain; image-rendering: auto;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.35));
}

/* --- Card Content --- */
.title {
  margin: 2px 0 6px;
  font-size: 16px; line-height: 1.35; font-weight: 600;
}
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px;
  background: var(--bg-elev-2); color: var(--text-dim);
  border: 1px solid var(--border);
}
.pill strong { color: var(--text); font-weight: 700; }
.pill.price { background: color-mix(in oklab, var(--accent) 12%, var(--bg-elev-2)); border-color: color-mix(in oklab, var(--accent) 28%, var(--border)); }

.time { color: var(--text-dim); font-size: 12.5px; }

.links { margin-top: 8px; display: flex; gap: 12px; flex-wrap: wrap; }
.link {
  color: var(--accent); text-decoration: none; font-weight: 600;
  padding: 4px 0; border-bottom: 1px dotted color-mix(in oklab, var(--accent) 55%, transparent);
}
.link:hover { color: #fff; border-bottom-color: transparent; }

/* --- Footer --- */
.foot {
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  max-width: 1160px; margin: 36px auto 28px; padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.foot .small { font-size: 12.5px; color: var(--text-dim); }

/* --- Utilities --- */
code {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  padding: 2px 6px; border-radius: 6px; color: var(--text);
}
.nav-stats { display:flex; align-items:center; gap:10px; }
.nav-stat {
  display:flex; align-items:center; gap:8px;
  padding:6px 10px; border:1px solid var(--border);
  background: var(--bg-elev-1); border-radius: 10px;
}
.ns-label { color: var(--text-dim); font-size: 12px; margin-right: 4px; }
.ns-key   { color: var(--text-dim); font-size: 11px; margin-left: 6px; }
.ns-val   { font-variant-numeric: tabular-nums; font-weight: 700; }
@media (max-width: 720px){ .nav-stats { display:none; } }
