/* --- Search bar (unique to this page) --- */
.search-bar {
  position: sticky;
  top: 40px;
  width: 100%;
  background-color: #f6f6f6;
  color: black;
  padding: 10px 0;
  text-align: center;
  font-size: 0.9rem;
  z-index: 1000;
}
body.light-mode .search-bar {
  background-color: #e5e5e5;
  color: #1f1f1f;
}
body:not(.light-mode) .search-bar {
  background-color: #2a2a2a;
  color: #eaeaea;
}

/* Inputs & selects inside search bar */
.search-bar input[type="text"],
.search-bar input[type="number"],
.search-bar select {
  height: 28px;
  background-color: #2c2c2c;
  color: #eaeaea;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 4px 6px;
  margin: 0 4px;
  box-sizing: border-box;
}
body.light-mode .search-bar input[type="text"],
body.light-mode .search-bar input[type="number"],
body.light-mode .search-bar select {
  background-color: #ffffff;
  color: #1f1f1f;
  border: 1px solid #ccc;
}

/* Compact widths */
#minRI, #maxRI, #minLw, #maxLw { width: 40px !important; }
#nFacetValue { width: 50px !important; }
#inTextValue { width: 120px !important; }

/* Search bar links follow theme */
.search-bar a { color: inherit; }
body.light-mode .search-bar a { color: #1f1f1f; }

/* --- Gallery grid --- */
.gem-gallery {
  padding-top: 38px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}
.gif {
  margin: 10px;
  flex-basis: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 50px;
}
.gif img {
  width: 300px;
  height: 300px;
  cursor: pointer;
}
.gif-name {
  max-width: 300px;
  word-wrap: break-word;
  margin: 5px 0;
  text-align: center;
  font-size: 0.8rem;
  height: 2.5em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Links inside gallery (gem titles) */
.gif-name a {
  text-decoration: none;
  color: inherit;
}
body.light-mode .gif-name a {
  color: #1a0dab;   /* Google-style blue, good visibility */
}
/* Dark mode: white links */
body:not(.light-mode) .gif-name a {
  color: #eaeaea;
}

/* Visited links */
body:not(.light-mode) .gif-name a:visited {
  color: #a5c9ff;  /* pleasant light blue */
}
body.light-mode .gif-name a:visited {
  color: #551A8B;  /* classic purple */
}

/* Hover/focus */
.gif-name a:hover,
.gif-name a:focus {
  text-decoration: underline;
}

/* --- Info box (search highlights) --- */
.info-box {
  width: 300px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #ccc;
  background-color: #f9f9f9;
  border-radius: 5px;
  max-height: 100px;
  overflow: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: #000;
}
body:not(.light-mode) .info-box {
  background: #403f48;
  border-color: #343438;
  color: #ccc;
}

/* --- Gem badges --- */
.gem-badges {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 5px;
}
.gem-badge {
  background-color: #ccc;
  border-radius: 8px;
  padding: 2px 5px;
  font-size: 0.75rem;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #000 !important;
}
