/* =========================
   Fakemon Dex - Unified CSS
   ========================= */

/* ---- Base Layout ---- */
:root {
  --sidebar-bg: #111;
  --sidebar-bg-2: #0f0f0f;
  --sidebar-text: #eee;
  --panel-bg: #f5f5f5;
  --card-bg: #fff;

  --accent: #4b7bec;
  --shadow: 0 2px 6px rgba(0,0,0,0.1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  display: flex;
  height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: 220px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

.sidebar h2 {
  font-size: 18px;
  margin: 0 0 8px;
  text-align: center;
}

/* Search */
#monSearch {
  display: block;
  width: calc(100% - 16px);
  margin: 6px 8px 10px;
  padding: 6px 10px;

  border-radius: 8px;
  border: 2px solid transparent; /* fixed border width prevents "growth" */
  background: #2a2a2a;
  color: #eee;

  font-size: 13px;
  outline: none;
}

#monSearch::placeholder { color: #aaa; }

#monSearch:focus {
  border-color: var(--accent);
}

/* Sidebar mons */
.mon-link {
  display: block;
  padding: 6px 8px;
  margin-bottom: 4px;
  text-decoration: none;
  color: #eee;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.3;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.mon-link:hover { background: #2a2a2a; }

/* silhouette background layer */
.mon-link::before {
  content: "";
  position: absolute;
  inset: 0;

  background-image: var(--mon-bg);
  background-repeat: no-repeat;
  background-position: 85% center;   /* default: near right, but not glued to edge */
  background-size: 70px auto;

  opacity: 0.30;
  filter: grayscale(1) contrast(1.15);
  pointer-events: none;
  z-index: 0;

  transform: translateX(0);
  transition: transform 180ms ease, opacity 180ms ease, filter 180ms ease;
}

/* keep text above silhouette */
.mon-link > span {
  position: relative;
  z-index: 1;
}

.mon-link.active {
  background: var(--sel-bg, #3f76ff);
  color: #fff;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
}

.mon-link.active::before,
.mon-link:hover::before {
  opacity: 0.90;
  transform: translateX(-20%);
  filter: none;
}

/* Sidebar scrollbar (W3Schools-style rectangles) */
.sidebar::-webkit-scrollbar { width: 16px; }
.sidebar::-webkit-scrollbar-track { background: var(--sidebar-bg); }
.sidebar::-webkit-scrollbar-thumb {
  background: #bdbdbd;
  border-radius: 0;
  border: 3px solid var(--sidebar-bg);
}
.sidebar::-webkit-scrollbar-button {
  display: none; width: 0; height: 0;
}
.sidebar::-webkit-scrollbar-thumb:hover { background: #d0d0d0; }

/* ---- Main ---- */
.main {
  flex: 1;
  background: var(--panel-bg);
  padding: 16px 24px;
  overflow-y: auto;
}

/* ---- Card ---- */
.card {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: var(--shadow);
  max-width: 900px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr);
  gap: 20px;

  position: relative;
  overflow: hidden;
}

/* watermark background image */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--bg-img);
  background-repeat: no-repeat;
  background-position: right center;
  background-size: cover;
  opacity: 0.12;
  pointer-events: none;
  z-index: 0;
}

.card > * {
  position: relative;
  z-index: 1;
}

.card-header {
  border-bottom: 1px solid #eee;
  margin-bottom: 12px;
  padding-bottom: 8px;
}

.card-header h1 {
  margin: 0;
  font-size: 24px;
}

.type-icons {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.section-title {
  font-size: 14px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #888;
  margin: 16px 0 4px;
}

pre {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 14px;
  margin: 0;
}

.notes {
  font-size: 13px;
  color: #555;
}

.mon-image {
  width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}

.chart-wrap {
  max-width: 420px;
  height: 280px;
  position: relative;
}

#stats-chart {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* ---- Learnset section under the card ---- */
#section-learnset {
  max-width: 900px;
  margin: 14px auto 0;
}

/* 4 across */
.learnset {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  align-items: start;
}

@media (max-width: 950px) {
  .learnset { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
}
@media (max-width: 560px) {
  .learnset { grid-template-columns: 1fr; }
}

/* learnset cards */
.learnset details {
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.08);
  overflow: hidden;
  background: #fff;
}

/* clickable header */
.learnset summary {
  cursor: pointer;
  font-weight: 900;
  font-size: 16px;
  padding: 12px 12px;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;

  /* remove all markers/arrows */
  list-style: none;
}

/* remove default marker triangles across browsers */
.learnset summary::-webkit-details-marker { display: none; }
.learnset summary::marker { content: ""; }

/* moves list */
.learnset .moves-list {
  max-height: 240px;
  overflow: auto;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(0,0,0,0.08);
}

.learnset ul {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  color: #222;
}

/* Category header colors */
.learnset details.cat-level summary { background: rgba(194, 46, 40, 0.16); }
.learnset details.cat-tms   summary { background: rgba(99, 144, 240, 0.18); }
.learnset details.cat-hms   summary { background: rgba(122, 199, 76, 0.22); }
.learnset details.cat-egg   summary { background: rgba(247, 208, 44, 0.26); }

/* Category-tinted list backgrounds (also used for scrollbar tracks) */
.cat-level .moves-list { background: rgba(194, 46, 40, 0.08); }
.cat-tms   .moves-list { background: rgba(99, 144, 240, 0.10); }
.cat-hms   .moves-list { background: rgba(122, 199, 76, 0.12); }
.cat-egg   .moves-list { background: rgba(247, 208, 44, 0.14); }


/* ============================
   LEARNSET SCROLLBARS – W3SCHOOLS STYLE (BLOCK)
   Track = background, Thumb = colored rectangle
   No arrows, no rounding, no borders
   ============================ */

.moves-list {
  overflow-y: auto;
  scrollbar-gutter: stable;

  /* Firefox */
  scrollbar-width: auto;
}

/* width */
.moves-list::-webkit-scrollbar {
  width: 10px; /* match W3Schools default; bump to 12 if you want */
}

/* Track */
.moves-list::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.06); /* fallback */
}

/* Handle */
.moves-list::-webkit-scrollbar-thumb {
  background: #888;     /* fallback */
  border-radius: 0;     /* ✅ rectangle */
  border: 0;            /* ✅ no inset */
}

/* no arrows */
.moves-list::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}



/* ✅ Only color the THUMB (keep your good design intact) */
.cat-level .moves-list::-webkit-scrollbar-thumb { background: #c22e28; } /* red */
.cat-tms   .moves-list::-webkit-scrollbar-thumb { background: #6390f0; } /* blue */
.cat-hms   .moves-list::-webkit-scrollbar-thumb { background: #7ac74c; } /* green */
.cat-egg   .moves-list::-webkit-scrollbar-thumb { background: #f7d02c; } /* yellow */

/* Firefox thumb color (track stays default) */
.cat-level .moves-list { scrollbar-color: #c22e28 auto; }
.cat-tms   .moves-list { scrollbar-color: #6390f0 auto; }
.cat-hms   .moves-list { scrollbar-color: #7ac74c auto; }
.cat-egg   .moves-list { scrollbar-color: #f7d02c auto; }
