/* Left Sidebar - Dataset Controls */
#dataset-legend,
#unified-legend {
  position: absolute;
  top: 40px;
  left: 20px;
  bottom: 20px;
  background: transparent;
  padding: 16px;
  border-radius: 12px;
  font-size: 11px;
  max-height: calc(100vh - 60px);
  width: 160px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Scrollable Content Area */
#scrollableContent {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  margin-bottom: 12px;
  min-height: 0;
}

/* Fixed Controls at Bottom */
#fixedControls {
  flex-shrink: 0;
  padding: 0;
  margin: 0;
}

/* Mode Switcher Styles */
.mode-switcher-container {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.mode-btn {
  flex: 1;
  padding: 6px 8px;
  background: #121418;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 200;
  cursor: pointer;
  transition: all 0.2s ease;
  pointer-events: auto;
}

.mode-btn:hover {
  background: #1B1F25;
  border-color: rgba(255, 255, 255, 1);
}

.mode-btn.active {
  background: #4ED9D9;
  color: #0F1115;
  border-color: #4ED9D9;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(78, 217, 217, 0.3);
}

/* Load Dataset Button Styles */
.load-dataset-btn {
  width: 100%;
  padding: 8px;
  margin-top: 8px;
  background: transparent;
  color: #4ED9D9;
  border: 1px solid #4ED9D9;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  font-size: 12px;
  transition: all 0.3s ease;
  box-shadow: none;
}

.load-dataset-btn:hover:not(:disabled) {
  background: rgba(78, 217, 217, 0.1);
  border-color: #6ee5e5;
  color: #6ee5e5;
  box-shadow: 0 0 12px rgba(78, 217, 217, 0.3);
  transform: translateY(-1px);
}

.load-dataset-btn:active:not(:disabled) {
  transform: translateY(0);
}

.load-dataset-btn.loading {
  background: transparent;
  color: rgba(78, 217, 217, 0.5);
  border-color: rgba(78, 217, 217, 0.5);
  cursor: wait;
  animation: pulse 1.5s ease-in-out infinite;
}

.load-dataset-btn.success {
  background: transparent;
  color: #22c55e;
  border-color: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.load-dataset-btn.error {
  background: transparent;
  color: #ef4444;
  border-color: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.load-dataset-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

#datasetColorsLegend,
#unifiedColorsLegend {
  position: absolute;
  left: 200px;
  bottom: 30px;
  background: transparent;
  padding: 12px;
  border-radius: 8px;
  font-size: 10px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  width: 140px;
  pointer-events: none;
  display: none;
  flex-direction: column;
  justify-content: flex-end;
}

/* Right Sidebar - Prediction Controls */
#prediction-legend {
  position: absolute;
  top: 40px;
  right: 20px;
  bottom: 20px;
  background: transparent;
  padding: 16px;
  border-radius: 12px;
  font-size: 11px;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  width: 160px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

#predColorsLegend {
  position: absolute;
  right: 200px;
  bottom: 20px;
  background: transparent;
  padding: 12px;
  border-radius: 8px;
  font-size: 10px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  width: 140px;
  pointer-events: none;
  display: none;
  flex-direction: column;
  justify-content: flex-end;
}

/* Legacy support for old sidebar (keep for backward compatibility) */
#legend {
  position: absolute;
  top: 40px;
  left: 20px;
  bottom: 20px;
  background: transparent;
  padding: 16px;
  border-radius: 12px;
  font-size: 11px;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  width: 160px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

#colorsLegend {
  position: absolute;
  left: 200px;
  bottom: 20px;
  background: transparent;
  padding: 12px;
  border-radius: 8px;
  font-size: 10px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  width: 140px;
  pointer-events: none;
  display: none;
  flex-direction: column;
  justify-content: flex-end;
}

#colorsLegend *,
#datasetColorsLegend *,
#unifiedColorsLegend *,
#predColorsLegend * {
  pointer-events: auto;
}

#colorsLegend h4,
#datasetColorsLegend h4,
#unifiedColorsLegend h4,
#predColorsLegend h4 {
  margin: 0 0 8px 0;
  font-size: 11px;
  font-weight: 200;
  color: #4ED9D9;
  letter-spacing: 2px;
  text-shadow: 0 0 4px rgba(78, 217, 217, 0.15);
}

.colors-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.color-item {
  display: flex;
  align-items: center;
  padding: 2px 4px;
  border-radius: 3px;
  transition: all 0.2s;
  line-height: 1.2;
}

.color-item:hover {
  background: #1B1F25;
}

.color-item span {
  color: #FFFFFF;
  font-size: 9px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.color-item .color-box {
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 2px;
  border: 1px solid rgba(78, 217, 217, 0.3);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

/* Custom scrollbar for colors legend */
#colorsLegend::-webkit-scrollbar,
#datasetColorsLegend::-webkit-scrollbar,
#unifiedColorsLegend::-webkit-scrollbar,
#predColorsLegend::-webkit-scrollbar {
  width: 4px;
}

#colorsLegend::-webkit-scrollbar-track,
#datasetColorsLegend::-webkit-scrollbar-track,
#unifiedColorsLegend::-webkit-scrollbar-track,
#predColorsLegend::-webkit-scrollbar-track {
  background: #1B1F25;
  border-radius: 2px;
}

#colorsLegend::-webkit-scrollbar-thumb,
#datasetColorsLegend::-webkit-scrollbar-thumb,
#unifiedColorsLegend::-webkit-scrollbar-thumb,
#predColorsLegend::-webkit-scrollbar-thumb {
  background: rgba(78, 217, 217, 0.4);
  border-radius: 2px;
}

#colorsLegend::-webkit-scrollbar-thumb:hover,
#datasetColorsLegend::-webkit-scrollbar-thumb:hover,
#unifiedColorsLegend::-webkit-scrollbar-thumb:hover,
#predColorsLegend::-webkit-scrollbar-thumb:hover {
  background: rgba(78, 217, 217, 0.6);
}

/* Custom scrollbar for scrollable content */
#scrollableContent::-webkit-scrollbar {
  width: 6px;
}

#scrollableContent::-webkit-scrollbar-track {
  background: #1B1F25;
  border-radius: 3px;
}

#scrollableContent::-webkit-scrollbar-thumb {
  background: rgba(78, 217, 217, 0.4);
  border-radius: 3px;
}

#scrollableContent::-webkit-scrollbar-thumb:hover {
  background: rgba(78, 217, 217, 0.6);
}

#legend *,
#dataset-legend *,
#unified-legend *,
#prediction-legend * {
  pointer-events: auto;
}

/* Custom scrollbar */
#legend::-webkit-scrollbar,
#dataset-legend::-webkit-scrollbar,
#prediction-legend::-webkit-scrollbar {
  width: 8px;
}

#legend::-webkit-scrollbar-track,
#dataset-legend::-webkit-scrollbar-track,
#prediction-legend::-webkit-scrollbar-track {
  background: #1B1F25;
  border-radius: 4px;
}

#legend::-webkit-scrollbar-thumb,
#dataset-legend::-webkit-scrollbar-thumb,
#prediction-legend::-webkit-scrollbar-thumb {
  background: rgba(78, 217, 217, 0.5);
  border-radius: 4px;
}

#legend::-webkit-scrollbar-thumb:hover,
#dataset-legend::-webkit-scrollbar-thumb:hover,
#prediction-legend::-webkit-scrollbar-thumb:hover {
  background: rgba(78, 217, 217, 0.7);
}

.control-buttons {
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  flex-shrink: 0;
}

.style-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.switcher-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.style-switcher {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s;
  background: #121418;
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.style-switcher:hover {
  background: #1B1F25;
  border-color: rgba(255, 255, 255, 1);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.switcher-prev,
.switcher-next {
  background: transparent;
  border: none;
  color: #4ED9D9;
  font-size: 16px;
  cursor: pointer;
  padding: 0 8px;
  transition: opacity 0.2s ease;
}

.switcher-value {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: #FFFFFF;
  font-weight: 200;
  text-shadow: 0 0 2px rgba(78, 217, 217, 0.2);
}

/* Filter Content Section - Tighter spacing */
.filter-content-section {
  margin-top: 0 !important;
  margin-bottom: 12px;
}

.toggle-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.style-option {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  background: #121418;
  font-size: 10px;
  color: #FFFFFF;
}

.style-option:hover {
  background: #1B1F25;
}

.style-option input[type="radio"] {
  margin-right: 8px;
  accent-color: #4ED9D9;
  cursor: pointer;
}

.style-option span {
  flex: 1;
}

.toggle-option {
  flex: 1;
  margin-bottom: 0;
}

.toggle-option label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  background: #121418;
  font-size: 10px;
  color: #FFFFFF;
  height: 100%;
}

.toggle-option label:hover {
  background: #1B1F25;
}

.toggle-option input[type="checkbox"] {
  margin-right: 6px;
  accent-color: #4ED9D9;
  cursor: pointer;
  width: 14px;
  height: 14px;
}

.toggle-option span {
  flex: 1;
  text-align: left;
  color: #FFFFFF;
}

.legend-item { 
  display: flex; 
  align-items: center; 
  margin-bottom: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  transition: all 0.2s;
}

.legend-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.color-box { 
  width: 16px; 
  height: 16px; 
  margin-right: 10px; 
  border-radius: 3px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.filter-section {
  margin-bottom: 12px;
  flex-shrink: 0;
}

.filter-section h4 {
  margin: 0 0 6px 0;
  font-size: 11px;
  font-weight: 200;
  color: #4ED9D9;
  letter-spacing: 2px;
  text-shadow: 0 0 4px rgba(78, 217, 217, 0.15);
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 120px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 8px;
  background: #121418;
  backdrop-filter: blur(10px);
}

/* Custom scrollbar for checkbox groups */
.checkbox-group::-webkit-scrollbar {
  width: 4px;
}

.checkbox-group::-webkit-scrollbar-track {
  background: #1B1F25;
  border-radius: 2px;
}

.checkbox-group::-webkit-scrollbar-thumb {
  background: rgba(78, 217, 217, 0.4);
  border-radius: 2px;
}

.checkbox-group::-webkit-scrollbar-thumb:hover {
  background: rgba(78, 217, 217, 0.6);
}

/* Custom scrollbar for legend content */
#legendContent::-webkit-scrollbar {
  width: 4px;
}

#legendContent::-webkit-scrollbar-track {
  background: #1B1F25;
  border-radius: 2px;
}

#legendContent::-webkit-scrollbar-thumb {
  background: rgba(78, 217, 217, 0.4);
  border-radius: 2px;
}

#legendContent::-webkit-scrollbar-thumb:hover {
  background: rgba(78, 217, 217, 0.6);
}

.checkbox-item {
  display: flex;
  align-items: center;
  font-size: 10px;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.2s;
  color: #FFFFFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.checkbox-item:hover {
  background: #1B1F25;
}

.checkbox-item input {
  margin-right: 6px;
  cursor: pointer;
  width: 14px;
  height: 14px;
  accent-color: #4ED9D9;
  flex-shrink: 0;
}

#speciesSearch,
#familySearch,
#datasetFamilySearch,
#datasetSpeciesSearch {
  width: 100%;
  padding: 6px 8px;
  font-size: 10px;
  margin-bottom: 6px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  background: #121418;
  backdrop-filter: blur(10px);
  color: #FFFFFF;
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
  font-weight: 200;
}

#speciesSearch::placeholder,
#familySearch::placeholder,
#datasetFamilySearch::placeholder,
#datasetSpeciesSearch::placeholder {
  color: #FFFFFF;
  opacity: 0.5;
}

#speciesSearch:focus,
#familySearch:focus,
#datasetFamilySearch:focus,
#datasetSpeciesSearch:focus {
  border-color: #FFFFFF;
  background: #1B1F25;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

#legendContent {
  margin-top: 12px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

#legendContent h4 {
  margin: 0 0 8px 0;
  font-size: 11px;
  font-weight: 200;
  color: #4ED9D9;
  letter-spacing: 2px;
  text-shadow: 0 0 4px rgba(78, 217, 217, 0.15);
}

#legendContent .legend-item {
  margin-bottom: 6px;
  padding: 4px 6px;
}

#legendContent .legend-item span {
  color: #FFFFFF;
  font-size: 10px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.legend-item { 
  display: flex; 
  align-items: center; 
  margin-bottom: 6px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: all 0.2s;
}

.legend-item:hover {
  background: #1B1F25;
}

.color-box { 
  width: 12px; 
  height: 12px; 
  margin-right: 8px; 
  border-radius: 2px;
  border: 2px solid rgba(78, 217, 217, 0.3);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}
