/* SPDX-License-Identifier: AGPL-3.0-only
 * SPDX-FileCopyrightText: 2021-2026 DALICC - Verein zur Foerderung der Rechtssicherheit in der Datenbewirtschaftung (ZVR 1249185710)
 */
/* Text-to-License: the form, the quota strip and the review panel.
 *
 * Loaded after site.css, components.css and auth.css, and it only adds: every colour,
 * radius and font here is one of the tokens those files define, so the page belongs to
 * the same design system as the composer it hands its result to.
 *
 * The one visual idea of its own is the evidence column. A proposed statement is only
 * as good as the sentence behind it, so the quote is a full-width blockquote in the
 * table rather than a truncated cell, and the confidence is a bar rather than a number
 * alone: a row that is worth arguing with should look different from one that is not.
 */

/* ------------------------------------------------------------ the form */

.translate-form textarea {
  width: 100%;
  min-height: 18rem;
  padding: 10px 12px;
  border: 1px solid var(--c-rule-strong);
  border-radius: var(--radius);
  background: var(--c-white);
  color: var(--c-ink);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.5;
  resize: vertical;
}

.translate-form textarea:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 1px;
}

.translate-counter {
  margin: 6px 0 0;
  color: var(--c-slate-muted);
  font-size: 15px;
  min-height: 1.5em;
}

.translate-counter[data-state="over"] {
  color: var(--c-red-dark);
  font-weight: 600;
}

.translate-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 24px 0 0;
}

.translate-actions--result {
  margin: 16px 0 32px;
}

.translate-progress {
  color: var(--c-slate-muted);
  font-size: 16px;
}

.translate-how {
  margin-top: 40px;
  padding: 16px 20px;
  background: var(--c-surface-alt);
  border: 1px solid var(--c-rule);
  border-radius: var(--radius);
}

.translate-how h2 {
  margin-top: 0;
}

.translate-how ul {
  margin: 0;
  padding-left: 20px;
}

.translate-how li + li {
  margin-top: 6px;
}

/* ------------------------------------------------------ the quota strip */

.quota-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
  margin: 16px 0 24px;
  padding: 12px 16px;
  background: var(--c-surface-alt);
  border: 1px solid var(--c-rule);
  border-radius: var(--radius);
  font-size: 16px;
}

.quota-strip__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quota-strip__label {
  color: var(--c-slate-muted);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.quota-strip__value {
  font-weight: 600;
  color: var(--c-slate-dark);
}

.quota-strip__note {
  color: var(--c-slate-muted);
  font-size: 14px;
}

.countdown {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------ the review panel */

.translate-meta {
  margin-top: -8px;
  font-size: 16px;
}

.translate-table {
  width: 100%;
  border-collapse: collapse;
}

.translate-table th,
.translate-table td {
  vertical-align: top;
  padding: 10px 12px;
  border-bottom: 1px solid var(--c-rule);
  text-align: left;
}

.translate-table tr.is-unknown {
  background: var(--c-peach);
}

.translate-table code {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--c-slate-mid);
}

.translate-evidence {
  width: 55%;
}

.translate-evidence blockquote,
.translate-unmodelled blockquote,
.translate-clause {
  margin: 0 0 8px;
  padding: 8px 12px;
  background: var(--c-surface-alt);
  border: 1px solid var(--c-rule);
  border-radius: var(--radius);
  font-size: 16px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.translate-evidence blockquote:last-child {
  margin-bottom: 0;
}

.confidence {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.confidence__bar {
  display: inline-block;
  width: 72px;
  height: 8px;
  background: var(--c-rule);
  border-radius: 4px;
  overflow: hidden;
}

.confidence__fill {
  display: block;
  height: 100%;
  background: var(--c-green);
}

.confidence__value {
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  color: var(--c-slate-mid);
}

.translate-warnings,
.translate-conflicts {
  margin: 0 0 24px;
  padding-left: 20px;
}

.translate-warnings li + li,
.translate-conflicts li + li {
  margin-top: 6px;
}

.translate-unmodelled dt {
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--c-slate-dark);
  margin-top: 12px;
}

.translate-unmodelled dd {
  margin: 4px 0 0;
}

/* --------------------------------------------------- the assistant admin */

.assistant-status {
  display: grid;
  gap: 4px 24px;
  grid-template-columns: max-content 1fr;
  margin: 0 0 24px;
}

.assistant-status dt {
  color: var(--c-slate-muted);
}

.assistant-status dd {
  margin: 0;
  font-weight: 600;
}

.assistant-key {
  font-family: var(--font-mono);
}

.assistant-prompt {
  max-height: 32rem;
  overflow: auto;
  padding: 12px 16px;
  background: var(--c-surface-alt);
  border: 1px solid var(--c-rule);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

@media (max-width: 604px) {
  .translate-evidence {
    width: auto;
  }

  .assistant-status {
    grid-template-columns: 1fr;
  }

  .assistant-status dd {
    margin-bottom: 8px;
  }
}

/* The page that follows a translation running in the background. The bar is the
   browser's own <progress>, styled only where it would otherwise clash with the rest
   of the page: a long licence is read part by part and the reader watches it. */
.translate-progress {
  border: 1px solid var(--c-rule);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

.translate-progress__state {
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.translate-progress__bar {
  width: 100%;
  height: 0.75rem;
}

/* The time the run has taken and the time it has left, side by side on a wide screen
   and under each other on a narrow one. */
.translate-progress__times {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 8px 0 0;
  font-size: 15px;
  color: var(--c-slate-muted);
}

/* The heartbeat. It counts up on its own between two polls, so the page shows that it
   is alive while a part is with the provider and nothing can come back yet. It is out
   of the announced region above on purpose: a line that changes every five seconds
   would be read out every five seconds. */
.translate-progress__beat {
  margin: 4px 0 0;
  font-size: 15px;
  min-height: 1.4em;
}

.translate-partial {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--c-rule);
}

.translate-partial__heading {
  margin: 0 0 4px;
  font-size: 17px;
}

.translate-partial__list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
  font-size: 15px;
  line-height: 1.5;
}

.translate-partial__list li {
  padding: 4px 0;
  border-bottom: 1px dotted var(--c-rule);
}

.translate-partial__list li:last-child {
  border-bottom: 0;
}

.translate-partial__label {
  font-weight: 600;
}

.translate-partial__quote {
  color: var(--c-slate-muted);
}

.translate-partial__failed {
  margin: 12px 0 0;
  font-size: 15px;
  color: var(--c-slate-muted);
}

@media (max-width: 604px) {
  .translate-progress {
    padding: 1rem;
  }

  /* The label and the quote of a statement stop fitting on one line well before this
     width, so each gets its own. */
  .translate-partial__label,
  .translate-partial__quote {
    display: block;
  }

  /* A box that scrolls inside a page that scrolls is hard to use with a thumb, and on
     a narrow screen it also cuts a line in half. The list just grows here. */
  .translate-partial__list {
    max-height: none;
    overflow-y: visible;
  }
}
