/* Attachments: chips in the composer, files in the person's bubble.
   Black and white on the warm neutrals, like the rest. */

.attach-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.attach-chip {
  position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 260px;
  padding: 6px 30px 6px 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass-soft);
}
.attach-chip.warn { border-style: dashed; }
.attach-lead {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  background: var(--glass-hover); color: var(--muted); overflow: hidden;
}
.attach-lead.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-lead .btn-spin { width: 14px; height: 14px; }
.attach-body { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; line-height: 1.3; }
.attach-name { font: 500 13px Inter, Vazirmatn, system-ui, sans-serif; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-sub { font: 12px Inter, Vazirmatn, system-ui, sans-serif; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-chip.uploading .attach-name { color: var(--muted); }
.attach-x {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: transparent; color: var(--faint); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.attach-x:hover { color: var(--text); background: var(--glass-hover); }
.attach-x:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

#attach-btn { padding: 0 9px; cursor: pointer; }
#attach-btn:hover, #attach-btn.has-files { color: var(--text); }
#attach-btn svg { flex: 0 0 auto; }

/* A file dragged over the page: the composer says where it goes. */
.composer.dropping { border-color: var(--text); border-style: dashed; }
.composer.dropping::after {
  content: "Drop to attach"; position: absolute; inset: 0; border-radius: inherit; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--ground) 82%, transparent); color: var(--text); font: 600 14px Inter, Vazirmatn, sans-serif; pointer-events: none;
}
.composer { position: relative; }

/* The one-line composer has no room for chips: files keep it full size. */
body.chatting .composer.small .attach-list { display: none; }

/* In the bubble: pictures as thumbnails, other files as cards, above the text. */
.msg.user.with-files { display: flex; flex-direction: column; gap: 8px; }
.msg.user.files-only { padding: 6px; }
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; white-space: normal; }
.msg-file {
  display: flex; align-items: center; gap: 8px; max-width: 240px; min-width: 0; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--line-soft); background: var(--glass-soft); color: var(--muted); line-height: 1.3;
}
.msg-file svg { flex: 0 0 auto; }
.msg-file.pic { padding: 0; overflow: hidden; border-radius: 10px; background: transparent; border: 0; cursor: zoom-in; font: inherit; }
.msg-file.pic:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.msg-file.pic img { display: block; height: 96px; width: auto; max-width: 200px; object-fit: cover; }

@media (max-width: 720px) {
  .attach-chip { max-width: calc(50% - 4px); flex: 1 1 140px; }
  .msg-file { max-width: 100%; }
  .msg-file.pic img { height: 80px; max-width: 160px; }
}
