/* encyclopedia/assets/ency.css
   Clean, self-contained UI for the Encyclopedia module.
   Scope: mostly through .encyclopedia-root to minimize side effects.
*/

:root{
  --enc-bg: #f5f7fb;
  --enc-surface: #ffffff;
  --enc-surface2: #f8fafc;
  --enc-border: rgba(15, 23, 42, 0.12);
  --enc-border2: rgba(15, 23, 42, 0.08);
  --enc-text: #0f172a;
  --enc-muted: rgba(15, 23, 42, 0.62);
  --enc-primary: #2563eb;
  --enc-primary2: #1d4ed8;
  --enc-success: #16a34a;
  --enc-danger: #dc2626;
  --enc-warning: #d97706;
  --enc-radius: 16px;
  --enc-radius-sm: 12px;
  --enc-shadow: 0 10px 30px rgba(2, 6, 23, 0.08);
  --enc-shadow-sm: 0 6px 18px rgba(2, 6, 23, 0.08);
}

html, body{ height:100%; }
body{
  margin:0;
  background: var(--enc-bg);
  color: var(--enc-text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height:1.35;
}

.encyclopedia-root, .encyclopedia-root *{ box-sizing:border-box; }

a{ color: var(--enc-primary2); text-decoration:none; }
a:hover{ opacity: .92; }

code{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

/* Layout */
.forum-root{ min-height:100vh; display:flex; flex-direction:column; }

.forum-container{
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 16px;
}
@media (max-width: 520px){
  .forum-container{ padding: 12px; }
}

/* Header */
.forum-header{
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--enc-border);
}
.forum-header-inner{
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 10px 16px;
  display:flex;
  gap: 12px;
  align-items:center;
}
.brand{
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--enc-text);
  font-size: 18px;
  padding: 6px 10px;
  border-radius: 999px;
}
.brand:hover{ background: rgba(37,99,235,0.08); }

.nav{
  display:flex;
  gap: 6px;
  align-items:center;
  flex: 1 1 auto;
  flex-wrap:wrap;
}
.nav a{
  color: var(--enc-muted);
  font-weight: 750;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 999px;
  transition: background .15s ease, color .15s ease;
}
.nav a:hover{
  background: rgba(37,99,235,0.08);
  color: var(--enc-text);
}
.nav a.active{
  background: rgba(37,99,235,0.14);
  color: var(--enc-primary2);
}

.header-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.search{
  position: relative;
}
.search input{
  width: 260px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--enc-border);
  background: rgba(255,255,255,0.9);
  outline: none;
  color: var(--enc-text);
}
.search input:focus{ border-color: rgba(37,99,235,0.45); box-shadow: 0 0 0 4px rgba(37,99,235,0.12); }

.burger{
  display:none;
  margin-left:auto;
  border: 1px solid var(--enc-border);
  background: rgba(255,255,255,0.9);
  color: var(--enc-text);
  border-radius: 12px;
  padding: 8px 10px;
  cursor:pointer;
  font-weight: 900;
}
.burger:hover{ border-color: rgba(37,99,235,0.45); }

.mobile-nav{
  display:none;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--enc-border2);
  background: rgba(255,255,255,0.92);
}
.mobile-nav a{
  display:block;
  padding: 10px 10px;
  border-radius: 12px;
  font-weight: 750;
  color: var(--enc-muted);
}
.mobile-nav a:hover{ background: rgba(37,99,235,0.08); color: var(--enc-text); }
.mobile-nav a.active{ background: rgba(37,99,235,0.14); color: var(--enc-primary2); }
.mobile-nav.open{ display:block; }

@media (max-width: 980px){
  .nav{ display:none; }
  .burger{ display:inline-flex; }
  .search input{ width: 220px; }
}
@media (max-width: 680px){
  .search{ display:none; }
}

/* Cards / surfaces */
.forum-card{
  background: var(--enc-surface);
  border: 1px solid var(--enc-border);
  border-radius: var(--enc-radius);
  box-shadow: var(--enc-shadow-sm);
  padding: 16px;
}
.forum-card.inner{
  background: var(--enc-surface2);
  border-color: var(--enc-border2);
  box-shadow: none;
}

.card{
  background: var(--enc-surface);
  border: 1px solid var(--enc-border);
  border-radius: var(--enc-radius);
  padding: 14px;
  box-shadow: none;
  display:block;
  color: inherit;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
a.card:hover{
  transform: translateY(-1px);
  border-color: rgba(37,99,235,0.28);
  box-shadow: var(--enc-shadow);
}

.muted{ color: var(--enc-muted); }

/* Alerts */
.forum-alert{
  border: 1px solid var(--enc-border);
  border-radius: var(--enc-radius-sm);
  padding: 12px 14px;
  background: rgba(15,23,42,0.03);
}
.forum-alert.success{ border-color: rgba(22,163,74,0.30); background: rgba(22,163,74,0.08); }
.forum-alert.danger{ border-color: rgba(220,38,38,0.30); background: rgba(220,38,38,0.08); }

/* Buttons */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--enc-border);
  background: rgba(255,255,255,0.92);
  color: var(--enc-text);
  font-weight: 800;
  cursor:pointer;
  user-select:none;
}
.btn:hover{ border-color: rgba(37,99,235,0.45); }
.btn.primary{
  background: var(--enc-primary);
  border-color: var(--enc-primary);
  color: #fff;
}
.btn.primary:hover{ background: var(--enc-primary2); border-color: var(--enc-primary2); }
.btn.danger{ background: var(--enc-danger); border-color: var(--enc-danger); color:#fff; }
.btn.danger:hover{ filter: brightness(0.95); }
.btn:disabled{ opacity: .55; cursor:not-allowed; }

/* Grids */
.grid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 12px;
}
@media (max-width: 980px){
  .grid{ grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 720px){
  .grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 460px){
  .grid{ grid-template-columns: 1fr; }
}

/* Tabs */
.tabs{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
  margin: 10px 0 14px;
}
.tab{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--enc-border);
  background: rgba(255,255,255,0.92);
  color: var(--enc-text);
  font-weight: 800;
  font-size: 13px;
}
.tab:hover{ border-color: rgba(37,99,235,0.45); }
.tab.active{
  background: rgba(37,99,235,0.14);
  border-color: rgba(37,99,235,0.28);
  color: var(--enc-primary2);
}

/* Pokedex cards */
.poke-card{ display:flex; gap: 12px; align-items:center; min-width:0; }
.poke-card img{ width: 56px; height: 56px; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(2,6,23,0.12)); }
.poke-card .num{ font-size: 12px; font-weight: 800; color: var(--enc-muted); }

/* Types */
.type-row{ margin-top: 6px; }
.type-badge{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid rgba(15,23,42,0.10);
  background: rgba(15,23,42,0.04);
  margin-right: 6px;
}
/* Soft type colors (background only; text uses base color for readability) */
.type-badge.t-fire{ background: rgba(244,63,94,0.10); }
.type-badge.t-water{ background: rgba(59,130,246,0.12); }
.type-badge.t-grass{ background: rgba(34,197,94,0.12); }
.type-badge.t-electric{ background: rgba(234,179,8,0.14); }
.type-badge.t-ice{ background: rgba(56,189,248,0.14); }
.type-badge.t-fighting{ background: rgba(249,115,22,0.14); }
.type-badge.t-poison{ background: rgba(168,85,247,0.14); }
.type-badge.t-ground{ background: rgba(245,158,11,0.16); }
.type-badge.t-fly, .type-badge.t-flying{ background: rgba(99,102,241,0.14); }
.type-badge.t-psychic{ background: rgba(236,72,153,0.14); }
.type-badge.t-bug{ background: rgba(132,204,22,0.16); }
.type-badge.t-rock{ background: rgba(120,113,108,0.14); }
.type-badge.t-ghost{ background: rgba(139,92,246,0.14); }
.type-badge.t-dragon{ background: rgba(79,70,229,0.14); }
.type-badge.t-dark{ background: rgba(15,23,42,0.10); }
.type-badge.t-steel{ background: rgba(148,163,184,0.16); }
.type-badge.t-fairy{ background: rgba(251,113,133,0.14); }
.type-badge.t-normal{ background: rgba(148,163,184,0.12); }

/* Pokemon page */
.pokemon-hero{ display:flex; gap: 18px; flex-wrap:wrap; align-items:flex-start; }
.pokemon-hero img.big{
  width: 220px;
  height: 220px;
  object-fit: contain;
  border-radius: var(--enc-radius);
  border: 1px solid var(--enc-border);
  background: rgba(255,255,255,0.75);
  box-shadow: var(--enc-shadow-sm);
}
@media (max-width: 560px){
  .pokemon-hero img.big{ width: 170px; height:170px; }
}

.statbar{
  height: 10px;
  border-radius: 999px;
  background: rgba(15,23,42,0.08);
  overflow:hidden;
}
.statbar > i{
  display:block;
  height: 10px;
  background: var(--enc-primary);
  width: 0;
}

/* Build previews */
.build-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 900px){
  .build-grid{ grid-template-columns: 1fr; }
}

.build-team{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
}
.build-team .slot{
  width: 64px;
  height: 64px;
  border-radius: 16px;
  border: 1px solid var(--enc-border);
  background: rgba(15,23,42,0.03);
  display:flex;
  align-items:center;
  justify-content:center;
}
.build-team .slot img{ width: 56px; height: 56px; object-fit: contain; }

.badge{
  display:inline-flex;
  align-items:center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid var(--enc-border);
  background: rgba(15,23,42,0.04);
}
.badge.rec{ background: rgba(234,179,8,0.18); border-color: rgba(234,179,8,0.25); }

/* Forms */
.form-row{
  display:flex;
  gap: 10px;
  flex-wrap:wrap;
}
.form-row .field{
  flex: 1 1 220px;
  min-width: 220px;
}
.field label{
  display:block;
  font-size: 12px;
  color: var(--enc-muted);
  margin-bottom: 6px;
  font-weight: 800;
}
.field input, .field textarea, .field select{
  width:100%;
  padding: 11px 12px;
  border: 1px solid var(--enc-border);
  border-radius: 12px;
  background: rgba(255,255,255,0.92);
  color: var(--enc-text);
  outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus{
  border-color: rgba(37,99,235,0.45);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.12);
}
.field textarea{ min-height: 120px; resize: vertical; }

.small-actions{ display:flex; gap: 8px; flex-wrap:wrap; margin-top: 10px; }

/* Tables */
.table-wrap{ overflow:auto; border-radius: var(--enc-radius-sm); border: 1px solid var(--enc-border); }
.table{
  width:100%;
  border-collapse: collapse;
  min-width: 520px;
  background: var(--enc-surface);
}
.table th, .table td{
  padding: 10px 12px;
  border-bottom: 1px solid var(--enc-border2);
  text-align:left;
  vertical-align:top;
}
.table th{
  font-size: 12px;
  color: var(--enc-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  background: rgba(15,23,42,0.03);
}

/* Links */
.link{ color: var(--enc-primary2); font-weight: 800; }
.link:hover{ text-decoration: underline; }

/* Pagination */
.pager{
  margin-top: 14px;
  display:flex;
  gap: 8px;
  flex-wrap:wrap;
  align-items:center;
}
.pager-item{
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--enc-border);
  background: rgba(255,255,255,0.92);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color: var(--enc-text);
  font-weight: 900;
}
.pager-item:hover{ border-color: rgba(37,99,235,0.45); }
.pager-item.active{ background: rgba(37,99,235,0.14); border-color: rgba(37,99,235,0.28); color: var(--enc-primary2); }
.pager-item.disabled{ opacity: .45; cursor: default; }
.pager-dots{ color: var(--enc-muted); font-weight: 900; padding: 0 4px; }

/* BBCode */
.bbcode-img{
  max-width: min(100%, 760px);
  max-height: 440px;
  border-radius: var(--enc-radius);
  border: 1px solid var(--enc-border);
  box-shadow: var(--enc-shadow-sm);
  display:block;
  background:#fff;
  object-fit: contain;
}
.quote{
  border-left: 3px solid var(--enc-primary);
  padding: 10px 12px;
  background: rgba(15,23,42,0.03);
  border-radius: 12px;
  margin: 10px 0;
}
.quote-h{
  font-weight: 900;
  margin-bottom: 6px;
  color: var(--enc-muted);
}
.code{
  background: rgba(15,23,42,0.03);
  border: 1px solid var(--enc-border);
  border-radius: 12px;
  padding: 12px;
  overflow:auto;
}

/* Autocomplete (JS attaches .ac-box) */
.ac-box{
  background: #fff;
  border: 1px solid var(--enc-border);
  border-radius: 12px;
  box-shadow: var(--enc-shadow);
  overflow:auto;
}
.ac-box button{
  width: 100%;
  text-align:left;
  padding: 10px 12px;
  border:0;
  background: transparent;
  cursor:pointer;
  color: var(--enc-text);
}
.ac-box button:hover{ background: rgba(37,99,235,0.08); }

/* Footer */
.forum-footer{
  margin-top: auto;
  padding: 18px 16px;
  border-top: 1px solid var(--enc-border);
  background: rgba(255,255,255,0.82);
}
.forum-footer .muted{ text-align:center; }


/* Item mini icons */
.item-mini{width:22px;height:22px;object-fit:contain;vertical-align:middle;}
.item-mini.big{width:44px;height:44px;}
.td-icon{width:44px;}
