:root {
  --header-height: 52px;
}

html,
body {
  height: 100%;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: var(--header-height) 0 0 0;
  background-color: #f5f7fa;
  color: #333;
  overflow: hidden;
}

/* Sidebar Styles */
.sidebar-toggle {
  position: fixed;
  left: 300px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 60px;
  background-color: #3498db;
  opacity: 0.7;
  border: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  z-index: 1000;
  transition: left 0.3s ease;
  box-shadow: 2px 0 8px rgba(0,0,0,0.15);
}

body:not(.sidebar-open) .sidebar-toggle {
  left: 0px;
}

.sidebar-toggle:hover {
  background-color: #2980b9;
  width: 25px;
}

.sidebar-toggle .arrow {
  color: white;
  font-size: 14px;
  font-weight: bold;
  transition: transform 0.3s ease;
}

.sidebar {
  position: fixed;
  left: -300px;
  top: var(--header-height);
  width: 300px;
  height: calc(100vh - var(--header-height));
  background-color: white;
  box-shadow: 2px 0 15px rgba(0,0,0,0.1);
  z-index: 999;
  transition: left 0.3s ease;
}

.sidebar.open {
  left: 0;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  padding: 0;
  border-bottom: 1px solid #e2e8f0;
  background-color: #f8f9fa;
}

.sidebar-header h2 {
  margin: 0;
  color: #2c3e50;
  font-size: 20px;
}

.sidebar-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #7f8c8d;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.sidebar-close:hover {
  background-color: #e2e8f0;
  color: #2c3e50;
}

.sidebar-content {
  padding: 20px 20px 60px 20px;
  max-height: calc(100vh - var(--header-height) - 60px);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Sidebar tabs (in header) */
.sidebar-tabs {
  display: flex;
  gap: 0;
  width: 100%;
}

.sidebar-tab {
  flex: 1;
  padding: 14px 12px;
  border: none;
  background: none;
  font-size: 10px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
  border-bottom: 2px solid transparent;
  margin-bottom: -10px;
  margin-top: 17px;
}

.sidebar-tab:hover {
  color: #2c3e50;
}

.sidebar-tab.active {
  color: #3498db;
  border-bottom-color: #3498db;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.tab-panel-placeholder {
  padding: 20px 0;
  color: #94a3b8;
  font-size: 14px;
}

/* H-index pane */
.h-index-container {
  padding: 0;
}

.h-index-header {
  font-weight: 600;
  font-size: 15px;
  color: #2c3e50;
  margin-bottom: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.h-index-description {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 12px;
  line-height: 1.4;
}

.h-index-empty {
  color: #94a3b8;
  font-size: 13px;
  padding: 12px 0;
}

.h-index-loading {
  color: #64748b;
  font-size: 12px;
  padding: 8px 0;
  text-align: center;
}

.h-index-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: calc(100vh - var(--header-height) - 200px);
  overflow-y: auto;
}

.h-index-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
  padding: 6px 8px;
  border-bottom: 1px solid #f1f5f9;
}

.h-index-row:hover {
  background-color: #f8fafc;
}

.h-index-name {
  flex: 1;
  color: #334155;
  min-width: 0;
  font-weight: 500;
}

.h-index-score {
  font-weight: 600;
  color: #1e293b;
  flex-shrink: 0;
  min-width: 40px;
  text-align: right;
}

/* Summation pane */
.summation-container {
  padding: 0;
}

.summation-header {
  font-weight: 600;
  font-size: 15px;
  color: #2c3e50;
  margin-bottom: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.summation-description {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 12px;
  line-height: 1.4;
}

.summation-empty {
  color: #94a3b8;
  font-size: 13px;
  padding: 12px 0;
}

.summation-loading {
  color: #64748b;
  font-size: 12px;
  padding: 8px 0;
  text-align: center;
}

.summation-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: calc(100vh - var(--header-height) - 200px);
  overflow-y: auto;
}

.summation-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
  padding: 6px 8px;
  border-bottom: 1px solid #f1f5f9;
}

.summation-row:hover {
  background-color: #f8fafc;
}

.summation-name {
  flex: 1;
  color: #334155;
  min-width: 0;
  font-weight: 500;
}

.summation-score {
  font-weight: 600;
  color: #1e293b;
  flex-shrink: 0;
  min-width: 60px;
  text-align: right;
}

.summation-framework-score {
  font-weight: bold;
}

/* Outlier Data pane */
.outlier-data-container {
  padding: 0;
}

.outlier-data-header {
  font-weight: 600;
  font-size: 13px;
  color: #2c3e50;
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.outlier-data-description {
  font-size: 11px;
  color: #64748b;
  line-height: 1.4;
}

.outlier-data-empty {
  color: #94a3b8;
  font-size: 12px;
  padding: 8px 0;
}

.outlier-data-loading {
  color: #64748b;
  font-size: 12px;
  padding: 8px 0;
  text-align: center;
}

.outlier-data-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: calc(100vh - var(--header-height) - 200px);
  overflow-y: auto;
}

.outlier-data-row {
  display: flex;
  gap: 0px;
  padding: 4px 0;
  font-size: 12px;
}

.outlier-data-name {
  flex: 0 0 100px;
  color: #334155;
  word-wrap: break-word;
  font-weight: 600;
}

.outlier-data-metrics {
  flex: 1;
  color: #475569;
  font-size: 12px;
}

.outlier-data-metric-line {
  margin-bottom: 3px;
}

.outlier-data-metric-line:last-child {
  margin-bottom: 0;
}

.outlier-data-metric-line.outlier-bottom {
  color: #991b1b;
}

.outlier-data-metric-line.outlier-top {
  color: #166534;
}

.outlier-data-count {
  flex: 0 0 40px;
  text-align: right;
  font-weight: 600;
  color: #1e293b;
  font-size: 13px;
}

.outlier-data-tooltip {
  position: fixed;
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  max-width: 300px;
  pointer-events: none;
  font-size: 12px;
}

.outlier-data-tooltip.hidden {
  display: none;
}

.outlier-tooltip-item {
  margin-bottom: 3px;
  line-height: 1.4;
}

.outlier-tooltip-item:last-child {
  margin-bottom: 0;
}

.outlier-tooltip-item.outlier-bottom {
  color: #991b1b;
}

.outlier-tooltip-item.outlier-top {
  color: #166534;
}

.outlier-data-row:hover {
  background-color: #f8fafc;
  cursor: pointer;
}


.control-section {
  margin-bottom: 25px;
}

.control-section h3 {
  margin: 0 0 12px 0;
  color: #2c3e50;
  font-size: 16px;
  font-weight: 600;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 8px;
}

.control-section select {
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  background-color: white;
  transition: border-color 0.2s ease;
}

.control-section select:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Adjust main content when sidebar is open */
body.sidebar-open {
  margin-left: 300px;
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  padding: 10px 24px;
  background-color: white;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0px;
}

.header-title h1,
.header-title h2 {
  margin: 0;
}

h2 {
  font-size: 16px;
  margin-bottom: 4px;
  color: #64748b;
}

h1 {
  font-size: 30px;
  margin: 0;
  color: #2c3e50;
}

.header-left {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-width: 0;
}

.header-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.header-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  padding-right: 0;
}

.header-dataset {
  display: flex;
  align-items: center;
  gap: 10px;
}

#dataset-select {
  min-width: 220px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 14px;
  background-color: #fff;
}

.header .custom-upload {
  display: none;
  padding: 6px 8px;
}

.header .file-upload {
  font-size: 12px;
  padding: 6px 10px;
}

.header .file-name {
  font-size: 12px;
}

.control-bar {
  margin: 8px 0;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  width: 70%;
}

select {
  padding: 8px 15px;
  border-radius: 4px;
  border: 1px solid #ccc;
  font-size: 16px;
  margin-right: 10px;
  min-width: 200px;
}

.toggle-view {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-end;
  width: 30%;
}

.toggle-view-label {
  margin-right: 10px;
}

.toggle-view-select {
    max-width: 200px;
    display: flex;
}

.percentile-scroll-container {
  display: flex;
  height: calc(100vh - var(--header-height));
}

.country-identifier-container {
  display: flex;
  height: calc(100vh - var(--header-height));
}

.identifier-layout {
  display: flex;
  height: 100%;
  width: 100%;
}

.indicator-list {
  flex: 0 0 30%;
  overflow-y: auto;
  padding: 25px 10px 10px 20px;
  border-right: 1px solid #e2e8f0;
  background: #ffffff;
  max-height: calc(100vh - var(--header-height) - 20px);
}

.indicator-item {
  display: block;
  width: 100%;
  text-align: left;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.indicator-item:hover {
  background: #edf2f7;
}

.indicator-item.active {
  background: #e6f2fb;
  border-color: #3498db;
}

/* Category slider (Category Slider - Distributed) */
.category-slider {
  position: relative;
  display: flex;
  flex-direction: row;
  height: 95%;
}

.category-labels {
  flex: 1;
  padding-right: 12px;
  position: relative;
  min-height: 100%;
}

.category-label {
  position: absolute;
  left: 0;
  right: 0;
  padding: 4px 6px;
  cursor: pointer;
  user-select: none;
  font-size: 11px;
  line-height: 1.1;
  transform: translateY(-50%);
  transition: all 0.2s ease;
}

.category-label:hover {
  background: #f8f9fa;
  border-color: #ddd;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.category-label.active {
  background: #e6f2fb;
  border-color: #3498db;
  font-weight: bold;
  box-shadow: 0 2px 6px rgba(52, 152, 219, 0.2);
}

/* Multi-select selection list */
.multi-selection-box {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 16px;
  box-shadow: inset 0 1px 2px rgba(148, 163, 184, 0.18);
}

.multi-selection-box .multi-selection-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
  margin-bottom: 8px;
}

.multi-selection-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.multi-selection-chip {
  border: 1px solid #c4d4f5;
  background: #e0e7ff;
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.multi-selection-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(30, 64, 175, 0.15);
}

.multi-selection-chip.primary {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(239, 68, 68, 0.3);
}

.multi-selection-chip.empty {
  background: #e2e8f0;
  border-color: #cbd5f5;
  color: #64748b;
  cursor: default;
  box-shadow: none;
}

.multi-selection-chip.missing {
  border-style: dashed;
  border-color: #94a3b8;
  background: #f8fafc;
  color: #64748b;
  opacity: 0.8;
}

.multi-selection-chip.primary.missing {
  border-color: #f87171;
  background: #fca5a5;
  color: #7f1d1d;
}

/* Collapsible section styles */
.collapsible-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  margin: 0 0 8px 0;
  padding: 4px 0;
}

.collapsible-header:hover {
  color: #3b82f6;
}

.collapse-arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
}

.collapsible-header.collapsed .collapse-arrow {
  transform: rotate(-90deg);
}

.collapsible-content {
  overflow: hidden;
  transition: max-height 0.2s ease, opacity 0.2s ease;
}

.collapsible-content.collapsed {
  max-height: 0 !important;
  opacity: 0;
  margin: 0;
  padding: 0;
}

.filter-select-info {
  font-size: 12px;
  color: #475569;
  margin-bottom: 8px;
}

.filter-select-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.filter-row {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px;
}

.filter-row select,
.filter-row input[type="number"],
.filter-row input[type="text"] {
  min-width: 60px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-size: 11px;
  color: #1e293b;
}

.filter-row input[type="number"] {
  width: 60px;
}

.filter-empty {
  font-size: 12px;
  color: #64748b;
  font-style: italic;
}

.filter-row .filter-remove-btn {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 4px;
  padding: 0;
  font-size: 16px;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.filter-row .filter-remove-btn:hover {
  background: #fecaca;
}

.filter-select-add-btn {
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  border: 1px dashed #94a3b8;
  background: #e2e8f0;
  color: #1e293b;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.filter-select-add-btn:hover {
  background: #cbd5f5;
}

/* Selection Table Styles (Encode by Selection mode) */
.selection-table-container {
  position: relative;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  padding: 8px;
  border-radius: 8px;
  box-shadow: inset 0 1px 2px rgba(148, 163, 184, 0.18);
}

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

.selection-table-controls {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.selection-table-count-label {
  flex: 1;
  text-align: left;
}

.selection-table-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.selection-table-row:hover {
  border-color: #94a3b8;
}

.selection-table-row.active {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.selection-table-color {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  flex-shrink: 0;
}

.selection-table-color:hover {
  border-color: #64748b;
}

.selection-table-row select {
  flex: 1;
  min-width: 0;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  font-size: 12px;
  color: #1e293b;
}

.selection-table-remove {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 4px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.selection-table-remove:hover {
  background: #fecaca;
}

.selection-table-add-btn {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
  border-radius: 4px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.selection-table-add-btn:hover {
  background: #c7d2fe;
  transform: scale(1.05);
}

.selection-table-empty {
  font-size: 12px;
  color: #64748b;
  font-style: italic;
  text-align: center;
  padding: 12px;
}

.category-rail {
  position: sticky;
  top: 10px;
  width: 16px;
  margin-right: 4px;
  display: flex;
  justify-content: center;
}

.category-rail-track {
  position: relative;
  width: 4px;
  background: #e5e7eb;
  border-radius: 4px;
  touch-action: none;
}

.category-handle {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #9ca3af;
  border: 1px solid #6b7280;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  cursor: grab;
  touch-action: none;
}

.category-handle:active {
  cursor: grabbing;
}

.beeswarm-panel {
  flex: 1;
  position: relative;
  padding: 25px 20px 10px 20px;
  overflow: visible;
}

#beeswarm-svg {
  width: 100%;
  height: 100%;
}

.tooltip {
  position: absolute;
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 6px 8px;
  border-radius: 4px;
  pointer-events: none;
  font-size: 12px;
  user-select: none;
}

.hover-label {
  position: absolute;
  top: 6px;
  left: 6px;
  background: transparent !important;
  color: #2c3e50;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  font-size: 12px;
  font-weight: bold;
  user-select: none;
}

.scroll-section {
  flex: 1;
  height: calc(90vh - 100px);
  overflow-y: auto;
  padding: 0 20px;
  scrollbar-width: thin;
  scrollbar-color: #3498db #f1f1f1;
  max-width: 200px;
}

.scroll-section::-webkit-scrollbar {
  width: 8px;
}

.scroll-section::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.scroll-section::-webkit-scrollbar-thumb {
  background-color: #3498db;
  border-radius: 6px;
}

.visualization-section {
  flex: 2;
  position: sticky;
  top: 100px;
  height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 20px;
}

.percentile-display {
  font-size: 50px;
  font-weight: bold;
  color: #3498db;
  text-align: center;
}

.metric-cards {
  width: 90%;
  max-height: 60vh;
  overflow-y: auto;
  padding: 10px;
}

.metric-card {
  background-color: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 15px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  border-left: 5px solid #3498db;
  transition: all 0.3s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.metric-name {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 10px;
  color: #2c3e50;
}

.metric-value {
  font-size: 16px;
  margin-bottom: 5px;
}

.metric-percentile {
  font-size: 16px;
  color: #e74c3c;
  font-weight: bold;
}

.step {
  height: 25vh;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.3;
  transition: opacity 0.3s ease;
  margin: 2vh 0;
}

.step.is-active {
  opacity: 1;
}

.step-content {
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  text-align: center;
  width: 80%;
}

.percentile-label {
  font-size: 36px;
  font-weight: bold;
  color: #2c3e50;
}

.percentile-description {
  margin-top: 10px;
  color: #7f8c8d;
}

/* Inline metrics within percentile steps */
.inline-metrics {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  align-items: center;
}

.inline-metric-chip {
  position: relative;
  background: #dbeafe;
  color: #1e40af;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid #bfdbfe;
  max-width: fit-content;
}

.inline-metric-chip:hover {
  background: #bfdbfe;
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.inline-metric-chip:hover .inline-metric-tooltip {
  opacity: 1;
  visibility: visible;
}

.inline-metric-name {
  display: block;
  text-align: center;
  white-space: nowrap;
}

.inline-metric-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  background: #1e293b;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.inline-metric-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1e293b;
}

.tooltip-value {
  font-weight: 600;
  margin-bottom: 2px;
}

.tooltip-percentile {
  font-size: 10px;
  opacity: 0.8;
}

.no-inline-metrics {
  color: #cbd5e1;
  font-size: 12px;
  padding: 4px;
}

.loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  font-size: 18px;
}

.cors-info {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1001;
}

.cors-message {
  background: white;
  padding: 30px;
  border-radius: 10px;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  margin: 20px;
}

.cors-message h3 {
  margin-top: 0;
  color: #e67e22;
  font-size: 20px;
}

.cors-message p {
  margin-bottom: 15px;
  line-height: 1.5;
}

.cors-message ol {
  margin-left: 20px;
}

.cors-message li {
  margin-bottom: 10px;
}

.cors-message ul {
  margin: 8px 0;
  padding-left: 20px;
}

.cors-message code {
  background-color: #f8f9fa;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #e74c3c;
}

.cors-message button {
  background-color: #3498db;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  margin-top: 15px;
}

.cors-message button:hover {
  background-color: #2980b9;
}

.no-metrics {
  text-align: center;
  color: #7f8c8d;
  font-style: italic;
  padding: 20px;
}

.scroll-indicator {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #7f8c8d;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: bounce 2s infinite;
}

.scroll-icon {
  margin-top: 5px;
  font-size: 20px;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

#file-input {
  display: none;
}

.hidden {
  display: none !important;
}

.dataset-selector {
    display: flex;
    flex-direction: column;
    gap: 0px !important;
}

.dataset-options,
.encoding-mode-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.dataset-option,
.encoding-mode-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    margin: 0;
    line-height: 1.4;
    border-radius: 6px;
    transition: background-color 0.2s;
    width: 100%;
    border: 1px solid transparent;
}

.dataset-option:hover,
.encoding-mode-option:hover {
    background-color: #f8f9fa;
    border-color: #e2e8f0;
}

.dataset-option input[type="radio"]:checked + span,
.encoding-mode-option input[type="radio"]:checked + span {
    font-weight: 600;
    color: #3498db;
}

.dataset-option input[type="radio"],
.encoding-mode-option input[type="radio"] {
    margin: 0 !important;
}

.dataset-option span,
.encoding-mode-option span {
    font-size: 13px; /* slightly smaller */
    color: #2c3e50;
    font-weight: 500;
    line-height: 1 !important;
}

.custom-upload {
    display: flex;
    align-items: center;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.file-upload {
  display: inline-block;
  background-color: #2ecc71;
  color: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px;
  text-decoration: none;
}

.file-upload:hover {
  background-color: #27ae60;
}

.file-name {
  font-style: italic;
  color: #7f8c8d;
  font-size: 14px;
}

.country-info {
  margin-bottom: 5px;
  text-align: center;
  display: flex;
  flex-direction: row;
  gap: 20px;
}

.country-name {
  font-size: 50px;
  font-weight: bold;
  color: #2c3e50;
  text-align: left;
}

.instructions {
  margin-top: 20px;
  padding: 15px;
  background-color: #edf2f7;
  border-radius: 8px;
  color: #4a5568;
  text-align: center;
  font-size: 14px;
}

/* Map Popup Styles */
.map-popup {
  position: absolute;
  top: 0;
  right: 0;
  width: 400px;
  height: 350px;
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 0 0 0 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 150;
  resize: none;
}

.map-popup-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 4px 6px;
  background: rgba(248, 250, 252, 0.95);
  border-bottom: 1px solid #e2e8f0;
  user-select: none;
}

.map-resize-handle {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 16px;
  height: 16px;
  background: #3b82f6;
  cursor: nwse-resize;
  border-radius: 0 8px 0 8px;
  z-index: 10;
}

.map-resize-handle:hover {
  background: #2563eb;
}

.map-popup-header span {
  font-weight: 600;
  font-size: 14px;
  color: #1e293b;
}

.map-popup-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #64748b;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.map-popup-close:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.map-popup-content {
  padding: 10px;
}

.map-popup-content svg {
  display: block;
}

/* Column Selection Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal-dialog {
  background: white;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
}

.modal-body {
  padding: 16px 24px;
  overflow-y: auto;
  flex: 1;
}

.column-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px;
}

.column-list-item {
  padding: 10px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
  font-size: 14px;
  color: #334155;
}

.column-list-item:hover {
  background: #f1f5f9;
}

.column-list-item.selected {
  background: #dbeafe;
  color: #1e40af;
  font-weight: 500;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-btn {
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid;
  transition: all 0.15s ease;
}

.modal-btn-cancel {
  background: white;
  color: #64748b;
  border-color: #cbd5e1;
}

.modal-btn-cancel:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.modal-btn-ok {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.modal-btn-ok:hover {
  background: #2563eb;
  border-color: #2563eb;
}

.modal-btn-ok:disabled {
  background: #cbd5e1;
  border-color: #cbd5e1;
  color: #94a3b8;
  cursor: not-allowed;
}
