/*
 * CSLIB Citations & h-index Styles — v2.1.0
 * Notes:
 * - Adds two-column card layout with avatar initials
 * - Highlights selected institute
 * - Styles pager + clear-filters + sticky toolbar
 */

/* ===== Layout ===== */
#cslib-citations .toolbar {
  position: sticky;
  top: 72px; /* adjust if header height differs */
  z-index: 10;
  background: #fff;
  padding: .5rem 0 .75rem;
  border-bottom: 1px solid var(--border-1, #e5e7eb);
}

#cslib-citations .filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 768px) {
  #cslib-citations .filters {
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
    align-items: center;
  }
}

.cs-facet .countbar {
  margin: 6px 0 10px;
  color: #4b5565;
}

/* ===== Results grid ===== */
#cslib-citations .results {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 1024px) {
  #cslib-citations .results {
    grid-template-columns: 1fr 1fr;
  }
}

/* ===== Card ===== */
#cslib-citations .card.two-col {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border-2, #e5e7eb);
  border-radius: 12px;
  background: #fff;
}
#cslib-citations .card .left {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
}
#cslib-citations .thumb.avatar {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--cslib-amber, #FFBF1C);
  color: var(--cslib-federal, #00044A);
  font-weight: 800;
  display: grid;
  place-items: center;
  user-select: none;
}
#cslib-citations .content .row1.title .name-link {
  font-size: 18px;
  font-weight: 700;
  color: var(--cslib-navy, #000080);
  text-decoration: none;
}
#cslib-citations .content .row1.title .name-link:hover {
  text-decoration: underline;
}
#cslib-citations .kv {
  color: #334155;
  margin-top: 2px;
}
#cslib-citations .kv.inline span + span { margin-left: 12px; }

#cslib-citations .right {
  min-width: 140px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
#cslib-citations .cta {
  display: inline-block;
  padding: .5rem .8rem;
  border: 1px solid var(--border-2, #e5e7eb);
  border-radius: 10px;
  background: #fff;
  text-decoration: none;
  font-weight: 700;
  color: var(--cslib-navy, #000080);
  min-width: 132px;
  text-align: center;
  cursor: pointer;
}
#cslib-citations .cta:hover {
  background: var(--cslib-navy, #000080);
  color: #fff;
  border-color: var(--cslib-navy, #000080);
}

/* ===== Institute facet ===== */
#cslib-citations .inst-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#cslib-citations .inst-list button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: .35rem .6rem;
  border: 1px solid var(--border-2, #e5e7eb);
  border-radius: 999px;
  background: #fff;
  color: #111827;
  cursor: pointer;
}
#cslib-citations .inst-list button .pill {
  display: inline-block;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  padding: 0 6px;
  font-size: 12px;
  display: grid;
  place-items: center;
  background: #f3f4f6;
}
#cslib-citations .inst-list button.is-active {
  border-color: var(--cslib-federal, #00044A);
  background: var(--cslib-federal, #00044A);
  color: #FFD60A;
}
#cslib-citations .inst-list button.is-active .pill {
  background: rgba(255,255,255,.15);
  color: #fff;
}

/* ===== Pager & utility ===== */
#cslib-citations .pager {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 10px;
}
#cslib-citations .pager .page-btn {
  border: 1px solid var(--border-2, #e5e7eb);
  background: #fff;
  padding: .35rem .6rem;
  border-radius: 8px;
  cursor: pointer;
}
#cslib-citations .pager .page-btn.active {
  background: var(--cslib-navy, #000080);
  border-color: var(--cslib-navy, #000080);
  color: #fff;
}
#cslib-citations .clear-filters {
  margin-left: 6px;
  font-size: 12px;
  text-decoration: underline;
  color: #6b7280;
  background: transparent;
  border: 0;
  cursor: pointer;
}

/* ===== Skeleton / empty / error ===== */
#cslib-citations .skeleton {
  display: grid; gap: 12px;
}
#cslib-citations .skeleton .shimmer {
  height: 84px;
  border-radius: 12px;
  background: linear-gradient(90deg,#f3f4f6 25%,#e5e7eb 37%,#f3f4f6 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

#cslib-citations .facet-list button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: .25rem .6rem;
  //border: 1px solid #ccc;   /* minimal thin border */
  border: 1px solid rgba(0,0,0,.05);  /* <-- transparency here */
  border-radius: 5px;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
}
#cslib-citations .facet-list button .pill {
  background: #f3f4f6;
  border-radius: 5px;
  padding: 0 6px;
  font-size: 12px;
}
#cslib-citations .facet-list button.is-active {
  border-color: var(--cslib-federal, #00044A);
  background: var(--cslib-federal, #00044A);
  color: #FFD60A;
}
#cslib-citations .facet-list .inst-more {
  border: none;
  background: transparent;
  color: var(--cslib-navy);
  font-weight: 600;
  text-decoration: underline;
}
/* Disable scrollbars on institute list */
#cslib-citations .facet-list {
  max-height: none !important;
  overflow: visible !important;
  flex-wrap: wrap;
  display: flex;
  gap: 6px;
}
#cslib-citations .facet-list .inst-more {
  border: none;
  background: transparent;
  color: var(--cslib-navy, #000080);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

/* Make left facet panel fixed height, independent of content */
#cslib-citations {
  display: flex;
  gap: 16px;
}

/* Left section */
#cslib-citations .facet-panel {
  flex: 0 0 280px;         /* fixed width (adjust as needed) */
  max-height: 100%;        /* don’t resize based on children */
  overflow-y: auto;        /* scroll inside if contents exceed height */
  border-right: 1px solid var(--border-2, #e5e7eb);
  padding-right: 12px;
}

/* Right section */
#cslib-citations .facet-main {
  flex: 1;
  min-width: 0;
}

#cslib-citations {
  display: flex;
  align-items: flex-start;   /* overrides stretch */
  gap: 16px;
}

#cslib-citations .facet-panel {
  flex: 0 0 280px;
  align-self: flex-start;    /* makes it independent */
}

#cslib-citations .facet-main {
  flex: 1;
  min-width: 0;
}

