html, body, #sigma-container { margin: 0; padding: 0; width: 100%; height: 100%; }
#sigma-container { background: #f2f2f2; }

/* Top-right site title */
.site-title {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 6px 10px;
  background: #f4f4f4;
  border: 1px solid #e6e6e6;
  box-shadow: 0 4px 18px rgba(0,0,0,0.12);
  border-radius: 8px;
  font-family: Arial;
  font-size: 24px;
  color: #222;
  z-index: 2001;
  pointer-events: none; /* Avoid interfering with canvas interactions */
}

/* Search bar below title */
.searchbar {
  position: fixed;
  top: 56px;
  right: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  background: #f4f4f4;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.12);
  padding: 6px 8px;
  z-index: 3000;
}
.search-input {
  appearance: none;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  font-family: Arial;
  font-size: 14px;
  min-width: 220px;
}

/* When searchbar is inside the legend panel, make it flow with the panel */
.legend-panel .searchbar {
  position: static;
  top: auto;
  right: auto;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  margin-bottom: 8px;
}
.legend-panel .search-input {
  min-width: 0;
  width: 100%;
  flex: 1 1 auto;
}

/* Legend panel */
.legend-panel {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 280px;
  max-height: calc(100% - 24px);
  overflow: auto;
  background: #f4f4f4;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.12);
  padding: 10px 12px;
  z-index: 2000;
}
.legend-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.legend-title { font-weight: 700; font-family: Arial; font-size: 15px; }
.legend-toggle { appearance: none; border: 1px solid #ddd; background: #fafafa; cursor: pointer; width: 28px; height: 28px; border-radius: 6px; font-size: 16px; line-height: 1; display: grid; place-items: center; }
.legend-toggle:hover { background: #f0f0f0; }
.legend-list { display: flex; flex-direction: column; gap: 8px; }
/* Actions row for facets */
.facet-actions { display: flex; gap: 6px; margin-bottom: 2px; }
.btn.small { padding: 6px 10px; font-size: 13px; }
/* Use grid so bars always start at the same x-position regardless of label length */
.legend-item {
  display: grid;
  grid-template-columns: 16px 140px 1fr; /* dot | fixed-width label | bar */
  align-items: center;
  column-gap: 8px;
  cursor: pointer;
}
.legend-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 12px; }
.legend-label { font-size: 14px; font-family: Arial; color: #222; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend-bar { height: 6px; background: #e5e5e5; border-radius: 4px; overflow: hidden;}
.legend-bar-fill { height: 100%; width: 0%; background: #888; border-radius: 4px; }

/* Collapsed state */
.legend-panel.collapsed .legend-list { display: none; }
.legend-panel.collapsed .legend-toggle { transform: rotate(-90deg); }

.legend-item.disabled .legend-label { color: #999; }
.legend-item.disabled .legend-bar-fill { background: #ddd !important; }

.legend-item:hover .legend-label { color: #999; }
.legend-item:hover .legend-bar { filter: brightness(0.85); }

/* Details row inside legend panel */
.details-item {
  display: grid;
  grid-template-columns: 16px 1fr; /* dot | content */
  align-items: start;
  column-gap: 8px;
  cursor: default;
}
.details-item .legend-label {
  white-space: normal;
  overflow: visible;
}
.details-item .legend-bar {
  background: transparent;
  height: auto;
  overflow: visible;
  display: flex;
  align-items: center;
  gap: 8px;
  grid-column: 2;
  margin-top: 8px;
}
.details-item .legend-label img,
.details-item .legend-label .details-image {
  display: block;
  width: 100%;
  height: 120px;           /* fixed display height for all thumbnails */
  object-fit: contain;     /* keep aspect ratio without cropping; use 'cover' to crop */
  border: 1px solid #eee;
  border-radius: 6px;
  background: #f4f4f4;
  margin-bottom: 6px;
}
.btn.small { padding: 6px 10px; font-size: 13px; }

/* Utility */
.text-muted { color: #666; }
.btn { color: #333; }

.btn { padding: 8px 12px; border-radius: 8px; border: 1px solid #ddd; background: #fafafa; cursor: pointer; text-decoration: none; font-family: Arial; font-size: 14px; transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease; }
.btn:link, .btn:visited { text-decoration: none; }
.btn:hover { background: #f0f0f0; border-color: #cfcfcf; }
.btn.primary { background: #2d6cdf; border-color: #2d6cdf; color: white; font-family: Arial; font-size: 14px; }
.btn.primary:hover { background: #1f5ed3; border-color: #1f5ed3; box-shadow: 0 2px 6px rgba(45, 108, 223, 0.3); }
.btn:disabled { opacity: 0.6; cursor: default; }

/* Controls panel (bottom-left) */
.controls-panel {
  position: absolute;
  right: 12px;
  bottom: 12px;
  background: #f4f4f4;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.12);
  padding: 8px;
  display: flex;
  gap: 8px;
  z-index: 2000;
}
.control-btn { min-width: 36px; height: 36px; display: grid; place-items: center; font-size: 18px; }
/* Use an image for the fullscreen button */
#fullscreen-toggle {
  background-image: url('images/fsc.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px 18px;
  font-size: 0; /* hide any fallback text */
}

/* Clickable tags in details */
.details-tag {
  text-decoration: underline;
  cursor: pointer;
  margin-right: 6px;
}
