/* ─────────────────────────────────────────
   RetroGames.Tech — Main Stylesheet
   Dark collector theme
───────────────────────────────────────── */

:root {
  --bg:        #0d0f1a;
  --surface:   #13152a;
  --card:      #1a1d35;
  --border:    #252840;
  --accent:    #f0a500;
  --accent-dim:#a87200;
  --purple:    #7c5cbf;
  --text:      #e2e4f0;
  --muted:     #7a7d99;
  --green:     #2ecc71;
  --red:       #e74c3c;
  --ebay:      #3665f3;
  --radius:    8px;
  --shadow:    0 4px 24px rgba(0,0,0,0.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ─────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.5px;
  text-decoration: none;
}

.logo span { color: var(--text); }

nav { display: flex; gap: 1.5rem; }
nav a { color: var(--muted); font-size: 0.9rem; font-weight: 500; transition: color 0.2s; }
nav a:hover { color: var(--text); text-decoration: none; }

/* ── Main Layout ─────────────────────────── */
main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ── Homepage ────────────────────────────── */
.hero {
  text-align: center;
  padding: 4rem 1rem 3rem;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--accent);
  margin-bottom: 0.75rem;
  letter-spacing: -1px;
}

.hero p {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 480px;
  margin: 0 auto 2rem;
}

.search-bar {
  display: flex;
  max-width: 480px;
  margin: 0 auto;
  gap: 0.5rem;
}

.search-bar input {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  outline: none;
}

.search-bar input:focus { border-color: var(--accent); }
.search-bar input::placeholder { color: var(--muted); }

.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

/* ── Game Grid (Homepage) ────────────────── */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.game-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  transition: border-color 0.2s, transform 0.2s;
  display: block;
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
}

.game-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
  color: var(--text);
}

.game-card .platform-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--purple);
  background: rgba(124,92,191,0.15);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.game-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.game-card .price {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.game-card .price-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

/* ── Game Page ───────────────────────────── */
.game-page h1 {
  font-size: 1.8rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.platform-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--purple);
  background: rgba(124,92,191,0.15);
  padding: 3px 8px;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 0.5rem;
}

/* ── Price Hero ──────────────────────────── */
.price-hero {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}

.price-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.price-card .label {
  font-size: 0.7rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.big-price {
  font-size: 3rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.price-card span:not(.label):not(.big-price) {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.trend-up   { color: var(--green); font-size: 0.9rem; font-weight: 600; }
.trend-down { color: var(--red);   font-size: 0.9rem; font-weight: 600; }

.cta-button {
  display: inline-flex;
  align-items: center;
  background: var(--ebay);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.85rem 1.75rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: opacity 0.2s, transform 0.2s;
  margin-left: auto;
  white-space: nowrap;
}

.cta-button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  text-decoration: none;
  color: #fff;
}

/* ── Sections ────────────────────────────── */
section {
  margin-top: 2.5rem;
}

section h2 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

/* ── Price History Table ─────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th {
  text-align: left;
  padding: 0.6rem 1rem;
  font-size: 0.7rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface); }

td:last-child { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }

/* ── Live Listings ───────────────────────── */
.listings-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.listings-list li {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: border-color 0.2s;
}

.listings-list li:hover { border-color: var(--accent); }

.listings-list a {
  color: var(--text);
  font-size: 0.9rem;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.listings-list a:hover { color: var(--accent); text-decoration: none; }

.listing-price {
  font-weight: 800;
  color: var(--accent);
  font-size: 1rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.see-all {
  display: inline-block;
  margin-top: 1rem;
  color: var(--ebay);
  font-size: 0.9rem;
  font-weight: 600;
}

/* ── Game Meta ───────────────────────────── */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.meta-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.meta-item dt {
  font-size: 0.7rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.meta-item dd {
  font-weight: 700;
  font-size: 0.95rem;
}

/* ── Game History ────────────────────────── */
.game-history p {
  color: var(--text);
  line-height: 1.8;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.game-history p:last-child { margin-bottom: 0; }

/* ── Game Header with Cover ──────────────── */
.game-header {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.game-cover {
  width: 120px;
  min-width: 120px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.game-header-info {
  flex: 1;
  padding-top: 0.25rem;
}

/* ── Screenshots ─────────────────────────── */
.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}

.screenshot {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
  transition: transform 0.2s;
}

.screenshot:hover { transform: scale(1.02); }

/* ── Homepage game card cover ────────────── */
.game-card-cover {
  width: 100%;
  height: 180px;
  object-fit: cover;
  object-position: top;
  display: block;
  border-radius: 0;
  margin-bottom: 0;
  border: none;
  border-bottom: 1px solid var(--border);
}

.game-card-body {
  padding: 0.85rem 1.25rem 1.25rem;
}

@media (max-width: 640px) {
  .game-cover { width: 80px; min-width: 80px; }
  .screenshot-grid { grid-template-columns: 1fr 1fr; }
}

/* ── No Price State ──────────────────────── */
.no-price {
  color: var(--muted);
  font-style: italic;
  font-size: 1.2rem;
}

/* ── Footer ──────────────────────────────── */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.8;
  margin-top: 4rem;
}

footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }

/* ── Consoles Page ───────────────────────── */
.consoles-page {
  max-width: 1100px;
}

.console-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.console-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.console-nav-link:hover {
  border-color: var(--accent);
  background: rgba(240,165,0,0.08);
  color: var(--accent);
  text-decoration: none;
}

.console-count {
  font-size: 0.7rem;
  background: rgba(124,92,191,0.2);
  color: var(--purple);
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
}

.console-section {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border);
}

.console-section:first-of-type {
  border-top-color: var(--accent);
}

.console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
}

.console-title-block {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.console-title-block h2 {
  font-size: 1.55rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -0.5px;
  border-bottom: none !important;
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
}

.console-years {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.5px;
}

.console-game-count {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.console-tagline {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  font-style: italic;
}

.console-grid {
  margin-top: 0 !important;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
}

.console-see-more {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 0.75rem;
  font-style: italic;
  padding: 0.5rem;
}

/* ── 404 ─────────────────────────────────── */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  text-align: center;
  gap: 1rem;
}

.error-page h1 { font-size: 5rem; color: var(--accent); font-weight: 900; }
.error-page p { color: var(--muted); font-size: 1.1rem; }

/* ── Responsive ──────────────────────────── */
@media (max-width: 640px) {
  header { padding: 0 1rem; }
  .logo { font-size: 0.95rem; }
  nav { gap: 1rem; }
  nav a { font-size: 0.8rem; }
  main { padding: 1.5rem 1rem 3rem; }
  .hero h1 { font-size: 1.8rem; }
  .price-hero { padding: 1.25rem; gap: 1.25rem; }
  .big-price { font-size: 2.2rem; }
  .cta-button { width: 100%; justify-content: center; margin-left: 0; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
