.metadata-diff-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 16px;
  overflow: auto;
  background: var(--editor-background);
  color: var(--editor-foreground);
}

.metadata-diff-panel h2 {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--editor-foreground);
}

.metadata-diff-panel h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--editor-foreground);
}

/* Stats Section */
.diff-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px;
  background: var(--sidebar-background);
  border-radius: 6px;
  border: 1px solid var(--sidebar-border);
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 11px;
  color: var(--descriptionForeground);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--editor-foreground);
}

/* Progress Section */
.diff-progress {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--sidebar-background);
  border-radius: 6px;
  border: 1px solid var(--sidebar-border);
}

.progress-bar-container {
  height: 6px;
  background: var(--input-background);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar {
  height: 100%;
  background: var(--button-background);
  border-radius: 3px;
  transition: width 0.2s ease;
}

.progress-text {
  font-size: 12px;
  color: var(--descriptionForeground);
  margin-top: 8px;
}

/* Actions Section */
.diff-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.diff-actions button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.diff-actions button.primary {
  background: var(--button-background);
  color: var(--button-foreground);
}

.diff-actions button.primary:hover:not(:disabled) {
  background: var(--button-hoverBackground);
}

.diff-actions button.secondary {
  background: var(--input-background);
  color: var(--editor-foreground);
  border: 1px solid var(--input-border);
}

.diff-actions button.secondary:hover:not(:disabled) {
  background: var(--list-hoverBackground);
}

.diff-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Entity Tabs */
.diff-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--input-border);
}

.diff-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--descriptionForeground);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.diff-tab:hover {
  color: var(--editor-foreground);
}

.diff-tab.active {
  color: var(--editor-foreground);
  border-bottom-color: var(--button-background);
  font-weight: 600;
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--badge-background, #e5a100);
  color: var(--badge-foreground, #fff);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

/* Results Section */
.diff-results {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.diff-summary {
  padding: 12px;
  background: var(--sidebar-background);
  border-radius: 6px;
  border: 1px solid var(--sidebar-border);
}

.diff-summary.no-differences {
  background: color-mix(in srgb, var(--testing-iconPassed) 10%, var(--sidebar-background));
  border-color: var(--testing-iconPassed);
}

.diff-summary.has-differences {
  background: color-mix(in srgb, var(--testing-iconFailed) 10%, var(--sidebar-background));
  border-color: var(--testing-iconFailed);
}

/* Field summary pills */
.diff-field-summaries {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.field-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 16px;
  border: 1px solid var(--input-border);
  background: var(--sidebar-background);
  color: var(--editor-foreground);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}

.field-pill:hover {
  background: var(--list-hoverBackground);
}

.field-pill.active {
  background: color-mix(in srgb, var(--button-background) 20%, var(--sidebar-background));
  border-color: var(--button-background);
  font-weight: 600;
}

.field-pill.clear-filter {
  padding: 5px 8px;
  border-color: var(--testing-iconFailed);
  color: var(--testing-iconFailed);
  font-weight: 600;
}

.field-pill-label {
  text-transform: capitalize;
}

.field-pill-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--badge-background, #e5a100);
  color: var(--badge-foreground, #fff);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
}

.field-pill-actions {
  display: inline-flex;
  gap: 2px;
  margin-left: 2px;
}

.pill-sync {
  padding: 1px 5px;
  font-size: 9px;
  font-weight: 600;
  border: 1px solid var(--input-border);
  border-radius: 3px;
  background: var(--input-background);
  color: var(--editor-foreground);
  cursor: pointer;
  transition: background 0.15s;
}

.pill-sync:hover:not(:disabled) {
  background: var(--list-hoverBackground);
}

.pill-sync:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pill-sync.db-to-file {
  border-color: var(--button-background);
  color: var(--button-background);
}

.pill-sync.file-to-db {
  border-color: var(--testing-iconQueued);
  color: var(--testing-iconQueued);
}

/* Item cards */
.diff-item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.diff-item-card {
  background: var(--sidebar-background);
  border: 1px solid var(--sidebar-border);
  border-radius: 6px;
  overflow: hidden;
}

.diff-item-header {
  padding: 8px 12px;
  font-weight: 600;
  font-size: 13px;
  background: var(--list-hoverBackground);
  border-bottom: 1px solid var(--sidebar-border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-missing-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--editorWarning-foreground) 18%, transparent);
  color: var(--editorWarning-foreground);
  white-space: nowrap;
  flex-shrink: 0;
}

.diff-item-card.file-missing {
  border-color: color-mix(in srgb, var(--editorWarning-foreground) 30%, var(--sidebar-border));
}

.diff-item-fields {
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.diff-field-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px;
  align-items: start;
  font-size: 12px;
}

.diff-field-name {
  font-weight: 600;
  text-transform: capitalize;
  color: var(--descriptionForeground);
  padding-top: 4px;
}

.diff-field-values {
  display: flex;
  gap: 8px;
}

.diff-field-value {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 8px;
  border-radius: 3px;
  font-family: var(--editor-font-family);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diff-field-value.db-value {
  background: color-mix(in srgb, var(--button-background) 12%, transparent);
  border: 1px solid var(--button-background);
}

.diff-field-value.file-value {
  background: color-mix(in srgb, var(--testing-iconQueued) 12%, transparent);
  border: 1px solid var(--testing-iconQueued);
}

.diff-field-value.file-value.missing {
  font-style: italic;
  color: var(--descriptionForeground);
}

.diff-source-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--descriptionForeground);
  margin-bottom: 1px;
}

/* Loading State */
.diff-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: var(--descriptionForeground);
}

.diff-loading .spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--input-border);
  border-top-color: var(--button-background);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Empty State */
.diff-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: var(--descriptionForeground);
  text-align: center;
}

.diff-empty .icon {
  font-size: 32px;
  opacity: 0.5;
}

/* Orphan Files */
.orphan-files-section {
  margin-top: 16px;
}

.orphan-files-section h3 {
  margin: 0 0 4px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--editorInfo-foreground, var(--editor-foreground));
}

.orphan-files-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.orphan-files-description {
  margin: 0 0 12px 0;
  font-size: 12px;
  color: var(--descriptionForeground);
}

.orphan-file-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--editorInfo-foreground, #3794ff) 18%, transparent);
  color: var(--editorInfo-foreground, #3794ff);
  white-space: nowrap;
  flex-shrink: 0;
}

.diff-item-card.orphan-file {
  border-color: color-mix(in srgb, var(--editorInfo-foreground, #3794ff) 30%, var(--sidebar-border));
}

.orphan-path {
  word-break: break-all;
  font-family: var(--vscode-editor-font-family, monospace);
  font-size: 11px;
}
