/**
 * @file calibrator.css
 * @description Styles for Prompt Calibrator views. Uses fnd-cal- prefix.
 * @version-history
 *   v1.0.0 — 2026-03-29 — Initial styles
 *   v2.0.0 — 2026-03-29 — V2: batch, step, paste, progress, synthesis, reflection styles
 *   v2.1.0 — 2026-03-29 — V2 tab rewrite: list header, create bar, empty states, template details, warning, hints
 */

/* ── List View ── */
.fnd-cal-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.fnd-cal-list-title { margin: 0; }
.fnd-cal-archive-toggle {
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}
.fnd-cal-create-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.fnd-cal-create-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}
.fnd-cal-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-dim);
}
.fnd-cal-list { display: flex; flex-direction: column; gap: 0.75rem; }
.fnd-cal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: border-color 0.15s;
}
.fnd-cal-card:hover { border-color: var(--accent); }
.fnd-cal-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.fnd-cal-card-name { font-weight: 600; font-size: 1rem; }
.fnd-cal-card-version { font-size: 0.8rem; color: var(--text-dim); }
.fnd-cal-card-meta { display: flex; gap: 1rem; font-size: 0.8rem; color: var(--text-dim); flex-wrap: wrap; }
.fnd-cal-card-score {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 0.5rem;
  overflow: hidden;
}
.fnd-cal-card-score-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s;
}
.fnd-cal-card-score-text {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}
.fnd-cal-badge-archived {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: var(--bg-dim);
  color: var(--text-dim);
  font-weight: 500;
}

/* ── Detail View ── */
.fnd-cal-detail { display: flex; flex-direction: column; gap: 1.5rem; }
.fnd-cal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.fnd-cal-header input {
  font-size: 1.1rem;
  font-weight: 600;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  color: var(--text);
  flex: 1;
}
.fnd-cal-header input:focus { border-color: var(--accent); outline: none; }
.fnd-cal-header-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* ── Side-by-side Prompt + Target ── */
.fnd-cal-editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 768px) {
  .fnd-cal-editor { grid-template-columns: 1fr; }
}
.fnd-cal-editor-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.fnd-cal-editor-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.fnd-cal-editor textarea {
  min-height: 300px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.5;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  color: var(--text);
}
.fnd-cal-editor textarea:focus { border-color: var(--accent); outline: none; }
.fnd-cal-editor-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Version selector ── */
.fnd-cal-version-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  padding: 0.5rem 0;
}
.fnd-cal-version-bar select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  color: var(--text);
  font-size: 0.85rem;
}
.fnd-cal-readonly-badge {
  font-size: 0.7rem;
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
  background: var(--bg-dim);
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.fnd-cal-save-version-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
}
.fnd-cal-changelog-input {
  flex: 1;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
}
.fnd-cal-warning {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--warning);
  background: var(--bg-dim);
  border-radius: 0 4px 4px 0;
  font-size: 0.85rem;
  color: var(--warning);
}
.fnd-cal-hint {
  font-size: 0.85rem;
  color: var(--text-dim);
}
.fnd-cal-empty-inline {
  text-align: center;
  padding: 1rem;
  color: var(--text-dim);
}

/* ── Model List ── */
.fnd-cal-models { display: flex; flex-direction: column; gap: 0.5rem; }
.fnd-cal-model-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.fnd-cal-model-row select {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  color: var(--text);
  font-size: 0.85rem;
  flex: 1;
  max-width: 300px;
}
.fnd-cal-model-label { font-weight: 500; min-width: 120px; }
.fnd-cal-model-provider { font-size: 0.8rem; color: var(--text-dim); }
.fnd-cal-model-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
}
.fnd-cal-model-remove:hover { color: var(--danger); }

/* ── Run Actions ── */
.fnd-cal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  padding: 0.75rem 0;
}

/* ── Chart ── */
.fnd-cal-chart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}
.fnd-cal-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.fnd-cal-chart-title { font-weight: 600; font-size: 0.9rem; }
.fnd-cal-chart svg { width: 100%; }
.fnd-cal-chart-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  margin-top: 0.5rem;
}
.fnd-cal-chart-legend-item { display: flex; align-items: center; gap: 0.35rem; }
.fnd-cal-chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* ── Run History ── */
.fnd-cal-runs { display: flex; flex-direction: column; gap: 0.75rem; }
.fnd-cal-run {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.fnd-cal-run-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  cursor: pointer;
}
.fnd-cal-run-header:hover { background: var(--bg-dim); }
.fnd-cal-run-summary { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.fnd-cal-run-model { font-weight: 600; }
.fnd-cal-run-score { font-weight: 600; }
.fnd-cal-run-score.pass { color: var(--success); }
.fnd-cal-run-score.mixed { color: var(--warning); }
.fnd-cal-run-score.fail { color: var(--danger); }
.fnd-cal-run-time { font-size: 0.8rem; color: var(--text-dim); }
.fnd-cal-run-dims { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.fnd-cal-dim-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-weight: 500;
}
.fnd-cal-dim-badge.pass { background: rgba(34,197,94,0.15); color: var(--success); }
.fnd-cal-dim-badge.fail { background: rgba(239,68,68,0.15); color: var(--danger); }

.fnd-cal-run-detail {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
}
.fnd-cal-run-detail pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.75rem;
  font-size: 0.75rem;
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.fnd-cal-run-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

/* ── Section titles ── */
.fnd-cal-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.fnd-cal-section-title {
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.75rem 1rem;
  background: var(--bg-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
.fnd-cal-section-body { padding: 1rem; }

/* ── Collapsible ── */
.fnd-cal-collapsed .fnd-cal-section-body { display: none; }

/* ── V2: Batch card ── */
.fnd-cal-batch { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; overflow: hidden; }
.fnd-cal-batch-header { padding: 12px 16px; cursor: pointer; display: flex; align-items: center; gap: 12px; background: var(--card); }
.fnd-cal-batch-header:hover { background: var(--bg-dim); }
.fnd-cal-batch-meta { display: flex; gap: 8px; align-items: center; font-size: 0.85rem; color: var(--text-dim); }
.fnd-cal-batch-scores { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.fnd-cal-batch-detail { padding: 16px; border-top: 1px solid var(--border); background: var(--surface); }

/* ── V2: Step sections inside expanded batch ── */
.fnd-cal-step { border: 1px solid var(--border); border-radius: 6px; margin-bottom: 12px; }
.fnd-cal-step summary { padding: 10px 14px; cursor: pointer; font-weight: 600; font-size: 0.9rem; background: var(--card); border-radius: 6px; }
.fnd-cal-step summary:hover { background: var(--bg-dim); }
.fnd-cal-step[open] summary { border-radius: 6px 6px 0 0; border-bottom: 1px solid var(--border); }
.fnd-cal-step-body { padding: 14px; }
.fnd-cal-step-model { padding: 10px 0; border-bottom: 1px solid var(--border); }
.fnd-cal-step-model:last-child { border-bottom: none; }
.fnd-cal-step-actions { display: flex; gap: 8px; padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--border); }

/* ── V2: Paste-back textarea ── */
.fnd-cal-paste { margin-top: 8px; }
.fnd-cal-paste textarea { width: 100%; min-height: 120px; font-family: var(--font-mono); font-size: 0.85rem; padding: 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text); resize: vertical; }
.fnd-cal-paste-actions { display: flex; gap: 8px; margin-top: 6px; }

/* ── V2: Progress indicator ── */
.fnd-cal-progress { padding: 8px 14px; font-size: 0.85rem; color: var(--accent); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.fnd-cal-progress::before { content: ''; display: inline-block; width: 12px; height: 12px; border: 2px solid var(--accent); border-top-color: transparent; border-radius: 50%; animation: fnd-cal-spin 0.8s linear infinite; }
@keyframes fnd-cal-spin { to { transform: rotate(360deg); } }

/* ── V2: Synthesis / Options ── */
.fnd-cal-synthesis { padding: 14px; }
.fnd-cal-proposal-card { border: 1px solid var(--border); border-radius: 6px; padding: 10px 14px; margin-bottom: 8px; background: var(--card); }
.fnd-cal-proposal-card .fnd-cal-proposal-sources { font-size: 0.8rem; color: var(--text-dim); margin-top: 4px; }
.fnd-cal-proposal-card .fnd-cal-proposal-impact { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }
.fnd-cal-proposal-impact.high { background: var(--success); color: #fff; }
.fnd-cal-proposal-impact.medium { background: var(--warning); color: #000; }
.fnd-cal-proposal-impact.low { background: var(--bg-dim); color: var(--text-dim); }
.fnd-cal-options { margin-top: 16px; }
.fnd-cal-option { border: 1px solid var(--border); border-radius: 6px; padding: 12px 16px; margin-bottom: 8px; cursor: pointer; background: var(--card); display: flex; align-items: flex-start; gap: 10px; }
.fnd-cal-option:hover { border-color: var(--accent); }
.fnd-cal-option.selected { border-color: var(--accent); background: var(--bg-dim); }
.fnd-cal-option input[type="radio"] { margin-top: 3px; }
.fnd-cal-option-label { font-weight: 600; }
.fnd-cal-option-impact { font-size: 0.85rem; color: var(--text-dim); margin-top: 2px; }
.fnd-cal-recommendation { margin-top: 12px; padding: 12px 16px; border-left: 3px solid var(--accent); background: var(--bg-dim); border-radius: 0 6px 6px 0; font-size: 0.9rem; }

/* ── V2: Reflection dual columns ── */
.fnd-cal-reflection-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) { .fnd-cal-reflection-cols { grid-template-columns: 1fr; } }
.fnd-cal-reflection-col { border: 1px solid var(--border); border-radius: 6px; padding: 12px; background: var(--card); }
.fnd-cal-reflection-col h4 { margin: 0 0 8px; font-size: 0.85rem; color: var(--text-dim); }

/* ── V2: Dimension table ── */
.fnd-cal-dim-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-top: 8px;
}
.fnd-cal-dim-table th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 2px solid var(--border);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.fnd-cal-dim-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.fnd-cal-dim-table tr:last-child td { border-bottom: none; }

/* ── V2: Collapsible pre blocks (inside steps) ── */
.fnd-cal-collapsible { margin-top: 4px; }
.fnd-cal-collapsible summary { padding: 4px 8px; cursor: pointer; font-size: 0.85rem; color: var(--text-dim); }

/* ── V2: Model parameter controls ── */
.fnd-cal-model-params { display: flex; gap: 12px; flex-wrap: wrap; }
.fnd-cal-model-param { display: flex; flex-direction: column; gap: 2px; font-size: 0.75rem; color: var(--text-dim); }
.fnd-cal-model-param input { width: 80px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; background: var(--card); color: var(--text); font-size: 0.8rem; }

/* ── V2: Template section ── */
.fnd-cal-templates { display: flex; flex-direction: column; gap: 8px; }
.fnd-cal-template-details {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.fnd-cal-template-details summary {
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  background: var(--card);
}
.fnd-cal-template-details summary:hover { background: var(--bg-dim); }
.fnd-cal-template-details[open] summary {
  border-bottom: 1px solid var(--border);
}
.fnd-cal-template-body { padding: 0.75rem; }
.fnd-cal-template-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}
.fnd-cal-template-textarea {
  width: 100%;
  min-height: 200px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.75rem;
  color: var(--text);
  resize: vertical;
}
.fnd-cal-template-textarea:focus { border-color: var(--accent); outline: none; }
.fnd-cal-template-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
