/* CSS Custom Properties - Design Tokens */
:root {
  /* Material Design 3 Inspired - Indigo/Teal Theme */
  --color-primary: #3f51b5;
  --color-primary-hover: #303f9f;
  --color-primary-light: #e8eaf6;
  --color-primary-dark: #1a237e;
  --color-secondary: #00897b;
  --color-secondary-hover: #00695c;
  --color-secondary-light: #e0f2f1;
  --color-success: #43a047;
  --color-success-hover: #2e7d32;
  --color-warning: #fb8c00;
  --color-warning-light: #fff3e0;
  --color-danger: #e53935;

  /* Neutrals - Material Design */
  --color-bg: #fafafa;
  --color-surface: #ffffff;
  --color-border: #e0e0e0;
  --color-border-hover: #bdbdbd;
  --color-text: #212121;
  --color-text-muted: #757575;
  --color-text-light: #9e9e9e;

  /* Dark accents */
  --color-dark: #263238;
  --color-dark-hover: #37474f;

  /* Spacing - using rem for scalability */
  --space-xs: 0.25rem;    /* 4px at 16px base */
  --space-sm: 0.5rem;     /* 8px */
  --space-md: 0.875rem;   /* 14px */
  --space-lg: 1.125rem;   /* 18px */
  --space-xl: 1.75rem;    /* 28px */

  /* Typography - using rem for scalability */
  --font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  --font-family-heading: "Poppins", sans-serif;
  --font-size-xs: 0.75rem;     /* 12px */
  --font-size-sm: 0.8125rem;   /* 13px */
  --font-size-base: 0.875rem;  /* 14px */
  --font-size-lg: 1rem;        /* 16px */
  --font-size-xl: 1.25rem;     /* 20px */
  --font-size-2xl: 1.5rem;     /* 24px */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Border radius - using rem for scalability */
  --radius-sm: 0.25rem;  /* 4px */
  --radius-md: 0.375rem; /* 6px */
  --radius-lg: 0.5rem;   /* 8px */

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
}

/* Custom Scrollbar - Thin and Elegant */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--color-text);
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  line-height: 1.5;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(
      circle at 20% 50%,
      rgba(79, 70, 229, 0.05) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 80%,
      rgba(13, 148, 136, 0.05) 0%,
      transparent 50%
    );
  pointer-events: none;
  z-index: 0;
}

.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  position: relative;
  z-index: 1;
}

.header-wrapper {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    var(--color-primary-dark) 100%
  );
  border-bottom: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  gap: 0.75rem;
  min-height: 2.5rem;
}

.header-wrapper::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

.header-wrapper h1 {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: #ffffff;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.demo-btn {
  background: linear-gradient(
    135deg,
    var(--color-secondary) 0%,
    var(--color-secondary-hover) 100%
  );
  color: white;
  border: none;
  border-radius: 24px;
  cursor: pointer;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  padding: 10px 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 8px rgba(0, 137, 123, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  white-space: nowrap;
}

.demo-btn:hover {
  box-shadow: 0 6px 16px rgba(0, 137, 123, 0.4);
  transform: translateY(-2px);
}

.demo-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 137, 123, 0.3);
}

.main-content {
  display: grid;
  grid-template-columns: 220px 1fr 1fr;
  grid-template-rows: 1fr;
  flex: 1;
  padding: var(--space-md);
  gap: var(--space-md);
  overflow: hidden;
  min-height: 0;
}

.main-content > * {
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

/* Sidebar Filters */
.filters-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
  width: 220px;
  flex-shrink: 0;
  padding-right: 0.25rem;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  overflow-y: auto;
}

.filter-section {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.filter-section:hover {
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
  border-color: rgba(79, 70, 229, 0.2);
}

.filter-section h3 {
  margin: 0 0 var(--space-md) 0;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
  font-family: "Josefin Sans", sans-serif;
  font-weight: 700;
}

.filter-group {
  margin-bottom: var(--space-md);
}

.filter-group:last-child {
  margin-bottom: 0;
}

.filter-group label {
  display: flex;
  align-items: center;
  padding: var(--space-xs) 0;
  font-size: var(--font-size-sm);
  color: var(--color-text);
  cursor: pointer;
  transition: color 0.2s ease;
}

.filter-group label:hover {
  color: var(--color-primary);
}

.filter-group input[type="checkbox"] {
  margin-right: var(--space-sm);
  cursor: pointer;
}

.filter-count {
  margin-left: auto;
  font-size: var(--font-size-xs);
  color: white;
  background-color: var(--color-primary);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-weight: var(--font-weight-semibold);
}

/* Center Workspace */
.workspace {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  overflow: hidden;
  padding-left: 0;
  min-height: 0;
  min-width: 0;
  flex: 1;
}

/* Selection Summary Panel */
.selection-summary {
  background: linear-gradient(
    135deg,
    rgba(238, 242, 255, 0.95) 0%,
    rgba(255, 255, 255, 0.95) 100%
  );
  backdrop-filter: blur(10px);
  border: 1px solid rgba(79, 70, 229, 0.2);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: 0 8px 16px rgba(79, 70, 229, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
}

.selection-summary::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(79, 70, 229, 0.05) 0%,
    transparent 70%
  );
  pointer-events: none;
}

.selection-summary h3 {
  margin: 0 0 var(--space-sm) 0;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  font-family: "Josefin Sans", sans-serif;
  font-weight: 700;
}

.summary-content {
  display: flex;
  gap: var(--space-lg);
  align-items: center;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.summary-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: var(--font-weight-semibold);
}

.summary-value {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
}

.summary-application {
  flex: 1;
}

.summary-application .summary-value {
  font-size: var(--font-size-base);
  color: var(--color-primary);
}

/* Right Results Panel */
.results-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  position: relative;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Panel System - Reusable component */
.panel {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

.panel-header {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}

.nav-bar {
  background: white;
  backdrop-filter: blur(10px);
  color: var(--color-text);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0;
  gap: 0.5rem;
  border-bottom: 2px solid #f3f4f6;
  position: relative;
  padding: 0.5rem 0.75rem 0;
}

.nav-bar div {
  cursor: pointer;
  color: #6b7280;
  padding: 0.875rem 1.25rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
  font-size: 0.875rem;
  position: relative;
  flex: 1;
  text-align: center;
  border-bottom: 3px solid transparent;
  border-radius: 8px 8px 0 0;
  letter-spacing: 0.01em;
  margin-bottom: -2px;
}

.nav-bar div:hover {
  background-color: #f9fafb;
  color: #4f46e5;
}

.nav-bar div.active {
  color: #4f46e5;
  font-weight: 700;
  border-bottom-color: #4f46e5;
  background-color: #f9fafb;
}

.nav-bar div:active {
  transform: translateY(0);
}

.graph-section {
  flex: 1;
  display: none;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}

.graph-section.active {
  display: flex;
}

.graph-container {
  flex: 1;
  background-color: transparent;
  border: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: auto;
  box-shadow: none;
  position: relative;
  min-height: 300px;
  max-height: 50vh; /* Limit to 50% of viewport height */
}

.graph-container.empty::before {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  background: linear-gradient(
    135deg,
    var(--color-primary-light) 0%,
    var(--color-secondary-light) 100%
  );
  border-radius: 50%;
  opacity: 0.3;
}

.graph-container.empty::after {
  content: "Results will appear here after analysis";
  position: absolute;
  color: var(--color-text-muted);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-medium);
  text-align: center;
  padding: var(--space-xl);
  max-width: 300px;
}

.graph-container embed[src=""],
.graph-container embed:not([src]) {
  display: none;
}

/* Ensure embeds scale properly within containers */
.graph-container embed {
  width: 100%;
  height: 100%;
  min-height: 300px;
  max-height: 50vh;
  object-fit: contain;
}

iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Benchmark Table */
.benchmark-container {
  flex: 1;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.05);
  min-height: 0;
  min-width: 0;
}

.benchmark-table-wrapper {
  flex: 1 1 0;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  background: var(--color-surface);
}

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

.benchmark-table thead {
  position: sticky;
  top: 0;
  background-color: var(--color-surface);
  z-index: 10;
}

.benchmark-table th {
  padding: var(--space-sm);
  text-align: left;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  border-bottom: 2px solid var(--color-border);
  background-color: var(--color-bg);
}

.benchmark-table th:first-child {
  width: 40px;
  text-align: center;
  padding-left: var(--space-md);
}

.benchmark-table th:nth-child(2) {
  width: 50px;
  text-align: center;
}

.benchmark-table td {
  padding: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--font-size-sm);
}

.benchmark-table td:first-child {
  padding-left: var(--space-md);
}

.benchmark-table td:last-child {
  padding-right: var(--space-md);
}

.benchmark-table tbody tr {
  transition: background-color 0.2s ease;
  cursor: pointer;
}

.benchmark-table tbody tr:hover {
  background-color: var(--color-primary-light);
}

.benchmark-table tbody tr.selected {
  background-color: var(--color-primary-light);
  border-left: 3px solid var(--color-primary);
}

.benchmark-table tbody tr.is-application {
  background-color: #fef3c7;
  border-left: 3px solid var(--color-warning);
}

.benchmark-table input[type="checkbox"],
.benchmark-table input[type="radio"] {
  cursor: pointer;
}
.default-header {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  padding-bottom: var(--space-sm);
  color: var(--color-text);
  margin-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}

.new-experiment {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-selection {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.05);
}

.pick-a-mode {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-md);
  font-family: "Josefin Sans", sans-serif;
  font-weight: 700;
}

.mode-selection-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  align-items: stretch;
}

/* Button System */
.btn {
  padding: var(--space-sm) var(--space-lg);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background-color: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
}

.btn-success {
  background-color: var(--color-success);
  color: white;
}

.btn-success:hover {
  background-color: var(--color-success-hover);
}

.add-button button,
.submit-container button {
  padding: var(--space-sm) var(--space-lg);
  background-color: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: var(--font-weight-medium);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.add-button button:hover,
.submit-container button:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.command {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
}
.command label {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px 20px;
  border-radius: 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid transparent;
}

.command label:hover {
  background-color: var(--color-primary-light);
  border-color: var(--color-primary);
  transform: translateX(4px);
}

.demo {
  background: linear-gradient(
    135deg,
    var(--color-secondary) 0%,
    var(--color-secondary-hover) 100%
  );
  color: white;
  border: none;
  border-radius: 24px;
  cursor: pointer;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  padding: 12px 28px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 8px rgba(0, 137, 123, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.demo:hover {
  box-shadow: 0 6px 16px rgba(0, 137, 123, 0.4);
  transform: translateY(-2px);
}

.demo:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 137, 123, 0.3);
}

.radioButton {
  margin-right: var(--space-sm);
  cursor: pointer;
}

.confirm-btn {
  display: block;
  background: linear-gradient(
    135deg,
    var(--color-secondary) 0%,
    var(--color-secondary-hover) 100%
  );
  color: white;
  text-align: center;
  border-radius: 28px;
  padding: 16px 48px;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 8px rgba(0, 137, 123, 0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
  width: 100%;
}

.confirm-btn:hover:not(:disabled) {
  box-shadow: 0 6px 16px rgba(0, 137, 123, 0.4);
  transform: translateY(-2px);
}

.confirm-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 137, 123, 0.3);
}

.confirm-btn:disabled {
  background: linear-gradient(
    135deg,
    var(--color-border) 0%,
    var(--color-text-light) 100%
  );
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.6;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xs);
  padding: var(--space-sm);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: grab;
  font-size: var(--font-size-sm);
  transition: all 0.2s ease;
}

.list-item:hover {
  border-color: var(--color-primary);
  background-color: var(--color-primary-light);
  box-shadow: var(--shadow-sm);
}

.list-item.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.list-item input:checked + div {
  background-color: var(--color-primary-light);
}

.arrow-btn {
  background-color: transparent;
  border: none;
  font-size: var(--font-size-lg);
  cursor: pointer;
  margin-left: var(--space-sm);
  color: var(--color-primary);
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.arrow-btn:hover {
  background-color: var(--color-primary-light);
  transform: translateX(2px);
}

.search {
  padding: 0 var(--space-xs) var(--space-sm) 0;
}

/* Beautiful Search Bars */
.search-wrapper {
  position: relative;
  width: 100%;
}

.search-wrapper::before {
  content: "🔍";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  pointer-events: none;
  opacity: 0.5;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-wrapper:focus-within::before {
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
}

.search input,
input[type="text"]#globalSearch,
input[type="text"]#newExperimentSearch {
  width: 100%;
  padding: 12px 12px 12px 40px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(79, 70, 229, 0.2);
  border-radius: 24px;
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.search input:focus,
input[type="text"]#globalSearch:focus,
input[type="text"]#newExperimentSearch:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15),
    0 0 0 4px rgba(79, 70, 229, 0.1);
  transform: translateY(-2px);
}

.search input::placeholder,
input[type="text"]#globalSearch::placeholder,
input[type="text"]#newExperimentSearch::placeholder {
  color: var(--color-text-muted);
  opacity: 0.7;
}

.graph-title {
  flex: 1;
  height: 100%;
}

.graph-title:not(:last-child) {
  border-right: 1px solid #ddd;
}
.graph {
  flex: 3;
  display: flex;
  flex-direction: column;
}

/* Warning System */
.warning {
  background-color: var(--color-warning-light);
  border: 1px solid var(--color-warning);
  border-left: 4px solid var(--color-warning);
  color: #92400e;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  margin: var(--space-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  min-height: 40px;
  box-shadow: var(--shadow-sm);
  flex-wrap: nowrap;
}

.warning span {
  flex: 1;
  min-width: 0;
}

.warning button {
  background: linear-gradient(
    135deg,
    var(--color-secondary) 0%,
    var(--color-secondary-hover) 100%
  );
  color: white;
  border: none;
  padding: var(--space-sm) var(--space-lg);
  border-radius: 20px;
  cursor: pointer;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(0, 137, 123, 0.3);
  white-space: nowrap;
  flex-shrink: 0;
}

.warning button:hover {
  box-shadow: 0 4px 8px rgba(0, 137, 123, 0.4);
  transform: translateY(-2px);
}

.add-new {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

/* Modal System */
#closeExperimentsModal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  justify-content: center;
  align-items: center;
  z-index: 1000;
  overflow-y: auto;
}


#closeExperimentsModal > div {
  background-color: var(--color-surface);
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 90%;
  max-height: 80%;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-box {
  background-color: var(--color-surface);
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 90%;
  max-height: 80%;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.3s ease;
}

.modal-close-btn {
  margin-top: var(--space-lg);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  border: none;
  padding: var(--space-sm) var(--space-xl);
  border-radius: 20px;
  cursor: pointer;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-base);
  transition: all 0.3s ease;
}

.modal-close-btn:hover {
  box-shadow: 0 4px 12px rgba(63, 81, 181, 0.4);
  transform: translateY(-2px);
}

.close-button {
  float: right;
  font-size: 28px;
  font-weight: bold;
  color: var(--color-text-muted);
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s ease;
}

.close-button:hover {
  color: var(--color-danger);
}

#closeExperimentsModal h3,
.modal-content h2 {
  margin-top: 0;
  color: var(--color-text);
  font-weight: var(--font-weight-bold);
}

#closeExperimentsModal button,
.modal-content button {
  background-color: var(--color-primary);
  color: white;
  border: none;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: var(--font-weight-medium);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

#closeExperimentsModal button:hover,
.modal-content button:hover {
  background-color: var(--color-primary-hover);
  box-shadow: var(--shadow-md);
}
#experimentInputs {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

#experimentInputs label {
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

#experimentInputs input {
  padding: var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
}

#experimentInputs input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

input[type="file"] {
  padding: var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  cursor: pointer;
}

/* Loader - Inline in Results Panel */
#loader {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  justify-content: center;
  align-items: center;
  z-index: 100;
  border-radius: var(--radius-lg);
}

#loader.show {
  display: flex;
}

#loader > div {
  text-align: center;
  padding: var(--space-xl);
}

#loader p {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  margin: 0;
  margin-top: var(--space-md);
}

/* Spinner animation */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto var(--space-md);
}

#newExperimentList .list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
  background-color: #f9f9f9;
  border-bottom: 1px solid #bbb;
  cursor: grab;
  font-size: 11px;
}

#newExperimentList .list-item.dragging {
  opacity: 0.5;
}

#newExperimentList .list-item input:checked + div {
  background-color: #e0f7fa;
}

#newExperimentList .arrow-btn {
  background-color: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  margin-left: 10px;
  color: #007bff;
}

/* Helper Text */
.helper-text {
  display: block;
  margin-top: var(--space-md);
  padding: var(--space-md);
  background-color: var(--color-secondary-light);
  border-left: 4px solid var(--color-secondary);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  text-align: center;
}

.helper-text.disabled {
  background-color: var(--color-bg);
  border-left-color: var(--color-text-muted);
  color: var(--color-text-muted);
}

.validation-message {
  display: none;
  margin-top: var(--space-sm);
  padding: var(--space-md);
  background-color: #fee;
  border: 1px solid var(--color-danger);
  border-radius: var(--radius-md);
  color: var(--color-danger);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.validation-message.show {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.validation-message::before {
  content: "⚠";
  font-size: var(--font-size-xl);
}

/* Clear Button */
.clear-selection-btn {
  background-color: transparent;
  color: var(--color-secondary);
  border: 2px solid var(--color-secondary);
  padding: 8px 20px;
  border-radius: 20px;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.clear-selection-btn:hover:not(:disabled) {
  background: linear-gradient(
    135deg,
    var(--color-secondary) 0%,
    var(--color-secondary-hover) 100%
  );
  border-color: var(--color-secondary);
  color: white;
  box-shadow: 0 2px 6px rgba(0, 137, 123, 0.3);
}

.clear-selection-btn:disabled {
  background-color: transparent;
  border-color: var(--color-border);
  color: var(--color-text-light);
  cursor: not-allowed;
  opacity: 0.5;
}

/* Sortable Columns */
.benchmark-table th {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.benchmark-table th.sortable:hover {
  background-color: var(--color-primary-light);
}

.benchmark-table th .sort-indicator {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  color: var(--color-text-muted);
}

.benchmark-table th.sort-asc .sort-indicator::after {
  content: "▲";
  color: var(--color-primary);
}

.benchmark-table th.sort-desc .sort-indicator::after {
  content: "▼";
  color: var(--color-primary);
}

/* Selection Stats Panel */
.stats-panel {
  background: linear-gradient(
    135deg,
    rgba(240, 253, 250, 0.95) 0%,
    rgba(255, 255, 255, 0.95) 100%
  );
  backdrop-filter: blur(10px);
  border: 1px solid rgba(13, 148, 136, 0.2);
  border-left: 4px solid var(--color-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  box-shadow: 0 8px 16px rgba(13, 148, 136, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
}

.stats-panel::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(13, 148, 136, 0.05) 0%,
    transparent 70%
  );
  pointer-events: none;
}

.stats-panel h3 {
  margin: 0 0 var(--space-md) 0;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-secondary);
  font-family: "Josefin Sans", sans-serif;
  font-weight: 700;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-sm);
}

.stat-item {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(5px);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid rgba(13, 148, 136, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stat-item:hover {
  box-shadow: 0 6px 12px rgba(13, 148, 136, 0.15);
  transform: translateY(-4px) scale(1.02);
  border-color: var(--color-secondary);
  background: rgba(255, 255, 255, 0.95);
}

.stat-label {
  font-size: var(--font-size-xs);
  color: var(--color-text);
  text-transform: uppercase;
  font-weight: var(--font-weight-semibold);
  margin-bottom: 2px;
  opacity: 0.8;
}

.stat-value {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-secondary);
}

.stat-item.empty .stat-value {
  color: var(--color-text-light);
}

/* Group Headers */
.group-header {
  background: linear-gradient(
    135deg,
    var(--color-primary-light) 0%,
    var(--color-surface) 100%
  );
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  cursor: pointer;
  user-select: none;
  border-left: 4px solid var(--color-primary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.group-header:hover {
  background: linear-gradient(
    135deg,
    var(--color-primary-light) 0%,
    var(--color-primary-light) 100%
  );
}

.group-header td {
  padding: var(--space-md) var(--space-sm);
  font-size: var(--font-size-base);
}

.group-toggle {
  display: inline-block;
  margin-right: var(--space-sm);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.group-header.collapsed .group-toggle {
  transform: rotate(-90deg);
}

.group-row {
  display: table-row;
}

.group-row.hidden {
  display: none;
}

.group-by-selector {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  font-weight: var(--font-weight-medium);
}

.group-by-selector select {
  padding: var(--space-xs) var(--space-sm);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.group-by-selector select:hover {
  border-color: var(--color-primary);
}

.group-by-selector select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* Add New Section & Modal */
.add-new {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-md);
  justify-content: space-between;
  align-items: flex-start;
}

.new-experiments-section {
  flex: 1;
  max-width: 40%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.05);
}

.new-experiments-section h3 {
  margin: 0 0 var(--space-sm) 0;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  font-family: "Josefin Sans", sans-serif;
  font-weight: 700;
}

.new-experiments-search {
  margin-bottom: var(--space-sm);
}

.new-experiments-search input {
  width: 100%;
  padding: var(--space-sm);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.new-experiments-search input:focus {
  outline: none;
  border-color: var(--color-secondary);
  box-shadow: 0 0 0 3px var(--color-secondary-light);
}

#newExperimentList {
  max-height: 20vh; /* Viewport-based height */
  overflow-y: auto;
}

#newExperimentList .list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm);
  margin-bottom: 2px;
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  cursor: grab;
  font-size: var(--font-size-sm);
  color: var(--color-text);
  transition: background-color 0.2s ease;
}

#newExperimentList .list-item:hover {
  background-color: var(--color-secondary-light);
}

#newExperimentList .list-item.dragging {
  opacity: 0.5;
}

#newExperimentList .arrow-btn {
  background-color: transparent;
  border: none;
  font-size: var(--font-size-lg);
  cursor: pointer;
  color: var(--color-secondary);
  transition: all 0.2s ease;
  padding: var(--space-xs);
}

#newExperimentList .arrow-btn:hover {
  color: var(--color-secondary-hover);
  transform: translateX(4px);
}

.add-new-btn {
  background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-secondary-hover) 100%);
  color: white;
  border: none;
  border-radius: 28px;
  padding: 14px 32px;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 4px 12px rgba(0, 137, 123, 0.35);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 160px;
  justify-content: center;
}

.add-new-btn:hover {
  box-shadow: 0 6px 20px rgba(0, 137, 123, 0.5);
  transform: translateY(-3px) scale(1.02);
}

.add-new-btn:active {
  transform: translateY(-1px) scale(1);
  box-shadow: 0 3px 8px rgba(0, 137, 123, 0.4);
}

/* Modal Styling */
.modal {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 2000;
  backdrop-filter: blur(4px);
}

.modal.show,
#addExperimentModal.show {
  display: flex !important;
}

.modal-content {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(250, 250, 250, 0.95) 100%);
  backdrop-filter: blur(20px);
  padding: 0;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 550px;
  max-height: 85vh;
  display: flex; /* Changed from default block */
  flex-direction: column; /* Stack children vertical */
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.5);
  position: relative;
  animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmerModal 3s infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes shimmerModal {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-content h2 {
  margin: 0;
  padding: var(--space-xl) var(--space-xl) var(--space-lg);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  font-family: var(--font-family-heading);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(63, 81, 181, 0.3);
  flex-shrink: 0; /* Prevent header from shrinking */
}

.modal-content h2::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: headerShimmer 4s infinite;
}

@keyframes headerShimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

.modal-content h2::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, 
    rgba(255, 255, 255, 0.3) 0%, 
    rgba(255, 255, 255, 0.8) 50%, 
    rgba(255, 255, 255, 0.3) 100%);
  animation: underlineGlow 2s ease-in-out infinite;
}

@keyframes underlineGlow {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* Modal body with padding */
.modal-body {
  padding: var(--space-xl);
  overflow-y: auto;
  flex: 1; /* Take up remaining space */
}

/* Modal footer */
.modal-footer {
  padding: var(--space-lg);
  background: rgba(255, 255, 255, 0.6);
  border-top: 1px solid var(--color-border);
  backdrop-filter: blur(10px);
  z-index: 5;
  flex-shrink: 0; /* Prevent footer from shrinking */
}

.modal-content > div:not(h2):not(.modal-body):not(.modal-footer) {
  padding: var(--space-xl);
}

#experimentInputs,
.file-upload-section {
  position: relative;
  z-index: 2;
}

.close-button {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  font-size: 28px;
  font-weight: bold;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  z-index: 10;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.close-button:hover {
  background: rgba(255, 255, 255, 0.25);
  color: white;
  transform: rotate(90deg) scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#experimentInputs {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  padding: var(--space-lg);
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-md);
  border: 1px solid rgba(63, 81, 181, 0.1);
}

#experimentInputs label {
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
  margin-bottom: var(--space-xs);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#experimentInputs input[type="text"] {
  padding: var(--space-md);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: white;
}

#experimentInputs input[type="text"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light), 0 4px 12px rgba(63, 81, 181, 0.15);
  transform: translateY(-2px);
}

.file-upload-section {
  margin-bottom: var(--space-lg);
  padding: var(--space-lg);
  background: rgba(224, 242, 241, 0.2);
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 137, 123, 0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.file-upload-section:hover {
  background: rgba(224, 242, 241, 0.3);
  border-color: rgba(0, 137, 123, 0.3);
  box-shadow: 0 4px 12px rgba(0, 137, 123, 0.1);
}

.file-upload-section p {
  font-size: var(--font-size-sm);
  color: var(--color-secondary);
  margin: 0 0 var(--space-md) 0;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.file-upload-section input[type="file"] {
  display: block;
  width: 100%;
  padding: var(--space-md);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(250, 250, 250, 0.95) 100%);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  position: relative;
}

.file-upload-section input[type="file"]::file-selector-button {
  background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-secondary-hover) 100%);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 8px 20px;
  margin-right: var(--space-md);
  cursor: pointer;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 137, 123, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.file-upload-section input[type="file"]::file-selector-button:hover {
  box-shadow: 0 4px 12px rgba(0, 137, 123, 0.4);
  transform: translateY(-2px);
}

.file-upload-section input[type="file"]:hover {
  border-color: var(--color-secondary);
  background: linear-gradient(135deg, rgba(224, 242, 241, 0.3) 0%, rgba(255, 255, 255, 0.95) 100%);
  box-shadow: 0 4px 12px rgba(0, 137, 123, 0.15);
}

.file-upload-section input[type="file"]:focus {
  outline: none;
  border-color: var(--color-secondary);
  border-style: solid;
  background: linear-gradient(135deg, rgba(224, 242, 241, 0.5) 0%, rgba(255, 255, 255, 1) 100%);
  box-shadow: 0 0 0 3px var(--color-secondary-light), 0 4px 12px rgba(0, 137, 123, 0.2);
}

.modal-submit-btn {
  background: linear-gradient(135deg, var(--color-success) 0%, var(--color-success-hover) 100%);
  color: white;
  border: none;
  border-radius: 28px;
  padding: 14px 36px;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 4px 12px rgba(67, 160, 71, 0.4);
  width: 100%;
  margin-top: 0; /* Removed margin as it's in footer now */
  position: relative;
  overflow: hidden;
}

.modal-submit-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.modal-submit-btn:hover::before {
  width: 300px;
  height: 300px;
}

.modal-submit-btn:hover {
  box-shadow: 0 6px 20px rgba(67, 160, 71, 0.5);
  transform: translateY(-3px);
}

.modal-submit-btn:active {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(67, 160, 71, 0.4);
}

/* Add Another Name Button */
.add-name-btn {
  background: transparent;
  color: var(--color-primary);
  border: 2px dashed var(--color-primary);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: var(--space-md) 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
}

.add-name-btn:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  border-style: solid;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(63, 81, 181, 0.15);
}

.add-name-btn:active {
  transform: translateY(0);
}

/* --- Responsive Scaling Fixes --- */

/* High DPI Scaling Support - 110-125% */
@media (max-width: 1600px) {
  .main-content {
    grid-template-columns: 160px 1fr minmax(280px, 1fr);
    gap: 0.5rem;
    padding: 0.5rem;
  }
  
  .filters-panel {
    width: 160px;
  }
  
  .header-wrapper h1 {
    font-size: var(--font-size-lg);
  }
  
  .demo-btn {
    padding: 0.5rem 1rem;
    font-size: var(--font-size-sm);
  }
  
  .benchmark-header {
    padding: 0.625rem 0.75rem;
    gap: 0.5rem;
  }
  
  .search-bar-inline {
    width: 160px;
  }
  
  .search-bar-inline input {
    padding: 0.5rem 0.625rem 0.5rem 2rem;
    font-size: 0.8125rem;
  }
  
  .group-by-selector {
    padding: 0.375rem 0.5rem;
  }
  
  .group-by-selector label {
    font-size: 0.75rem;
  }
  
  .group-by-selector select {
    font-size: 0.75rem;
  }
  
  .benchmark-header .add-new-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }
}

/* Higher DPI Scaling - 125-150% */
@media (max-width: 1400px) {
  .main-content {
    grid-template-columns: 140px 1fr minmax(250px, 1fr);
    gap: 0.5rem;
    padding: 0.5rem;
  }
  
  .filters-panel {
    width: 140px;
  }
  
  .nav-bar {
    padding: 0.25rem 0.5rem 0;
    gap: 0.25rem;
  }
  
  .nav-bar div {
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
  }
  
  .benchmark-header {
    padding: 0.625rem 0.75rem;
    gap: 0.75rem;
  }
  
  .search-bar-inline {
    width: 140px;
  }
  
  .search-bar-inline input {
    padding: 0.375rem 0.5rem 0.375rem 1.75rem;
    font-size: 0.75rem;
  }
  
  .search-bar-inline::before {
    font-size: 0.875rem;
    left: 0.5rem;
  }
  
  .group-by-selector {
    padding: 0.25rem 0.375rem;
  }
  
  .selection-toolbar {
    padding: 0.25rem 0.5rem;
  }
  
  .results-header {
    padding: 0.875rem 1rem;
  }
  
  .results-header h3 {
    font-size: 0.9375rem;
  }
}

/* Very High DPI - 150%+ or narrow screens */
@media (max-width: 1200px) {
  .main-content {
    grid-template-columns: 120px 1fr minmax(200px, 280px);
    gap: 0.375rem;
  }
  
  .filters-panel {
    width: 120px;
  }
  
  .filter-section {
    padding: 0.5rem;
  }
  
  .filter-section h3 {
    font-size: 0.6875rem;
    margin-bottom: 0.375rem;
    padding-bottom: 0.25rem;
  }
  
  .filter-group label {
    font-size: 0.6875rem;
    padding: 0.0625rem 0;
  }
  
  .filter-count {
    font-size: 0.5625rem;
    padding: 0.0625rem 0.25rem;
  }
  
  .benchmark-header {
    padding: 0.5rem;
    gap: 0.375rem;
  }
  
  .search-bar-inline {
    width: 120px;
  }
}

/* Extreme DPI / 175%+ or tablet-sized effective viewport */
@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 100px 1fr;
    grid-template-rows: 1fr auto;
  }
  
  .filters-panel {
    width: 100px;
  }
  
  .results-panel {
    grid-column: 1 / -1;
    min-height: 300px;
    max-height: 40vh;
  }
  
  .header-wrapper {
    padding: var(--space-sm) var(--space-md);
    min-height: auto;
  }
  
  .header-wrapper h1 {
    font-size: var(--font-size-base);
  }
  
  .analysis-bar {
    padding: var(--space-sm) var(--space-md);
  }
  
  .validation-chips {
    gap: 0.25rem;
    flex-wrap: wrap;
  }
  
  .validation-chip {
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
  }
}

/* Stack everything vertically at very small effective viewports */
@media (max-width: 900px) {
  .main-content {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    overflow-y: auto;
  }
  
  .filters-panel {
    flex-direction: row;
    flex-wrap: wrap;
    max-height: none;
    gap: 0.5rem;
  }
  
  .filter-section {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 150px;
  }
  
  .workspace {
    min-height: 300px;
  }
  
  .results-panel {
    min-height: 300px;
    max-height: none;
  }
}

/* Mobile / Very small screens */
@media (max-width: 768px) {
  .header-wrapper {
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
  }
  
  .analysis-bar-content {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .validation-chips {
    width: 100%;
  }
  
  .nav-bar div {
    padding: 0.5rem;
    font-size: 0.75rem;
  }
  
  .filter-section {
    flex: 1 1 100%;
  }
}

/* Fix for High DPI / Scaling - ensure text doesn't overflow buttons */
* {
  text-rendering: optimizeLegibility;
}

/* Ensure container doesn't exceed viewport */
.container {
  max-width: 100vw;
  overflow-x: hidden;
}

/* ===== STICKY ANALYSIS BAR ===== */
.analysis-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(250, 250, 250, 0.95) 100%);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  padding: 0.625rem 1.25rem;
}

.analysis-bar-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Validation Chips */
.validation-chips {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.validation-chip {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.875rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.validation-chip.met {
  background: linear-gradient(135deg, rgba(67, 160, 71, 0.08) 0%, rgba(46, 125, 50, 0.03) 100%);
  border-color: var(--color-success);
}

.validation-chip .chip-label {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.validation-chip .chip-value {
  color: var(--color-text-muted);
  font-size: 0.8125rem;
}

.validation-chip.met .chip-value {
  color: var(--color-success);
  font-weight: var(--font-weight-medium);
}

/* Analysis Bar Controls */
.analysis-bar-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.analysis-bar-control label {
  font-size: 0.6875rem;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  white-space: nowrap;
}

.analysis-bar-control select {
  padding: var(--space-sm) var(--space-md);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  background: white;
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 200px;
}

.analysis-bar-control select:hover {
  border-color: var(--color-primary);
}

.analysis-bar-control select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* Mode Toggle */
.mode-toggle {
  display: flex;
  gap: var(--space-xs);
  background: var(--color-bg);
  padding: 0.375rem;
  border-radius: 2rem;
  border: 2px solid var(--color-border);
}

.mode-option {
  display: flex;
  align-items: center;
  padding: 0.5rem 1.25rem;
  border-radius: 1.5rem;
  cursor: pointer !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.9375rem;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  user-select: none;
}

.mode-option input[type="radio"] {
  display: none;
}

.mode-option:hover {
  background: rgba(255, 255, 255, 0.5);
}

.mode-option input[type="radio"]:checked + span {
  color: white;
}

.mode-option:has(input[type="radio"]:checked) {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(63, 81, 181, 0.3);
}

/* Sticky Analyze Button */
.analyze-btn-sticky {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-secondary-hover) 100%);
  color: white;
  border: none;
  border-radius: 2rem;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 137, 123, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.analyze-btn-sticky .btn-icon {
  font-size: 0.875rem;
}

.analyze-btn-sticky:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(0, 137, 123, 0.5);
  transform: translateY(-2px);
}

.analyze-btn-sticky:active:not(:disabled) {
  transform: translateY(0);
}

.analyze-btn-sticky:disabled {
  background: linear-gradient(135deg, var(--color-border) 0%, var(--color-text-light) 100%);
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.6;
}

/* Responsive adjustments for analysis bar */
@media (max-width: 1400px) {
  .validation-chips {
    min-width: auto;
    flex-wrap: wrap;
  }
  
  .validation-chip {
    flex: 1 1 auto;
    min-width: 150px;
  }
}

@media (max-width: 1024px) {
  .analysis-bar {
    padding: var(--space-sm) var(--space-md);
  }
  
  .analysis-bar-content {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-sm);
  }
  
  .validation-chips {
    flex-direction: column;
  }
  
  .validation-chip {
    width: 100%;
  }
  
  .analyze-btn-sticky {
    width: 100%;
    justify-content: center;
  }
}

/* Results Header */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  border-bottom: none;
  cursor: pointer;
  user-select: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.results-header:hover {
  background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.15);
}

.results-header > div {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.results-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: white;
  letter-spacing: -0.01em;
}

.results-status {
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.collapse-toggle {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: white;
  backdrop-filter: blur(10px);
}

.collapse-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.08);
}

.toggle-icon {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.875rem;
  font-weight: bold;
}

.results-panel.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

/* Collapsible Results Panel */
.results-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: visible;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.results-panel .graph {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.results-panel.collapsed .graph {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.results-panel:not(.collapsed) .graph {
  max-height: none;
  opacity: 1;
}

/* Active Filters */
.active-filters {
  padding: var(--space-sm) var(--space-md);
  background: rgba(255, 248, 225, 0.5);
  border-bottom: 1px solid var(--color-border);
}

.active-filters-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xs);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.clear-filters-btn {
  padding: var(--space-xs) var(--space-sm);
  background: white;
  border: 1px solid var(--color-danger);
  border-radius: var(--radius-sm);
  color: var(--color-danger);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all 0.2s ease;
}

.clear-filters-btn:hover {
  background: var(--color-danger);
  color: white;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: white;
  border: 1px solid var(--color-primary);
  border-radius: 1rem;
  font-size: var(--font-size-xs);
  color: var(--color-primary);
  font-weight: var(--font-weight-medium);
}

.filter-chip-remove {
  cursor: pointer;
  font-weight: var(--font-weight-bold);
  color: var(--color-danger);
  transition: transform 0.2s ease;
}

.filter-chip-remove:hover {
  transform: scale(1.2);
}

/* Collapsible Filter Sections */
.filter-section-header {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
}

.filter-section-header:hover {
  color: var(--color-primary);
}

.toggle-arrow {
  font-size: 0.75rem;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
}

.filter-section.collapsed .toggle-arrow {
  transform: rotate(-90deg);
}

.filter-section.collapsed .filter-group {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0;
  margin: 0;
}

.filter-group {
  max-height: 500px;
  opacity: 1;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Selection Toolbar */
.selection-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: linear-gradient(135deg, rgba(238, 242, 255, 0.5) 0%, rgba(255, 255, 255, 0.8) 100%);
  border-bottom: 1px solid var(--color-border);
  gap: var(--space-md);
  position: sticky;
  top: 0;
  z-index: 10;
}

.selection-counter {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--font-size-sm);
}

.counter-label {
  color: var(--color-text-muted);
  font-weight: var(--font-weight-medium);
}

.counter-value {
  color: var(--color-primary);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-lg);
  min-width: 2rem;
  text-align: center;
}

.selection-actions {
  display: flex;
  gap: var(--space-xs);
}

.toolbar-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  background: white;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0.2, 1);
  white-space: nowrap;
}

.toolbar-btn:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(63, 81, 181, 0.2);
}

.toolbar-btn:active {
  transform: translateY(0);
}

.toolbar-btn.secondary {
  border-color: #ddd;
  color: #666;
}

.toolbar-btn.secondary:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: #999;
  color: #333;
}

/* Benchmark Header */
.benchmark-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: linear-gradient(to bottom, #ffffff, #f8f9fa);
  border-bottom: 2px solid #e5e7eb;
  gap: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.benchmark-header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex: 1;
}

.search-bar-inline {
  flex: 0 0 auto;
  width: 260px;
  position: relative;
}

.search-bar-inline::before {
  content: "🔍";
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  pointer-events: none;
  opacity: 0.5;
  z-index: 1;
}

.search-bar-inline input {
  width: 100%;
  padding: 0.625rem 1rem 0.625rem 2.5rem;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.875rem;
  background: white;
  transition: all 0.2s ease;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.search-bar-inline input:hover {
  border-color: #9ca3af;
}

.search-bar-inline input:focus {
  outline: none;
  border-color: #4f46e5;
  background: white;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1), 0 1px 2px rgba(0, 0, 0, 0.05);
}

.search-bar-inline input::placeholder {
  color: #9ca3af;
  font-size: 0.875rem;
}

.group-by-selector {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  background: white;
  padding: 0.5rem 0.875rem;
  border-radius: 8px;
  border: 1.5px solid #e5e7eb;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.group-by-selector:hover {
  border-color: #d1d5db;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.group-by-selector label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.group-by-selector select {
  padding: 0.25rem 0.5rem;
  border: none;
  border-radius: 4px;
  font-size: 0.875rem;
  background: transparent;
  color: #111827;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  outline: none;
}

.group-by-selector select:hover {
  background: #f3f4f6;
}

.group-by-selector select:focus {
  background: #f3f4f6;
}

.benchmark-header .add-new-btn {
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  white-space: nowrap;
  border-radius: 8px;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 4px rgba(0, 137, 123, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.benchmark-header .add-new-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 137, 123, 0.35), 0 2px 4px rgba(0, 0, 0, 0.08);
}

.benchmark-header .add-new-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 137, 123, 0.2);
}

/* Benchmark Name Column - Truncation with Ellipsis */
.benchmark-table td:nth-child(3) {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Prevent text selection on interactive elements */
button,
input[type="button"],
input[type="submit"],
label,
.toolbar-btn,
.add-new-btn,
.clear-selection-btn,
.clear-filters-btn,
.collapse-toggle,
.analyze-btn-sticky,
.demo-btn,
.filter-section-header,
.filter-chip-remove,
.nav-bar div,
.graph-title,
.validation-chip,
.mode-toggle,
.benchmark-header,
.selection-toolbar,
.active-filters-header {
  user-select: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  cursor: default;
}

/* Ensure buttons have pointer cursor */
button:not(:disabled),
.toolbar-btn,
.add-new-btn,
.clear-selection-btn,
.clear-filters-btn,
.collapse-toggle,
.analyze-btn-sticky:not(:disabled),
.demo-btn:not(:disabled),
.filter-chip-remove {
  cursor: pointer !important;
}

/* === HIGH DPI SCALING FIXES - Benchmark Header Only === */

/* 125% scaling - make benchmark header elements wrap/shrink */
@media (max-width: 1536px) {
  .benchmark-header {
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }
  
  .benchmark-header-left {
    flex: 1 1 auto;
    min-width: 0;
    gap: 0.75rem;
  }
  
  .search-bar-inline {
    width: 200px;
    flex-shrink: 1;
    min-width: 140px;
  }
  
  .benchmark-header .add-new-btn {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
  }
}

/* 150% scaling - more aggressive shrinking */
@media (max-width: 1280px) {
  .benchmark-header {
    padding: 0.5rem 0.75rem;
    gap: 0.375rem;
  }
  
  .benchmark-header-left {
    gap: 0.5rem;
  }
  
  .search-bar-inline {
    width: 160px;
    min-width: 120px;
  }
  
  .search-bar-inline input {
    padding: 0.5rem 0.75rem 0.5rem 2rem;
    font-size: 0.8125rem;
  }
  
  .search-bar-inline::before {
    left: 0.625rem;
    font-size: 0.875rem;
  }
  
  .group-by-selector {
    padding: 0.375rem 0.5rem;
    gap: 0.375rem;
  }
  
  .group-by-selector label {
    font-size: 0.75rem;
  }
  
  .group-by-selector select {
    font-size: 0.75rem;
    padding: 0.125rem 0.25rem;
  }
  
  .benchmark-header .add-new-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    min-width: auto;
  }
}

/* 175%+ scaling - stack elements if needed */
@media (max-width: 1024px) {
  .benchmark-header-left {
    flex-wrap: wrap;
  }
  
  .search-bar-inline {
    width: 100%;
    max-width: 200px;
  }
  
  .group-by-selector {
    flex-shrink: 1;
  }
}

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

/* 150% DPI Scaling */
@media (max-width: 1280px) {
  :root {
    --space-xs: 0.1875rem;
    --space-sm: 0.375rem;
    --space-md: 0.625rem;
    --space-lg: 0.875rem;
    --space-xl: 1.25rem;
    --font-size-xs: 0.6875rem;
    --font-size-sm: 0.75rem;
    --font-size-base: 0.8125rem;
    --font-size-lg: 0.875rem;
  }
  
  .analysis-bar {
    padding: 0.5rem 0.75rem;
  }
  
  .validation-chip {
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
  }
  
  .mode-toggle {
    padding: 0.25rem;
  }
  
  .mode-option {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
  }
  
  .analyze-btn-sticky {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
  }
}

/* 175% DPI Scaling */
@media (max-width: 1100px) {
  :root {
    --space-xs: 0.125rem;
    --space-sm: 0.25rem;
    --space-md: 0.5rem;
    --space-lg: 0.75rem;
    --space-xl: 1rem;
    --font-size-xs: 0.625rem;
    --font-size-sm: 0.6875rem;
    --font-size-base: 0.75rem;
    --font-size-lg: 0.8125rem;
  }
  
  .main-content {
    grid-template-columns: 140px 1fr 280px;
    gap: 0.5rem;
    padding: 0.5rem;
  }
  
  .analysis-bar {
    padding: 0.375rem 0.625rem;
  }
  
  .analysis-bar-content {
    gap: 0.5rem;
  }
  
  .validation-chip {
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    gap: 0.125rem;
  }
  
  .mode-toggle {
    padding: 0.1875rem;
  }
  
  .mode-option {
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
  }
  
  .analyze-btn-sticky {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
  }
  
  .filter-section h3 {
    font-size: 0.75rem;
    padding-bottom: 0.25rem;
  }
  
  .filter-option label {
    font-size: 0.6875rem;
  }
  
  .nav-bar div {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }
}

/* 200% DPI Scaling / Tablet Portrait */
@media (max-width: 960px) {
  :root {
    --font-size-xs: 0.5625rem;
    --font-size-sm: 0.625rem;
    --font-size-base: 0.6875rem;
    --font-size-lg: 0.75rem;
  }
  
  .main-content {
    grid-template-columns: 120px 1fr 240px;
    gap: 0.375rem;
    padding: 0.375rem;
  }
  
  .filters-panel {
    padding: 0.5rem;
  }
  
  .filter-section {
    margin-bottom: 0.5rem;
  }
  
  .filter-section h3 {
    font-size: 0.6875rem;
  }
  
  .filter-option label {
    font-size: 0.625rem;
  }
  
  .count-badge {
    font-size: 0.5625rem;
    padding: 0.125rem 0.375rem;
  }
  
  .results-header h2 {
    font-size: 1rem;
  }
  
  .results-header .run-status {
    font-size: 0.625rem;
  }
}

/* Tablet / Small laptop - Stack layout */
@media (max-width: 850px) {
  .main-content {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto;
    gap: 0.5rem;
    padding: 0.5rem;
    height: auto;
    min-height: calc(100vh - 120px);
  }
  
  .filters-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    max-height: none;
    overflow: visible;
    order: 1;
  }
  
  .filter-section {
    margin-bottom: 0;
  }
  
  .workspace {
    order: 2;
    min-height: 350px;
    max-height: 50vh;
  }
  
  .results-panel {
    order: 3;
    min-height: 300px;
    max-height: none;
  }
  
  .analysis-bar-content {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .validation-chips {
    justify-content: center;
    flex-wrap: wrap;
  }
}

/* Mobile Landscape */
@media (max-width: 700px) {
  /* Reset root font sizes for mobile */
  :root {
    --font-size-xs: 0.6875rem;
    --font-size-sm: 0.75rem;
    --font-size-base: 0.8125rem;
    --font-size-lg: 0.875rem;
    --font-size-xl: 1rem;
  }
  
  .container {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }
  
  /* Header - compact mobile version */
  .header-wrapper {
    padding: 0.625rem 0.75rem;
    flex-direction: row;
    justify-content: space-between;
  }
  
  .header-title {
    font-size: 0.8125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
  }
  
  .demo-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.6875rem;
  }
  
  /* Analysis bar - horizontal scroll for chips */
  .analysis-bar {
    padding: 0.5rem 0.625rem;
  }
  
  .analysis-bar-content {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }
  
  .validation-chips {
    flex-wrap: nowrap;
    gap: 0.375rem;
    flex-shrink: 0;
  }
  
  .validation-chip {
    padding: 0.25rem 0.5rem;
    font-size: 0.625rem;
    white-space: nowrap;
    flex-shrink: 0;
  }
  
  .analysis-bar-control {
    flex-shrink: 0;
    gap: 0.375rem;
  }
  
  .mode-toggle {
    padding: 0.1875rem;
    gap: 0.25rem;
  }
  
  .mode-option {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    white-space: nowrap;
  }
  
  .analyze-btn-sticky {
    padding: 0.375rem 0.625rem;
    font-size: 0.6875rem;
  }
  
  /* Main content - single column */
  .main-content {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 140px);
    gap: 0.5rem;
    padding: 0.5rem;
  }
  
  /* Filters - hidden on mobile */
  .filters-panel {
    display: none;
  }
  
  /* Workspace - benchmark table */
  .workspace {
    order: 2;
    flex: 2 1 auto;
    min-height: 320px;
    height: auto;
  }
  
  .benchmark-container {
    height: 100%;
    max-height: none;
  }
  
  .benchmark-header {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
  }
  
  .benchmark-header-left {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }
  
  .search-bar-inline {
    width: 100%;
    max-width: none;
  }
  
  .search-bar-inline input {
    font-size: 0.8125rem;
  }
  
  .group-by-selector {
    width: 100%;
    justify-content: space-between;
  }
  
  .benchmark-header .add-new-btn {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.75rem;
  }
  
  .benchmark-table-wrapper {
    flex: 1;
    max-height: none;
  }
  
  .benchmark-table th,
  .benchmark-table td {
    padding: 0.625rem 0.5rem;
    font-size: 0.75rem;
  }
  
  .benchmark-table input[type="checkbox"],
  .benchmark-table input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
    appearance: auto;
    -webkit-appearance: auto;
    -moz-appearance: auto;
    opacity: 1;
    display: inline-block;
  }
  
  .benchmark-table td:first-child,
  .benchmark-table th:first-child {
    width: 50px;
    text-align: center;
    padding: 0.5rem 0.25rem;
  }
  
  .benchmark-table td:nth-child(2),
  .benchmark-table th:nth-child(2) {
    width: 50px;
    text-align: center;
    padding: 0.5rem 0.25rem;
  }
  
  /* Results panel */
  .results-panel {
    order: 3;
    flex: 1 1 auto;
    min-height: 250px;
    max-height: none;
  }
  
  .results-header {
    padding: 0.75rem;
  }
  
  .results-header h2 {
    font-size: 1rem;
  }
  
  .nav-bar {
    flex-wrap: wrap;
    padding: 0.25rem;
  }
  
  .nav-bar div {
    flex: 1 1 45%;
    text-align: center;
    padding: 0.5rem 0.375rem;
    font-size: 0.6875rem;
  }
  
  .graph-container {
    min-height: 350px;
    max-height: 60vh;
  }
  
  .graph-container embed,
  .graph-container iframe {
    min-height: 350px;
    height: 100%;
  }
}

/* Mobile Portrait */
@media (max-width: 480px) {
  .header-wrapper {
    padding: 0.5rem;
  }
  
  .header-title {
    font-size: 0.6875rem;
    max-width: 65%;
  }
  
  .demo-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.625rem;
  }
  
  /* Analysis bar - stack on very small screens */
  .analysis-bar-content {
    flex-wrap: wrap;
  }
  
  .validation-chips {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }
  
  .analysis-bar-control {
    width: 100%;
    justify-content: space-between;
  }
  
  .mode-toggle {
    flex: 1;
    max-width: 60%;
  }
  
  .mode-option {
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
  }
  
  .analyze-btn-sticky {
    flex: 0 0 auto;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
  }
  
  /* Filters - hidden on mobile */
  .filters-panel {
    display: none;
  }
  
  /* Ensure radio/checkboxes visible */
  .benchmark-table input[type="checkbox"],
  .benchmark-table input[type="radio"] {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    cursor: pointer;
    appearance: auto;
    -webkit-appearance: auto;
    -moz-appearance: auto;
    opacity: 1;
    display: inline-block;
    margin: 0 auto;
  }
  
  .benchmark-table th,
  .benchmark-table td {
    padding: 0.5rem 0.375rem;
    font-size: 0.75rem;
  }
  
  .benchmark-table td:first-child,
  .benchmark-table th:first-child {
    width: 50px;
  }
  
  .benchmark-table td:nth-child(2),
  .benchmark-table th:nth-child(2) {
    width: 50px;
  }
  
  .nav-bar div {
    flex: 1 1 100%;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.625rem;
  }
  
  .nav-bar div:last-child {
    border-bottom: none;
  }
  
  .graph-container {
    min-height: 300px;
    max-height: 55vh;
  }
  
  .graph-container embed,
  .graph-container iframe {
    min-height: 300px;
    height: 100%;
  }
  
  /* Warning on mobile */
  .warning {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
  
  .warning button {
    width: 100%;
  }
}

/* Extra small devices */
@media (max-width: 360px) {
  .header-title {
    font-size: 0.75rem;
  }
  
  .validation-chip {
    font-size: 0.625rem;
    padding: 0.25rem 0.5rem;
  }
  
  .mode-option {
    padding: 0.375rem 0.625rem;
    font-size: 0.6875rem;
  }
  
  .analyze-btn-sticky {
    padding: 0.5rem 0.75rem;
    font-size: 0.6875rem;
  }
}

/* Landscape orientation for mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .main-content {
    grid-template-columns: 120px 1fr 200px;
    grid-template-rows: 1fr;
    height: calc(100vh - 100px);
  }
  
  .filters-panel {
    display: flex;
    flex-direction: column;
    max-height: 100%;
    overflow-y: auto;
  }
  
  .workspace {
    min-height: auto;
    max-height: none;
  }
  
  .results-panel {
    min-height: auto;
  }
  
  .header-wrapper {
    padding: 0.375rem 0.75rem;
  }
  
  .analysis-bar {
    padding: 0.25rem 0.5rem;
  }
}

/* Print styles */
@media print {
  .header-wrapper,
  .analysis-bar,
  .filters-panel,
  .benchmark-header,
  .nav-bar {
    display: none;
  }
  
  .main-content {
    display: block;
  }
  
  .results-panel {
    width: 100%;
    box-shadow: none;
    border: 1px solid #000;
  }
}
