/* Photos and files sent in a conversation, and the paperclip that adds them. */

/* Under the bubble: pictures small enough to see at a glance, files as a
   row with their name and size. */
.message-files {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  opacity: 1;
}

.message-files__picture img {
  display: block;
  max-width: min(15rem, 60vw);
  max-height: 15rem;
  border-radius: 0.75rem;
  border: 1px solid var(--color-base-300);
  object-fit: cover;
  background-color: var(--color-base-200);
}

.message-files__file {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: min(18rem, 70vw);
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-base-300);
  border-radius: 0.75rem;
  background-color: var(--color-base-100);
  color: var(--color-base-content);
}

.message-files__file:hover {
  border-color: var(--color-primary);
}

.message-files__icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  color: var(--color-primary);
}

.message-files__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.message-files__size {
  flex-shrink: 0;
  color: color-mix(in oklab, var(--color-base-content) 60%, transparent);
}

/* The message box stacks the notes about picked files above the row with
   the paperclip, the text and Send. */
.message-form {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.message-problem {
  font-size: 0.875rem;
  color: var(--color-error);
}

.message-problem:empty {
  display: none;
}

.message-chosen {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.message-chosen[hidden] {
  display: none;
}

/* The real file picker hides inside the paperclip button but can still be
   reached with the keyboard. */
.message-attach {
  position: relative;
}

.message-attach:focus-within {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.message-attach__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
