/* Files: uploading — the control, the drop, and the ask before it happens.
 *
 * Its own sheet for the same reason upload.js is its own module: the
 * uploading path is one story (a split button, a drop target, a
 * confirmation), and files-new/styles.css is at its 1000-line cap. Every
 * rule here moved verbatim; nothing was rewritten on the way.
 */

/* Stage 3: drag-and-drop upload visual feedback (core.js), ported from the old page's
   #files-pane.dragging treatment — a dashed accent outline over the whole layout area. */
#files-tab .fn-files-layout.fn-dragging {
  position: relative;
  outline: 2px dashed var(--ui-accent);
  outline-offset: -6px;
  border-radius: var(--ui-radius, 18px);
  background: color-mix(in srgb, var(--ui-accent) 5%, transparent);
}
/* The drop zone says where the drop goes, before it goes (operator, 30 Sep).
   It is also the route that avoids Chrome's native folder-upload
   confirmation, which we cannot change -- so it is worth being obvious. */
#files-tab .fn-files-layout.fn-dragging::after {
  content: attr(data-drop-hint);
  position: absolute;
  left: 50%;
  top: 22px;
  transform: translateX(-50%);
  z-index: 40;
  padding: 8px 14px;
  border: 1px solid var(--ui-accent);
  border-radius: 999px;
  background: var(--ui-raised);
  color: var(--ui-text);
  font-size: 13px;
  font-weight: 650;
  pointer-events: none;
}

/* The Upload control is a two-item menu: files, or a whole folder. One
   labelled button stays findable at 390px, where a second one would not fit
   (operator, 30 Sep: "the upload button must be easy to find"). */
#files-tab .fn-upload-wrap { position: relative; display: inline-flex; }
#files-tab .fn-upload-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 140;
  display: grid; min-width: 11rem; padding: 5px;
  border: 1px solid var(--ui-line); border-radius: 10px;
  background: var(--ui-raised);
  box-shadow: 0 10px 30px var(--shadow-color);
}
#files-tab .fn-upload-menu[hidden] { display: none; }
/* The folder a drop is aimed at, while the pointer is over it. */
#files-tab .fn-tree-row.is-drop-target {
  background: color-mix(in srgb, var(--ui-accent) 18%, transparent);
  box-shadow: inset 0 0 0 2px var(--ui-accent);
  border-radius: 8px;
}

/* A drop's own confirmation: what is going where, before it goes. */
#files-tab .fn-upload-confirm {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 18px;
  background: color-mix(in srgb, var(--ui-bg) 62%, transparent);
  backdrop-filter: blur(3px);
}
#files-tab .fn-upload-confirm[hidden] { display: none; }
#files-tab .fn-upload-confirm-card {
  display: grid;
  gap: 10px;
  width: min(30rem, 100%);
  padding: 18px 20px;
  border: 1px solid var(--ui-line);
  border-radius: 14px;
  background: var(--ui-panel);
  box-shadow: 0 18px 50px var(--shadow-color);
}
#files-tab .fn-upload-confirm-card h2 {
  margin: 0; color: var(--ui-text); font-size: 15px; font-weight: 700;
}
#files-tab .fn-upload-confirm-card h2 span { color: var(--ui-accent); }
#files-tab .fn-upload-confirm-summary {
  margin: 0; color: var(--ui-text-soft); font-size: 13px;
}
#files-tab .fn-upload-confirm-list {
  margin: 0; padding: 0; list-style: none;
  display: grid; gap: 2px;
  max-height: 9rem; overflow-y: auto;
  color: var(--ui-muted); font-size: 12px;
}
#files-tab .fn-upload-confirm-list .fn-upload-confirm-more { color: var(--ui-text-soft); }
#files-tab .fn-upload-confirm-actions {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px;
}

/* The caret half of the split button. */
#files-tab .fn-tab-upload-more {
  display: inline-grid;
  place-items: center;
  width: 26px;
  min-width: 26px;
  align-self: stretch;
  padding: 0;
  border: 1px solid var(--ui-line);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: var(--ui-raised);
  color: var(--ui-text-soft);
  cursor: pointer;
}
#files-tab .fn-tab-upload-more:hover { background: var(--ui-hover); color: var(--ui-text); }
#files-tab .fn-tab-upload-more .ui-icon { width: 14px; height: 14px; }
/* The two halves read as one control. */
#files-tab .fn-upload-wrap .fn-tab-upload { border-radius: 8px 0 0 8px; }
#files-tab .fn-upload-menu-caption {
  margin: 2px 6px 6px;
  color: var(--ui-muted);
  font-size: 11px;
}
#files-tab .fn-upload-menu-caption b { color: var(--ui-text); font-weight: 650; }
#files-tab .fn-upload-menu button {
  padding: 8px 10px; min-height: 36px;
  border: 0; border-radius: 7px; background: none;
  color: var(--ui-text); font: inherit; text-align: left; cursor: pointer;
}
#files-tab .fn-upload-menu button:hover { background: var(--ui-hover); }
#files-tab .fn-upload-menu button:focus-visible {
  outline: 2px solid var(--ui-accent); outline-offset: -2px;
}
