/* ═══ Results History Panel ═══ */
.history-panel {
  width: 100%;
  max-width: 640px;
  background: var(--bg-primary);
  border: 0.5px solid var(--border-tertiary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 4px;
}

.history-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--border-tertiary);
  cursor: pointer;
  user-select: none;
}

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

.history-icon { font-size: 14px; }

.history-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

.history-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-tertiary);
}

.history-chevron {
  font-size: 10px;
  color: var(--text-tertiary);
  transition: transform 0.2s;
}

.history-panel.open .history-chevron { transform: rotate(90deg); }

.history-body {
  display: none;
  max-height: 320px;
  overflow-y: auto;
}

.history-panel.open .history-body { display: block; }

.history-empty {
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-tertiary);
}

.history-loading {
  padding: 16px;
  text-align: center;
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Toolbar */
.history-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-bottom: 0.5px solid var(--border-tertiary);
  background: var(--bg-secondary);
}

.history-refresh-btn {
  margin-left: auto;
  font-size: 11px;
  padding: 4px 8px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  font-family: var(--font-sans);
}

.history-refresh-btn:hover { color: var(--text-secondary); background: var(--bg-primary); }

.history-sort-label {
  font-size: 10px;
  color: var(--text-tertiary);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* Result items */
.hist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-bottom: 0.5px solid var(--border-tertiary);
  cursor: pointer;
  transition: background 0.1s;
}

.hist-item:last-child { border-bottom: none; }
.hist-item:hover { background: var(--bg-secondary); }

.hist-score {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.hist-score.hi { background: rgba(5, 150, 105, 0.12); color: #059669; }
.hist-score.mid { background: rgba(217, 119, 6, 0.12); color: #D97706; }
.hist-score.lo { background: rgba(190, 58, 74, 0.12); color: #BE3A4A; }

.hist-info { flex: 1; min-width: 0; }

.hist-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hist-meta {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 2px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hist-meta-item {
  display: flex;
  align-items: center;
  gap: 3px;
}

.hist-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.hist-item:hover .hist-actions { opacity: 1; }

.hist-action-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hist-action-btn:hover { background: var(--bg-tertiary); color: var(--text-secondary); }
.hist-action-btn.delete:hover { background: var(--coral-light); color: var(--coral); }

/* Layer count badges in history */
.hist-layers {
  font-size: 9px;
  font-family: var(--font-mono);
  padding: 1px 5px;
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-tertiary);
  border: 0.5px solid var(--border-tertiary);
}
