.attachments-preview, .document-attachment {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  transition: 0.4s ease-in-out;
  width: 100%;

  &:has(.heading-wrapper.hidden) #image_preview {
    display: none;
  }
}

.document-attachment {
  align-items: center;
  background-color: var(--off-white);
  border: 1px solid var(--light-gray);
  border-radius: var(--border-radius);
  padding: 0.5rem 1rem;
}

audio.audio-attachment {
  width: 100%;
}

video.video-attachment {
  width: 100%;
}

/* Chat Message Attachment Inputs */
section.message-attachment-inputs {
  background-color: var(--off-white);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;

  header.attachments-header {
    align-items: center;

    h4 {
      border-right: 1px solid var(--light-gray);
      flex: 0;
      padding-right: 0.5rem;
    }
  }

  &:not(:has(.field.attachments-preview audio)) .field.audio-input .attachment-input-controls {
    display: none;
  }

  .field {
    padding: 0.5rem;
    flex: 1 1 0;

    &.attachments-preview {
      border-bottom: 1px solid var(--light-gray);
      gap: 0.5rem;
      padding-bottom: 0.5rem;

      .attachments {
        max-height: var(--container-s);
      }

      input {
        display: none;
      }
    }

    &.audio-input {
      align-items: center;
      flex-direction: row;
      justify-content: space-between;
      height: fit-content;

      audio {
        display: none;
      }
    }
  }
}

.attachment-container.chat-pictures-container {
  .chat-image-preview {
    flex: 1 1 0;
    align-items: center;
    min-width: var(--container-xs);
    width: 100%;

    &.new-chat-picture {
      border-left: 1px solid var(--light-gray);
      padding-left: 0.5rem;
    }

    .avatar-wrapper {
      border: 1px solid var(--light-gray);
    }
  }
}

/* Chat message attachment styles only */
.chat-attachment__preview {
  position: relative;
  background-color: var(--off-white);
  border: 1px solid var(--light-gray);
  border-radius: var(--border-radius);
  height: 64px;

  img {
    border-radius: var(--border-radius);
  }
}

.chat-attachment__preview--image {
  aspect-ratio: 1 / 1;
  min-width: 64px;
  max-width: 64px;
  max-height: 64px;
}

.chat-attachment__preview--audio {
  width: 240px;

  audio {
    height: 100%;
    width: 100%;
    padding: calc(0.5rem - 1px);
  }
}

.chat-attachment__preview--document {
  width: 240px;
  align-items: center;
  padding: 8px;
  display: flex;
  gap: 8px;
}

.chat-attachment__file-name {
  font-weight: var(--font-weight-semibold);
}

.chat-attachment__file-extension {
  font-size: 1rem;
  color: var(--mid-gray);
}

.chat-attachment__file-icon {
  position: relative;
  padding: 14px;
  background-color: var(--theme-color);
  border-radius: var(--border-radius);

  svg {
    display: block;
    width: 16px;
    height: 16px;
    fill: var(--off-white);
    stroke: var(--off-white);
  }
}

.chat-attachment__remove-btn {
  cursor: pointer;
  position: absolute;
  display: block;
  width: 28px;
  height: 28px;
  right: -8px;
  top: -8px;
  border-radius: 50%;
  background-color: var(--off-white);

  &::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    display: block;
    width: 24px;
    height: 24px;
    background-color: var(--dark-gray);
    border-radius: 50%;
  }

  &:hover::before {
    background-color: var(--ink);
  }

  svg {
    position: absolute;
    top: 9px;
    left: 6px;
    width: 10px;
    height: 10px;
    z-index: 1;
    fill: var(--off-white);
    stroke: var(--off-white);
  }
}