/* BidX home-page category grid and category browser thumbnails.
   Every tile has the same shape: a tinted square thumbnail, the category name
   (wrapping onto as many lines as it needs) and the number of ads. */

#categories .cats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 12px 10px;
  margin-top: 16px;
}

#categories .cats .cat {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
  min-height: 0;
  padding: 10px 4px 8px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  box-shadow: none;
  color: #101828;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  overflow: visible;
  transform: none;
  -webkit-tap-highlight-color: transparent;
}

#categories .cats .cat::after { content: none; }

#categories .cats .cat:hover,
#categories .cats .cat.active {
  transform: none;
  border-color: #cbe7d4;
  background: #f6fbf7;
  box-shadow: none;
}

#categories .cats .cat:focus-visible {
  outline: 3px solid #15803D;
  outline-offset: 2px;
}

/* Thumbnail: the local category photo sits over the category emoji, which only
   shows when the photo cannot load. */
#categories .cat i {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  margin: 0;
  border-radius: 18px;
  background: #ecf7f0;
  box-shadow: inset 0 0 0 1px rgba(21,128,61, .08);
  color: #15803D;
  font-size: 30px;
  font-style: normal;
  line-height: 1;
  text-indent: 0;
  overflow: hidden;
}

#categories .cat-icon-photo {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  padding: 8px;
  box-sizing: border-box;
  border-radius: 0;
  background: #ecf7f0;
  object-fit: contain;
}

#categories .cat-name {
  display: block;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
  white-space: normal;
}

#categories .cats .cat small {
  display: block;
  margin: 0;
  color: #667085;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

#categories .cats .cat-view-all { border-style: solid; }
#categories .cats .cat-view-all i { background: #15803D; color: #fff; box-shadow: none; }
#categories .cats .cat-view-all .cat-name { color: #15803D; }

@media (max-width: 600px) {
  #categories .cats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px 4px;
  }
  #categories .cats .cat { padding: 6px 2px; font-size: 11px; }
  #categories .cat i { width: 56px; height: 56px; border-radius: 16px; font-size: 26px; }
  #categories .cat-icon-photo { padding: 7px; }
}

@media (max-width: 360px) {
  #categories .cat i { width: 50px; height: 50px; border-radius: 14px; font-size: 24px; }
  #categories .cats .cat { font-size: 10.5px; }
}

/* Category browser rows use the same thumbnail as the home grid. */
.shopcat-thumb { position: relative; overflow: hidden; }
.shopcat-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 4px;
  box-sizing: border-box;
  background: #eef8f1;
  object-fit: contain;
}
.shopcat-main strong { overflow-wrap: break-word; }
