/* Replay view: synthetic match form + render job status. */

.replay-form {
  display: grid;
  gap: 20px;
}

.replay-field {
  display: grid;
  gap: 7px;
}

.replay-field > label,
.replay-field-label {
  color: var(--dark);
  font-size: 13px;
  font-weight: 600;
}

.replay-field .form-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: 0;
  text-transform: none;
}

.replay-field .form-hint code,
.replay-match-id {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--line-soft);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
}

.replay-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #fecdca;
  border-radius: 8px;
  background: #fff7f7;
  color: var(--red);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
}

.replay-loop-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  cursor: pointer;
}

.replay-loop-toggle input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

.replay-loop-toggle strong {
  display: block;
  color: var(--dark);
  font-size: 13px;
}

.replay-loop-toggle .form-hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-transform: none;
  letter-spacing: 0;
}

/* Always-on loops sit above the job history they keep producing. */
.replay-loops {
  display: grid;
  gap: 14px;
}

.replay-loop {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.replay-loop-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.replay-loop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Form submit sits in its own footer, divided from the fields above. */
.replay-form-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}

.replay-form-footer button {
  min-height: 38px;
  padding: 0 18px;
}

/* Shown wherever a page polls, so nothing looks stale without a Refresh. */
.auto-refresh {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.auto-refresh::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(8, 127, 91, 0.18);
  animation: pulse-live-green 1.8s ease-in-out infinite;
}

.replay-table {
  min-width: 1020px;
  table-layout: fixed;
}

.replay-table th,
.replay-table td {
  padding: 13px 16px;
  vertical-align: top;
}

.replay-table th:nth-child(1),
.replay-table td:nth-child(1) {
  width: 128px;
}

.replay-table th:nth-child(2),
.replay-table td:nth-child(2) {
  width: 300px;
}

.replay-table th:nth-child(3),
.replay-table td:nth-child(3) {
  width: 210px;
}

.replay-table th:nth-child(4),
.replay-table td:nth-child(4),
.replay-table th:nth-child(5),
.replay-table td:nth-child(5) {
  width: 182px;
  white-space: nowrap;
}

.replay-table th:nth-child(6),
.replay-table td:nth-child(6) {
  width: 128px;
}

.replay-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}

.replay-status::before {
  content: '';
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-dot, var(--muted));
}

.replay-status-queued {
  --status-dot: #d97706;
}

.replay-status-running {
  --status-dot: #65a30d;
  --status-pulse: rgba(101, 163, 13, 0.3);
  --status-pulse-soft: rgba(101, 163, 13, 0.1);
}

.replay-status-running::before {
  animation: pulse-replay-running 1.6s ease-in-out infinite;
}

@keyframes pulse-replay-running {
  0%,
  100% {
    box-shadow: 0 0 0 3px var(--status-pulse);
  }
  50% {
    box-shadow: 0 0 0 6px var(--status-pulse-soft);
  }
}

.replay-status-done {
  --status-dot: var(--green);
}

.replay-status-failed {
  --status-dot: var(--red);
}

/* Replay jobs table */
.replay-match-name {
  color: var(--dark);
  font-weight: 600;
}

.replay-match-id {
  display: inline-block;
  margin-top: 3px;
  font-size: 12px;
}

.replay-row-actions {
  text-align: right;
  white-space: nowrap;
}
