/* Sidebar layout and controls for listing filters */
.listing-with-sidebar {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

/* sidebar */
.listing-sidebar {
  width: 18rem;
  min-width: 14rem;
  max-width: 22rem;
  background: var(--quarto-bg, #fff);
  border: 1px solid rgba(0,0,0,0.06);
  padding: 0.75rem;
  border-radius: 6px;
  position: sticky;
  top: 1rem;
  height: fit-content;
  max-height: calc(100vh - 2rem); /* prevent sidebar from being too tall */
  overflow-y: auto; /* allow sidebar itself to scroll if needed */
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

/* content area (table + pagination) expands */
.listing-content {
  flex: 1 1 auto;
  min-width: 0;
}

/* header in sidebar */
.listing-sidebar h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.05rem;
  font-weight: 700;
}

/* search */
.fs-search {
  margin-bottom: 0.5rem;
}
.fs-search input[type="search"] {
  width: 100%;
  box-sizing: border-box;
  padding: 0.4rem 0.45rem;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.12);
}

/* selects */
.filter-wrap {
  margin-bottom: 0.5rem;
}
.filter-wrap label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}
.fs-select {
  width: 100%;
  padding: 0.35rem 0.45rem;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.12);
  background: white;
}

/* reset + apply */
.filter-reset-wrap {
  margin-top: 1rem; /* increased top margin */
  text-align: right;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  align-items: center;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(0,0,0,0.06); /* visual separator */
  clear: both; /* prevent float issues */
}
.fs-reset,
.fs-apply {
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  border: 1px solid rgba(0,0,0,0.12);
  background: transparent;
  flex-shrink: 0; /* prevent buttons from shrinking */
}
.fs-apply {
  background: #d9534f; /* red */
  color: #fff;
  border-color: rgba(0,0,0,0.08);
}

/* hide the helper columns (peer_reviewed and registration_required) visually */
.col-peer_reviewed,
.col-registration_required {
  display: none;
}

/* hide Quarto built-in search in listing if present */
.listing .search,
.listing input[type="search"],
.listing .listing-search {
  display: none !important;
}

/* hide filtered rows efficiently via class (fewer style recalcs) */
.filtered-out {
  display: none !important;
}

/* responsive */
@media (max-width: 900px) {
  .listing-with-sidebar {
    flex-direction: column;
  }
  .listing-sidebar {
    position: relative;
    top: auto;
    width: 100%;
  }
}

/* Multi-select filters */
.filter-multi {
  margin-bottom: 0.75rem;
}

.filter-multi-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

.checkbox-container {
  max-height: 6rem; /* reduced height */
  overflow-y: auto;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 4px;
  padding: 0.25rem;
  background: #fafafa;
  margin-bottom: 0.5rem; /* ensure spacing after container */
}

.checkbox-item {
  display: flex;
  align-items: center;
  margin-bottom: 0.2rem;
  padding: 0.1rem 0.2rem;
}

.checkbox-item:hover {
  background: rgba(0,0,0,0.02);
  border-radius: 2px;
}

.filter-checkbox {
  margin-right: 0.4rem;
  margin-top: 0;
}

.checkbox-label {
  font-size: 0.85rem;
  font-weight: normal;
  cursor: pointer;
  flex: 1;
  margin-bottom: 0;
}