/* ---------- chat attachments ---------- */

.message-content:empty {
  display: none;
}

.message-body {
  flex: 1;
}

.attachments {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin: 4px 0 2px;
}

.attach-image {
  display: block;
  max-width: min(400px, 100%);
  max-height: 300px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-elevated);
  cursor: zoom-in;
}

.attach-image img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 300px;
  object-fit: contain;
}

.attach-video {
  width: min(420px, 100%);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-sidebar);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.attach-video video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.attach-card {
  width: min(420px, 100%);
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-sidebar);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.attach-card audio {
  width: 100%;
  height: 36px;
}

.attach-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.attach-video .attach-head {
  padding: 8px 10px;
}

.attach-file-icon {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  color: var(--accent);
}

.attach-file-icon span {
  position: absolute;
  bottom: 6px;
  font-size: 8px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.02em;
}

.attach-meta {
  flex: 1;
  min-width: 0;
  display: grid;
}

.attach-title {
  padding: 0;
  border: 0;
  background: none;
  color: #8fb3ff;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.attach-title:hover {
  text-decoration: underline;
}

/* ---------- composer ---------- */

.composer-row {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  background: var(--bg-input);
  border-radius: 8px;
  padding-left: 6px;
}

.composer-row textarea,
.composer-row textarea:focus {
  flex: 1;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  outline: none;
}

.attach-btn {
  flex: none;
  margin-top: 7px;
  color: var(--text-muted);
}

.attach-btn:hover {
  color: var(--text);
}

.composer.uploading .attach-btn {
  opacity: 0.4;
  pointer-events: none;
}

.attach-tray {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 12px;
  margin-bottom: 2px;
  border-radius: 8px 8px 0 0;
  background: var(--bg-input);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.attach-tray::-webkit-scrollbar {
  height: 6px;
}

.attach-tray::-webkit-scrollbar-thumb {
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.18);
}

.attach-tray::-webkit-scrollbar-track {
  background: transparent;
}

.attach-tray:not(.hidden) + .composer-row {
  border-radius: 0 0 8px 8px;
}

.attach-item {
  position: relative;
  flex: none;
  width: 150px;
  display: grid;
  gap: 4px;
  padding: 8px;
  border-radius: 6px;
  background: var(--bg-sidebar);
  overflow: hidden;
}

.attach-thumb,
.attach-item .attach-file-icon {
  width: 100%;
  height: 96px;
  border-radius: 4px;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.25);
}

.attach-name {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attach-size {
  font-size: 11px;
  color: var(--text-muted);
}

.attach-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: rgba(17, 18, 20, 0.85);
  color: var(--danger);
  cursor: pointer;
}

.composer.uploading .attach-remove {
  display: none;
}

/* Upload progress: a bar along the bottom of each file. */
.attach-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: calc(var(--done, 0) * 100%);
  background: var(--accent);
  transition: width 0.15s linear;
}

.attach-item.sent .attach-progress {
  background: var(--ok);
}

/* ---------- dropping files ---------- */

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(10, 11, 14, 0.7);
  pointer-events: none;
}

.drop-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 28px 40px;
  border-radius: 14px;
  border: 2px dashed rgba(255, 255, 255, 0.45);
  background: var(--accent);
  color: #fff;
  text-align: center;
}

.drop-card strong {
  font-size: 18px;
}

/* ---------- image viewer ---------- */

.modal.image-modal {
  width: auto;
  max-width: calc(100% - 48px);
  background: transparent;
  box-shadow: none;
}

.image-viewer {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.image-viewer img {
  max-width: calc(100vw - 64px);
  max-height: calc(100vh - 120px);
  border-radius: 6px;
  object-fit: contain;
}

.image-viewer-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.image-viewer-bar .link {
  color: #fff;
}

/* ---------- files that are still on another PC ---------- */

.attach-card.remote {
  position: relative;
  overflow: hidden;
}

.attach-card.remote.error .attach-sub {
  color: var(--warn);
}

.attach-card .attach-head .btn {
  flex: none;
}

.attach-image.placeholder {
  position: relative;
  display: grid;
  place-items: center;
  gap: 8px;
  min-width: 160px;
  min-height: 90px;
  cursor: default;
  background: var(--bg-sidebar);
  border: 1px dashed rgba(255, 255, 255, 0.14);
}

.attach-head a.icon-btn {
  display: grid;
  place-items: center;
  color: inherit;
}

.attach-slot {
  max-width: 100%;
}

.attach-slot > .attach-card,
.attach-slot > .attach-video {
  width: 420px;
  max-width: 100%;
}
