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

/* ── Base ──────────────────────────────────────────────────────────────────── */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #1a1a1a;
  color: #e0e0e0;
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

a { color: #7b8cde; text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
#sidebar {
  width: 190px;
  min-height: 100vh;
  background: #111;
  position: fixed;
  left: 0; top: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #2a2a2a;
  z-index: 100;
}

#logo {
  display: block;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  padding: 20px 16px;
  border-bottom: 1px solid #2a2a2a;
  text-decoration: none;
  letter-spacing: 0.5px;
}

#logo:hover { text-decoration: none; background: #1a1a1a; }

/* ── Sidebar search ────────────────────────────────────────────────────────── */
#search-box {
  padding: 14px 12px;
  border-bottom: 1px solid #2a2a2a;
  position: relative;
}

#search-input {
  width: 100%;
  padding: 8px 10px;
  background: #222;
  border: 1px solid #3a3a3a;
  border-radius: 5px;
  color: #e0e0e0;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

#search-input:focus { border-color: #7b8cde; }
#search-input::placeholder { color: #555; }

#search-results {
  display: none;
  position: fixed;
  top: 0;
  left: 190px;
  width: 300px;
  background: #1e1e1e;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 300;
  box-shadow: 4px 4px 20px rgba(0,0,0,0.5);
}

#search-results.open { display: block; }

.sr-section {
  padding: 6px 10px 2px;
  font-size: 10px;
  font-weight: 700;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: #161616;
}

.sr-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: #ccc;
  transition: background 0.1s;
}

.sr-item:hover { background: #2a2a2a; }

.sr-item img { width: 28px; height: 28px; object-fit: contain; }
.sr-item .sr-sub { font-size: 11px; color: #555; margin-left: auto; }

/* ── Nav links ─────────────────────────────────────────────────────────────── */
#nav-links {
  list-style: none;
  padding: 10px 8px;
}

#nav-links li { margin-bottom: 2px; }

.nav-link {
  display: block;
  padding: 10px 14px;
  color: #999;
  text-decoration: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover { background: #1e1e1e; color: #fff; text-decoration: none; }
.nav-link.active { background: #2a2a2a; color: #fff; }

/* ── Main content ──────────────────────────────────────────────────────────── */
#content {
  margin-left: 190px;
  padding: 32px 36px;
  flex: 1;
  min-width: 0;
}

/* ── Page title ────────────────────────────────────────────────────────────── */
.page-title {
  font-size: 30px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 22px;
}

/* ── Breadcrumb ────────────────────────────────────────────────────────────── */
.breadcrumb {
  font-size: 13px;
  color: #555;
  margin-bottom: 12px;
}

/* ── Type badge ────────────────────────────────────────────────────────────── */
.type-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-transform: capitalize;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  white-space: nowrap;
}

/* ── Category badge ────────────────────────────────────────────────────────── */
.cat-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.cat-physical { background: #b5390a; color: #fff; }
.cat-special  { background: #4254a8; color: #fff; }
.cat-status   { background: #555;    color: #ddd; }

/* ── Section card ──────────────────────────────────────────────────────────── */
.card {
  background: #222;
  border-radius: 8px;
  padding: 22px 24px;
  margin-bottom: 22px;
}

.card-title {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #333;
}

/* ── Pokemon header layout ─────────────────────────────────────────────────── */
.poke-header {
  display: flex;
  gap: 36px;
  margin-bottom: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.poke-sprite-box {
  background: #252525;
  border-radius: 12px;
  padding: 16px;
  width: 220px;
  min-width: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.poke-sprite-box img {
  width: 188px;
  height: 188px;
  object-fit: contain;
}

.poke-details { flex: 1; min-width: 240px; }

.poke-id { font-size: 15px; color: #555; margin-bottom: 4px; }

.poke-details h1 {
  font-size: 34px;
  font-weight: 700;
  color: #fff;
  text-transform: capitalize;
  margin-bottom: 16px;
}

/* ── Info table (label / value rows) ──────────────────────────────────────── */
.info-rows { margin-bottom: 20px; }

.info-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 9px;
}

.info-lbl {
  width: 82px;
  text-align: right;
  color: #777;
  font-size: 13px;
  flex-shrink: 0;
}

.info-val {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 14px;
}

/* ── Stat bars ─────────────────────────────────────────────────────────────── */
.stats-block { display: flex; flex-direction: column; gap: 7px; }

.stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-lbl {
  width: 76px;
  text-align: right;
  font-size: 12px;
  color: #888;
  flex-shrink: 0;
}

.stat-num {
  width: 34px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-align: right;
  flex-shrink: 0;
}

.stat-bar-bg {
  width: 180px;
  height: 8px;
  background: #333;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

.stat-bar-fill { height: 100%; border-radius: 4px; }

/* ── Move stat strip ───────────────────────────────────────────────────────── */
.move-strip {
  display: flex;
  background: #252525;
  border-radius: 7px;
  overflow: hidden;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.move-strip-cell {
  flex: 1;
  min-width: 90px;
  padding: 13px 18px;
  border-right: 1px solid #333;
}

.move-strip-cell:last-child { border-right: none; }

.ms-label {
  font-size: 10px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}

.ms-value {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Filter bar ────────────────────────────────────────────────────────────── */
.filter-bar { margin-bottom: 18px; }

.filter-input {
  width: 100%;
  max-width: 380px;
  padding: 9px 14px;
  background: #222;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.filter-input:focus { border-color: #7b8cde; }
.filter-input::placeholder { color: #555; }

/* ── Tables (shared) ───────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 9px 12px;
  font-size: 10px;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid #2e2e2e;
  white-space: nowrap;
}

.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #252525;
  vertical-align: middle;
}

.data-table tbody tr:hover td { background: #252525; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ── Pokemon list sprite ───────────────────────────────────────────────────── */
.poke-mini-sprite {
  width: 46px;
  height: 46px;
  object-fit: contain;
  display: block;
}

/* ── Numeric stat cells ────────────────────────────────────────────────────── */
.num-cell {
  text-align: right;
  font-size: 13px;
  color: #bbb;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ── Inline ability links ──────────────────────────────────────────────────── */
.ab-link {
  color: #7b8cde;
  cursor: pointer;
  text-transform: capitalize;
}

.ab-link:hover { text-decoration: underline; }

.hidden-pill {
  display: inline-block;
  font-size: 10px;
  color: #666;
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
}

/* ── Ability block on Pokémon page ─────────────────────────────────────────── */
.ab-row { margin-bottom: 8px; font-size: 14px; }

/* ── Item info grid ────────────────────────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.info-cell {
  background: #2a2a2a;
  border-radius: 6px;
  padding: 12px 16px;
}

.info-cell-lbl {
  font-size: 10px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 5px;
}

.info-cell-val {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-transform: capitalize;
}

/* ── Home grid ─────────────────────────────────────────────────────────────── */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.home-card {
  background: #222;
  border-radius: 8px;
  padding: 22px 18px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  text-decoration: none;
  display: block;
}

.home-card:hover { background: #2a2a2a; transform: translateY(-1px); text-decoration: none; }
.home-card-icon { font-size: 28px; margin-bottom: 10px; }
.home-card-title { font-size: 15px; font-weight: 700; color: #fff; margin-bottom: 4px; }
.home-card-sub { font-size: 12px; color: #666; }

/* ── Pokémon browse grid ───────────────────────────────────────────────────── */
.poke-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.poke-grid-card {
  background: #222;
  border-radius: 8px;
  padding: 10px 6px 8px;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  display: block;
  transition: background 0.15s;
}

.poke-grid-card:hover { background: #2a2a2a; text-decoration: none; }
.poke-grid-card img { width: 72px; height: 72px; object-fit: contain; }
.poke-grid-id { font-size: 10px; color: #555; margin-top: 2px; }
.poke-grid-name { font-size: 12px; font-weight: 600; color: #ddd; text-transform: capitalize; margin-top: 2px; }
.poke-grid-types { display: flex; justify-content: center; gap: 4px; margin-top: 5px; flex-wrap: wrap; }

/* ── Loading / error ───────────────────────────────────────────────────────── */
.loading-msg, .error-msg {
  color: #555;
  font-size: 15px;
  text-align: center;
  margin-top: 80px;
}

.error-msg { color: #c44; }

/* ── Move list description column ──────────────────────────────────────────── */
.desc-col {
  font-size: 12px;
  color: #888;
  max-width: 320px;
}

/* ── Flavor text ───────────────────────────────────────────────────────────── */
.flavor-text {
  font-size: 13px;
  color: #999;
  font-style: italic;
  line-height: 1.5;
  margin-top: 10px;
}

/* ── Effect text ───────────────────────────────────────────────────────────── */
.effect-text {
  font-size: 14px;
  color: #ccc;
  line-height: 1.65;
}

/* ── Table container with overflow ─────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  background: #222;
  margin-bottom: 22px;
}

/* ── Type badge as link ─────────────────────────────────────────────────────── */
a.type-badge { text-decoration: none; transition: opacity 0.15s; }
a.type-badge:hover { text-decoration: none; opacity: 0.82; }

/* ── Types overview grid ────────────────────────────────────────────────────── */
.type-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.type-overview-card {
  background: #222;
  border-radius: 8px;
  padding: 16px;
  text-decoration: none;
  display: block;
  transition: background 0.15s;
}

.type-overview-card:hover { background: #2a2a2a; text-decoration: none; }

/* ── Pokémon list filters (mirrors draft app fa-filters) ─────────────────────── */
.fa-filters    { margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.fa-filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.fa-filter-input {
  background: #222; border: 1px solid #3a3a3a; border-radius: 6px;
  color: #e0e0e0; font-size: 13px; padding: 7px 10px; outline: none;
}
.fa-filter-input:focus { border-color: #7b8cde; }
.fa-stat-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.fa-stat-filter  { display: flex; align-items: center; gap: 3px; }
.fa-stat-label   { font-size: 11px; color: #777; min-width: 24px; }
.fa-stat-op  { background: #222; border: 1px solid #3a3a3a; border-radius: 4px; color: #ccc; font-size: 12px; padding: 3px 4px; }
.fa-stat-val { background: #222; border: 1px solid #3a3a3a; border-radius: 4px; color: #e0e0e0; font-size: 12px; padding: 3px 6px; width: 52px; }

/* ── Sort indicators ─────────────────────────────────────────────────────────── */
.pk-th.sort-asc::after  { content: ' ↑'; }
.pk-th.sort-desc::after { content: ' ↓'; }
.pk-row:hover td { background: #252525; }

/* ── Hamburger button (hidden on desktop) ───────────────────────────────────── */
#sidebar-toggle {
  display: none;
  position: fixed;
  top: calc(var(--top-nav-h, 52px) + 10px);
  left: 12px;
  z-index: 300;
  background: #1e1e1e;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  padding: 7px 9px;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
}
#sidebar-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: #ccc;
  border-radius: 2px;
  transition: background 0.15s;
}
#sidebar-toggle:hover span { background: #fff; }

/* Overlay that dims content when sidebar is open on mobile */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 149;
}
#sidebar-overlay.open { display: block; }

/* ── Mobile breakpoint ──────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  #sidebar-toggle {
    display: flex;
  }

  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 150;
  }
  #sidebar.open {
    transform: translateX(0);
  }

  #content {
    margin-left: 0;
    padding: 16px 14px;
    padding-top: calc(var(--top-nav-h, 52px) + 52px);
  }

  #search-results {
    left: 0;
    width: 100vw;
  }
}
