/* vault-docs: Documents in the Vault — the Add choice (Login or Document), document rows, and the
   document panel (file card, preview). Light and dark come from the shared colour variables. */

/* a document's icon where a login shows its letter */
.avatar.doc-icon { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.avatar.doc-icon svg { width: 18px; height: 18px; }

/* Add: two big choices, in a small box like the confirm box (an action sheet on phones) */
.panel.add-choice { width: min(440px, calc(100vw - 32px)); padding: 0; border-radius: 20px; }
.add-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.add-opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.add-opt:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.add-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.add-opt-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 10px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.add-opt-icon svg { width: 20px; height: 20px; }
.add-opt-text { min-width: 0; }
.add-opt-text b { display: block; font-weight: 600; }
.add-opt-text small { display: block; color: var(--muted); font-size: 13px; line-height: 18px; }

/* the file card */
.doc-file { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 8px 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--text) 3%, transparent); }
.doc-file[hidden] { display: none; }
.doc-file-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 10px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.doc-file-icon svg { width: 20px; height: 20px; }
.doc-file-text { flex: 1 1 auto; min-width: 0; }
.doc-file-text b, .doc-file-text small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-file-text b { font-weight: 600; }
.doc-file-text small { color: var(--muted); font-size: 12px; line-height: 18px; }
.doc-file-btns { display: flex; flex: none; gap: 2px; }
.doc-file-btns svg { width: 18px; height: 18px; }
#doc-preview.on { color: var(--accent); }
.doc-pick { align-self: flex-start; margin-top: 8px; }
.doc-file:not([hidden]) + .doc-pick { margin-top: 8px; }
.doc-hint { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 18px; }
.doc-hint[hidden] { display: none; }

/* preview: the decrypted image or PDF, inside the panel */
.doc-preview { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--text) 4%, transparent); }
.doc-preview[hidden] { display: none; }
.doc-img { display: block; max-width: 100%; max-height: 60vh; margin: 0 auto; object-fit: contain; }
.doc-pdf { display: block; width: 100%; height: 60vh; border: 0; background: #fff; }

/* dragging a file over the panel */
#doc-panel.dropping { outline: 2px dashed var(--accent); outline-offset: -8px; }

/* phone: the same bottom action bar as the login panel */
@media (max-width: 760px) {
  #doc-panel .panel-foot {
    position: sticky; bottom: 0; z-index: 4; display: flex; flex-wrap: wrap; gap: 8px;
    margin: auto -16px calc(-24px - env(safe-area-inset-bottom, 0px)); padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line); background: var(--surface);
  }
  #doc-panel .panel-foot .btn.primary { flex: 1 1 100%; order: 1; margin-left: 0; }
  #doc-panel .panel-foot .btn:not(.primary) { flex: 1 1 0; }
  #doc-panel .panel-foot .btn[hidden] { display: none; }
  .doc-pick { align-self: stretch; }
  .doc-file-btns .icon-btn { width: 40px; height: 40px; }
  .doc-img { max-height: 50vh; }
  .doc-pdf { height: 55vh; }
  .add-opt { min-height: 68px; }
  dialog.panel.add-choice {
    width: 100%; max-width: 100%; height: auto; max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 24px);
    margin: auto 0 0; border: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0;
  }
  dialog.panel.add-choice::before { top: 8px; }
  .add-choice .em-ask-btns { flex-direction: column; }
}
