/* Schedule (docs/design-system.md, Surfaces): a 760px column - the stop notice
   and the settings form as panels, then the queue as rows in one panel. */

.schedule__sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.schedule__placeholder {
  display: flex;
  justify-content: center;
  padding: var(--space-12);
}

.schedule__note {
  margin: 0;
  font-size: var(--text-note);
  color: var(--color-text-muted);
}

/* What stopped the queue, with the button that fixes it. */
.schedule__notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.schedule__notice-message {
  margin: 0;
  font-weight: var(--weight-semibold);
}

.schedule__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.schedule__slots {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.schedule__slot {
  width: 140px;
}

.schedule__form-actions {
  display: flex;
  justify-content: flex-end;
}

/* A queue row: grip, place, first slide, title, date and slot, Unschedule.
   Rows are split by line-soft lines; a dragged row lifts over its
   neighbours. */
.schedule__row {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  background: var(--color-bg-surface);
}

.schedule__row + .schedule__row {
  border-top: var(--border-width) solid var(--color-border-subtle);
}

.schedule__row--dragging {
  z-index: 1;
  box-shadow: inset 0 0 0 var(--border-width) var(--color-border);
}

.schedule__grip {
  display: flex;
  padding: 0;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  cursor: grab;
  touch-action: none;
}

.schedule__row--dragging .schedule__grip {
  cursor: grabbing;
}

.schedule__position {
  width: 2ch;
  text-align: right;
  font-size: var(--text-note);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
}

.schedule__thumb {
  flex-shrink: 0;
  width: 50px;
  overflow: hidden;
  border-radius: var(--radius-thumb);
}

.schedule__thumb--empty {
  aspect-ratio: 9 / 16;
  background: var(--color-bg-page);
}

.schedule__row-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: var(--weight-semibold);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.schedule__when {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Ready to schedule: one row of 112px 9:16 tiles that scrolls sideways and
   never wraps, so the section keeps one height whatever the count. The
   height is a tile and its title line, with room under them for the
   scrollbar. The empty state fills the same height. */
.schedule__sections {
  --schedule-tile-width: 112px;
  --schedule-strip-height: calc(
    var(--schedule-tile-width) * 16 / 9 + var(--space-2) + /* ds-lint-allow */
    var(--text-note) * var(--leading-normal) + var(--space-4)
  );
}

.schedule__strip {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  height: var(--schedule-strip-height); /* ds-lint-allow */
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.schedule__strip-empty {
  height: var(--schedule-strip-height); /* ds-lint-allow */
}

.schedule__strip-empty .empty-state {
  height: 100%;
  padding-block: var(--space-4);
}

/* A tile is one click target. The plus at its top-left is the round
   control of the Images check, always visible; hover and focus outline the
   preview like a selected one. */
.schedule-tile {
  display: flex;
  flex: none;
  flex-direction: column;
  gap: var(--space-2);
  width: var(--schedule-tile-width); /* ds-lint-allow */
  cursor: pointer;
}

.schedule-tile--disabled {
  cursor: not-allowed;
}

.schedule-tile__preview {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: var(--color-text);
  border-radius: var(--radius-thumb);
}

.schedule-tile--disabled .schedule-tile__preview {
  opacity: 0.6;
}

.schedule-tile__plus {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-height-check);
  height: var(--control-height-check);
  color: var(--color-text-on-dark);
  background: var(--color-overlay-control);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--color-text-on-dark);
  backdrop-filter: blur(4px);
}

.schedule-tile__badges {
  position: absolute;
  right: var(--space-2);
  bottom: var(--space-2);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
}

.schedule-tile__title {
  overflow: hidden;
  font-size: var(--text-note);
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Phone: the notice puts its button under the text; a row wraps, so the
   date and Unschedule go under the title. */
@media (max-width: 860px) {
  .schedule__notice {
    flex-direction: column;
    align-items: flex-start;
  }

  .schedule__row {
    flex-wrap: wrap;
    padding: var(--space-4);
  }

  /* The title fills the first line beside the grip, the place and the
     thumbnail (together about 140px), which pushes the date and
     Unschedule to the second line. */
  .schedule__row-title {
    flex-basis: calc(100% - 140px);
  }
}
