/* The Files panel on a delivery (js/upload-view.js, upload-tiles.js) and
   the "Uploading" indicator (js/upload-indicator.js). Loaded by index.html
   after app.css and components.css, and reuses their classes: .panel
   .panel-head .tile .wgrid .bar .tag .chip .seg .btn .drop .callout.
   Colours and spacing are tokens from app.css's :root scales or from the
   block below; light and dark follow the same tokens. The client's page
   (recipient.css) reuses the tile classes too, so what only the
   producer's caption needs is under .up-cap-row (upload-tiles.css).

   New files (not uploaded yet) sit in a tinted well inside the panel;
   files already in the delivery sit on the panel itself, so the two never
   read as one grid.

   The tiles themselves, their check, label and caption, are in
   upload-tiles.css, which loads right after this file. */

:root {
  --up-bar-height: 3px;       /* the progress line along the foot of a tile and of the summary bar */
  --up-indicator-width: 140px;
}

/* --- the panel ------------------------------------------------------- */

#uppy-dashboard.over {
  outline: 2px dashed var(--accent);
  outline-offset: var(--space-3);
  border-radius: var(--radius-l);
}

.up-empty { padding: var(--space-6) var(--space-4); }
.up-empty b { font-size: var(--text-l); line-height: 22px; }
.up-empty .actions { margin-top: var(--space-3); }

.up-head-actions { display: flex; gap: var(--space-2); }

.up-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
/* Up to ten filters in a Files delivery: on a wide page they wrap inside the
   panel; the phone rule below turns them into one row that scrolls. */
.up-toolbar { flex-wrap: wrap; }
.up-toolbar .seg { flex-wrap: wrap; }
.seg button { white-space: nowrap; }
.seg button .n { margin-left: var(--space-1); color: var(--mute); font-weight: 400; }

/* New files: a well on the paper colour, edge to edge of the panel's
   padding, so what is about to be sent is plainly apart from what is
   already there. */
.up-group[data-part=staged] {
  margin: 0 calc(-1 * var(--space-3)) var(--space-5);
  padding: var(--space-4);
  border-radius: var(--radius-l);
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--line2);
}

/* The second group starts a new section, but only when both show. */
.up-group:not([hidden]) ~ .up-group:not([hidden]) { margin-top: var(--space-2); }

.up-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
}
.up-group-head h3 {
  margin: 0;
  font: 500 var(--text-ui)/20px var(--font-sans);
  color: var(--ink);
}
.up-group-head h3 .s { margin-left: var(--space-1); font-weight: 400; }
/* Pushed to the right edge, on the first line or the wrapped one. */
.up-select { margin-left: auto; }
/* What arrived since the last full download (js/delivery-added-since.js):
   a line of its own under the heading, its button after the words. */
.up-added-since { flex-basis: 100%; margin: 0; }
/* Its text button gets a finger's height, as the request panel's do. */
@media (pointer: coarse), (max-width: 820px) {
  .up-added-since .btn { min-height: var(--control-l); }
}

.up-folders {
  align-items: center;
  margin-bottom: var(--space-4);
}
.up-folders > .s { margin-right: var(--space-1); }
.up-folders:empty { display: none; }

.up-more { display: flex; margin: var(--space-3) auto 0; }

/* --- files that did not finish uploading (js/upload-resume.js) --------- */

.up-resume { margin-bottom: var(--space-4); }

/* --- the bars: the summary of what is being sent, and what is chosen ----- */

/* Two bars share the foot of the panel: the summary, and the saved files
   the producer has chosen to give tags or a note (file-meta.css). Two
   sticky boxes on one edge would sit on each other, so the edge is one
   sticky box that stacks whichever bars have something to say, and is
   nothing when neither does. */
.up-bars {
  position: sticky;
  bottom: var(--space-4);
  z-index: 20;
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-5);
}
.up-bars:not(:has(> :not([hidden]))) { display: none; }

/* A bar rises into place (8px, 220ms) the moment there is something to say,
   so the producer's eye goes to the button that acts on it. */
.up-summary {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sheet);
  background: var(--surface);
  box-shadow: var(--shadow-overlay);
  animation: rise var(--dur-slow) var(--ease-out);
}
.up-total { display: block; height: 3px; border-radius: 0; }

.up-summary-in {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-5);
}
.up-summary-text { display: flex; flex-direction: column; min-width: 0; }
.up-chosen { font-size: var(--text-l); line-height: 22px; color: var(--ink2); }
.up-chosen b { font-weight: 500; color: var(--ink); }
.up-detail { display: flex; justify-content: space-between; gap: var(--space-3); }
.up-detail:empty { display: none; }

/* --- the indicator that follows you around the app -------------------- */

/* Hidden on the delivery it is about (js/upload-indicator.js). */
.up-indicator {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-l);
  background: var(--ink);
  box-shadow: var(--shadow-overlay);
  color: var(--bg);
  font-size: var(--text-m);
  font-weight: 500;
  animation: rise var(--dur-slow) var(--ease-out);
  text-decoration: none;
}
.up-indicator .bar {
  width: var(--up-indicator-width);
  height: var(--up-bar-height);
  background: color-mix(in srgb, var(--bg) 30%, transparent);
}

/* --- phone ------------------------------------------------------------- */

@media (max-width: 820px) {
  /* The Add buttons drop under the title, side by side. */
  .up-head { flex-wrap: wrap; }
  .up-head-actions {
    order: 1;
    flex-basis: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  /* One row that scrolls by itself, not a second wrapped line. */
  .up-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    /* overflow-x makes y clip too: room for a button's 2px focus ring. */
    padding-block: var(--space-1);
    scrollbar-width: none;
  }
  .up-toolbar::-webkit-scrollbar { display: none; }
  .up-toolbar .seg { flex: none; flex-wrap: nowrap; }

  .up-folders { flex-wrap: wrap; overflow: visible; margin-left: 0; margin-right: 0; padding: 0; }

  .up-group[data-part=staged] { margin-inline: calc(-1 * var(--space-2)); padding: var(--space-3); }

  /* Room for the tabbar under the bars. */
  .up-bars { bottom: calc(56px + var(--space-2) + env(safe-area-inset-bottom, 0px)); }

  .up-indicator { bottom: calc(56px + var(--space-4) + env(safe-area-inset-bottom, 0px)); right: var(--space-2); }
}
