/* =========================================================================
   REUSABLE COMPONENTS — buttons, cards, stats, inputs, shiny cards, popup
   ========================================================================= */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s, filter 0.15s, background 0.15s;
}

.btn:hover { transform: translateY(-1px); filter: brightness(1.1); }
.btn svg  { width: 20px; height: 20px; }

.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--ghost   { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-2); }

.btn--social  { color: #fff; }
.btn--youtube { background: var(--youtube); }
.btn--twitch  { background: var(--twitch); }
.btn--x       { background: var(--x); border-color: var(--border); }

.btn--small { padding: 0.45rem 0.9rem; font-size: 0.85rem; }
.btn--small svg { width: 16px; height: 16px; }

.button-row,
.social-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.button-row--center { justify-content: center; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

/* ---------- Stats ---------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--gap);
  margin-bottom: 1.5rem;
}

.stat-row .stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.stat { display: flex; flex-direction: column; }
.stat__value { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat__label { font-size: 0.85rem; color: var(--text-muted); }

/* ---------- Form inputs ---------- */
.input {
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}

/* ---------- Tags ---------- */
.tag-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.tag {
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
}

/* ---------- Shiny cards (home + dex) ---------- */
.shiny-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: var(--gap);
}

.shiny-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 1rem 0.75rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.shiny-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px -12px var(--accent);
}

.shiny-card__dex {
  position: absolute;
  top: 0.6rem;
  left: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Sprite box — sprites are shown at their natural size (scaled up a bit),
   centered and sitting on the same "floor" so they line up across cards. */
.shiny-card__sprite {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 120px;
  height: 120px;
  margin-bottom: 0.4rem;
}

/* ---------- Sprites (see js/lib/pokemon.js) ---------- */
.sprite {
  max-width: 100%;
  max-height: 100%;
}

/* Gen 5 pixel sprites: keep pixels crisp and scale up 1.25x */
.sprite--gen5 {
  image-rendering: pixelated;
  scale: 1.25;
  transform-origin: bottom center;
}

/* Gen 6+ 3D sprites: same 1.25x so sizes match the pixel sprites */
.shiny-card .sprite--3d {
  max-width: 96px;
  max-height: 96px;
  scale: 1.25;
  transform-origin: bottom center;
}

.shiny-card__name { font-weight: 800; font-size: 1.05rem; }

.shiny-card__meta {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.shiny-card__date { font-size: 0.75rem; color: var(--text-muted); }

.ball-icon {
  display: inline-block;
  width: 22px;
  height: 22px;
  vertical-align: middle;
  image-rendering: pixelated;
}

/* ---------- Popup dialog ---------- */
.dialog {
  width: min(760px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  padding: 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.dialog::backdrop {
  background: rgb(5 6 12 / 0.75);
  backdrop-filter: blur(3px);
}

.dialog__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}
