/* =========================================================
   POKÉPOPULARITY – Additional CSS (clean + organized)
   =============================a============================ */

/* -------------------------
   1) Page scroll model
   Desktop: app-style (body locked, content column scrolls)
   Mobile: normal page scroll (stacked layout)
-------------------------- */
html, body {
  height: auto;
}

body {
  overflow-x: hidden;
}

body::-webkit-scrollbar {
  display: none;
}

/* Main columns wrapper */
.pp-main{
  height: calc(100vh);
  min-height: 0;
}

/* Scroll container */
.pp-scroll{
  overflow-y: auto !important;
  min-height: 0 !important;
}

/* -------------------------
   2) Card grid (Ajax Load More output)
-------------------------- */
.alm-listing{
  display: grid;
  gap: 24px !important;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
}

.pp-card{
  width: 100%;
  max-width: 200px;
  justify-self: center;
  text-align: center;
}

.pp-card img{
  width: 100%;
  height: auto;
  display: block;
  max-width: 200px;
  border-radius: 8px;
  margin: 0;
}

/* Text under cards */
.pp-name{
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
}

.pp-rank{ font-weight: 500; }
.pp-sep{ color: #aaa; }

/* Links */
.pp-card a{
  text-decoration: none !important;
  color: inherit !important;
}

.pp-card a:hover{
  text-decoration: none !important;
}

/* -------------------------
   3) Minimal scrollbar
-------------------------- */

/* Firefox */
.pp-scroll{
  scrollbar-width: thin;
  scrollbar-color: rgba(120,120,120,0.5) transparent;
}

/* Chrome */
.pp-scroll::-webkit-scrollbar{ width: 6px; }

.pp-scroll::-webkit-scrollbar-track{
  background: transparent;
}

.pp-scroll::-webkit-scrollbar-thumb{
  background: rgba(120,120,120,0.5);
  border-radius: 6px;
}

.pp-scroll::-webkit-scrollbar-thumb:hover{
  background: rgba(120,120,120,0.8);
}

/* -------------------------
   4) Responsive behavior
-------------------------- */

@media (max-width: 900px) {

  /* kill sticky sidebar on mobile */
  .pp-main .wp-block-column {
    position: static !important;
    top: auto !important;
  }

  .pp-main .is-position-sticky,
  .pp-main [style*="position:sticky"],
  .pp-main [style*="position: sticky"] {
    position: static !important;
    top: auto !important;
  }

  /* remove divider borders */
  .pp-main .wp-block-column{
    border: none !important;
    padding-right: 0;
  }

  /* unlock normal scrolling */
  html, body { height: auto !important; }

  body { overflow: auto !important; }

  .pp-main { height: auto !important; }

  .pp-scroll { overflow: visible !important; }

  /* tighter grid */
  .alm-listing{
    gap: 16px !important;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
  }

  .pp-card{
    max-width: 160px;
  }
}

/* -------------------------
   Mobile layout
0-------------------------- */

@media (max-width: 600px) {

  /* always 2 columns */
  .alm-listing{
    gap: 12px !important;
    grid-template-columns: repeat(2, minmax(0,1fr)) !important;
  }

  .pp-card{
    max-width: none !important;
    width: 100% !important;
  }

}

@media (max-width: 400px) {

  /* STILL keep 2 columns */
  .alm-listing{
    grid-template-columns: repeat(2, minmax(0,1fr)) !important;
  }

}

/* -------------------------
   5) Legacy card grid
-------------------------- */

.pokemon-card-grid{
  --card: 200px;
  --gap: 50px;

  display: grid!important;
  gap: var(--gap)!important;

  grid-template-columns: repeat(auto-fill, minmax(var(--card), 1fr))!important;
}

.pokemon-card-grid img{
  margin: 0;
}

@media (max-width: 1000px){
  .pokemon-card-grid{
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 800px){
  .pokemon-card-grid{
    grid-template-columns: repeat(3, 1fr);
  }
	
	.sidebar {
		height: 100%!important;
	}
}

@media (max-width: 600px){
  .pokemon-card-grid{
    grid-template-columns: repeat(2, 1fr);
  }
}

/* -------------------------
   Search bar
-------------------------- */

.wp-block-search{
  max-width: 420px;
  display: flex;
  align-items: center;
}

.wp-block-search__input{
  background: #111;
  border: 2px solid #f6c500;
  color: #fff;
  padding: 4px 10px;
  border-radius: 20px 0 0 20px;
  font-size: 14px;
  height: 32px;
  min-height: 32px !important;
}

.wp-block-search__input::placeholder{
  color: #888;
}

.wp-block-search__button{
  background: #f6c500;
  border: 2px solid #f6c500;
  color: #000;
  border-radius: 0 20px 20px 0;
  padding: 0 14px;
  height: 32px;
  transition: all 0.2s ease;
}

.wp-block-search__button:hover{
  background: #ffd733;
  border-color: #ffd733;
}

.wp-block-search__input:focus{
  outline: none;
  box-shadow: 0 0 6px rgba(246,197,0,0.6);
}

/* -------------------------
   Rank badge
-------------------------- */

.pp-card{
  position: relative;
}

.pp-rank-badge{

  position: absolute;
  bottom: 8px;
  left: 8px;

  width: 40px;
  height: 40px;

  border-radius: 999px;

  display: flex;
  align-items: center;
  justify-content: center;

  font-weight: 800;
  font-size: 14px;

  border: 2px solid rgba(255,255,255,0.25);
  box-shadow: 0 3px 10px rgba(0,0,0,0.35);

  z-index: 3;
}

.pp-rank-num{
  line-height: 1;
}

.pp-tier-gold{
  background: radial-gradient(circle at 30% 30%, #ffe27a 0%, #d4a514 65%, #8c6a00 100%);
  color: #2b2100;
}

.pp-tier-silver{
  background: radial-gradient(circle at 30% 30%, #f0f3f7 0%, #b7c0cb 65%, #6d7782 100%);
  color: #1d232a;
}

.pp-tier-bronze{
  background: radial-gradient(circle at 30% 30%, #e8b08a 0%, #b66a3c 65%, #6d3a1f 100%);
  color: #1f0f08;
}

.pp-tier-iron{
  background: radial-gradient(circle at 30% 30%, #7a7f89 0%, #4f5560 65%, #2b3038 100%);
  color: #f2f4f7;
}

.my-featured-image{
  max-width: 100px !important;
  height: auto !important;
  display: inline-block !important;
  vertical-align: middle !important;
  margin-right: 16px !important;
}

/* =========================================
   GRID VIEW ONLY
   ========================================= */

body.pp-view-grid .alm-listing{
  display:grid !important;
  gap:24px !important;
  grid-template-columns:repeat(auto-fill, minmax(200px, 1fr)) !important;
}

body.pp-view-grid .pp-card{
  position:relative !important;
  width:100% !important;
  max-width:200px !important;
  justify-self:center !important;
  text-align:center !important;
}

body.pp-view-grid .pp-card > a{
  display:block !important;
  width:100% !important;
  text-decoration:none !important;
  color:inherit !important;
}

body.pp-view-grid .pp-row-main,
body.pp-view-grid .pp-pokemon-main{
  display:block !important;
  width:100% !important;
  min-width:0 !important;
}

body.pp-view-grid .pp-pokemon-thumb{
  width:100% !important;
  max-width:200px !important;
  height:auto !important;
  display:block !important;
  margin:0 auto !important;
}

body.pp-view-grid .pp-name{
  margin-top:8px !important;
  font-size:14px !important;
  font-weight:600 !important;
  text-align:center !important;
}

/* IMPORTANT: hide preview cards in grid view */
body.pp-view-grid .pp-card-preview,
body.pp-view-grid .pp-card-preview-item{
  display:none !important;
}

/* tablet */
@media (max-width: 900px){
  body.pp-view-grid .alm-listing{
    grid-template-columns:repeat(3, 1fr) !important;
    gap:18px !important;
  }
}

/* mobile */
@media (max-width: 600px){
  body.pp-view-grid .alm-listing{
    grid-template-columns:repeat(2, 1fr) !important;
    gap:12px !important;
  }

  body.pp-view-grid .pp-card{
    max-width:none !important;
    width:100% !important;
  }
}

/* -------------------------
   LIST VIEW
-------------------------- */

body.pp-view-list .alm-listing{
  display:block !important;
}

body.pp-view-list .pp-card{
  display:block !important;
  width:100% !important;
  max-width:none !important;
  padding:0 !important;
  margin:0 0 8px 0 !important;
  background:transparent !important;
  border:none !important;
  border-radius:0 !important;
  box-shadow:none !important;
}

/* the anchor is the real row */
body.pp-view-list .pp-card > a{
  display:flex !important;
  align-items:center !important;
  gap:18px !important;
  width:100% !important;
  padding:10px 8px !important;
  text-decoration:none !important;
  border-bottom:1px solid rgba(255,255,255,0.08);
  box-sizing:border-box !important;
}

/* rank badge FIRST, inline */
body.pp-view-list .pp-rank-badge{
  position:static !important;
  order:1 !important;
  flex:0 0 auto !important;
  margin:0 !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
}

/* pokemon section SECOND */
body.pp-view-list .pp-row-main{
  display:flex !important;
  align-items:center !important;
  gap:18px !important;
  width:100% !important;
  order:2 !important;
  min-width:0 !important;
}

body.pp-view-list .pp-pokemon-main{
  display:flex !important;
  align-items:center !important;
  gap:14px !important;
  flex:0 0 230px !important;
  min-width:230px !important;
}

body.pp-view-list .pp-pokemon-thumb{
  width:60px !important;
  max-width:60px !important;
  height:auto !important;
  display:block !important;
  margin:0 !important;
  flex:0 0 60px !important;
}

body.pp-view-list .pp-name{
  margin:0 !important;
  font-size:16px !important;
  font-weight:700 !important;
  line-height:1.2 !important;
  text-align:left !important;
  color:#ffd84a !important;
}

/* preview cards THIRD */
body.pp-view-list .pp-card-preview{
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(110px, max-content)) !important;
  justify-content: start !important;
  align-content: start !important;
  gap: 10px !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: 100% !important;
}

body.pp-view-list .pp-card-preview-item{
  display: block !important;
  width: auto !important;
}

body.pp-view-list .pp-card-preview-item img{
  display: block !important;
  width: 110px !important;
  max-width: none !important;
  height: auto !important;
  border-radius: 6px !important;
  box-shadow: none !important;
  margin: 0 !important;
}

/* prevent old generic list rules from making things weird */
body.pp-view-list .pp-card br{
  display: none !important;
}

/* -------------------------
   Responsive
-------------------------- */

@media (max-width: 1100px){
  body.pp-view-list .pp-card > a{
    gap: 14px !important;
    padding: 10px 8px !important;
  }

  body.pp-view-list .pp-pokemon-main{
    flex: 0 0 200px !important;
    min-width: 200px !important;
  }

  body.pp-view-list .pp-card-preview{
    grid-template-columns: repeat(auto-fit, minmax(95px, max-content)) !important;
    gap: 8px !important;
  }

  body.pp-view-list .pp-card-preview-item img{
    width: 95px !important;
  }
}

@media (max-width: 800px){
  body.pp-view-list .pp-card > a{
    align-items: flex-start !important;
  }

  body.pp-view-list .pp-row-main{
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }

  body.pp-view-list .pp-pokemon-main{
    min-width: 0 !important;
    flex: 0 0 auto !important;
  }

  body.pp-view-list .pp-card-preview{
    width: 100% !important;
    grid-template-columns: repeat(auto-fit, minmax(90px, max-content)) !important;
    gap: 8px !important;
  }

  body.pp-view-list .pp-card-preview-item img{
    width: 90px !important;
  }
}

@media (max-width: 600px){
  body.pp-view-list .pp-card > a{
    gap: 10px !important;
    padding: 8px 4px !important;
  }

  body.pp-view-list .pp-pokemon-thumb{
    width: 48px !important;
    max-width: 48px !important;
    flex: 0 0 48px !important;
  }

  body.pp-view-list .pp-name{
    font-size: 14px !important;
  }

  body.pp-view-list .pp-card-preview{
    grid-template-columns: repeat(auto-fit, minmax(72px, max-content)) !important;
    gap: 6px !important;
  }

  body.pp-view-list .pp-card-preview-item img{
    width: 72px !important;
  }
}

/* =========================================
   LIST VIEW SIZE BOOST
   ========================================= */

body.pp-view-list .pp-card > a{
  padding: 14px 10px !important;
  gap: 24px !important;
}

body.pp-view-list .pp-pokemon-thumb{
  width: 78px !important;
  max-width: 78px !important;
  flex: 0 0 78px !important;
}

body.pp-view-list .pp-name{
  font-size: 18px !important;
}

/* allow more space for pokemon section */

body.pp-view-list .pp-pokemon-main{
  flex:0 0 260px !important;
  min-width:260px !important;
}

@media (max-width: 720px) {
  .pairrank .pairrank__stage {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  .pairrank .pairrank__card {
    padding: 10px !important;
    max-width: none !important;
    width: 100% !important;
  }

  .pairrank .pairrank__slot {
    min-width: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }

  .pairrank .pairrank__imgwrap {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
  }

  .pairrank img.pairrank__img,
  .pairrank .pairrank__img {
    width: 100% !important;
    max-width: 200px !important;
    height: auto !important;
    display: block !important;
  }

  .pairrank .pairrank__label {
    font-size: 15px !important;
  }

  .pairrank .pairrank__stats {
    font-size: 14px !important;
  }

  .pairrank .pairrank__link {
    font-size: 13px !important;
  }

  .pairrank .pairrank__vs {
    font-size: 14px !important;
    min-width: 18px !important;
    transform: none !important;
  }
}

@media (max-width: 768px) {
  .pp-logo {
    display: none !important;
  }
}

.pp-scroll {
  height: 100% !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  position: relative !important;
}

.pp-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 50 !important;
  background: #23272b !important;
  box-shadow: 0 1px 0 #2a2f34;
}

.pp-scroll > * {
  overflow: visible !important;
}