/* Task 19: remove and restore. The viewer's bottom action bar and its
   Remove, the confirm sheet inside the (dark) viewer, the toast's action
   button and toasts shown inside the viewer, and the light Recently removed
   page. Reuses app.css's tokens and classes (.btn, .meta, .title, .page,
   .sheet*, .form-error) and people.css's .back-link and
   .sheet-actions-stacked; nothing here restyles them outside these screens.
   No inline styles anywhere. */

/* The bar's height: 10px top padding, a 48px button, 20px bottom padding. */
:root {
  --viewer-actions-h: 78px;
}

/* ---------- the viewer's action bar ---------- */

.viewer-actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 10px calc(16px + env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px))
    calc(16px + env(safe-area-inset-left, 0px));
}

/* Their own display (flex, and .btn's inline-flex) would otherwise beat the
   hidden attribute's. */
.viewer-actions[hidden],
.viewer-actions .btn[hidden] {
  display: none;
}

.viewer-actions .btn {
  flex: 0 1 auto;
  width: auto;
  min-width: 140px;
  padding: 0 28px;
  white-space: nowrap; /* a label never wraps */
}

/* The photo sits above the bar rather than under it. */
.viewer:has(.viewer-actions:not([hidden])) .viewer-stage {
  padding-bottom: calc(var(--viewer-actions-h) + env(safe-area-inset-bottom, 0px));
}

/* ---------- the confirm sheet (ui/confirm-sheet.js) ---------- */

/* Inside the viewer it sits above the toasts the viewer hosts (z-index 60). */
.viewer .sheet-backdrop {
  z-index: 70;
  background: rgba(10, 10, 11, 0.6);
}

/* The viewer is dark, so its sheet is too: night, a hairline at its top,
   and app.css's .dark buttons (night, with a 1px line) on it. */
.dark .confirm-sheet {
  background: var(--night);
  color: var(--moon);
  box-shadow:
    inset 0 1px 0 var(--night-line),
    0 -10px 30px rgba(0, 0, 0, 0.5);
}

.confirm-error {
  margin: 0 0 16px;
}

/* A held button (its action is on its way) keeps focus, so it's
   aria-disabled rather than disabled; this is how it looks. */
.confirm-sheet .btn[aria-disabled='true'],
.removed-page .btn[aria-disabled='true'] {
  opacity: 0.55;
  cursor: progress;
}

/* ---------- a toast with an action (ui/toast.js, "Removed." and "Undo") ---------- */

.toast-has-action {
  display: flex;
  align-items: center;
  gap: 14px;
  /* 8px round the button leaves room for its focus ring inside the toast. */
  padding: 8px 8px 8px 18px;
  /* A hairline, so it still reads on the dark album and viewer. */
  box-shadow:
    inset 0 0 0 1px var(--night-line),
    0 10px 26px rgba(0, 0, 0, 0.4);
}

.toast-text {
  flex: 1 1 auto;
}

/* Its first half second (ui/toast.js's ARM_MS): a tap passes the button by,
   so the second tap of a double tap on the sheet's Remove, which sat just
   here, can't undo what the first one did. */
.toast-arming .toast-action {
  pointer-events: none;
}

.toast-action {
  flex: none;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 24px;
  background: var(--night-btn);
  color: var(--moon);
  box-shadow: inset 0 0 0 1px var(--night-line);
  font-family: inherit;
  font-size: 16px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

/* The toast is night wherever it shows, so its ring is Marigold, as on any
   dark screen. */
.toast-action:focus-visible {
  outline: 2px solid var(--marigold);
  outline-offset: 2px;
}

/* Toasts inside the open viewer (ui/toast.js's hostToasts): lifted off the
   night behind them, and above the action bar when it's showing. Three
   classes, so they win over album.css's body:has(.album-dock) placement. */
.viewer-backdrop .viewer .toast-stack {
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
}

.viewer-backdrop .viewer:has(.viewer-actions:not([hidden])) .toast-stack {
  bottom: calc(var(--viewer-actions-h) + 6px + env(safe-area-inset-bottom, 0px));
}

.viewer .toast {
  background: var(--night-btn);
}

.viewer .toast-action {
  background: var(--night);
}

/* ---------- Recently removed (light), in People's and Shared links' style ---------- */

/* Wider than .page's 400px, so a desktop gets a real grid of photos. */
.removed-page {
  max-width: 720px;
}

.removed-page .title {
  margin: 0 0 4px;
}

.removed-intro {
  margin: 0 0 24px;
}

/* The error screens: the reason sits under the heading, not against it
   (app.css's .form-error pulls itself up by 4px for a field above it). */
.removed-page > .form-error {
  margin: 16px 0 18px;
}

.removed-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.removed-grid[hidden],
.removed-empty[hidden],
.removed-more-wrap[hidden] {
  display: none;
}

.removed-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--paper);
}

.removed-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--wash);
}

.removed-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-quiet);
  font-size: 15px;
}

.removed-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 12px 10px;
}

.removed-days {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

.removed-card-info .meta {
  overflow-wrap: anywhere;
}

/* Restore sits at the foot of every card, so a row's buttons line up. */
.removed-card .btn {
  width: auto;
  margin: auto 12px 12px;
  white-space: nowrap;
}

/* Why a restore was refused, just above that card's Restore. The line takes
   over Restore's auto top margin, so the two sit together at the card's
   foot and a row's buttons still line up. */
.removed-card-error {
  margin: auto 12px 10px;
  overflow-wrap: anywhere;
}

.removed-card-error + .btn {
  margin-top: 0;
}

.removed-empty {
  margin: 8px 0 0;
}

.removed-more-wrap {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.removed-more-wrap .btn,
.removed-retry {
  width: auto;
  padding: 0 28px;
}

.removed-more-error {
  margin: 0 0 12px;
  align-self: stretch;
}
