/* ==========================================================================
   File drop — multi-file uploader
   Drop zone + browse, then a list of the chosen files with size and a remove ×.
   The single-file .upload-box stays for logo/banner slots; this is for anywhere
   the user attaches SEVERAL documents to one question (the tax checklist).
   Catalogued in preview/index.html (#filedrop).
   ========================================================================== */

.file-drop {
  display: block;
}

/* ----- the zone ----- */

.file-drop__zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 132px;
  padding: var(--space-6);
  border: var(--border-width) dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-base);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.file-drop__zone svg {
  width: 24px;
  height: 24px;
  color: var(--color-text-muted);
  flex: none;
}

.file-drop__hint {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* provisional — no hover/drag state in Figma */
.file-drop__zone:hover { border-color: var(--color-text); }
.file-drop__zone:focus-visible { outline: 2px solid var(--color-text); outline-offset: 2px; }

.file-drop.is-over .file-drop__zone {
  border-color: var(--color-text);
  background: var(--color-bg);
}

/* Once files are attached the zone steps back to a quiet one-line "Add more". */
.file-drop.has-files .file-drop__zone {
  flex-direction: row;
  min-height: 0;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
}

/* ----- the list ----- */

.file-drop__list {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.file-drop__file {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.file-drop__file > svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--color-text-muted);
}

.file-drop__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-drop__size {
  flex: none;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.file-drop__remove {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: var(--radius-full);
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
}

.file-drop__remove svg { width: 16px; height: 16px; }
.file-drop__remove:hover { background: var(--color-bg-subtle); color: var(--color-text); }

/* ----- rejected files ----- */

.file-drop__file--bad {
  border-color: var(--color-danger-border);
  background: var(--color-danger-bg);
}

.file-drop__file--bad > svg,
.file-drop__why {
  color: var(--color-danger);
}

.file-drop__why {
  flex: none;
  font-size: var(--text-sm);
}

/* Restored from a saved draft — the name was remembered, the file itself
   never left the browser it was attached in, so it has to be added again. */
.file-drop__file--stale {
  border-style: dashed;
}

.file-drop__file--stale .file-drop__name,
.file-drop__file--stale > svg {
  color: var(--color-text-muted);
}

.file-drop__file--stale .file-drop__why { color: var(--color-text-muted); }

@media (max-width: 640px) {
  .file-drop__file { flex-wrap: wrap; }
  .file-drop__name { flex: 1 0 100%; white-space: normal; }
}

/* ==========================================================================
   ALREADY IN THE PILE (Peter, 19 Aug 2026)
   A question the Inbox has already answered says so instead of asking again;
   a STANDING document from an earlier year is offered back for one tap.
   Both sit ABOVE the drop zone — the answer comes before the ask.
   ========================================================================== */
.file-drop__have,
.file-drop__offer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: 14px 16px;
  margin-bottom: 10px;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: var(--leading-body);
}
.file-drop__have strong,
.file-drop__offer strong { font-weight: var(--weight-regular); color: var(--color-text); }
.file-drop__have svg { width: 18px; height: 18px; flex: none; color: var(--color-success); }
.file-drop__have span { flex: 1; min-width: 0; }
.file-drop__seeit { color: var(--color-text-muted); font-size: var(--text-sm); }
.file-drop__seeit:hover { color: var(--color-text); }
.file-drop__offer span { flex: 1; min-width: 0; }
