/*
 * admin/css/pages/themes.css — Themes (card grid) and Edit theme (variant
 * pills, reference grid, model params, variant test). Loaded on demand by
 * pages/event/themes.js and theme-edit.js (ensureStylesheet). Every colour,
 * radius, font and easing is a var() from tokens.css.
 */

/* ── Themes list (the cards are the kit .theme-card in base.css) ────────── */
.themes-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Edit theme: Theme tab ──────────────────────────────────────────────── */
.theme-library-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-override {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Edit theme: variant pills ──────────────────────────────────────────── */
/* The kit .pill-group / .pill (base.css); the pressed pill is the variant
   being edited. Only what the kit has no word for lives here. */
.variant-pills .pill {
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: left;
}

/* The unsaved-changes dot before a variant's label. */
.variant-pill-dot {
  color: var(--warning);
  font-size: 11px;
}

.pill[aria-pressed="true"] .variant-pill-dot {
  color: inherit;
}

/* "+ Add variant" is an action, not a variant: an outlined pill (an inset
   ring, so it keeps the pills' height). */
.variant-add {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--border);
}

.variant-add:disabled,
.variant-add:disabled:hover {
  background: transparent;
  opacity: .5;
  cursor: not-allowed;
}

.variant-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.variant-delete-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

/* ── Reference images ───────────────────────────────────────────────────── */
.ref-field {
  gap: 8px;
}

.ref-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ref-tile {
  position: relative;
  width: 76px;
  height: 76px;
  overflow: hidden;
  border-radius: var(--radius-btn);
}

.ref-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ref-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--rail-bg) 72%, transparent);
  color: var(--rail-active-text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.ref-remove:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

.ref-remove:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.ref-add {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  padding: 0;
  border: 1px dashed var(--border);
  border-radius: var(--radius-btn);
  background: transparent;
  color: var(--text-dim);
  font-size: 22px;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease-ui);
}

.ref-add:hover {
  background: var(--surface-hi);
}

.ref-add:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.ref-add:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.ref-add:disabled:hover {
  background: transparent;
}

/* ── Model + params ─────────────────────────────────────────────────────── */
.model-block,
.model-params {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.model-params-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

/* Param names are API keys (aspect_ratio, cfg_scale): keep their case. */
.model-param-label,
.model-params .field-check .field-label {
  text-transform: none;
  letter-spacing: 0.01em;
}

.model-advanced-toggle {
  align-self: flex-start;
}

/* ── Variant test ───────────────────────────────────────────────────────── */
.variant-test {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.variant-test-row,
.variant-test-picked {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.variant-test-thumb {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  overflow: hidden;
  border-radius: var(--radius-btn);
  color: var(--text-faint);
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
}

.variant-test-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.variant-test-filename {
  color: var(--text-dim);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.variant-test-status:empty {
  display: none;
}

.variant-test-result {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.variant-test-result-img {
  max-height: 60vh;
  margin: 0 auto;
  border-radius: var(--radius-btn);
}

.variant-test-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text-dim);
  font-size: 12px;
}

.variant-test-meta div {
  display: flex;
  gap: 6px;
  min-width: 0;
}

.variant-test-meta dt {
  font-weight: 600;
}

.variant-test-meta dd {
  overflow-wrap: anywhere;
}

.variant-test-prompt {
  max-height: 160px;
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  border-radius: var(--radius-input);
  background: var(--surface);
  font-size: 12px;
  white-space: pre-wrap;
}

.variant-test-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
