/* CLAUDE 10-24: the clipper workflow (clipper.js). The setup screen's list of videos in a batch, and the Library's
   Select mode with its action bar. Graphite (DESIGN-SYSTEM.md): rows are lines, not boxes; one primary button; every
   value is a token. */

/* ---- the setup screen: several videos ---- */
.cs-batch {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  min-width: 0;
}
.cs-batch-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
}
.cs-batch-head[hidden],
.cs-batch-list[hidden] {
  display: none;
}
.cs-batch-sum {
  color: var(--c-fg-3);
  font-size: var(--t-meta);
  font-variant-numeric: tabular-nums;
}
.cs-batch-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: min(40vh, 360px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.cs-batch-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: var(--h-touch);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--c-line);
}
.cs-batch-row:last-child {
  border-bottom: 0;
}
.cs-batch-thumb {
  flex: none;
  width: 64px;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-sm);
  background: var(--c-raised);
  overflow: hidden;
}
.cs-batch-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cs-batch-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cs-batch-name {
  overflow: hidden;
  color: var(--c-fg);
  font-size: var(--t-body);
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.cs-batch-meta {
  overflow: hidden;
  color: var(--c-fg-3);
  font-size: var(--t-meta);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.cs-batch-row[data-state='failed'] .cs-batch-meta {
  color: var(--c-danger);
  white-space: normal;
}
.cs-batch-row[data-state='done'] .cs-batch-meta {
  color: var(--c-signal); /* green only for a state: this video's clips are ready */
}
.cs-batch-row[data-state='waiting'] .cs-batch-thumb,
.cs-batch-row[data-state='importing'] .cs-batch-thumb {
  animation: cs-batch-wait calc(var(--d-count) * 2) var(--ease-out, ease) infinite alternate;
}
/* the job's progress as a hairline under the row */
.cs-batch-bar {
  position: absolute;
  left: calc(64px + var(--s-3));
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--c-fg) var(--p), transparent var(--p));
  transition: background-size var(--d-base, 0.2s);
}
.cs-batch-x {
  flex: none;
}
.cs-batch-x svg,
.lib-bulk-x svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}
.cs-batch-add {
  display: flex;
  gap: var(--s-2);
  min-width: 0;
}
.cs-batch-add input {
  flex: 1;
  min-width: 0;
  min-height: var(--h-touch);
  font-size: max(16px, var(--t-body)); /* 16 px: iOS does not zoom the page into the field */
}
/* one video: the add row waits until it is loaded; a batch hides the single video's line (each row has its own) */
.setup-page.is-loading:not(.is-batch) .cs-batch-add {
  opacity: 0.5;
  pointer-events: none;
}
.setup-page.is-batch .cs-src,
.setup-page.is-batch .setup-range,
.setup-page.is-batch #setupFindBlock,
.setup-page.is-batch .srt-upload {
  display: none;
}
@keyframes cs-batch-wait {
  to {
    opacity: 0.45;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cs-batch-row .cs-batch-thumb {
    animation: none;
  }
}
@media (max-width: 767.98px) {
  .cs-batch-list {
    max-height: none; /* the sheet scrolls */
  }
}

/* ---- the Library: Select ---- */
.lib-select-btn {
  min-height: var(--h-touch);
}
.lib-select-btn[aria-pressed='true'] {
  color: var(--c-fg);
  border-color: var(--c-fg);
}
.lib-head-actions {
  display: flex;
  gap: var(--s-2);
  align-items: center;
}
.lib-pick {
  position: absolute;
  top: var(--s-2);
  left: var(--s-2);
  z-index: 3;
  display: grid;
  place-items: center;
  width: var(--h-touch);
  height: var(--h-touch);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.lib-pick::before {
  content: '';
  width: 22px;
  height: 22px;
  border: 2px solid rgb(255 255 255 / 92%); /* over the video in both themes */
  border-radius: var(--r-sm);
  background: rgb(0 0 0 / 35%);
  box-shadow: var(--e-1, 0 1px 2px rgb(0 0 0 / 40%));
}
.lib-pick[aria-checked='true']::before,
.lib-pick[aria-checked='mixed']::before {
  border-color: var(--c-primary);
  background: var(--c-primary)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / 16px no-repeat;
}
.lib-pick[aria-checked='mixed']::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8h8' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}
.lib-pick:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: -4px;
  border-radius: var(--r-sm);
}
.lib-selecting .badge-new,
.lib-selecting .edited-tag {
  display: none;
}
.lib-selecting :is(.proj-tile, .lib-card).is-picked :is(.cover, .thumb) {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
}
/* the action bar: fixed at the bottom while selecting */
.lib-bulk {
  position: sticky;
  bottom: var(--s-4);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
  margin: var(--s-5) auto 0;
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4);
  width: fit-content;
  max-width: 100%;
  border-radius: var(--r-lg, 14px);
  background: var(--c-raised);
  box-shadow: var(--e-2);
  animation: lib-bulk-in var(--d-sheet, 0.28s) var(--ease-sheet, ease-out) backwards;
}
.lib-bulk[hidden] {
  display: none;
}
.lib-bulk-count {
  color: var(--c-fg);
  font-size: var(--t-body);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.lib-bulk-go {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.lib-bulk .m-btn {
  min-height: var(--h-touch);
}
/* CLAUDE 11-04: Apply a clipping preset to the picked clips (index.html #applyPresetDialog) */
.apply-preset .ap-field {
  display: grid;
  gap: var(--s-2);
  margin: var(--s-4) 0;
}
.apply-preset .ap-parts {
  display: grid;
  gap: var(--s-2);
  margin: 0 0 var(--s-3);
  padding: 0;
  border: 0;
}
.apply-preset .ap-parts legend {
  margin-bottom: var(--s-2);
  font-weight: 500;
}
.apply-preset .ap-part {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: var(--h-touch);
}
@keyframes lib-bulk-in {
  from {
    opacity: 0;
    translate: 0 var(--shift-lg, 12px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .lib-bulk {
    animation: none;
  }
}
@media (max-width: 767.98px) {
  .lib-bulk {
    position: fixed;
    left: var(--s-3);
    right: var(--s-3);
    bottom: calc(var(--tabs-h, 64px) + var(--s-2));
    width: auto;
    margin: 0;
    padding: var(--s-2) var(--s-3);
  }
  .lib-bulk-go {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    width: 100%;
  }
  .lib-bulk-go .m-btn {
    padding: 0 var(--s-2);
    font-size: var(--t-label);
  }
  .lib-bulk-count {
    flex: 1;
  }
  #libBulkAll {
    margin-right: var(--h-touch); /* room for the close button in the corner */
  }
  .lib-bulk .lib-bulk-x.m-btn {
    position: absolute;
    top: var(--s-1, 4px);
    right: var(--s-1, 4px);
  }
}
