/* Custom styling of IMigratorPawnTrap (the progress bars and the pause/cancel controls of the migration).
   site.css keeps the template defaults; add new custom styles here.                              */

/* ---- Progress bar --------------------------------------------------------------
   Used for the migration progress on the home page. Set data-state on .jsm-progress:
   idle | indeterminate (total not known yet) | running | paused | done | cancelled | error
   and --jsm-value (e.g. 42%) for the filled part.                                   */
.jsm-progress {
  --jsm-from: #0c66e4;
  --jsm-to: #4c9aff;
  --jsm-value: 0%;
  position: relative;
  height: 0.625rem;
  overflow: hidden;
  border-radius: 999px;
  background-color: rgba(9, 30, 66, 0.08);
  box-shadow: inset 0 1px 2px rgba(9, 30, 66, 0.12);
}

.jsm-progress--sm {
  height: 0.4375rem;
}

.jsm-progress__fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--jsm-value);
  overflow: hidden;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--jsm-from), var(--jsm-to));
  transition: width 450ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.jsm-progress[data-state="idle"] .jsm-progress__fill {
  transition: none;
}

/* Result colour fades in over the blue gradient, so finishing is a smooth change instead of a jump. */
.jsm-progress__fill::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--jsm-result-from, transparent), var(--jsm-result-to, transparent));
  opacity: 0;
  transition: opacity 350ms ease;
}

.jsm-progress[data-state="done"] {
  --jsm-result-from: #1f845a;
  --jsm-result-to: #4bce97;
  animation: jsm-progress-glow 900ms ease-out 1;
}

.jsm-progress[data-state="error"] {
  --jsm-result-from: #c9372c;
  --jsm-result-to: #f87168;
}

.jsm-progress[data-state="paused"] {
  --jsm-result-from: #b38600;
  --jsm-result-to: #f5cd47;
}

.jsm-progress[data-state="cancelled"] {
  --jsm-result-from: #626f86;
  --jsm-result-to: #a5adba;
}

.jsm-progress[data-state="done"] .jsm-progress__fill::before,
.jsm-progress[data-state="error"] .jsm-progress__fill::before,
.jsm-progress[data-state="paused"] .jsm-progress__fill::before,
.jsm-progress[data-state="cancelled"] .jsm-progress__fill::before {
  opacity: 1;
}

/* A soft highlight sweeps over the filled part while work is in progress. */
.jsm-progress[data-state="running"] .jsm-progress__fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 25%, rgba(255, 255, 255, 0.5) 50%, transparent 75%);
  transform: translateX(-100%);
  animation: jsm-progress-shimmer 1.8s ease-in-out infinite;
}

/* Total not known yet: a segment glides along the track. */
.jsm-progress[data-state="indeterminate"] .jsm-progress__fill {
  width: 38%;
  transition: none;
  animation: jsm-progress-slide 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes jsm-progress-shimmer {
  to { transform: translateX(100%); }
}

@keyframes jsm-progress-slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(263%); }
}

@keyframes jsm-progress-glow {
  from { box-shadow: inset 0 1px 2px rgba(9, 30, 66, 0.12), 0 0 0 0 rgba(31, 132, 90, 0.35); }
  to { box-shadow: inset 0 1px 2px rgba(9, 30, 66, 0.12), 0 0 0 0.375rem rgba(31, 132, 90, 0); }
}

@keyframes jsm-progress-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

/* Reduced motion: no sliding, sweeping or growing; state is shown by colour and a slow opacity pulse. */
@media (prefers-reduced-motion: reduce) {
  .jsm-progress__fill,
  .jsm-progress__fill::before {
    transition: none;
  }

  .jsm-progress[data-state="running"] .jsm-progress__fill::after {
    display: none;
  }

  .jsm-progress[data-state="indeterminate"] .jsm-progress__fill {
    width: 100%;
    transform: none;
    animation: jsm-progress-pulse 2s ease-in-out infinite;
  }

  .jsm-progress[data-state="done"] {
    animation: none;
  }
}

.jsm-num {
  font-variant-numeric: tabular-nums;
}

.jsm-progress-group {
  display: grid;
  gap: 0.9rem;
  max-width: 34rem;
  margin-inline: auto;
  text-align: start;
}

.jsm-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.3rem;
  font-size: 0.875rem;
  color: var(--bs-secondary-color);
}

.jsm-row-actions {
  display: flex;
  flex-wrap: wrap; /* narrow screens: button, progress and Pause/Cancel wrap onto separate lines instead of widening the table */
  align-items: center;
  gap: 0.75rem;
}

/*
 * The progress of a row has a fixed size, so nothing around it moves while the text changes: the bar and the counter
 * share the first line, the status or step (which varies in length) the second, cut off with an ellipsis if too long.
 */
.jsm-row-progress {
  display: grid;
  grid-template-columns: 8rem 6.5rem;
  align-items: center;
  column-gap: 0.5rem;
  row-gap: 0.15rem;
  font-size: 0.8125rem;
  color: var(--bs-secondary-color);
}

/* Idle rows keep their space (visibility, not display), so the table does not jump when a bar appears. */
.jsm-row-progress--idle {
  visibility: hidden;
}

.jsm-row-progress .jsm-progress {
  width: 8rem;
}

/* A fixed line height, so a row is as tall with empty text (idle) as with text (running). */
.jsm-row-progress .jsm-num {
  min-height: 1.25rem;
  line-height: 1.25rem;
  text-align: end;
  white-space: nowrap;
}

.jsm-row-step {
  grid-column: 1 / -1;
  min-height: 1.25rem;
  line-height: 1.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Number columns of the project table: tabular digits and a minimum width, so a growing count does not resize the column. */
.jsm-col-num {
  min-width: 5.5rem;
  font-variant-numeric: tabular-nums;
}

/* The current step of "Migrate all" keeps its line (hidden only hides the text), so the layout below it stays still. */
.jsm-step-line {
  min-height: 1.4em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Bootstrap hides [hidden] with display: none !important, so keeping the space needs an !important of its own. */
.jsm-step-line[hidden] {
  display: block !important;
  visibility: hidden;
}

.jsm-row-controls {
  display: flex;
  gap: 0.375rem;
}

/* The same width for "Pause" and "Resume" (and their German words), so the buttons do not change size when toggled. */
.jsm-row-controls .btn {
  min-width: 6.5rem;
}

/* Idle rows keep the space of their buttons (hidden here only hides them), so the table does not change width when they appear. */
.jsm-row-controls[hidden] {
  display: flex !important;
  visibility: hidden;
}

/* ---- Formatted issue view ------------------------------------------------------
   The Jira-like display on the Browse details page (Views/Browse/_DetailsFormatted.cshtml). jf-rich is the
   container of rendered rich text (Services/AdfRenderer.cs), which sets the other jf-* classes inside it. */
.jf-key {
  font-size: 0.875rem;
}

/* A flex child shrinks below the width of a long word only with this. */
.jf-min-w-0 {
  min-width: 0;
}

.jf-avatar {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background-color: #0c66e4;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

.jf-avatar-sm {
  width: 1.5rem;
  height: 1.5rem;
  font-size: 0.625rem;
}

.jf-bubble {
  margin-top: 0.25rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
  background-color: var(--bs-tertiary-bg);
}

.jf-bubble > .jf-rich > :last-child {
  margin-bottom: 0;
}

/* The fields of the Details card: the label above its value, like in Jira. */
.jf-fields dt {
  margin-bottom: 0.125rem;
  color: var(--bs-secondary-color);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.jf-fields dd {
  margin-bottom: 0.75rem;
  overflow-wrap: anywhere;
}

.jf-fields dd:last-child {
  margin-bottom: 0;
}

.jf-rich {
  overflow-wrap: anywhere;
}

.jf-rich img,
.jf-rich video {
  max-width: 100%;
  height: auto;
}

.jf-rich pre {
  overflow-x: auto;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  background-color: var(--bs-tertiary-bg);
}

.jf-rich table {
  display: block;
  overflow-x: auto;
}

.jf-rich blockquote {
  padding-inline-start: 0.75rem;
  border-inline-start: 3px solid var(--bs-border-color);
  color: var(--bs-secondary-color);
}

/* Panels: a coloured left border and background per type. */
.jf-panel {
  --jf-panel-border: #0c66e4;
  --jf-panel-bg: #e9f2ff;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  border-inline-start: 4px solid var(--jf-panel-border);
  border-radius: 0.25rem;
  background-color: var(--jf-panel-bg);
  color: #172b4d;
}

.jf-panel > :last-child {
  margin-bottom: 0;
}

.jf-panel-info {
  --jf-panel-border: #0c66e4;
  --jf-panel-bg: #e9f2ff;
}

.jf-panel-note {
  --jf-panel-border: #8270db;
  --jf-panel-bg: #f3f0ff;
}

.jf-panel-warning {
  --jf-panel-border: #e2b203;
  --jf-panel-bg: #fff7d6;
}

.jf-panel-error {
  --jf-panel-border: #c9372c;
  --jf-panel-bg: #ffeceb;
}

.jf-panel-success {
  --jf-panel-border: #1f845a;
  --jf-panel-bg: #dcfff1;
}

/* Status lozenge. */
.jf-status {
  display: inline-block;
  padding: 0 0.375rem;
  border-radius: 0.1875rem;
  background-color: #dcdfe4;
  color: #172b4d;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.jf-status-neutral {
  background-color: #dcdfe4;
  color: #172b4d;
}

.jf-status-purple {
  background-color: #dfd8fd;
  color: #352c63;
}

.jf-status-blue {
  background-color: #cce0ff;
  color: #09326c;
}

.jf-status-red {
  background-color: #ffd5d2;
  color: #5d1f1a;
}

.jf-status-yellow {
  background-color: #f8e6a0;
  color: #533f04;
}

.jf-status-green {
  background-color: #baf3db;
  color: #164b35;
}

.jf-mention {
  padding: 0 0.25rem;
  border-radius: 0.75rem;
  background-color: #cce0ff;
  color: #09326c;
}

.jf-emoji {
  font-size: 1.1em;
  line-height: 1;
}

.jf-date {
  padding: 0 0.25rem;
  border-radius: 0.1875rem;
  background-color: #dcdfe4;
  color: #172b4d;
  white-space: nowrap;
}

.jf-media {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.25rem;
  background-color: var(--bs-tertiary-bg);
  font-size: 0.875rem;
}

.jf-task-list {
  padding-inline-start: 0;
  list-style: none;
}

.jf-task {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
