/* CSS Variables for Light/Dark Mode */
:root {
  /* Light mode colors (default) */
  --bg-primary: #ffffff;
  --bg-secondary: #f9f9f9;
  --bg-tertiary: #f5f5f5;
  --bg-card: #ffffff;
  --bg-hover: #f0f0f0;
  --bg-active: #e3f2fd;
  --bg-selected: #e3f2fd;
  --bg-multi-selected: #f1f8e9;
  --bg-warning: #fff3cd;
  --bg-success: #e8f5e9;
  --bg-error: #ffebee;
  
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-muted: #999999;
  --text-inverse: #ffffff;
  --text-success: #2e7d32;
  --text-error: #c62828;
  --text-warning: #856404;
  --text-info: #1565c0;
  --text-link: #2196F3;
  
  --border-primary: #eeeeee;
  --border-secondary: #dddddd;
  --border-tertiary: #cccccc;
  --border-active: #2196F3;
  --border-selected: #4CAF50;
  --border-warning: #ffeaa7;
  --border-error: #ffcccc;
  --border-success: #c8e6c9;
  --border-info: #bbdefb;
  
  --button-primary: #af4c8e;
  --button-primary-hover: #45a049;
  --button-secondary: #f44336;
  --button-secondary-hover: #da190b;
  --button-tertiary: #2196F3;
  --button-tertiary-hover: #1976D2;
  --button-warning: #FF9800;
  --button-disabled: #9e9e9e;

  --progress: #8BC34A;
  
  --shadow-light: rgba(0, 0, 0, 0.1);
  --shadow-medium: rgba(0, 0, 0, 0.2);
  --shadow-heavy: rgba(0, 0, 0, 0.3);
}

/* Dark mode colors */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --bg-tertiary: #2d2d2d;
    --bg-card: #1e1e1e;
    --bg-hover: #3d3d3d;
    --bg-active: #0d47a1;
    --bg-selected: #101c48;
    --bg-multi-selected: #152b0c;
    --bg-warning: #332701;
    --bg-success: #1b5e20;
    --bg-error: #7f0000;
    
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #707070;
    --text-inverse: #121212;
    --text-success: #81c784;
    --text-error: #ef9a9a;
    --text-warning: #ffd54f;
    --text-info: #64b5f6;
    --text-link: #90caf9;
    
    --border-primary: #333333;
    --border-secondary: #444444;
    --border-tertiary: #555555;
    --border-active: #64b5f6;
    --border-selected: #81c784;
    --border-warning: #ffb74d;
    --border-error: #e57373;
    --border-success: #66bb6a;
    --border-info: #42a5f5;
    
    --button-primary: #2e7d32;
    --button-primary-hover: #388e3c;
    --button-secondary: #c62828;
    --button-secondary-hover: #d32f2f;
    --button-tertiary: #1565c0;
    --button-tertiary-hover: #1976d2;
    --button-warning: #f57c00;
    --button-disabled: #616161;
    
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.5);
    --shadow-heavy: rgba(0, 0, 0, 0.7);
  }
}

* {
  -webkit-tap-highlight-color: transparent;
}

*:focus:not(:focus-visible) {
    outline: none;
}

#root {
  width: 100%;
  margin: 0 auto;
  padding: 1rem;
  text-align: center;
  background-color: var(--bg-primary);
  color: var(--text-primary);
}


/* App Header Styles */

/* App Footer Styles */

/* Bluetooth Warning Styles */
.bluetooth-warning {
  background: var(--bg-warning);
  border: 1px solid var(--border-warning);
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
  text-align: left;
}

.bluetooth-warning h3 {
  color: var(--text-warning);
  margin-top: 0;
}

.bluetooth-warning p {
  color: var(--text-warning);
  margin-bottom: 10px;
}

.bluetooth-warning ul {
  color: var(--text-warning);
  padding-left: 20px;
}

.bluetooth-warning li {
  margin-bottom: 5px;
}

/* Bluetooth Checking Overlay Styles */
.bluetooth-checking-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 1;
  transition: opacity 0.5s ease-in-out;
}

.bluetooth-checking-overlay.hiding {
  opacity: 0;
}

.bluetooth-checking-content {
  text-align: center;
  padding: 20px;
}

.bluetooth-checking-content h3 {
  margin: 0 0 20px 0;
  font-size: 1.5em;
  color: var(--text-primary);
  animation: pulse 1.5s infinite;
}

.warning-actions {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

.go-ahead-btn {
  background-color: transparent;
  color: var(--text-muted);
  border: 3px solid var(--text-muted);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 1em;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.5s ease;
}

.go-ahead-btn:hover {
  border: 3px solid var(--text-muted);
  background-color: var(--text-muted);
  color: var(--text-inverse);
  transform: translateY(-4px);
}

.go-ahead-btn:active {
  transform: translateY(-2px);
}

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

/* Bluetooth Warning Styles with transition effect */
.bluetooth-warning {
  background: var(--bg-warning);
  border: 1px solid var(--border-warning);
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
  text-align: left;
  animation: fadeInFromNone 0.5s ease-in-out forwards;
  max-width: 90vw;
  opacity: 0;
}

@keyframes fadeInFromNone {
  0% {
    opacity: 0;
    max-height: 0;
    padding: 0;
    margin: 0;
  }
  1% {
    opacity: 0;
    max-height: 0;
    padding: 0;
    margin: 0;
  }
  100% {
    opacity: 1;
    max-height: 500px;
    padding: 20px;
    margin: 20px 0;
  }
}

.bluetooth-warning h3 {
  color: var(--text-warning);
  margin-top: 0;
}

.bluetooth-warning p {
  color: var(--text-warning);
  margin-bottom: 10px;
}

.bluetooth-warning ul {
  color: var(--text-warning);
  padding-left: 20px;
}

.bluetooth-warning li {
  margin-bottom: 5px;
}

/* BLE Passthrough Styles */
.ble-passthrough {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  max-width: 800px;
  margin: 0 auto;
  padding: 15px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  padding-top: 70px; 
  padding-bottom: 100px;
  min-height: calc(100vh - 170px); 
  overflow-y: auto;
  box-sizing: border-box;
}

.connect-btn {
  background-color: var(--button-primary);
  color: var(--text-inverse);
}

.connect-btn:hover:not(:disabled) {
  background-color: var(--button-primary-hover);
}

.notify-status {
  padding: 5px 10px;
  border-radius: 4px;
  font-weight: 500;
}

.notify-status.active {
  background-color: var(--bg-success);
  color: var(--text-success);
}

.notify-status.inactive {
  background-color: var(--bg-error);
  color: var(--text-error);
}

/* Measurement Control Section Styles */

.measurement-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

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


.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--button-primary), var(--progress));
  transition: width 0.3s ease;
}

/* Measurement Results Styles */

.lab-values {
  display: flex;
  gap: 15px;
}

.lab-value {
  display: flex;
  align-items: center;
}

.lab-value .label {
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 5px;
  font-size: 0.9em;
}

.lab-value .value {
  font-family: monospace;
  color: var(--text-primary);
  font-size: 0.9em;
}

/* History Panel Styles */

.history-content {
  padding: 15px;
}

.history-list {
  max-height: 400px;
  overflow-y: auto;
}

.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  margin-bottom: 10px;
}

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

.history-time {
  font-weight: 600;
  color: var(--text-primary);
}

/* Real-time Data Section */

.empty-history {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 20px 0;
}

/* Debug Panel Styles */
.debug-panel {
  margin-bottom: 30px;
  text-align: left;
  border: 1px solid var(--border-secondary);
  border-radius: 8px;
  overflow: hidden;
}

.debug-header {
  background: var(--bg-tertiary);
  padding: 10px 15px;
  cursor: pointer;
  transition: background 0.2s;
}

.debug-header:hover {
  background: var(--bg-hover);
}

.debug-header h3 {
  margin: 0;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.debug-status {
  font-size: 0.8em;
  color: #777;
  font-weight: normal;
}

.debug-content {
  padding: 15px;
  background: var(--bg-secondary);
}

/* Send Data Section */
.send-data-section, .received-data-section, .log-section {
  margin-bottom: 20px;
  text-align: left;
}

.send-data-section h4, .received-data-section h4, .log-section h4 {
  margin-top: 0;
  color: #444;
  border-bottom: 1px solid var(--border-primary);
  padding-bottom: 5px;
}

.send-controls {
  background: var(--bg-primary);
  padding: 15px;
  border-radius: 6px;
  border: 1px solid var(--border-primary);
}

.mode-toggle {
  margin-bottom: 15px;
}

.mode-toggle label {
  margin-right: 15px;
  font-weight: 500;
}

.send-input {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.send-data-input {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border-secondary);
  border-radius: 4px;
  font-family: monospace;
}

.send-data-input:disabled {
  background-color: var(--bg-tertiary);
}

.send-btn {
  background-color: var(--button-warning);
  color: var(--text-inverse);
  border: none;
  border-radius: 4px;
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 500;
}

.send-btn:hover:not(:disabled) {
  background-color: #e68900;
}

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

.format-help {
  color: var(--text-secondary);
  font-size: 0.85em;
  font-style: italic;
}

.debug-data-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

@media (max-width: 768px) {
  .debug-data-container {
    grid-template-columns: 1fr;
  }
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.clear-btn {
  background-color: var(--button-disabled);
  color: var(--text-inverse);
  border: none;
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 0.8em;
}

.clear-btn:hover {
  background-color: #757575;
}

.data-display {
  background: var(--bg-primary);
  border: 1px solid var(--border-secondary);
  border-radius: 4px;
  padding: 15px;
  height: 200px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.9em;
  white-space: pre-wrap;
}

.received-display {
  background: var(--bg-card);
}

.log-display {
  background: var(--bg-secondary);
}

.data-item, .log-item {
  margin-bottom: 5px;
  padding: 2px 0;
  border-bottom: 1px solid var(--border-primary);
}

.data-item:last-child, .log-item:last-child {
  border-bottom: none;
}

.empty-state {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 20px;
}

.auto-scroll {
  margin-top: 10px;
  font-size: 0.85em;
}

.auto-scroll label {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Responsive Styles */
@media (max-width: 768px) {
  .ble-passthrough {
    padding: 10px;
  }
  
  .send-input {
    flex-direction: column;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .debug-header h3 {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
  
  .debug-status {
    align-self: flex-start;
  }
}


.chart-section {
  margin-bottom: 30px;
  text-align: left;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 20px;
}

.chart-section .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.chart-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.chart-metadata {
  display: flex;
  gap: 15px;
  font-size: 0.9em;
  color: var(--text-primary);
}

.chart-metadata .timestamp {
  font-weight: 600;
  color: var(--text-primary);
}

.chart-metadata .brightness {
  background: var(--bg-active);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--text-info);
}

.chart-metadata .status {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.85em;
}

.chart-metadata .status.completed {
  background: var(--bg-success);
  color: var(--text-success);
}

.chart-metadata .status.incomplete {
  background: var(--bg-error);
  color: var(--text-error);
}

.no-chart-data {
  text-align: center;
  color: var(--text-primary);
  padding: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-secondary);
  border-radius: 8px;
}

.no-chart-data p {
  margin: 10px 0;
}

/* History Section Styles */
.history-section {
  margin-bottom: 20px;
  text-align: left;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 12px;
}

.history-section .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.history-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.import-btn {
  background: transparent;
  border: 1px solid var(--border-secondary);
  border-radius: 4px;
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-secondary);
  transition: all 0.2s;
  font-size: 0.85em;
}

.import-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-tertiary);
  color: var(--text-primary);
}

.multi-select-toggle {
  background: transparent;
  border: 1px solid var(--border-secondary);
  border-radius: 4px;
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-secondary);
  transition: all 0.2s;
  font-size: 0.85em;
}

.multi-select-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--border-tertiary);
  color: var(--text-primary);
}

.multi-select-toggle.active {
  background: var(--bg-active);
  border-color: var(--button-tertiary);
  color: var(--text-link);
}

.multi-select-toggle.active:hover {
  background: var(--border-info);
  border-color: var(--button-tertiary-hover);
  color: var(--button-tertiary-hover);
}

/* Multi-select tool panel - 使用CSS transition实现动画 */
.multi-select-tool-panel {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-secondary);
  border-radius: 6px;
  margin-bottom: 12px;
  padding: 10px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease-in-out;
}

.multi-select-tool-panel.show-animation {
  max-height: 300px; /* 足够容纳所有按钮 */
  opacity: 1;
  transform: translateY(0);
}

.tool-panel-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.selection-tools, .action-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tool-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-secondary);
  border-radius: 4px;
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-secondary);
  transition: all 0.2s;
  font-size: 0.85em;
  min-width: 100px;
}

.tool-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-tertiary);
  color: var(--text-primary);
}

.tool-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.select-all-btn:hover:not(:disabled) {
  color: var(--button-primary);
  border-color: var(--border-selected);
}

.invert-btn:hover:not(:disabled) {
  color: var(--button-warning);
  border-color: var(--button-warning);
}

.deselect-btn:hover:not(:disabled) {
  color: var(--button-secondary);
  border-color: var(--button-secondary);
}

.export-btn:hover:not(:disabled) {
  color: #9C27B0;
  border-color: #9C27B0;
}

.compare-btn:hover:not(:disabled) {
  color: #009688;
  border-color: #009688;
}

.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
}

.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
}

.history-item:hover {
  border-color: var(--border-active);
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.1);
}

.history-item.selected {
  border-color: var(--bg-active);
  background: var(--bg-selected);
}

.history-item.multi-selected {
  border-color: var(--border-selected);
  background: var(--bg-multi-selected);
}

.history-color-gradient {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  border: 2px solid var(--border-secondary);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  flex-shrink: 0;
  background: linear-gradient(45deg, 
    var(--color-o3, #ccc) 0%, 
    var(--color-o2, #aaa) 50%, 
    var(--color-o1, #888) 100%
  );
  position: relative;
  overflow: hidden;
}

.history-color-gradient .checkmark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.history-color-gradient .checkmark svg {
  filter: drop-shadow(0 1px 2px var(--shadow-heavy));
}

.history-content {
  flex: 1;
  min-width: 0;
}

.history-time {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.85em;
  margin-bottom: 2px;
  line-height: 1.1;
}

.history-data {
  display: flex;
  flex-direction: column;
}

.lab-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1em;
}

.lab-value {
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.lab-value .label {
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 2px;
}

.lab-value .value {
  font-family: monospace;
  color: var(--text-primary);
  font-weight: 500;
}

.no-data {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.8em;
}

.empty-history {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 20px;
  grid-column: 1 / -1;
}

/* Chart Container Styles */
.chart-main {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}



.chart-container {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

/* Lab Colors Display - Below Chart */
.lab-colors-display {
  width: 100%;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-secondary);
  border-radius: 8px;
  box-sizing: border-box;
}

.lab-colors-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.lab-color-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.color-block {
  width: 25px;
  height: 25px;
  border-radius: 4px;
  border: 1px solid var(--border-secondary);
  box-shadow: 0 1px 3px var(--shadow-light);
  flex-shrink: 0;
}

.color-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.angle-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.85em;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lab-values {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.lab-value {
  font-family: monospace;
  font-size: 0.7em;
  color: var(--text-secondary);
  white-space: nowrap;
}



/* Mobile layout - Stacked */
@media (max-width: 768px) {
  .chart-main {
    flex-direction: column;
  }
  
  .lab-colors-display {
    width: 100%;
  }
  
  .lab-color-item {
    flex-direction: row;
  }
  
  .lab-values {
    gap: 8px;
  }
}

/* Fix chart container to prevent page deformation */
.chart-container {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

/* Ensure chart section doesn't cause horizontal scroll */
.chart-section {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

/* Responsive adjustments for other components */
@media (max-width: 768px) {
  
  .measurement-btn {
    width: 100%;
  }
  
  .chart-section .section-header,
  .history-section .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .chart-info {
    align-self: flex-start;
  }
  
  .chart-metadata {
    flex-direction: column;
    gap: 5px;
  }
  
  .history-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

.error-message {
  color: var(--text-error);
  text-align: center;
  padding: 20px;
  font-weight: 500;
}

/* Overall layout fixes */
.ble-passthrough {
  max-width: 100%;
  padding: 10px;
  box-sizing: border-box;
  overflow-x: hidden;
  padding-bottom: 80px; /* Space for bottom toolbar */
}

.chart-section {
  padding: 12px;
  margin-bottom: 15px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
}

/* Top Toolbar Styles - 顶栏，厚度为底栏的一半 */
.top-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-tertiary);
  box-shadow: 0 4px 20px var(--shadow-medium);
  z-index: 100;
  padding: 10px 24px;
  height: 45px; /* 底栏高度的一半 */
  display: flex;
  align-items: center;
  justify-content: space-between; /* 两端对齐，标题在左，状态指示器在右 */
}

/* 顶栏标题样式 */
.top-toolbar-title {
  font-size: 1.4em;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px var(--shadow-light);
}

/* 蓝牙状态指示器样式 */
.bluetooth-status-indicator {
  display: flex;
  align-items: center;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-left: 10px;
}

.status-dot.available {
  background-color: var(--text-success);
}

.status-dot.unavailable {
  background-color: var(--text-error);
}

/* 顶栏占位符样式 */
.top-toolbar-placeholder {
  height: 45px; /* 与顶栏高度相同 */
  width: 100%;
  margin-bottom: 10px; /* 添加一些间距 */
}

/* Bottom Toolbar Styles - 进一步加厚 */
.bottom-toolbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border-tertiary);
  box-shadow: 0 -4px 20px var(--shadow-medium);
  z-index: 100;
  padding: 20px 24px;
  height: 90px;
  display: flex;
  align-items: center;
}

.toolbar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  transition: all 0.3s ease;
}

/* 未连接状态：三个按钮均匀分布 */
.toolbar-content.disconnected {
  justify-content: space-between;
}

/* 连接状态：Debug按钮右对齐，其他按钮填满剩余空间 */
.toolbar-content.connected {
  justify-content: space-between;
}

/* 测量状态：Debug按钮右对齐，Start/Stop按钮填满剩余空间 */
.toolbar-content.measuring {
  justify-content: space-between;
}

/* 按钮容器 - 新的布局策略 */
.measurement-button-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s ease;
}

.connect-button-container {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  transition: all 0.3s ease;
}

.debug-button-container {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  transition: all 0.3s ease;
}

/* 未连接时：三个按钮均匀分布 */
.toolbar-content.disconnected .measurement-button-container {
  flex: 1;
  justify-content: center;
}

.toolbar-content.disconnected .connect-button-container {
  flex: 1;
  justify-content: center;
}

.toolbar-content.disconnected .debug-button-container {
  flex: 1;
  justify-content: flex-end;
}

/* 连接后：Connect按钮变成小图标，Start按钮变大 */
.toolbar-content.connected .measurement-button-container {
  flex: 1;
  justify-content: flex-start;
  margin-right: 16px;
}

.toolbar-content.connected .connect-button-container {
  flex: 0 0 auto;
  margin: 0 16px;
}

.toolbar-content.connected .debug-button-container {
  flex: 0 0 auto;
  justify-content: flex-end;
}

/* 测量时：Start/Stop按钮变大，Connect按钮小图标 */
.toolbar-content.measuring .measurement-button-container {
  flex: 1;
  justify-content: flex-start;
  margin-right: 16px;
}

.toolbar-content.measuring .connect-button-container {
  flex: 0 0 auto;
  margin: 0 16px;
}

.toolbar-content.measuring .debug-button-container {
  flex: 0 0 auto;
  justify-content: flex-end;
}

/* 按钮基础样式 */
.toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

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

/* Start按钮样式 - 连接后变大 */
.measurement-btn.start {
  background: var(--button-primary);
  color: var(--text-inverse);
  min-width: 120px;
  width: 100%;
  max-width: 300px;
  height: 50px;
  font-size: 1.1em;
  font-weight: 600;
}

.measurement-btn.start:hover:not(:disabled) {
  background: var(--button-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

/* 连接后Start按钮变大 - 加大圆角 */
.toolbar-content.connected .measurement-btn.start,
.toolbar-content.measuring .measurement-btn.start {
  max-width: 500px;
  height: 60px;
  font-size: 1.2em;
  padding: 12px 24px;
  border-radius: 16px;
}

/* Stop按钮样式 - 包含进度条，连接后变大 */
.measurement-btn.stop {
  background: var(--button-secondary);
  color: var(--text-inverse);
  min-width: 120px;
  width: 100%;
  max-width: 400px;
  position: relative;
  overflow: hidden;
  border: none;
  height: 50px;
  font-size: 1.1em;
  font-weight: 600;
}

.measurement-btn.stop:hover:not(:disabled) {
  background: var(--button-secondary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

/* 连接后Stop按钮变大 - 加大圆角 */
.toolbar-content.connected .measurement-btn.stop,
.toolbar-content.measuring .measurement-btn.stop {
  max-width: 500px;
  height: 60px;
  font-size: 1.2em;
  padding: 12px 24px;
  border-radius: 16px;
}

.stop-button-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  z-index: 2;
}

/* 进度百分比显示 */
.progress-percent {
  font-size: 0.85em;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

/* 进度条背景 - 充满整个按钮 */
.progress-background {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, 
    rgba(255, 255, 255, 0.15) 0%, 
    rgba(255, 255, 255, 0.25) 50%, 
    rgba(255, 255, 255, 0.15) 100%);
  border-radius: 8px;
  overflow: hidden;
  z-index: 1;
  transition: width 0.5s ease;
}

.progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, 
    rgba(255, 255, 255, 0.2) 0%, 
    rgba(255, 255, 255, 0.4) 50%, 
    rgba(255, 255, 255, 0.2) 100%);
  animation: progress-shimmer 1.5s infinite linear;
  border-radius: 8px;
}

@keyframes progress-shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* 测量时按钮的额外样式 */
.toolbar-content.measuring .measurement-btn.stop {
  background: linear-gradient(90deg, 
    var(--button-secondary) 0%, 
    var(--button-secondary-hover) 100%);
  box-shadow: 0 2px 8px rgba(244, 67, 54, 0.2);
}

/* Connect按钮样式 - 加厚加宽 */
.connect-btn {
  background: var(--button-tertiary);
  color: var(--text-inverse);
  min-width: 140px;
  height: 50px;
  font-size: 1.1em;
  font-weight: 600;
  border-radius: 12px;
}

.connect-btn:hover:not(:disabled) {
  background: var(--button-tertiary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

/* Disconnect小图标按钮 - 放大 */
.disconnect-btn-icon {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-secondary);
  min-width: auto;
  padding: 12px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  animation: shrink-button 0.3s ease;
}

.disconnect-btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-tertiary);
  transform: scale(1.1);
}

@keyframes shrink-button {
  0% {
    width: 120px;
    border-radius: 8px;
  }
  100% {
    width: 48px;
    border-radius: 50%;
  }
}

/* Debug按钮样式 - 放大 */
.debug-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-secondary);
  min-width: auto;
  padding: 12px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.debug-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-tertiary);
  transform: scale(1.1);
}

/* 连接状态动画 */
.connect-button-container.connected {
  animation: fade-in 0.3s ease;
}

@keyframes fade-in {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* 响应式调整 */
@media (max-width: 768px) {
  .toolbar-content {
    gap: 8px;
    padding: 0 5px;
  }
  
  .toolbar-btn {
    padding: 8px 12px;
    font-size: 0.9em;
  }
  
  .measurement-btn.start,
  .measurement-btn.stop {
    min-width: 100px;
    max-width: 250px;
  }
  
  .connect-btn {
    min-width: 100px;
  }
  
  .disconnect-btn-icon,
  .debug-btn {
    width: 40px;
    height: 40px;
    padding: 8px;
  }
  
  @keyframes shrink-button {
    0% {
      width: 100px;
      border-radius: 8px;
    }
    100% {
      width: 40px;
      border-radius: 50%;
    }
  }
}

@media (max-width: 480px) {
  .bottom-toolbar {
    padding: 8px 10px;
  }
  
  .toolbar-content {
    gap: 5px;
  }
  
  .toolbar-btn {
    padding: 6px 10px;
    font-size: 0.85em;
  }
  
  .measurement-btn.start,
  .measurement-btn.stop {
    min-width: 80px;
    max-width: 200px;
  }
  
  .connect-btn {
    min-width: 80px;
  }
  
  .disconnect-btn-icon,
  .debug-btn {
    width: 36px;
    height: 36px;
    padding: 6px;
  }
  
  @keyframes shrink-button {
    0% {
      width: 80px;
      border-radius: 8px;
    }
    100% {
      width: 36px;
      border-radius: 50%;
    }
  }
}

/* Connection Status Indicator */
.connection-status-indicator {
  text-align: center;
  margin: 10px 0;
}

/* Clear History Button in History Panel */
.clear-history-btn {
  background: transparent;
  border: 1px solid var(--border-secondary);
  border-radius: 4px;
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-secondary);
  transition: all 0.2s;
  font-size: 0.85em;
}

.clear-history-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-tertiary);
  color: var(--text-primary);
}

.clear-history-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Debug Dialog Styles */
.debug-dialog-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: 1000;
  padding: 20px;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.debug-dialog-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.debug-dialog {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 0 10px 40px var(--shadow-medium);
  max-width: 900px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.debug-dialog.hidden {
  opacity: 0;
  transform: scale(0.95);
}

.debug-dialog-header {
  background: var(--bg-tertiary);
  padding: 20px;
  border-bottom: 1px solid var(--border-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.debug-dialog-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.3em;
}

.debug-dialog-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  background: var(--bg-secondary);
}

.debug-status-section {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  border: 1px solid var(--border-primary);
}

.debug-status-section h4 {
  margin-top: 0;
  margin-bottom: 15px;
  color: var(--text-primary);
}

.status-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  transition: all 0.2s;
}

.status-row:hover {
  background: var(--bg-hover);
  border-color: var(--border-secondary);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px var(--shadow-light);
}

.status-label {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95em;
}

.status-value {
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.9em;
  min-width: 80px;
  text-align: center;
}

.status-value.connected {
  background: var(--bg-success);
  color: var(--text-success);
  border: 1px solid var(--border-success);
}

.status-value.disconnected {
  background: var(--bg-error);
  color: var(--text-error);
  border: 1px solid var(--border-error);
}

.status-value.active {
  background: var(--bg-success);
  color: var(--text-success);
  border: 1px solid var(--border-success);
}

.status-value.inactive {
  background: var(--bg-error);
  color: var(--text-error);
  border: 1px solid var(--border-error);
}

.data-display-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

.model-selection-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  transition: all 0.2s;
  margin-bottom: 20px;
}
.model-label{
  margin-left: 10px;
}

.model-btn { 
  margin-right: 10px;
  padding: 5px 10px;
  border: 1px solid var(--border-secondary);
  border-radius: 16px;;
  background: var(--bg-card);
  cursor: 'pointer';
  color: var(--text-secondary);
  transition: all 0.3s;
}

.model-btn:hover { 
  background: var(--bg-hover);
  border: 1px solid var(--bg-hover);
  color: var(--text-primary);
  box-shadow: 0 2px 6px var(--shadow-light);
}

@media (max-width: 768px) {
  .data-display-sections {
    grid-template-columns: 1fr;
  }
}

/* Remove old debug panel styles */
.debug-panel {
  display: none;
}

.compare-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.compare-dialog-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.compare-dialog {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 20px 60px var(--shadow-heavy);
  max-width: 1000px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.compare-dialog.hidden {
  opacity: 0;
  transform: scale(0.95);
}

.compare-dialog-header {
  background: var(--bg-tertiary);
  padding: 20px 30px;
  border-bottom: 1px solid var(--border-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.compare-dialog-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.3em;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.close-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.compare-dialog-content {
  padding: 30px;
  overflow-y: auto;
  flex: 1;
  background: var(--bg-secondary);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}

.compare-table th {
  background: var(--bg-tertiary);
  padding: 10px;
  text-align: left;
  border: 1px solid var(--border-secondary);
  font-weight: 600;
  color: var(--text-primary);
}

.compare-table td {
  padding: 10px;
  border: 1px solid var(--border-secondary);
  vertical-align: top;
}

.compare-table tr:nth-child(even) {
  background: var(--bg-secondary);
}

.compare-table tr:hover {
  background: var(--bg-hover);
}

.lab-values {
  font-family: monospace;
  color: var(--text-primary);
  font-size: 0.9em;
}

/* Measurement Selection Styles (like history items) */

.history-style-selection {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .history-style-selection {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

.history-color-gradient {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  border: 2px solid var(--border-secondary);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  flex-shrink: 0;
  background: linear-gradient(45deg, 
    var(--color-o3, #ccc) 0%, 
    var(--color-o2, #aaa) 50%, 
    var(--color-o1, #888) 100%
  );
  position: relative;
  overflow: hidden;
}

.history-content {
  flex: 1;
  min-width: 0;
}

.history-time {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95em;
  margin-bottom: 8px;
  line-height: 1.1;
}

.history-data {
  display: flex;
  flex-direction: column;
}

.lab-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1em;
}

.lab-value {
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.lab-value .label {
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 4px;
  font-size: 0.9em;
}

.lab-value .value {
  font-family: monospace;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.9em;
}

/* Delta-E Results Styles */
.delta-e-results {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-tertiary);
}

.delta-e-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
  background: var(--bg-card);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.delta-e-table th {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border-secondary);
}

.delta-e-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-tertiary);
  color: var(--text-primary);
}

.delta-e-table tr:last-child td {
  border-bottom: none;
}

.delta-e-table tr:nth-child(even) {
  background: var(--bg-secondary);
}

.delta-e-table tr:hover {
  background: var(--bg-secondary);
}

.delta-value {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 1.05em;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
}

.compare-table th {
  background: var(--bg-hover);
  padding: 14px 16px;
  text-align: left;
  border: 1px solid var(--border-tertiary);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9em;
}

.compare-table td {
  padding: 14px 16px;
  border: 1px solid var(--border-tertiary);
  vertical-align: top;
}

.compare-table tr:nth-child(even) {
  background: var(--bg-hover);
}

.lab-values {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
  color: var(--text-primary);
  font-size: 0.9em;
  line-height: 1.4;
}

.error-message {
  color: #e74c3c;
  text-align: center;
  padding: 30px;
  font-weight: 600;
  font-size: 1.1em;
  background: var(--bg-error);
  border-radius: 8px;
  border: 1px solid var(--border-error);
}

/* Theme Selection Section */
.theme-selection-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  transition: all 0.2s;
  margin-bottom: 20px;
}

.theme-label {
  color: var(--text-secondary);
  font-size: 14px;
}

.theme-label span {
  color: var(--text-primary);
  font-weight: 500;
}

.theme-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Custom Dropdown */
.custom-dropdown {
  position: relative;
}

.dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border-secondary);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  min-width: 140px;
  transition: all 0.2s ease;
}

.dropdown-trigger:hover:not(:disabled) {
  background: var(--bg-hover);
}

.dropdown-trigger:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.dropdown-arrow {
  transition: transform 0.2s ease;
  margin-left: auto;
}

.dropdown-arrow.open {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--bg-primary);
  border: 1px solid var(--border-secondary);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  overflow: hidden;
  animation: dropdownFadeIn 0.15s ease;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
  border-bottom: 1px solid var(--border-primary);
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover {
  background: var(--bg-hover);
}

.dropdown-item.active {
  background: var(--bg-active);
  color: var(--text-link);
}

.dropdown-item .item-name {
  font-weight: 500;
  font-size: 14px;
}

.dropdown-item .item-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.dropdown-item.active .item-desc {
  color: var(--text-link);
  opacity: 0.8;
}


/* Desktop layout - Comprehensive */
@media (min-width: 769px) {
  .ble-passthrough {
    max-width: 1200px; 
    padding: 15px;
    margin: 0 auto;
  }
  
  .chart-section {
    padding: 15px;
  }
  
  .chart-main {
    flex-direction: row;
    gap: 20px;
    align-items: flex-start;
  }
  
  .recharts-container {
    flex: 1;
    min-width: 0;
  }
  
  .lab-colors-display {
    flex: 0 0 200px; 
    min-width: 180px;
    max-width: 250px;
    height: fit-content;
  }
  
  .lab-colors-row {
    flex-direction: column;
    gap: 10px;
  }
  
  .lab-color-item {
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
  }
  
  .color-block {
    width: 30px;
    height: 30px;
  }
  
  .color-info {
    width: 100%;
  }
  
  .lab-values {
    flex-direction: column;
    gap: 2px;
  }
  
  .lab-value {
    text-align: center;
    width: 100%;
  }
  
  .compare-dialog {
    max-width: 1000px;
  }
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .compare-dialog {
    max-height: 95vh;
    border-radius: 12px;
  }
  
  .compare-dialog-header {
    padding: 18px 20px;
  }
  
  .compare-dialog-content {
    padding: 20px;
  }
  
  .delta-e-table,
  .compare-table {
    font-size: 0.85em;
  }
  
  .delta-e-table th,
  .delta-e-table td,
  .compare-table th,
  .compare-table td {
    padding: 10px 12px;
  }
}

/* Licenses Dialog */
.licenses-dialog-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: 1001;
  padding: 20px;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.licenses-dialog-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.licenses-dialog {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 0 10px 40px var(--shadow-medium);
  max-width: 800px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.licenses-dialog.hidden {
  opacity: 0;
  transform: scale(0.95);
}

.licenses-dialog-header {
  background: var(--bg-tertiary);
  padding: 20px;
  border-bottom: 1px solid var(--border-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.licenses-dialog-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.3em;
}

.licenses-dialog-scroll-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  overflow: hidden;
}

.licenses-scrollbar-track {
  position: absolute;
  right: 4px;
  top: 0;
  bottom: 0;
  width: 6px;
  background: transparent;
  z-index: 10;
  border-radius: 3px;
}

.licenses-scrollbar-thumb {
  width: 100%;
  height: 30px;
  background: var(--text-secondary);
  opacity: 0.4;
  border-radius: 3px;
  transition: opacity 0.2s;
  position: absolute;
  top: 0;
  left: 0;
  transform: translateY(0);
}

.licenses-scrollbar-thumb:hover {
  opacity: 0.7;
}

.licenses-dialog-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  background: var(--bg-secondary);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.licenses-dialog-content::-webkit-scrollbar {
  display: none;
}

.licenses-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: monospace;
  font-size: 0.9em;
  line-height: 1.6;
  color: var(--text-primary);
  margin: 0;
  text-align: left;
}

.loading-licenses {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px;
}

@media (max-width: 768px) {
  .licenses-dialog {
    max-height: 95vh;
    border-radius: 12px;
  }
  
  .licenses-dialog-header {
    padding: 18px 20px;
  }
  
  .licenses-dialog-content {
    padding: 20px;
  }
}