/* ========== Design tokens ========== */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #111;
  --muted: #6b7280;
  --border: #e5e7eb;
  --brand: #ef4444;
  --ring: rgba(239, 68, 68, 0.3);
  --chip: #f3f4f6;

  /* Type colors (Pokémon types) */
  --t-normal:#a8a77a; --t-fire:#ee8130; --t-water:#6390f0; --t-electric:#f7d02c;
  --t-grass:#7ac74c; --t-ice:#96d9d6; --t-fighting:#c22e28; --t-poison:#a33ea1;
  --t-ground:#e2bf65; --t-flying:#a98ff3; --t-psychic:#f95587; --t-bug:#a6b91a;
  --t-rock:#b6a136; --t-ghost:#735797; --t-dragon:#6f35fc; --t-dark:#705746;
  --t-steel:#b7b7ce; --t-fairy:#d685ad;
}

:root.dark {
  --bg: #0b0f14;
  --surface: #0f1720;
  --text: #f3f4f6;
  --muted: #9aa3af;
  --border: #1f2937;
  --chip: #111827;
  --ring: rgba(99, 102, 241, 0.35);
  --brand: #f87171;
}

/* Reset-ish */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* Layout */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1rem;
  display: grid; gap: 0.75rem;
}
.brand { margin: 0; font-size: 1.5rem; letter-spacing: 0.5px; }
.controls { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.search { display: flex; gap: 0.5rem; align-items: center; }
.filters { display: flex; gap: 0.5rem; align-items: center; margin-left: auto; }

.container { max-width: 1100px; margin: 1rem auto; padding: 0 1rem; }
.status { margin: 0.5rem 0 1rem; color: var(--muted); min-height: 1.25rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}

.site-footer {
  margin: 3rem 0 2rem;
  text-align: center;
  color: var(--muted);
}

/* Favorites side panel */
.favorites-panel {
  position: fixed; right: 1rem; bottom: 1rem; width: 260px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 0.75rem; box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}
.fav-header { display: flex; align-items: center; justify-content: space-between; }
.fav-list { list-style: none; padding: 0; margin: 0.25rem 0 0; max-height: 260px; overflow: auto; }
.fav-list li { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0; border-bottom: 1px dashed var(--border);}
.fav-list li:last-child { border-bottom: 0; }
.fav-list img { width: 36px; height: 36px; image-rendering: pixelated; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.85rem;
  display: grid; gap: 0.5rem;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,0.06); }
.card-header { display: flex; align-items: center; justify-content: space-between; }
.card-id { color: var(--muted); font-variant-numeric: tabular-nums; }
.card-name { margin: 0; font-size: 1rem; text-transform: capitalize; }

.thumb {
  width: 100%;
  aspect-ratio: 1/1;
  display: grid; place-items: center;
  background: var(--chip);
  border-radius: 12px;
}
.thumb img { width: 80%; height: 80%; image-rendering: pixelated; }

.type-row { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.type {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.2rem 0.5rem; border-radius: 999px; font-size: 0.8rem;
  color: #fff; text-transform: capitalize;
}
.type.normal{background:var(--t-normal);} .type.fire{background:var(--t-fire);}
.type.water{background:var(--t-water);} .type.electric{background:var(--t-electric);}
.type.grass{background:var(--t-grass);} .type.ice{background:var(--t-ice);}
.type.fighting{background:var(--t-fighting);} .type.poison{background:var(--t-poison);}
.type.ground{background:var(--t-ground);} .type.flying{background:var(--t-flying);}
.type.psychic{background:var(--t-psychic);} .type.bug{background:var(--t-bug);}
.type.rock{background:var(--t-rock);} .type.ghost{background:var(--t-ghost);}
.type.dragon{background:var(--t-dragon);} .type.dark{background:var(--t-dark);}
.type.steel{background:var(--t-steel);} .type.fairy{background:var(--t-fairy);}

/* Buttons / inputs */
.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}
.btn:hover { box-shadow: 0 0 0 3px var(--ring); }
.btn.ghost { background: transparent; }

input[type="search"], select {
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  min-width: 10ch;
}
input:focus, select:focus { outline: none; box-shadow: 0 0 0 3px var(--ring); }

/* Pagination */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 0.75rem;
  margin: 1rem 0 2rem;
}
.page-info { color: var(--muted); }

/* Toggle */
.toggle { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; user-select: none; }
.toggle input { display: none; }
.toggle-ui {
  width: 42px; height: 24px; border-radius: 999px; position: relative;
  background: var(--chip); border: 1px solid var(--border); display: inline-block;
}
.toggle-ui::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 50%;
  transition: transform 160ms ease;
}
:root.dark .toggle-ui::after { transform: translateX(18px); }

/* Modal */
.modal { border: none; padding: 0; background: rgba(0,0,0,0.35); }
.modal[open] { display: grid; place-items: center; }
.modal-card {
  width: min(680px, 92vw);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1rem 1rem 1.25rem;
}
.modal-close {
  float: right; border: none; background: transparent; font-size: 1.1rem; cursor: pointer;
}
.modal-content { display: grid; gap: 0.75rem; }
.modal-hero { display: grid; grid-template-columns: 160px 1fr; gap: 1rem; align-items: center; }
.modal-hero .art {
  width: 160px; height: 160px; display: grid; place-items: center; background: var(--chip); border-radius: 12px;
}
.modal-hero img { width: 85%; height: 85%; image-rendering: pixelated; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1rem; }
.kv div { display: grid; gap: 0.25rem; }
.statbar { height: 8px; background: var(--chip); border-radius: 999px; overflow: hidden; }
.statbar > span { display: block; height: 100%; background: var(--brand); }

/* Small screens */
@media (max-width: 640px) {
  .favorites-panel { position: static; width: auto; margin: 1rem; }
  .modal-hero { grid-template-columns: 1fr; }
}

footer {
    background-color: #111; /* Dark background */
    color: #ccc; /* Light grey text */
    text-align: center;
    padding: 15px 0;
    font-size: 0.9rem;
    border-top: 1px solid #333;
}

footer a {
    color: #4db6ac; /* Soft teal link color */
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #80cbc4; /* Lighter teal on hover */
}

footer span {
    color: #fff; /* Your name in white for emphasis */
    font-weight: bold;
}
