/*
  Datasets and training.

  The one layout that matters here is the caption grid: a picture is useless for
  judging a caption unless you can see both at once, so an item is an image and
  its text side by side, sized so a row of them still fits a laptop.
*/

/* Forms ---------------------------------------------------------------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

/* Term/definition pairs for the guidance card. */
.guide {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px var(--sp-3);
  margin: var(--sp-3) 0 0;
}

.guide dt {
  font-weight: 600;
  font-size: 12.5px;
}

.guide dd {
  margin: 0;
}

@media (max-width: 620px) {
  .guide {
    grid-template-columns: 1fr;
    gap: 2px var(--sp-3);
  }

  .guide dd {
    margin-bottom: var(--sp-2);
  }
}

/* A training log is the only place raw tool output is shown, and when a run
   fails it is the whole story, so it gets real height. */
.run-log {
  max-height: 340px;
  overflow: auto;
  margin: var(--sp-3) 0 0;
  padding: var(--sp-3);
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--fg-2);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Dataset list --------------------------------------------------------- */

.ds-tile {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--t-fast), transform var(--t-fast);
}

.ds-tile:hover {
  border-color: var(--border-2);
  transform: translateY(-1px);
}

.ds-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--s3);
  color: var(--fg-3);
}

.ds-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Caption grid --------------------------------------------------------- */

.ds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--sp-3);
}

.ds-item {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

/* An image with no caption is the thing you are looking for in this grid. */
.ds-item.is-empty {
  border-color: rgba(251, 191, 36, .35);
}

.ds-item-img {
  flex: none;
  width: 104px;
  height: 104px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--s3);
}

.ds-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ds-item-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.ds-caption {
  min-height: 76px;
  font-size: 12.5px;
}

.ds-save {
  min-width: 48px;
  text-align: right;
}

/* The library picker this page opens is shared with the create form; its
   styles live in app.css beside the other dialogs. */
