.floating-controls {
  position: fixed;
  z-index: var(--z-go-to-top);
  right: calc(20px + env(safe-area-inset-right));
  bottom: calc(156px + env(safe-area-inset-bottom));

  /* 1. 核心修改：改为水平flex布局，并垂直居中 */
  display: flex;
  flex-direction: row;
  /* 水平排列：按钮在左，面板在右 */
  align-items: center;
  /* 垂直居中对齐 */
  gap: 8px;
  /* 在按钮和面板之间创建8px的间距 */
}

/* 响应式可见性：在小屏幕上靠近底部与边缘，保持可见 */
@media (max-width: 480px) {
  .floating-controls {
    right: calc(20px + env(safe-area-inset-right));
    bottom: calc(20px + env(safe-area-inset-bottom));
  }
  .floating-controls.open .controls-panel {
    width: 92vw; /* 让面板在窄屏上不溢出 */
  }
}
@media (max-height: 600px) {
  .floating-controls {
    bottom: 20px;
  }
}

/* 当通过JS拖动定位后，取消右/下定位 */
.floating-controls[style*="left"] {
  right: auto;
  bottom: auto;
  transform: none;
}

/* 3. 控制面板样式 - 新增：平滑的宽度和透明度过渡动画 */
.floating-controls .controls-panel {
  /* 基础样式 */
  background: #ffffff;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-right: 8px;

  /* 动画相关的初始状态 (折叠时) */
  width: 0;
  opacity: 0;
  visibility: hidden;
  padding: 0;
  /* 折叠时无内边距 */
  overflow: hidden;
  /* 隐藏内部内容 */
  white-space: nowrap;
  /* 防止内容在动画过程中换行 */
  transition: width 0.3s ease, opacity 0.2s ease, padding 0.3s ease,
    visibility 0s 0.3s;
}

/* 4. 当父容器有 .open 类时，面板的展开状态 */
.floating-controls.open .controls-panel {
  width: 320px;
  /* 恢复原始宽度 */
  opacity: 1;
  visibility: visible;
  padding: 10px;
  /* 恢复内边距 */
  transition: width 0.3s ease, opacity 0.3s 0.1s ease, padding 0.3s ease,
    visibility 0s;
}

.floating-controls .controls-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.floating-controls .controls-row:last-child {
  margin-bottom: 0;
}

.floating-controls .controls-label {
  font-size: 12px;
  color: #374151;
}

.floating-controls .chart-control-group {
  width: 100%;
}

.floating-controls .chart-control-group .dropdown-toggle {
  min-width: 0;
  width: 100%;
}

/* style_benchmarks.css (在文件末尾添加) */

.floating-controls .controls-panel.is-showing-dropdown {
  overflow: visible;
  /* 关键：临时允许内容溢出面板边界 */
}

html.dark .floating-controls .controls-panel {
  background: #1f2937;
  color: #e5e7eb;
  border: 1px solid #374151;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* style_benchmarks.css (替换旧的按钮样式部分) */

/* 
 * 按钮样式 - 新的青色 (Teal) 主题
 * 核心修复：使用 ID选择器 (#floating-controls-toggle) 来确保
 * 拥有足够的优先级，以覆盖来自 style_shared.css 的通用按钮样式。
*/
#floating-controls-toggle.toggle-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  /* 使用青色系 */
  background-color: rgba(20, 184, 166, 0.4);
  /* Teal color (#14b8a6) with 40% opacity */

  color: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  touch-action: none;
  flex-shrink: 0;
  position: relative;
}

#floating-controls-toggle.toggle-btn:hover {
  background-color: rgba(20, 184, 166, 0.85);
  /* Teal color with 85% opacity */
  transform: scale(1.08);
}

/* 暗色模式样式 - 新的亮青色主题 */
html.dark #floating-controls-toggle.toggle-btn {
  background-color: rgba(45, 212, 191, 0.5);
  /* Lighter Teal color (#2dd4bf) with 50% opacity */
  color: #e5e7eb;
}

html.dark #floating-controls-toggle.toggle-btn:hover {
  background-color: rgba(45, 212, 191, 0.85);
  /* Lighter Teal with 85% opacity */
}

/* ===== SCATTER PLOT LEGENDS ===== */

/* Scatter chart layout */
.scatter-chart-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 1024px) {
  .scatter-chart-layout {
    flex-direction: row;
  }
}
/* FIX: Constrain Comprehensive Chart height on mobile to prevent infinite growth */
@media (max-width: 767px) {
  #comprehensive-chart-wrapper .chart-container {
    height: 350px !important;
    min-height: 300px !important;
    max-height: 400px !important;
  }
}
/* Legend panel */
.scatter-legend-panel {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  max-width: 160px;
  width: 100%;
  overflow-y: auto;
}

@media (min-width: 1024px) {
  .scatter-legend-panel {
    width: 10rem;
    /* 160px */
    min-width: 120px;
    max-width: 160px;
  }
}

html.dark .scatter-legend-panel {
  background: #1f2937;
  border-color: #374151;
}

/* Chart panel */
.scatter-chart-panel {
  flex: 1;
  min-width: 0;
}

/* Scatter plot legend container */
.scatter-legend-container {
  font-size: 12px;
}

/* Dark mode support for scatter legend */
html.dark #scatter-shape-legend {
  background: rgba(31, 41, 55, 0.95);
  border-color: rgba(255, 255, 255, 0.1);
  color: #f3f4f6;
}

/* Legend wrapper */
.scatter-legends-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Legend sections */
.model-legend-section,
.shape-legend-section {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding-bottom: 12px;
}

.model-legend-section:last-child,
.shape-legend-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

html.dark .model-legend-section,
html.dark .shape-legend-section {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* Legend titles */
.legend-title {
  font-weight: 600;
  margin-bottom: 8px;
  color: #374151;
  font-size: 13px;
}

html.dark .legend-title {
  color: #f3f4f6;
}

/* Legend lists */
.legend-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.legend-group-toggle {
  border: 1px solid transparent;
}

.legend-group-toggle:focus-visible {
  outline: none;
  border-color: #6366f1;
}

.legend-group-list-scroll {
  max-height: 220px;
  overflow-y: auto;
}

.legend-group-list-scroll::-webkit-scrollbar {
  width: 6px;
}

.legend-group-list-scroll::-webkit-scrollbar-thumb {
  background-color: rgba(107, 114, 128, 0.45);
  border-radius: 9999px;
}

html.dark .legend-group-list-scroll::-webkit-scrollbar-thumb {
  background-color: rgba(156, 163, 175, 0.4);
}

/* Legend items */
.legend-item {
  display: flex;
  align-items: center;
  padding: 2px 0;
  font-size: 11px;
  color: #6b7280;
}

html.dark .legend-item {
  color: #d1d5db;
}

/* Color boxes for model legend */
.legend-color-box {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  margin-right: 8px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

html.dark .legend-color-box {
  border-color: rgba(255, 255, 255, 0.2);
}

/* Shape canvases for featurization legend */
.legend-shape {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  flex-shrink: 0;
}

/* Legend text */
.legend-text {
  font-size: 11px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html.dark .legend-text {
  color: #d1d5db;
}

/* Hidden legend items */
.legend-item-hidden {
  opacity: 0.4;
  text-decoration: line-through;
}

.legend-item-hidden .legend-color-box,
.legend-item-hidden .legend-shape {
  opacity: 0.4;
}

/* Legend item hover effects */
.legend-item:hover {
  background-color: #f3f4f6;
  border-radius: 4px;
}

html.dark .legend-item:hover {
  background-color: #374151;
}

/* ===== FILTER COMPONENTS ===== */

/* ===== UNIFIED MOBILE STYLES FOR 1023px AND BELOW ===== */

/* Mobile sticky controls for filters/search/sort */
#mobile-sticky-controls-benchmarks {
  display: none;
  /* Hidden by default, shown by JS/media query */
  position: sticky;
  top: 64px;
  /* Adjust for fixed navbar height - tight fit */
  background-color: white;
  z-index: 10;
  /* Lower than navigation bar (z-index: 1000) */
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Unified mobile styles for 1023px and below */
@media (max-width: 1023.98px) {
  /* 强力隐藏所有筛选板 */
  body.benchmarks-page aside.desktop-filter-panel,
  body.benchmarks-page .desktop-filter-panel,
  .benchmarks-page aside.desktop-filter-panel,
  .benchmarks-page .desktop-filter-panel {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    position: absolute !important;
    left: -9999px !important;
    z-index: -9999 !important;
  }

  /* 主内容区宽度最大化，适配所有嵌套 */
  body.benchmarks-page .grid.grid-cols-1.md\:grid-cols-4 > main.md\:col-span-3,
  .benchmarks-page .grid.grid-cols-1.md\:grid-cols-4 > main.md\:col-span-3,
  .grid.grid-cols-1.md\:grid-cols-4 > main.md\:col-span-3 {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  body.benchmarks-page .grid.grid-cols-1.md\:grid-cols-4,
  .benchmarks-page .grid.grid-cols-1.md\:grid-cols-4,
  .grid.grid-cols-1.md\:grid-cols-4 {
    display: block !important;
    grid-template-columns: 1fr !important;
  }

  /* 3. Show mobile sticky controls - Enhanced with multiple selectors */
  #mobile-sticky-controls-benchmarks,
  body #mobile-sticky-controls-benchmarks,
  .benchmarks-page #mobile-sticky-controls-benchmarks {
    display: block !important;
    /* Ensure it's visible on mobile with high priority */
    visibility: visible !important;
    opacity: 1 !important;
  }

  /* Override any inline styles */
  #mobile-sticky-controls-benchmarks[style*="display: none"],
  body #mobile-sticky-controls-benchmarks[style*="display: none"],
  .benchmarks-page #mobile-sticky-controls-benchmarks[style*="display: none"] {
    display: block !important;
  }

  /* Adjust chart control groups within mobile sticky header */
  #mobile-sticky-controls-benchmarks .chart-control-group {
    width: auto;
    /* Override w-full or sm:w-auto if present */
    flex-basis: auto;
    /* Allow flex-grow to work */
  }

  /* 4. Hide desktop analysis dashboard controls */
  .desktop-analysis-dashboard-controls {
    display: none !important;
  }

  /* 5. Disable sticky positioning for analysis dashboard header */
  .analysis-dashboard-header {
    position: static;
    /* Disable sticky positioning on smaller screens */
  }

  /* 6. Adjust dashboard controls layout */
  #dashboard-controls {
    justify-content: flex-start;
    width: 100%;
  }

  /* 7. Hide scatter legend panel */
  .scatter-legend-panel {
    display: none !important;
  }

  /* 8. Mobile sidebar optimizations */
  .mobile-sidebar .filter-content .filter-group .block.text-sm {
    font-size: 0.75rem;
    /* Even smaller font for labels */
    margin-bottom: 0.125rem;
    /* Even tighter margin */
  }

  .mobile-sidebar .filter-content .multi-select-trigger {
    padding: 0.375rem 0.625rem;
    /* Even smaller padding */
    font-size: 0.75rem;
    /* Even smaller font */
  }

  .mobile-sidebar .multi-select-dropdown label {
    padding: 0.375rem 0.625rem;
    /* Even smaller padding for options */
    font-size: 0.75rem;
    /* Even smaller font for options */
  }

  .mobile-sidebar .multi-select-dropdown input[type="checkbox"] {
    height: 0.75rem;
    /* Smaller checkbox */
    width: 0.75rem;
    /* Smaller checkbox */
    margin-right: 0.375rem;
    /* Tighter margin */
  }

  .mobile-sidebar .multi-select-dropdown .text-sm,
  .mobile-sidebar .multi-select-dropdown span:not(.selected-text) {
    font-size: 0.75rem !important;
    /* Ensure text within options is small */
  }
}

@media (min-width: 1024px) {
  #mobile-sticky-controls-benchmarks,
  #mobile-filter-drawer-benchmarks,
  #filter-drawer-overlay-benchmarks {
    display: none !important;
  }
}

/* Mobile Filter Drawer Styles */
.filter-drawer-overlay {
  transition: opacity 0.3s ease-in-out;
}

.mobile-filter-drawer {
  max-height: 80vh;
  /* Limit height to 80% of viewport height */
  overflow-y: auto;
  /* Enable scrolling for content within the drawer */
}

.mobile-filter-drawer.open {
  transform: translateY(0);
}

#benchmark-filter-count-badge-mobile {
  display: none !important;
}

/* Task Type Toggle Buttons */
.task-type-toggle-container {
  display: flex;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  overflow: hidden;
  background-color: white;
  width: 100%;
  max-width: 100%;
}

.task-type-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  background-color: white;
  border: none;
  border-right: 1px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  flex: 1;
  min-height: 2.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-type-toggle:last-child {
  border-right: none;
}

.task-type-toggle:hover:not(.active) {
  background-color: #f9fafb;
  color: #374151;
}

.task-type-toggle.active {
  background-color: #4f46e5;
  color: white;
  font-weight: 600;
}

.task-type-toggle i {
  margin-right: 0.375rem;
  font-size: 0.625rem;
}

/* 响应式设计 - 小屏幕优化 */
@media (max-width: 768px) {
  .task-type-toggle-container {
    /* min-width: 180px; Removed for better responsiveness */
    max-width: 100%;
  }

  .task-type-toggle {
    padding: 0.5rem 0.375rem;
    font-size: 0.75rem;
    min-height: 2.25rem;
    font-weight: 600;
  }

  .task-type-toggle i {
    margin-right: 0.25rem;
    font-size: 0.625rem;
  }
}

@media (max-width: 480px) {
  .task-type-toggle-container {
    /* min-width: 140px; Removed for better responsiveness */
    max-width: 100%;
  }

  .task-type-toggle {
    padding: 0.375rem 0.25rem;
    font-size: 0.625rem;
    min-height: 2rem;
    font-weight: 600;
  }

  .task-type-toggle i {
    margin-right: 0.125rem;
    font-size: 0.5rem;
  }
}

@media (max-width: 360px) {
  .task-type-toggle {
    padding: 0.25rem 0.125rem;
    font-size: 0.5rem;
    min-height: 1.75rem;
  }

  .task-type-toggle i {
    margin-right: 0.1rem;
    font-size: 0.375rem;
  }
}

/* Filter chips */
.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  margin: 0.25rem;
  background-color: #f1f5f9;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #4b5563;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.filter-chip:hover {
  background-color: #e2e8f0;
  color: #1a202c;
}

.filter-chip.active,
.tag-filter.active {
  background-color: #4f46e5;
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border-color: #4f46e5;
}

/* Tag filter styles */
.tag-filter {
  padding: 0.25rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #374151;
  background-color: white;
  transition: all 0.15s ease-in-out;
  cursor: pointer;
}

.tag-filter:hover:not(.active) {
  background-color: #f3f4f6;
  border-color: #9ca3af;
}

/* Multi-select dropdown styles */
.multi-select-trigger {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  line-height: 1rem;
  border: 1px solid #d1d5db;
  background-color: white;
  border-radius: 0.375rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  cursor: default;
}

.multi-select-trigger .selected-text {
  font-size: 0.75rem;
  color: #374151;
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.multi-select-trigger i {
  color: #9ca3af;
  margin-left: 0.5rem;
  transition: transform 0.2s ease;
  /* Add transition for smooth rotation */
}

.multi-select-trigger.open i {
  transform: rotate(180deg);
}

.multi-select-trigger:hover {
  border-color: #a5b4fc;
}

.multi-select-trigger:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 1px #4f46e5;
}

.multi-select-dropdown {
  border: 1px solid #e2e8f0;
  /* Lighter border */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
  /* More pronounced shadow */
  max-height: 200px;
  /* Slightly increased max-height */
  overflow-y: auto;
  z-index: 1100;
  /* Increased z-index to appear above other content and consistent with custom-dropdown */
  background-color: white;
  border-radius: 0.5rem;
  /* More rounded corners, consistent with cards */
  transition: all 0.2s ease-in-out;
  padding: 0.5rem;
  /* Add internal padding */
}

.multi-select-dropdown .p-2 {
  padding: 0.25rem;
}

.multi-select-dropdown label {
  padding: 0.375rem 0.75rem;
  /* More comfortable padding */
  font-size: 0.875rem;
  /* Slightly larger font */
  display: flex;
  align-items: center;
  cursor: pointer;
  border-radius: 0.375rem;
  /* Rounded corners for each option */
  transition: background-color 0.2s ease;
}

.multi-select-dropdown label:hover {
  background-color: #eef2ff;
  /* Lighter indigo on hover, similar to card hover */
}

.multi-select-dropdown input[type="checkbox"] {
  height: 0.875rem;
  width: 0.875rem;
  margin-right: 0.5rem;
}

.multi-select-dropdown input[type="checkbox"]:focus {
  ring: 2px;
  ring-offset: 0;
  --tw-ring-color: #4f46e5;
  box-shadow: 0 0 0 2px var(--tw-ring-color);
}

.multi-select-dropdown .text-sm,
.multi-select-dropdown span:not(.selected-text) {
  font-size: 0.75rem !important;
  color: #374151;
}

.multi-select-dropdown.hidden {
  opacity: 0;
  transform: scale(0.95);
}

.multi-select-dropdown:not(.hidden) {
  opacity: 1;
  transform: scale(1);
}

/* Filter sections */
.filter-section-toggle {
  transition: all 0.2s;
}

.filter-section-toggle:hover {
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.filter-section-toggle i {
  transition: transform 0.3s ease;
}

.filter-section-toggle.open i {
  transform: rotate(180deg);
}

.filter-content {
  max-height: 1000px;
  /* Set a large max-height for open state */
  /* Removed overflow: hidden to prevent clipping of dropdowns */
  transition: max-height 0.5s ease-in-out, opacity 0.3s ease-in-out,
    visibility 0.3s ease-in-out;
  opacity: 1;
  visibility: visible;
}

.filter-content.hidden {
  max-height: 0;
  opacity: 0;
  visibility: hidden;
  margin-top: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* style_benchmarks.css */
#clear-search-btn {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 1rem;
  /* display: none;  <-- 已删除 */
  /* 确保它在 flex 容器中垂直居中（虽然 items-center 通常已处理，但在某些特定 reset 下可能需要） */
  display: flex;
  align-items: center;
  justify-content: center;
}

#clear-search-btn:hover {
  color: #ef4444; /* 对应 text-red-600 */
}

/* ===== TABLE COMPONENTS ===== */

.benchmark-table-container {
  position: relative;
  overflow-x: auto;
  margin-bottom: 1rem;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  background-color: white;
}

.benchmark-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.benchmark-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: white;
}

.benchmark-table th {
  position: sticky;
  top: 0;
  background-color: white;
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  border-bottom: 2px solid #e5e7eb;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.benchmark-table th:hover {
  background-color: #f9fafb;
}

.benchmark-table th:first-child {
  border-top-left-radius: 0.5rem;
}

.benchmark-table th:last-child {
  border-top-right-radius: 0.5rem;
}

.benchmark-table tbody tr:hover {
  background-color: #f0f4f8;
}

.benchmark-table th .sort-icon {
  margin-left: 8px;
  font-size: 0.75rem;
  color: #6b7280;
}

.benchmark-table th.sorted-asc .sort-icon {
  transform: rotate(180deg);
}

.benchmark-table th.sorted-desc .sort-icon {
  transform: rotate(0deg);
}

.benchmark-table th.sorted-asc .sort-icon,
.benchmark-table th.sorted-desc .sort-icon {
  color: #4f46e5;
}

/* ===== ACTION BUTTONS ===== */

.action-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.75rem 1rem;
  font-weight: 500;
  font-size: 0.875rem;
  border: 1px solid #e5e7eb;
  background-color: white;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  position: relative;
  overflow: hidden;
}

.action-button:hover {
  background-color: #f9fafb;
  border-color: #d1d5db;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.action-button:focus {
  outline: none;
  box-shadow: none !important;
  ring: none !important;
  border-color: inherit;
}

.action-button i {
  flex-shrink: 0;
  font-size: 0.75rem;
}

/* Export button styles */
.export-button {
  color: #2563eb;
  background-color: rgba(37, 99, 235, 0.05);
  border: 1px solid rgba(37, 99, 235, 0.2);
}

/* Export dropdown specific styles */
#exportDropdown .dropdown-toggle {
  color: #2563eb;
  background-color: rgba(37, 99, 235, 0.05);
  border: 1px solid rgba(37, 99, 235, 0.2);
  padding: 0.6rem 1.2rem;
  /* Increased padding */
  font-size: 0.95rem;
  /* Slightly larger font */
  font-weight: 500;
  border-radius: 0.375rem;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 130px;
  /* Slightly wider */
}

#exportDropdown .dropdown-toggle i {
  font-size: 0.85rem;
  /* Adjust icon size */
}

#exportDropdown .dropdown-menu li {
  font-size: 0.9rem;
  /* Adjust dropdown menu item font size */
}

.export-button i {
  font-size: 0.85rem;
  /* Adjust icon size for the button itself */
}

/* Dark mode styles for export button */
html.dark #exportDropdown .dropdown-toggle {
  color: #93c5fd;
  /* light blue */
  background-color: rgba(59, 130, 246, 0.1);
  /* blue-500 with opacity */
  border-color: rgba(59, 130, 246, 0.3);
}

html.dark #exportDropdown .dropdown-toggle:hover {
  background-color: rgba(59, 130, 246, 0.2);
  color: #bfdbfe;
  /* lighter blue */
  border-color: rgba(59, 130, 246, 0.5);
}

html.dark #exportDropdown .dropdown-menu li {
  color: #e5e7eb;
  /* light gray */
}

html.dark #exportDropdown .dropdown-menu li:hover {
  background: #374151;
  /* dark gray */
  color: #d1d5db;
  /* lighter gray */
}

#exportDropdown .dropdown-toggle:hover {
  background-color: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.15);
}

#exportDropdown .dropdown-menu {
  min-width: 180px;
}

#exportDropdown .dropdown-menu li {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  transition: background 0.15s;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  color: #374151;
}

#exportDropdown .dropdown-menu li:hover {
  background: #e0e7ff;
  color: #3730a3;
}

#exportDropdown .dropdown-menu li i {
  width: 16px;
  text-align: center;
}

.export-button:hover {
  background-color: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.15);
}

.export-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.1);
}

.export-button:active,
.export-button:focus {
  background-color: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
  outline: none;
  box-shadow: none !important;
  ring: none !important;
  z-index: 1;
}

/* View toggle button styles */
.view-toggle-button {
  color: #6b7280;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-left: none;
  transition: all 0.3s ease;
  position: relative;
}

.view-toggle-button:first-child {
  border-left: 1px solid #e5e7eb;
}

.view-toggle-button:hover:not(.active) {
  background-color: #f8fafc;
  color: #374151;
  border-color: #d1d5db;
}

.view-toggle-button:hover:not(.active):first-child {
  border-left-color: #d1d5db;
}

.view-toggle-button.active {
  background-color: #2563eb;
  color: #ffffff;
  font-weight: 600;
  border-color: #2563eb;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
  z-index: 2;
  position: relative;
}

.view-toggle-button.active:first-child {
  border-left-color: #2563eb;
}

.view-toggle-button.active:hover {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
}

.view-toggle-button.active:hover:first-child {
  border-left-color: #1d4ed8;
}

.view-toggle-button.active + .view-toggle-button {
  border-left-color: #2563eb;
}

.view-toggle-button:not(.active) + .view-toggle-button.active {
  border-left-color: #2563eb;
}

.view-toggle-button.active:hover + .view-toggle-button {
  border-left-color: #1d4ed8;
}

.view-toggle-button:not(.active):hover + .view-toggle-button.active {
  border-left-color: #1d4ed8;
}

/* Remove focus ring for view toggle buttons */
.view-toggle-button:focus {
  outline: none;
  box-shadow: none !important;
  ring: none !important;
  border-color: inherit;
}

/* Button states */
.action-button.loading {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
}

.action-button.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.action-button.loading i {
  opacity: 0;
}

.action-button.success {
  background-color: rgba(16, 185, 129, 0.1) !important;
  color: #059669 !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
  transform: scale(1.02);
}

.export-button.success {
  background-color: rgba(37, 99, 235, 0.15) !important;
  color: #1d4ed8 !important;
  border-color: rgba(37, 99, 235, 0.4) !important;
}

.view-toggle-button.success {
  background-color: #2563eb !important;
  color: #ffffff !important;
  border-color: #2563eb !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3) !important;
}

.action-button.error {
  background-color: rgba(239, 68, 68, 0.1) !important;
  color: #dc2626 !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  animation: shake 0.5s ease-in-out;
}

/* Tooltip styles */
.action-button[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #1f2937;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 400;
  white-space: nowrap;
  z-index: 1000;
  margin-bottom: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  animation: tooltipFadeIn 0.2s ease-in-out;
}

.action-button[data-tooltip]:hover::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #1f2937;
  z-index: 1000;
  margin-bottom: 0.125rem;
}

/* ===== UTILITY COMPONENTS ===== */

/* Chart container */
.chart-container {
  position: relative;
  height: 500px;
  width: 100%;
}

/* No results message */
.no-results-message {
  text-align: center;
  padding: 40px;
  color: #6b7280;
  font-size: 1.125rem;
  background-color: #f8fafc;
  border-radius: 0.5rem;
  margin-top: 2rem;
}

/* Pagination styles removed - now using consistent Tailwind classes like datasets and methods pages */

/* ===== ANIMATIONS ===== */

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-4px);
  }

  75% {
    transform: translateX(4px);
  }
}

@keyframes tooltipFadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ===== RESPONSIVE DESIGN ===== */

/* Desktop sticky positioning for filter panel - avoid navbar overlap */
@media (min-width: 768px) {
  .md\:sticky.md\:top-4 {
    top: 80px !important;
  }
}

/* Mobile optimizations */
@media (max-width: 767px) {
  /* Layout optimizations */
  .md\:col-span-1 {
    width: 100%;
  }

  .md\:col-span-3 {
    width: 100%;
  }

  .md\:grid-cols-4 {
    grid-template-columns: 1fr;
  }

  .md\:flex-row {
    flex-direction: column;
  }

  .md\:w-1\/4,
  .md\:w-3\/4 {
    width: 100%;
  }

  /* Filter area optimizations */
  .h-fit.sticky.top-4 {
    position: static;
    margin-bottom: 1rem;
    padding: 1rem;
    background-color: #f8fafc;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
  }

  /* Chart container optimizations */
  .chart-container {
    height: 280px;
    margin: 0.5rem 0;
    padding: 0.5rem;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }

  .chart-container canvas {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Table optimizations */
  .benchmark-table {
    min-width: 700px;
  }

  /* Pagination optimizations removed - using consistent Tailwind classes */

  /* No results message optimizations */
  .no-results-message {
    padding: 2rem 1rem;
    font-size: 1rem;
    margin: 1rem;
  }
}

@media (max-width: 640px) {
  /* Small screen device optimizations */
  .action-button {
    min-height: 2.75rem;
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    font-weight: 600;
  }

  .action-button i {
    font-size: 0.875rem;
  }

  .export-button,
  .view-toggle-button {
    min-width: 4rem;
    min-height: 2.75rem;
    font-weight: 600;
  }

  .action-button .mr-2 {
    margin-right: 0.375rem;
  }

  /* 确保按钮文字可见性 */
  .action-button span {
    color: inherit;
    font-weight: inherit;
  }

  .export-button span,
  .view-toggle-button span {
    font-size: 0.75rem;
    font-weight: 600;
  }

  /* Multi-select dropdown optimizations */
  .multi-select-trigger {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    min-height: 0.5rem;
  }

  .multi-select-dropdown {
    max-height: 200px;
    font-size: 0.75rem;
  }

  /* Filter tag optimizations */
  .filter-chip {
    font-size: 0.65rem;
    padding: 0.2rem 0.4rem;
    margin: 0.1rem 0.2rem 0.1rem 0;
  }

  .tag-filter {
    font-size: 0.65rem;
    padding: 0.2rem 0.4rem;
  }

  /* Table further optimizations */
  .benchmark-table {
    font-size: 0.7rem;
  }

  .benchmark-table th,
  .benchmark-table td {
    padding: 4px 6px;
    font-size: 0.7rem;
  }

  /* Chart container further optimizations */
  .chart-container {
    height: 250px;
    margin: 0.25rem 0;
    padding: 0.25rem;
  }

  /* Search box optimizations */
  input[type="text"],
  input[type="search"] {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
  }

  /* Main container padding adjustments */
  .container,
  .max-w-7xl {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  /* Mobile text styling */
  .action-button .text-xs {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.025em;
  }

  .action-button .ml-1 {
    margin-left: 0.375rem;
  }

  .action-button .ml-2 {
    margin-left: 0.5rem;
  }

  .action-button .hidden {
    display: none !important;
  }

  .action-button .sm\:hidden {
    display: inline !important;
  }

  .flex.flex-col.sm\:flex-row {
    gap: 0.5rem;
  }

  .export-button {
    min-width: 4rem;
    padding: 0.5rem 0.625rem;
    font-weight: 600;
  }

  .view-toggle-button {
    min-width: 4rem;
    padding: 0.5rem 0.5rem;
    font-weight: 600;
  }

  .view-button.flex-1 {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.5rem;
  }

  /* 超小屏幕下的按钮文字优化 */
  .action-button .sm\:hidden {
    font-size: 0.7rem !important;
    font-weight: 700 !important;
    color: inherit !important;
  }

  .export-button .sm\:hidden,
  .view-toggle-button .sm\:hidden {
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.025em;
  }

  .rounded-lg.shadow-sm {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  }
}

/* --- Add this to style_benchmarks.css --- */

/* Unified chip style */
.active-filter-chip,
.active-sort-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  margin: 0.25rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s ease;
  background-color: #eef2ff;
  /* A light indigo */
  color: #4338ca;
  /* A darker indigo */
  border: 1px solid #c7d2fe;
}

.active-filter-chip:hover,
.active-sort-chip:hover {
  background-color: #e0e7ff;
  border-color: #a5b4fc;
}

/* Specific style for sort chips if needed */
.active-sort-chip {
  background-color: #f0fdf4;
  /* A light green */
  color: #15803d;
  /* A darker green */
  border: 1px solid #bbf7d0;
}

.active-sort-chip:hover {
  background-color: #dcfce7;
  border-color: #86efac;
}

.active-sort-chip button,
.active-filter-chip button {
  opacity: 0.7;
}

.active-sort-chip button:hover,
.active-filter-chip button:hover {
  opacity: 1;
  color: #b91c1c;
  /* a red color for delete */
}

/* ===== NEW STYLES FOR INTERACTIVE DASHBOARD ===== */

.analysis-dashboard-header {
  top: 64px;
  /* Adjust this value based on your navbar's height */
  transition: top 0.3s ease;
  /* Added for softer look */
  box-shadow: none !important;
}

@media (max-width: 768px) {
  .analysis-dashboard-header {
    position: static;
    /* Disable sticky positioning on smaller screens */
  }

  #dashboard-controls {
    justify-content: flex-start;
    width: 100%;
  }
}

/* Dark mode for analysis dashboard header */
html.dark .analysis-dashboard-header {
  background-color: transparent !important;
  box-shadow: none !important;
}

/* --- Analysis Card & Collapsible Sections --- */
.section-toggle-button {
  transition: background-color 0.2s ease-in-out;
}

.section-toggle-button:hover {
  background-color: #f1f5f9;
  /* gray-100 */
}

.section-content {
  transition: max-height 0.5s ease-in-out, opacity 0.5s;
  overflow: hidden;
}

.section-content.hidden {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* --- Report Panel --- */
.analysis-report-panel {
  background-color: var(--card-bg-color, #f8fafc);
  border-radius: 0.375rem;
  padding: 1rem;
  color: var(--text-color, #333);
}

.analysis-report-panel ul {
  list-style-position: inside;
  padding-left: 0.5rem;
}

.analysis-report-panel li::marker {
  color: #4f46e5;
  /* indigo-600 */
}

/* --- Chart Controls --- */
.chart-control-button {
  padding: 0.25rem 0.75rem;
  border: 1px solid #d1d5db;
  /* gray-300 */
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #374151;
  /* gray-700 */
  background-color: white;
  transition: all 0.2s ease;
  cursor: pointer;
}

.chart-control-button:hover:not(.active) {
  background-color: #f9fafb;
  /* gray-50 */
  border-color: #6b7280;
  /* gray-500 */
}

.chart-control-button.active {
  background-color: #4f46e5;
  /* indigo-600 */
  color: white;
  border-color: #4f46e5;
  font-weight: 600;
}

#showBestToggle label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  color: #374151;
}

/* --- Table Interaction --- */
.benchmark-table tbody tr {
  transition: background-color 0.2s ease-in-out;
  cursor: pointer;
}

.benchmark-table tbody tr.highlighted-row {
  background-color: #e0e7ff !important;
  /* indigo-200, use !important to override hover */
  --tw-ring-color: #4f46e5;
  box-shadow: 0 0 0 2px var(--tw-ring-color);
  outline: 2px solid var(--tw-ring-color);
  z-index: 5;
  position: relative;
}

/* 定位模式：搜索匹配的行高亮 */
.benchmark-table tbody tr.search-match-row {
  background-color: #fef3c7 !important;
  /* amber-100, use !important to override hover */
  --tw-ring-color: #f59e0b;
  box-shadow: 0 0 0 2px var(--tw-ring-color);
  outline: 2px solid var(--tw-ring-color);
  z-index: 4;
  position: relative;
}

/* 定位模式：搜索不匹配的行淡化 */
.benchmark-table tbody tr.search-non-match-row {
  opacity: 0.3;
  transition: opacity 0.2s ease;
}

/* --- Chart Tooltip Styles (from Chart.js options) --- */
.chartjs-tooltip {
  opacity: 1;
  pointer-events: none;
  position: absolute;
  background: rgba(31, 41, 55, 0.9);
  /* gray-800 with opacity */
  color: white;
  border-radius: 0.375rem;
  padding: 0.75rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.1s ease;
  z-index: 1000;
}

.chartjs-tooltip-key {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 2px;
}

/* ===== ENHANCED CHART CONTROLS ===== */

/* Chart control container */
#main-chart-controls {
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

#main-chart-controls:hover {
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
  transform: translateY(-1px);
}

/* Chart control group */
.chart-control-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  min-width: 120px;
  flex: 1;
}

/* Custom dropdown in chart controls */
.chart-control-group .custom-dropdown {
  max-width: 150px;
  min-width: 100px;
  flex: 1;
}

.chart-control-group .dropdown-toggle {
  height: 1.75rem;
  font-size: 0.75rem;
  padding: 0.2rem 1.25rem 0.2rem 0.5rem;
  width: 100%;
}

.chart-control-group .dropdown-menu {
  max-height: 150px;
  overflow-y: auto;
  z-index: 1001;
}

.chart-control-group .dropdown-menu li {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
}

/* Chart control label */
.chart-control-label {
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 0;
  margin-right: 0.5rem;
  color: #374151;
  line-height: 1.2;
  white-space: nowrap;
  flex-shrink: 0;
}

.chart-control-label i {
  font-size: 0.9em;
  margin-right: 0.2em;
}

/* Chart control select wrapper */
.chart-control-select-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: 0;
}

/* Chart control select */
.chart-control-select {
  appearance: none;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  /* Match multi-select-trigger */
  padding: 0.25rem 1.75rem 0.25rem 0.75rem;
  /* Adjusted padding */
  font-size: 0.75rem;
  /* Match multi-select-trigger */
  font-weight: 500;
  color: #374151;
  min-height: 2rem;
  /* Make it more compact */
  height: 2rem;
  line-height: 1.5;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease-in-out;
  cursor: pointer;
}

.chart-control-select:hover {
  border-color: #a5b4fc;
  /* Match multi-select-trigger hover */
}

.chart-control-select:focus {
  border-color: #4f46e5;
  outline: none;
  box-shadow: 0 0 0 1px #4f46e5;
  /* Match multi-select-trigger focus */
}

.chart-control-icon {
  position: absolute;
  right: 0.75rem;
  /* Adjusted to match new padding */
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  pointer-events: none;
  font-size: 0.95em;
}

/* Chart quality indicator */
.chart-quality-indicator {
  display: flex;
  align-items: center;
}

.chart-quality-indicator span {
  transition: all 0.2s ease;
}

.chart-quality-indicator span:hover {
  transform: scale(1.05);
}

/* Enhanced chart container */
.chart-container {
  transition: all 0.3s ease;
  overflow: hidden;
}

.chart-container:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Chart canvas enhancement for better quality */
.chart-container canvas {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: -o-crisp-edges;
  -ms-interpolation-mode: nearest-neighbor;
}

/* Responsive design for chart controls */
@media (max-width: 640px) {
  .chart-control-group {
    min-width: 120px;
  }

  .chart-control-select {
    font-size: 0.75rem;
    min-height: 2rem;
    height: 2rem;
    padding: 0.25rem 1.5rem 0.25rem 0.625rem;
  }

  .chart-control-label {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .chart-control-group {
    min-width: 100px;
  }

  .chart-control-select {
    min-width: 90px;
    padding: 0.2rem 1.3rem 0.2rem 0.5rem;
    font-size: 0.7rem;
    min-height: 1.8rem;
    height: 1.8rem;
  }

  .chart-control-label {
    font-size: 0.65rem;
  }
}

/* Dark mode support for chart controls */
html.dark #main-chart-controls {
  background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%);
  border-color: #3b82f6;
}

html.dark .chart-control-label {
  color: #e5e7eb;
}

html.dark .chart-control-select {
  background-color: #1f2937;
  border-color: #4b5563;
  color: #e5e7eb;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
}

html.dark .chart-control-select:hover {
  border-color: #6b7280;
}

html.dark .chart-control-select:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 1px #4f46e5;
}

html.dark .chart-control-icon {
  color: #9ca3af;
}

html.dark .chart-control-select:focus + .chart-control-icon {
  color: #6366f1;
}

html.dark .chart-container {
  background-color: #1f2937;
  border-color: #4b5563;
}

html.dark .chart-quality-indicator span {
  background-color: #065f46;
  color: #d1fae5;
}

/* Mobile Sidebar Overlay */
.filter-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 40;
  /* Below the sidebar */
  display: none;
  transition: opacity 0.3s ease-in-out;
}

.filter-drawer-overlay.hidden {
  opacity: 0;
}

.filter-drawer-overlay:not(.hidden) {
  opacity: 1;
}

/* 移动端横向图例条 */
#mobile-legend-bar {
  width: 100%;
  margin-bottom: 0.5rem;
}

#mobile-legend-wrapper {
  width: 100%;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  border: 1px solid #e5e7eb;
}

html.dark #mobile-legend-wrapper {
  background: #1f2937;
  border-color: #374151;
}

#mobile-legend-content {
  padding: 0.25rem 0.5rem 0.5rem 0.5rem;
}

#mobile-model-legend-list,
#mobile-featurization-legend-list {
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #d1d5db #f3f4f6;
  padding-bottom: 2px;
}

#mobile-model-legend-list::-webkit-scrollbar,
#mobile-featurization-legend-list::-webkit-scrollbar {
  height: 4px;
  background: #f3f4f6;
}

#mobile-model-legend-list::-webkit-scrollbar-thumb,
#mobile-featurization-legend-list::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 2px;
}

@media (min-width: 1024px) {
  #mobile-legend-bar {
    display: none !important;
  }
}

/* 保证横向图例项紧凑 */
#mobile-model-legend-list .legend-item,
#mobile-featurization-legend-list .legend-item {
  min-width: max-content;
  background: none;
  border: none;
  box-shadow: none;
  margin: 0;
}

#impact-chart-layout-grid {
  display: grid;
  /* 默认两列：图例列（10rem, 约w-40），图表列（剩余所有空间） */
  grid-template-columns: 10rem 1fr;
  gap: 1rem;
  /* 创建图例和图表之间的间距 */
  transition: grid-template-columns 0.3s ease-in-out;
  /* 平滑过渡动画 */
}

/* 当图例收起时，图例列的宽度变为0，间距也变为0 */
#impact-chart-layout-grid.legend-collapsed {
  grid-template-columns: 0px 1fr;
  gap: 0;
}

/* 在图例收起时，将其内容隐藏，防止溢出 */
#impact-chart-layout-grid.legend-collapsed #splitTypeImpactLegendPanel {
  visibility: hidden;
  opacity: 0;
  transition: visibility 0s 0.3s, opacity 0.3s ease-in-out;
}

#impact-chart-layout-grid > .flex.flex-col {
  min-width: 0;
}

/* --- Split Type Impact Legend Panel: 固定高度+滚动条样式与散点图一致 --- */

/* ===== Dropdown Search Bar Styles ===== */

/* ===== Dropdown Search Bar Styles (Revised) ===== */

/* Container for the search bar within the dropdown */
.multi-select-dropdown .search-container {
  position: -webkit-sticky;
  /* For Safari */
  position: sticky;
  top: 0;
  /* Ensures it sticks to the absolute top of the scrollable container */
  z-index: 10;
  background-color: white;
  padding: 0.25rem 0.5rem;
  /* Reduced vertical and horizontal padding to make it shorter */
  border-bottom: 1px solid #e5e7eb;
  /* gray-200 */
}

/* Search input field within the dropdown */
.multi-select-dropdown .dropdown-search {
  width: 100%;
  padding: 0.25rem 0.5rem;
  /* Reduced padding to make the input field shorter */
  border: 1px solid #d1d5db;
  /* gray-300 */
  border-radius: 0.25rem;
  /* Slightly smaller radius to match the new height */
  font-size: 0.8rem;
  /* Reduced font size for a more compact look */
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.multi-select-dropdown .dropdown-search:focus {
  outline: none;
  border-color: #4f46e5;
  /* indigo-600 */
  box-shadow: 0 0 0 1px #4f46e5;
}

/* Dark mode styles for the search bar */
html.dark .multi-select-dropdown .search-container {
  background-color: #1f2937;
  /* gray-800 */
  border-bottom-color: #374151;
  /* gray-700 */
}

html.dark .multi-select-dropdown .dropdown-search {
  background-color: #374151;
  /* gray-700 */
  border-color: #4b5563;
  /* gray-600 */
  color: #e5e7eb;
  /* gray-200 */
}

/* When the search container is hidden, it should take up no space */
.multi-select-dropdown .search-container.hidden {
  display: none;
}

/*
 *  强制移除下拉框顶部的内边距来修复吸顶搜索栏的空隙问题
 */
.multi-select-dropdown {
  padding-top: 0 !important;
}

/* 为了保持选项和搜索框的间距，给搜索框本身加上一点下边距 */
.multi-select-dropdown .search-container {
  margin-bottom: 0.25rem;
}

/* 1. 默认情况下，隐藏图例面板 */
#scatter-legend-panel {
  display: none;
}

/* 2. 在大屏幕 (1024px及以上) 时，强制将其显示为块级元素 */
/*    使用 !important 来确保它拥有最高优先级，不会被其他样式意外覆盖 */
@media (min-width: 1024px) {
  #scatter-legend-panel {
    display: block !important;
  }
}

/* ===== Dropdown Search Bar Styles (Revised) ===== */

/* Container for the search bar within the dropdown */
.multi-select-dropdown .search-container {
  position: -webkit-sticky;
  /* For Safari */
  position: sticky;
  top: 0;
  /* Ensures it sticks to the absolute top of the scrollable container */
  z-index: 10;
  background-color: white;
  padding: 0.25rem 0.5rem;
  /* Reduced vertical and horizontal padding to make it shorter */
  border-bottom: 1px solid #e5e7eb;
  /* gray-200 */
}

/* Search input field within the dropdown */
.multi-select-dropdown .dropdown-search {
  width: 100%;
  padding: 0.25rem 2.25rem 0.25rem 0.5rem;
  /* MODIFIED: Increased right padding to make space for the clear button */
  border: 1px solid #d1d5db;
  /* gray-300 */
  border-radius: 0.25rem;
  /* Slightly smaller radius to match the new height */
  font-size: 0.8rem;
  /* Reduced font size for a more compact look */
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* ADDED: Rule to position the clear button */
.multi-select-dropdown .search-container button {
  position: absolute;
  right: 0.5rem;
  /* Aligns with container padding */
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  /* gray-400 */
  display: flex;
  align-items: center;
  padding: 0.25rem;
  /* Small padding to increase clickable area */
}

/* ADDED: Hover effect for the clear button */
.multi-select-dropdown .search-container button:hover {
  color: #6b7280;
  /* gray-500 */
}

.multi-select-dropdown .dropdown-search:focus {
  outline: none;
  border-color: #4f46e5;
  /* indigo-600 */
  box-shadow: 0 0 0 1px #4f46e5;
}

/* Dark mode styles for the search bar */
html.dark .multi-select-dropdown .search-container {
  background-color: #1f2937;
  /* gray-800 */
  border-bottom-color: #374151;
  /* gray-700 */
}

html.dark .multi-select-dropdown .dropdown-search {
  background-color: #374151;
  /* gray-700 */
  border-color: #4b5563;
  /* gray-600 */
  color: #e5e7eb;
  /* gray-200 */
}

/* When the search container is hidden, it should take up no space */
.multi-select-dropdown .search-container.hidden {
  display: none;
}

/* ===== 新增：统一的交互式图例面板样式 ===== */

.interactive-legend-panel {
  /* 核心修复：设置一个最大高度，并启用垂直滚动 */
  max-height: 27rem;
  /* 约等于 432px，可以根据需要调整 */
  overflow-y: auto;
  /* 当内容超出时显示滚动条 */

  /* 统一的美化样式 (可以根据您的喜好调整) */
  background: white;
  /* border-right: 1px solid #e5e7eb; */
  /* 右边框作为与图表的分隔 */
  /* padding: 1rem; */
  transition: all 0.3s ease-in-out;
}

/* 深色模式下的样式 */
html.dark .interactive-legend-panel {
  background: #1f2937;
  /* gray-800 */
  border-right-color: #374151;
  /* gray-700 */
}

/* 滚动条美化 (可选，但推荐) */
.interactive-legend-panel::-webkit-scrollbar {
  width: 6px;
}

.interactive-legend-panel::-webkit-scrollbar-track {
  background: transparent;
}

.interactive-legend-panel::-webkit-scrollbar-thumb {
  background-color: #d1d5db;
  /* gray-300 */
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.interactive-legend-panel::-webkit-scrollbar-thumb:hover {
  background-color: #9ca3af;
  /* gray-400 */
}

html.dark .interactive-legend-panel::-webkit-scrollbar-thumb {
  background-color: #4b5563;
  /* gray-600 */
}

html.dark .interactive-legend-panel::-webkit-scrollbar-thumb:hover {
  background-color: #6b7280;
  /* gray-500 */
}

/* style_benchmarks.css */

/* ... 文件中所有现有样式保持不变 ... */

/* 新增：可拖动提示词的样式 */
.drag-tooltip {
  position: absolute;
  bottom: 110%;
  /* 定位在按钮正上方 */
  left: 50%;
  transform: translateX(-50%);
  background-color: #1f2937;
  /* dark:bg-gray-800 */
  color: #ffffff;
  padding: 0.3rem 0.6rem;
  border-radius: 0.375rem;
  /* rounded-md */
  font-size: 0.75rem;
  /* text-sm */
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -2px rgba(0, 0, 0, 0.1);

  /* 初始状态为隐藏，通过透明度和缩放实现动画 */
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(5px);
  /* 初始时稍微向下偏移 */
  transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out,
    visibility 0s 0.2s;
  pointer-events: none;
  /* 确保提示词不会干扰鼠标事件 */
}

/* 提示词的小箭头 */
.drag-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #1f2937 transparent transparent transparent;
}

/* 当鼠标悬停在按钮上时，显示提示词 */
.floating-controls .toggle-btn:hover .drag-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
}

/* 暗色模式下的提示词样式 */
html.dark .drag-tooltip {
  background-color: #374151;
  /* dark:bg-gray-700 */
  color: #f3f4f6;
  /* dark:text-gray-100 */
}

html.dark .drag-tooltip::after {
  border-top-color: #374151;
  /* dark:bg-gray-700 */
}

/* ===== 新增：桌面端浮动控件的居中定位 ===== */
/* 此规则仅在屏幕宽度大于或等于 1024px 时生效 */
@media (min-width: 1024px) {
  .floating-controls {
    /* 1. 实现垂直居中 */
    top: 50%;
    transform: translateY(-50%);

    /* 2. 实现水平定位（核心部分） */
    /*
     * 逻辑解释:
     * 您的主内容区（版心）最大宽度为 80rem (max-w-7xl)。
     * 整个屏幕宽度是 100vw。
     * (100vw + 80rem) / 2 可以精确计算出主内容区右侧边缘的位置。
     * 我们在此基础上再加上 2rem (32px) 的间距。
     */
    left: calc((100vw + 80rem) / 2 + 2rem);

    /* 3. 覆盖并取消手机端的定位样式 */
    right: auto;
    bottom: auto;
  }
}

/* 在 style_benchmarks.css 文件末尾添加 */
.legend-item-disabled {
  cursor: not-allowed;
}

/* css/style_benchmarks.css */

/* =============================================== */
/* ===== 新增：交互式图例头部和清除按钮样式 ===== */
/* =============================================== */

#comprehensive-legend-panel > .legend-header,
#splitTypeImpactLegendPanel > .legend-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 0;
  position: sticky;
  top: 0;
  background-color: #f9fafb;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  z-index: 20;
}

/* 深色模式下的图例头部样式 */
html.dark #comprehensive-legend-panel > .legend-header,
html.dark #splitTypeImpactLegendPanel > .legend-header {
  border-bottom-color: #374151;
  background-color: #1f2937;
}

#comprehensive-legend-content,
#splitTypeImpactLegendContent {
  padding-top: 0.5rem;
}

.legend-main-title {
  font-size: 0.875rem;
  /* 14px */
  font-weight: 600;
  /* semibold */
  color: #1f2937;
  /* 默认文字颜色 */
}

.dark .legend-main-title {
  color: #f3f4f6;
  /* 深色模式下的文字颜色 */
}

.legend-clear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  /* 28px */
  height: 1.75rem;
  /* 28px */
  border: none;
  border-radius: 9999px;
  /* 圆形 */
  background-color: transparent;
  color: #9ca3af;
  /* 默认图标颜色 */
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  font-size: 0.8rem;
  /* 图标大小 */
}

.legend-clear-btn:hover {
  background-color: #e5e7eb;
  /* 悬停背景色 */
  color: #1f2937;
  /* 悬停图标颜色 */
}

.dark .legend-clear-btn:hover {
  background-color: #4b5563;
  /* 深色模式下的悬停背景色 */
  color: #ffffff;
  /* 深色模式下的悬停图标颜色 */
}

/* 当按钮被 JS 禁用时的样式 */
.legend-clear-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background-color: transparent;
}

/* ===== 新增：图表重置/操作按钮样式 ===== */
.chart-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  /* 8px */
  padding: 0.375rem 0.75rem;
  /* 6px 12px */
  background-color: #f9fafb;
  /* gray-50 */
  border: 1px solid #d1d5db;
  /* gray-300 */
  border-radius: 0.375rem;
  /* rounded-md */
  font-size: 0.75rem;
  /* 12px */
  font-weight: 500;
  color: #374151;
  /* gray-700 */
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  white-space: nowrap;
}

.chart-action-btn:hover {
  background-color: #f3f4f6;
  /* gray-100 */
  border-color: #9ca3af;
  /* gray-400 */
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.chart-action-btn:active {
  background-color: #e5e7eb;
  /* gray-200 */
}

.chart-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 暗色模式 */
html.dark .chart-action-btn {
  background-color: #374151;
  /* gray-700 */
  border-color: #4b5563;
  /* gray-600 */
  color: #d1d5db;
  /* gray-300 */
}

html.dark .chart-action-btn:hover {
  background-color: #4b5563;
  /* gray-600 */
  border-color: #6b7280;
  /* gray-500 */
}

/* =================================================================== */
/* ===== START: 新增 - 图表驱动筛选 (Chart-Driven Filtering) 样式 ===== */
/* =================================================================== */

/* 1. 鼠标光标样式
 * 当图表容器被JS添加 .selection-mode 类时，
 * 鼠标悬停在 canvas 上会变成十字准星，提示用户可以开始选择。
*/
#scatter-plot-container.selection-mode canvas {
  cursor: crosshair;
}

/* 2. 数据点高亮样式
 * 我们不会直接定义这个样式，而是在JS中动态修改点的 borderWidth 和 borderColor。
 * Chart.js 对于点样式的控制在JS中进行更灵活。
 * 这里只是一个注释，提醒我们将在JS中实现这一点。
*/

/* 3. 选中操作面板的微调 */
#chart-selection-panel {
  /* 使用flex布局确保内部元素对齐 */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  /* 左右两部分之间的间距 */
  transition: all 0.3s ease-in-out;
  /* 平滑的显示/隐藏动画 */
}

/* 当面板隐藏时 (通过JS添加 .hidden 类) */
#chart-selection-panel.hidden {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

/* 4. 筛选状态提示栏的微调 */
#chart-filter-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s ease-in-out;
}

#chart-filter-status-bar.hidden {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

/* 5. 确保按钮在小屏幕上也能良好显示 */
@media (max-width: 480px) {
  #chart-selection-panel,
  #chart-filter-status-bar {
    flex-direction: column;
    /* 垂直堆叠 */
    align-items: stretch;
    /* 元素宽度撑满容器 */
    gap: 0.5rem;
    /* 减小间距 */
    text-align: center;
  }

  #chart-selection-panel .flex.items-center.gap-2 {
    justify-content: center;
    /* 按钮居中 */
  }

  #reset-chart-filter-btn {
    width: 100%;
    /* 重置按钮撑满 */
  }
}

/* ================================================================= */
/* ===== END: 图表驱动筛选样式 ===== */
/* ================================================================= */
/* 解决顶部空白问题 */
#chart-interaction-container:empty {
  margin-bottom: 0;
  /* 如果容器内没有可见子元素，则移除外边距 */
}

#chart-selection-panel.hidden,
#chart-filter-status-bar.hidden {
  display: none;
  /* 关键：使用 display:none 彻底移除元素，而不是仅仅隐藏 */
}

/* css/style_benchmarks.css (替换所有旧的图表驱动筛选样式) */

/* ================================================================================= */
/* ===== START: UNIFIED Chart-Driven Filtering Styles (for Scatter & Impact) ===== */
/* ================================================================================= */

/* 1. 鼠标光标样式 (在多选模式下) */
#scatter-plot-container.selection-mode canvas,
#impact-chart-layout-grid.selection-mode canvas {
  cursor: crosshair;
}

/* 2. 交互面板的通用样式 (当它们可见时) */
#chart-selection-panel,
#chart-filter-status-bar,
#impact-chart-selection-panel,
#impact-chart-filter-status-bar {
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

/* 3. CRITICAL FIX: 当交互面板的父容器为空时，彻底隐藏它自己。*/
/*    这会移除由 mb-3 (margin-bottom) 等工具类产生的空白。*/
#chart-interaction-container:empty,
#impact-chart-interaction-container:empty {
  display: none !important;
}

/* 4. CRITICAL FIX: 当交互面板本身被隐藏时，确保它们从布局中完全消失。*/
/*    这是解决空白问题的核心规则。*/
#chart-selection-panel.hidden,
#chart-filter-status-bar.hidden,
#impact-chart-selection-panel.hidden,
#impact-chart-filter-status-bar.hidden {
  display: none !important;
}

/* 5. 统一的响应式布局 (确保在小屏幕上也能正常显示) */
@media (max-width: 480px) {
  #chart-selection-panel,
  #chart-filter-status-bar,
  #impact-chart-selection-panel,
  #impact-chart-filter-status-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    text-align: center;
  }

  #chart-selection-panel .flex.items-center.gap-2,
  #impact-chart-selection-panel .flex.items-center.gap-2 {
    justify-content: center;
  }

  #reset-chart-filter-btn,
  #reset-impact-chart-filter-btn {
    width: 100%;
  }
}

main.md\:col-span-3 > .bg-white.rounded-lg {
  overflow: hidden;
}

/* ========================================================== */
/* ===== START: 粘性筛选侧边栏 (已统一滚动条样式) ===== */
/* ========================================================== */

/* 
 * 此规则仅在屏幕宽度大于或等于 768px 时生效。
*/
@media (min-width: 768px) {
  .desktop-filter-panel {
    /* 核心粘性定位属性 */
    position: -webkit-sticky;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;

    /* (亮色模式) 滚动条样式 - 采用您提供的统一颜色 */
    scrollbar-width: thin;
    scrollbar-color: #a0aec0 #f1f5f9;
    /* 滑块(中灰) 轨道(浅灰) */
  }

  /* (亮色模式) Webkit 浏览器滚动条样式 (Chrome, Safari, Edge) */
  .desktop-filter-panel::-webkit-scrollbar {
    width: 8px;
  }

  .desktop-filter-panel::-webkit-scrollbar-track {
    background: #f1f5f9;
    /* 轨道的背景色 (浅灰) */
    border-radius: 4px;
  }

  .desktop-filter-panel::-webkit-scrollbar-thumb {
    background-color: #a0aec0;
    /* 滑块的颜色 (中灰) */
    border-radius: 4px;
    border: 2px solid #f1f5f9;
    /* 创建内边距效果 */
  }

  .desktop-filter-panel::-webkit-scrollbar-thumb:hover {
    background-color: #718096;
    /* 鼠标悬停时滑块的颜色 (深灰) */
  }

  /* ======================================================== */
  /* ===== START: 深色模式样式 - 采用您提供的统一颜色 ===== */
  /* ======================================================== */

  /* (深色模式) Firefox 浏览器滚动条样式 */
  html.dark .desktop-filter-panel {
    scrollbar-color: #4b5563 #1f2937;
    /* 深色滑块 深色轨道 */
  }

  /* (深色模式) Webkit 浏览器滚动条样式 */
  html.dark .desktop-filter-panel::-webkit-scrollbar-track {
    background: #1f2937;
    /* 深色模式轨道背景 */
  }

  html.dark .desktop-filter-panel::-webkit-scrollbar-thumb {
    background-color: #4b5563;
    /* 深色模式滑块颜色 */
    border-color: #1f2937;
    /* 匹配深色轨道背景 */
  }

  html.dark .desktop-filter-panel::-webkit-scrollbar-thumb:hover {
    background-color: #6b7280;
    /* 深色模式悬停颜色 */
  }

  /* ======================================================== */
  /* ===== END: 深色模式样式 ===== */
  /* ======================================================== */
}

/* css/style_benchmarks.css (在文件末尾添加) */

/* ========================================================== */
/* ===== 新增：框选覆盖层样式 (Ctrl + Drag) ===== */
/* ========================================================== */

.selection-box {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  pointer-events: none;
  /* 确保它不会捕获鼠标事件 */

  /* 定义一个与缩放框不同的颜色，例如绿色 */
  border: 1px dashed #10b981;
  /* A nice green color (emerald-500) */
  background-color: rgba(16, 185, 129, 0.1);
  /* A light, transparent green */
}

.zoom-mode-enabled:hover {
  cursor: zoom-in;
}

/* START: [FINAL & RE-STYLED] Redesigned Dataset Size Slider Styles */

.size-slider-container {
  margin-top: 8px;
}

.size-slider {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  height: 24px;
}

.size-slider-track {
  position: absolute;
  width: 100%;
  height: 6px;
  background-color: #e5e7eb;
  /* Tailwind gray-200 */
  border-radius: 3px;
  cursor: pointer;
}

.dark .size-slider-track {
  background-color: #374151;
  /* Tailwind gray-700 */
}

.size-slider-fill {
  position: absolute;
  height: 6px;
  background-color: #4f46e5;
  /* Indigo */
  border-radius: 3px;
  width: 100%;
}

.size-slider-thumb {
  position: absolute;
  left: 100%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  background-color: #ffffff;
  border: 3px solid #4f46e5;
  border-radius: 50%;
  cursor: grab;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  z-index: 10;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.dark .size-slider-thumb {
  background-color: #1f2937;
}

.size-slider-thumb:hover {
  transform: translateX(-50%) scale(1.1);
}

.size-slider-thumb.grabbing {
  cursor: grabbing;
  transform: translateX(-50%) scale(1.15);
}

.size-slider-thumb.disabled {
  background-color: #d1d5db;
  border-color: #9ca3af;
  cursor: not-allowed;
}

.dark .size-slider-thumb.disabled {
  background-color: #4b5563;
  border-color: #6b7280;
}

/* --- START: Tooltip Style Fix --- */
.size-slider-tooltip {
  position: absolute;
  top: 150%;
  /* 修改：从 bottom 改为 top，并增加距离，使其位于滑块下方 */
  left: 50%;
  /* 修改：从 left: 0 改为 left: 50%，配合 transform 居中 */
  transform: translateX(-50%);
  background-color: #374151;
  /* Tailwind gray-700 */
  color: #ffffff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 20;
}

/* 新增：为提示框添加指向上方的小箭头 */
.size-slider-tooltip::after {
  content: "";
  position: absolute;
  bottom: 100%;
  /* 将箭头定位在提示框的顶部 */
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: transparent transparent #374151 transparent;
  /* 创建一个指向上方的三角形 */
}

.dark .size-slider-tooltip {
  background-color: #4f46e5;
  color: #ffffff;
}

/* 新增：深色模式下的箭头颜色 */
.dark .size-slider-tooltip::after {
  border-bottom-color: #4f46e5;
}

/* --- END: Tooltip Style Fix --- */

/* --- START: Count Badge Style Fix --- */
#datasetSizeCountBadge {
  /* [FIX] Light mode: light gray background with dark text */
  background-color: #f3f4f6;
  /* Tailwind gray-100 */
  color: #374151;
  /* Tailwind gray-700 */
  border: 1px solid #e5e7eb;
  /* Tailwind gray-200 */

  padding: 4px 10px;
  border-radius: 6px;
  min-width: 50px;
  text-align: center;
  font-family: monospace;
  font-size: 14px;
  /* Slightly larger for better readability */
  font-weight: 600;
  transition: background-color 0.2s, color 0.2s;
}

.dark #datasetSizeCountBadge {
  /* Dark mode: purple background with white text */
  background-color: #4f46e5;
  color: #ffffff;
  border-color: transparent;
}

/* --- END: Count Badge Style Fix --- */

/* END: [FINAL & RE-STYLED] Redesigned Dataset Size Slider Styles */
/* ========================================================== */
/* ===== 新增：平滑的卡片展开/折叠动画样式 ===== */
/* ========================================================== */

/* 1. 为卡片折叠/展开的按钮添加过渡效果 */
.analysis-card-toggle i {
  transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* 2. 定义内容区域的样式和动画 */
.section-content {
  /* 关键：使用 max-height 来控制高度，并为其添加过渡动画 */
  /* transition: max-height 0.5s ease-in-out, opacity 0.3s ease-in-out 0.1s; */
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.4s ease-in-out, padding-top 0.4s ease-in-out,
    padding-bottom 0.4s ease-in-out, border-top-width 0.4s ease-in-out;
  overflow: hidden;
  /* 必须设置，否则内容会溢出 */
}

/* 3. 内容区域展开时的状态 */
/* 默认情况下（没有 .hidden 类时）它应该是展开的 */
.section-content {
  max-height: 4000px;
  /* 设置一个足够大的值，确保内容能完全显示 */
  opacity: 1;
}

/* 4. 内容区域折叠时的状态 (当 JS 添加 .hidden 类时) */
.section-content.hidden {
  max-height: 0;
  opacity: 0;
  /* 动画的一部分：在折叠时也移除内边距和边框，使效果更完美 */
  padding-top: 0;
  padding-bottom: 0;
  border-top-width: 0;
}

/* Toggle Switch Styles */
input:checked ~ .toggle-bg {
  background-color: #0d9488;
  /* Teal-600 */
}

input:checked ~ .dot {
  transform: translateX(100%);
}

.dark input:checked ~ .toggle-bg {
  background-color: #14b8a6;
  /* Teal-500 */
}

.chart-container canvas.box-select-mode {
  cursor: crosshair !important;
}

/* ========================================================== */
/* ===== 新增：通用的拨动开关样式 (Toggle Switch) ===== */
/* ========================================================== */

/* 当 checkbox 被选中时，移动背景和滑块 */
input:checked ~ .toggle-bg {
  background-color: #0d9488;
  /* Teal-600 */
}

input:checked ~ .dot {
  transform: translateX(100%);
}

/* 深色模式下选中的颜色 */
.dark input:checked ~ .toggle-bg {
  background-color: #14b8a6;
  /* Teal-500 */
}

/* ========================================================== */
/* ===== 新增：小多图（Split View）容器样式 ===== */
/* ========================================================== */
.small-multiple-chart-wrapper {
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  /* gray-200 */
  border-radius: 0.5rem;
  /* rounded-lg */
  background-color: #f9fafb;
  /* gray-50 */
}

.dark .small-multiple-chart-wrapper {
  border-color: #374151;
  /* dark:border-gray-700 */
  background-color: rgba(31, 41, 55, 0.5);
  /* dark:bg-gray-800 with opacity */
}

/* Layout for Split Impact Analysis Chart with Collapsible Legend */
.split-impact-layout-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  /* Default: 200px legend, rest for chart */
  gap: 1rem;
  transition: grid-template-columns 0.3s ease-in-out;
}

.split-impact-layout-grid.legend-collapsed {
  grid-template-columns: 0px 1fr;
  /* When collapsed, legend width is 0 */
}

.legend-panel-collapsible {
  position: relative;
  transition: opacity 0.3s ease-in-out;
}

.split-impact-layout-grid.legend-collapsed .legend-panel-collapsible {
  opacity: 0;
  pointer-events: none;
}

.legend-toggle-btn {
  position: absolute;
  top: 50%;
  right: -12px;
  /* Position button just outside the legend panel */
  transform: translateY(-50%);
  z-index: 10;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: white;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s;
}

.legend-toggle-btn:hover {
  background-color: #f7fafc;
}

.chart-panel-main {
  min-width: 0;
  /* Important for flexbox inside grid */
}

.split-impact-layout-grid {
  display: grid;
  grid-template-columns: 160px 1fr; /* 默认图例宽度 160px */
  gap: 1rem;
  transition: grid-template-columns 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.split-impact-layout-grid.legend-collapsed {
  grid-template-columns: 0px 1fr;
  gap: 0;
}

.legend-panel-wrapper {
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.legend-toggle-btn {
  position: absolute;
  top: 50%;
  /* 初始位置修正：与 grid-template-columns 的 160px 保持一致 */
  left: 160px;
  transform: translateY(-50%) translateX(-50%);
  z-index: 20;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: white;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.2s ease-in-out, background-color 0.2s;
}

.legend-toggle-btn:hover {
  background-color: #f3f4f6;
  transform: translateY(-50%) translateX(-50%) scale(1.1);
}

/* ===== START: 这是本次的核心修复 ===== */
/* 使用一个更具体的选择器来提高优先级，并确保它能覆盖任何其他规则 */
body .split-impact-layout-grid.legend-collapsed .legend-toggle-btn {
  left: 14px !important; /* 使用 !important 强制应用此规则 */
}
/* ===== END: 核心修复 ===== */

.chart-panel-main {
  min-width: 0;
}

/* --- 暗色模式样式 --- */
.dark .legend-toggle-btn {
  background-color: #374151;
  border-color: #4b5563;
  color: #d1d5db;
}

.dark .legend-toggle-btn:hover {
  background-color: #4b5563;
}
.performance-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding-top: 10px;
  margin-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
html:not(.dark) .performance-filter-group {
  border-top-color: rgba(0, 0, 0, 0.1);
}

.performance-filter-label-row {
  display: flex;
  align-items: center;
  width: 100%;
}
.performance-filter-label-row .chart-control-label {
  margin-bottom: 0;
  white-space: nowrap;
}

/* Toggle Switch Styles */
.toggle-dot {
  transition: transform 0.2s ease-in-out;
}
#performance-filter-toggle:checked ~ .toggle-dot {
  transform: translateX(100%);
}
#performance-filter-toggle:checked ~ .toggle-bg {
  background-color: #4f46e5;
  border-color: #4f46e5;
}
.dark #performance-filter-toggle:checked ~ .toggle-bg {
  background-color: #6366f1;
  border-color: #6366f1;
}

/* The new slider row container */
.performance-slider-container {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  position: relative; /* For the tooltip */
}

.performance-slider-value-display {
  font-family: monospace;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280; /* gray-500 */
  flex-shrink: 0;
}
.dark .performance-slider-value-display {
  color: #9ca3af; /* gray-400 */
}

.performance-slider {
  position: relative;
  flex-grow: 1;
  height: 20px;
  display: flex;
  align-items: center;
}

.performance-slider-track {
  position: absolute;
  width: 100%;
  height: 6px;
  background-color: #e5e7eb; /* gray-200 */
  border-radius: 3px;
  cursor: pointer;
}
.dark .performance-slider-track {
  background-color: #374151; /* gray-700 */
}

.performance-slider-fill {
  position: absolute;
  height: 6px;
  background-color: #6366f1; /* indigo-500 */
  border-radius: 3px;
  z-index: 1;
}

.performance-slider-thumb {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  background-color: #fff;
  border: 2px solid #4f46e5; /* indigo-600 */
  border-radius: 50%;
  cursor: grab;
  z-index: 2; /* Thumbs must be above the fill */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.performance-slider-thumb.active,
.performance-slider-thumb:hover {
  transform: translateY(-50%) scale(1.15);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}
.performance-slider-thumb.grabbing {
  cursor: grabbing;
}

.dark .performance-slider-thumb {
  background-color: #1f2937; /* gray-800 */
  border-color: #a5b4fc; /* indigo-300 */
}

/* Disabled State */
.performance-filter-group.disabled {
  opacity: 0.5;
  pointer-events: none;
}
.performance-slider.disabled {
  pointer-events: none;
}

/* Tooltip */
.performance-filter-tooltip {
  position: absolute;
  top: -30px; /* Position above the whole container */
  left: 50%;
  transform: translateX(-50%);
  background-color: #374151;
  color: white;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.dark .performance-filter-tooltip {
  background-color: #f3f4f6;
  color: #1f2937;
}
.performance-filter-group.disabled
  .performance-slider-container:hover
  .performance-filter-tooltip {
  opacity: 1;
}
/* In css/style_benchmarks.css */

/* ========================================================== */
/* ===== 可折叠图例面板的 Grid 布局样式 (最终统一版) ===== */
/* ========================================================== */

/* 1. 为两个图表的布局容器应用相同的 Grid 基础样式 */
#impact-chart-layout-grid,
#split-impact-layout-grid {
  display: grid;
  /* 初始图例宽度统一为 160px */
  grid-template-columns: 160px 1fr;
  gap: 1rem;
  transition: grid-template-columns 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

/* 2. 当任一容器被折叠时，应用相同的折叠样式 */
#impact-chart-layout-grid.legend-collapsed,
#split-impact-layout-grid.legend-collapsed {
  grid-template-columns: 0px 1fr;
  gap: 0;
}

/* 3. 为两个图表的折叠按钮应用相同的定位和动画 (按钮的 class 是共享的) */
/* 注意：这里我们不再指定父容器，因为按钮的初始定位由 JS 控制或有默认值 */
.legend-toggle-btn {
  position: absolute;
  top: 50%;
  /* 初始 left 值由 JS 或其他规则设定，我们主要关注折叠后的变化 */
  transform: translateY(-50%) translateX(-50%);
  z-index: 20;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: white;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.2s ease-in-out, background-color 0.2s;
}

.legend-toggle-btn:hover {
  background-color: #f3f4f6;
  transform: translateY(-50%) translateX(-50%) scale(1.1);
}

/* ===== START: 这是本次修复的核心 ===== */
/* 4. 当任一容器被折叠时，都将它内部的按钮移动到新的位置 */
#impact-chart-layout-grid.legend-collapsed .legend-toggle-btn,
#split-impact-layout-grid.legend-collapsed .legend-toggle-btn {
  left: 14px !important;
}
/* ===== END: 核心修复 ===== */

/* 5. 统一的暗色模式样式 */
.dark .legend-toggle-btn {
  background-color: #374151;
  border-color: #4b5563;
  color: #d1d5db;
}

.dark .legend-toggle-btn:hover {
  background-color: #4b5563;
}

/* 6. 统一的 chart-panel-main 样式 (防止内容溢出) */
#impact-chart-layout-grid > .flex.flex-col,
#split-impact-layout-grid .chart-panel-main {
  min-width: 0;
}

/* 7. 统一的 legend-panel-wrapper 样式 (如果存在) */
.legend-panel-wrapper {
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
/* ========================================================== */
/* ===== NEW: Comprehensive Analysis Mode Switcher Styles ===== */
/* ========================================================== */

.mode-switch-btn {
  padding: 0.5rem 1rem;
  border: none;
  background-color: transparent;
  color: #6b7280; /* gray-500 */
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 0.375rem; /* rounded-md */
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.dark .mode-switch-btn {
  color: #d1d5db; /* gray-300 */
}

.mode-switch-btn:hover:not(.active) {
  background-color: #e5e7eb; /* gray-200 */
  color: #1f2937; /* gray-800 */
}

.dark .mode-switch-btn:hover:not(.active) {
  background-color: #4b5563; /* gray-600 */
  color: #ffffff;
}

.mode-switch-btn.active {
  background-color: #ffffff;
  color: #4f46e5; /* indigo-600 */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.dark .mode-switch-btn.active {
  background-color: #374151; /* gray-700 */
  color: #a5b4fc; /* indigo-300 */
}
/* 1. 为两个图表的布局容器应用相同的 Grid 基础样式 */
#comprehensive-layout-grid,
#split-impact-layout-grid {
  display: grid;
  /* 初始图例宽度统一为 160px */
  grid-template-columns: 160px 1fr;
  gap: 1rem;
  transition: grid-template-columns 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

/* 2. 当任一容器被折叠时，应用相同的折叠样式 */
#comprehensive-layout-grid.legend-collapsed,
#split-impact-layout-grid.legend-collapsed {
  grid-template-columns: 0px 1fr;
  gap: 0;
}

/* 3. 【核心修复】确保图表面板在任何情况下都不会被 transform */
#comprehensive-layout-grid .chart-panel-main,
#split-impact-layout-grid .chart-panel-main {
  min-width: 0; /* 防止内容溢出的重要设置 */
  transform: none !important; /* 强制禁用任何平移动画 */
}

/* 4. 折叠按钮的样式 (保持不变，但为了完整性包含在此) */
.legend-toggle-btn {
  position: absolute;
  top: 50%;
  left: 160px; /* 初始位置与图例宽度匹配 */
  transform: translateY(-50%) translateX(-50%);
  z-index: 20;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: white;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.2s ease-in-out;
}

/* 5. 当任一容器被折叠时，都将它内部的按钮移动到新的位置 */
#comprehensive-layout-grid.legend-collapsed .legend-toggle-btn,
#split-impact-layout-grid.legend-collapsed .legend-toggle-btn {
  left: 14px !important;
}

/* 6. 图例面板容器的样式 */
.legend-panel-wrapper {
  overflow: hidden;
  transition: opacity 0.35s ease;
}

.legend-collapsed .legend-panel-wrapper {
  opacity: 0;
}

/* (这里可以接上您其他的暗色模式等样式) */
.dark .legend-toggle-btn {
  background-color: #374151;
  border-color: #4b5563;
  color: #d1d5db;
}
.dark .legend-toggle-btn:hover {
  background-color: #4b5563;
}
/* ========================================================== */
/* ===== 新增：用于禁用图表控件的辅助样式 ===== */
/* ========================================================== */

.disabled-control {
  opacity: 0.5;
  pointer-events: none; /* 关键：禁止所有鼠标事件，包括点击 */
  cursor: not-allowed;
}

/* 确保 label 及其内部元素也应用此样式 */
label.disabled-control {
  opacity: 0.5;
  cursor: not-allowed;
}
/* ========================================================== */
/* ===== 新增：修复深色模式下拨动开关的可见性问题 ===== */
/* ========================================================== */

/* 1. 为开关的背景轨道（toggle-bg）在深色模式下提供一个更亮的颜色 */
.dark .toggle-bg {
  background-color: #4b5563; /* Tailwind gray-600 */
  /* 添加一个 subtle 的边框来增加轮廓感 */
  border: 1px solid #6b7280; /* Tailwind gray-500 */
}

/* 2. 确保滑块（dot）在深色模式下是清晰可见的亮色 */
.dark .dot {
  background-color: #d1d5db; /* Tailwind gray-300 */
}

/* 3. 当开关被激活时，使用您图片中的亮青色，并移除边框 */
.dark input:checked ~ .toggle-bg {
  background-color: #14b8a6; /* 明亮的 Teal-500 */
  border-color: transparent; /* 激活时不需要边框 */
}

/* 4. 当开关被激活时，滑块变为纯白色，对比更强 */
.dark input:checked ~ .dot {
  background-color: #ffffff;
}

/* 5. (可选) 为开关添加平滑的颜色过渡动画 */
.toggle-bg,
.dot {
  transition: background-color 0.2s ease-in-out, transform 0.2s ease-in-out,
    border-color 0.2s ease-in-out;
}
/* ==========================================================================
   [新] 交互式图例项的视觉状态样式
   ========================================================================== */

/* 1. 当一个图例项被“隐藏”时应用的样式 (普通点击) */
.legend-item.legend-item-hidden .legend-text {
  text-decoration: line-through; /* 添加删除线 */
  color: #9ca3af; /* 文字颜色变浅 (Tailwind gray-400) */
}

.dark .legend-item.legend-item-hidden .legend-text {
  color: #6b7280; /* 深色模式下的文字颜色 (Tailwind gray-500) */
}

.legend-item.legend-item-hidden .legend-shape,
.legend-item.legend-item-hidden canvas {
  opacity: 0.4; /* 图标/颜色块的透明度降低 */
  filter: grayscale(80%); /* 使其变为灰色调 */
}

/* 2. 当一个图例项因上下文而被“禁用”时应用的样式 (例如，在隔离模式下) */
.legend-item.legend-item-disabled {
  opacity: 0.35; /* 整体透明度大幅降低 */
  pointer-events: none; /* 禁用所有鼠标事件，使其不可点击 */
  cursor: not-allowed; /* 显示“禁止”光标 */
}

/* 3. （可选，但推荐）确保隐藏和禁用的样式可以叠加，且禁用优先 */
/* 如果一个项同时被隐藏和禁用，我们优先显示“禁用”的样式 */
.legend-item.legend-item-disabled .legend-text {
  text-decoration: none; /* 移除可能存在的删除线，因为“禁用”是更强的状态 */
}

#comprehensive-chart-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
}

#comprehensive-chart-wrapper .chart-container {
  min-width: 720px;
  position: relative;
}

@media (max-width: 1023.98px) {
  #comprehensive-chart-wrapper .chart-container {
    min-width: 100%;
  }
}

/* ========================================================== */
/* ===== TABLE OPTIMIZATIONS (Scientific & Interactive) ===== */
/* ========================================================== */

/* 1. 容器：限制高度以启用内部滚动 */
.benchmark-table-container {
  max-height: 75vh; /* 限制表格最大高度 */
  overflow: auto; /* 启用双向滚动 */
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.dark .benchmark-table-container {
  border-color: #374151;
  background-color: #1f2937;
}

/* 2. 表格基础 */
.benchmark-table {
  border-collapse: separate; /* 必须为 separate 才能让 sticky 生效 */
  border-spacing: 0;
  width: 100%;
}

@media (max-width: 767.98px) {
  .benchmark-table th:nth-child(n + 9),
  .benchmark-table td:nth-child(n + 9) {
    display: none;
  }
}

@media (max-width: 479.98px) {
  .benchmark-table th:nth-child(n + 7),
  .benchmark-table td:nth-child(n + 7) {
    display: none;
  }
}

/* 3. 固定表头 (Sticky Header) */
.benchmark-table thead th {
  position: sticky;
  top: 0;
  z-index: 20; /* 必须高于普通单元格 */
  background-color: #f9fafb; /* gray-50 */
  color: #374151;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); /* 添加阴影增加层次感 */
}

.dark .benchmark-table thead th {
  background-color: #1f2937;
  color: #e5e7eb;
  border-bottom-color: #4b5563;
}

/* 4. 固定首列 (Sticky First Column - Dataset) */
/* 假设第一列是 Dataset */
.benchmark-table tbody td:first-child,
.benchmark-table thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 21; /* 比普通表头更高 */
  background-color: #ffffff; /* 必须有背景色，否则透明 */
  border-right: 1px solid #e5e7eb; /* 分隔线 */
}

.dark .benchmark-table tbody td:first-child,
.dark .benchmark-table thead th:first-child {
  background-color: #1f2937;
  border-right-color: #4b5563;
}

/* 表头左上角交叉点需要最高的层级 */
.benchmark-table thead th:first-child {
  z-index: 30;
  background-color: #f9fafb;
}
.dark .benchmark-table thead th:first-child {
  background-color: #1f2937;
}

/* 5. 数值列样式 (科研规范) */
.metric-cell {
  text-align: right; /* 右对齐 */
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; /* 等宽字体 */
  font-variant-numeric: tabular-nums; /* 强制数字等宽 */
  white-space: nowrap;
}

/* 6. 更好的行交互 */
.benchmark-table tbody tr {
  transition: background-color 0.15s ease;
}
.benchmark-table tbody tr:hover td {
  background-color: #eff6ff; /* blue-50 */
}
.dark .benchmark-table tbody tr:hover td {
  background-color: #374151; /* dark:gray-700 */
}

/* 选中行高亮 */
.benchmark-table tbody tr.highlighted-row td {
  background-color: #e0e7ff !important; /* indigo-100 */
}
.dark .benchmark-table tbody tr.highlighted-row td {
  background-color: #312e81 !important; /* indigo-900 */
}

/* 定位模式：搜索匹配的行高亮 */
.benchmark-table tbody tr.search-match-row td {
  background-color: #fef3c7 !important; /* amber-100 */
}
.dark .benchmark-table tbody tr.search-match-row td {
  background-color: #78350f !important; /* amber-900 */
}

/* 7. 图标链接样式 */
.resource-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  color: #6b7280;
  transition: all 0.2s;
}
.resource-icon:hover {
  background-color: #e5e7eb;
  color: #4f46e5;
}
/* 修复：强制悬浮面板在展开状态下允许溢出，确保下拉菜单可见 */
.floating-controls.open .controls-panel {
  overflow: visible !important;
}

/* 修复：确保下拉菜单层级最高，不被其他元素遮挡 */
.floating-controls .dropdown-menu {
  z-index: 9999 !important;
}
.performance-slider-thumb {
  position: absolute;
  top: 50%;
  /* 确保 left 在 JS 中设置，或默认为 0 */
  transform: translate(-50%, -50%);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  z-index: 20;
}

.performance-slider-thumb:hover {
  /* 关键：必须保留 translate(-50%, -50%) 才能保持居中 */
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2); /* 可选：增加悬浮阴影 */
}

.performance-slider-thumb.is-dragging {
  transform: translate(-50%, -50%) scale(1.25);
  cursor: grabbing;
}
/* ========================================== */
/* ===== 悬浮面板下拉菜单 终极修复补丁 ===== */
/* ========================================== */

/* 1. 确保面板展开时，绝对允许内容溢出 */
/* 注意：我们将 overflow: visible 加在 .open 状态下，或者通过 JS 添加的 .is-showing-dropdown 类上 */
.floating-controls.open .controls-panel {
  overflow: visible !important;
}

/* 2. 提升下拉菜单的层级，确保它浮在所有内容（包括 Canvas 图表和滑块）之上 */
.floating-controls .custom-dropdown .dropdown-menu {
  position: absolute !important;
  top: 100% !important;
  left: 0 !important;
  width: 100% !important;
  z-index: 10000 !important; /* 极高的层级 */

  /* 视觉样式复原，防止被全局样式覆盖 */
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  max-height: 200px;
  overflow-y: auto;
}

/* 智能上弹：当添加 .drop-up 时，改为在按钮上方展开 */
.floating-controls .custom-dropdown .dropdown-menu.drop-up {
  top: auto !important;
  bottom: 100% !important;
}
/* 兼容：如果 HTML 使用了 bottom-full 类（例如来自 Tailwind），也按上弹处理 */
.floating-controls .custom-dropdown .dropdown-menu.bottom-full {
  top: auto !important;
  bottom: 100% !important;
}

/* 暗色模式适配 */
html.dark .floating-controls .custom-dropdown .dropdown-menu {
  background-color: #374151;
  border-color: #4b5563;
}

/* 3. 确保包含下拉菜单的容器本身也是 visible 的 */
.floating-controls .chart-control-group,
.floating-controls .custom-dropdown {
  overflow: visible !important;
  position: relative; /* 确保下拉菜单相对于按钮定位 */
}

/* 4. 辅助类：当 JS 检测到下拉菜单打开时，强制父容器允许溢出 (双重保险) */
.controls-panel.is-showing-dropdown {
  z-index: 60;
  overflow: visible !important;
}

/* ========================================================== */
/* ===== 修复：浮动面板开关动画 (Unique ID Fix) ===== */
/* ========================================================== */

/* 1. 针对新 ID 的滑块移动动画 */
#fpPerformanceFilterToggle:checked ~ .toggle-dot {
  transform: translateX(100%);
}

/* 2. 针对新 ID 的背景颜色变化 */
#fpPerformanceFilterToggle:checked ~ .toggle-bg {
  background-color: #4f46e5; /* Indigo-600 */
  border-color: #4f46e5;
}

/* 3. 暗色模式适配 */
html.dark #fpPerformanceFilterToggle:checked ~ .toggle-bg {
  background-color: #6366f1; /* Indigo-500 */
  border-color: #6366f1;
}
