// This is related to all quote logics
.module-quote {
  position: relative;

  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  overflow: hidden;
  border-left-width: 4px;
  border-left-style: solid;

  /* Primary */
  &__primary {
    flex-grow: 1;
    padding-inline-start: 8px;
    padding-inline-end: 8px;
    max-width: 100%;
  }
  &__primary__profile-name {
    font-style: italic;
  }
  &__primary__type-label {
    font-style: italic;
    font-size: var(--font-size-sm);
    line-height: 18px;

    color: var(--message-bubbles-received-text-color);
    border-color: var(--message-bubbles-received-text-color);
  }
  &__primary__author {
    font-size: var(--font-size-sm);
    font-weight: bold;
    line-height: 18px;
    margin-bottom: 5px;

    overflow-x: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--message-bubbles-received-text-color);

    .module-contact-name {
      font-weight: bold;
    }
  }
  &__primary__text {
    font-size: 14px;
    line-height: 18px;
    text-align: start;

    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    white-space: pre-wrap;

    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;

    color: var(--message-bubbles-received-text-color);

    a {
      color: var(--message-bubbles-received-text-color);
    }
  }
  &__primary__filename-label {
    font-size: 12px;
  }

  /* Icons */
  &__icon-container {
    flex: initial;
    min-width: 54px;
    width: 54px;
    max-height: 54px;
    position: relative;

    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    &__inner {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;

      text-align: center;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    &__circle-background {
      display: flex;
      align-items: center;
      justify-content: center;

      height: 32px;
      width: 32px;
      border-radius: 50%;
      background-color: var(--chat-buttons-background-color);

      &:hover {
        background-color: var(--chat-buttons-background-hover-color);
      }
    }
    &__icon {
      width: 24px;
      height: 24px;

      &--file {
        @include color-svg('../images/file.svg', var(--button-icon-stroke-color));
      }
      &--image {
        @include color-svg('../images/image.svg', var(--button-icon-stroke-color));
      }
      &--microphone {
        @include color-svg('../images/microphone.svg', var(--button-icon-stroke-color));
      }
      &--play {
        @include color-svg('../images/play.svg', var(--chat-buttons-icon-color));
      }
      &--movie {
        @include color-svg('../images/movie.svg', var(--button-icon-stroke-color));
      }
    }
  }

  /* Generic Files */
  &__generic {
    &-file {
      display: flex;
      flex-direction: row;
      align-items: center;
    }
    &-file__icon {
      background: url('../images/file-gradient.svg');
      background-size: 75%;
      background-repeat: no-repeat;
      height: 28px;
      width: 36px;
      margin-inline-start: -4px;
      margin-inline-end: -6px;
      margin-bottom: 5px;
    }
    &-file__text {
      font-size: 14px;
      line-height: 18px;
      color: var(--message-bubbles-received-text-color);

      max-width: calc(100% - 26px);
      overflow-x: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }
  }

  /* Reference Warning */
  &__reference {
    &-warning {
      height: 26px;
      display: flex;
      flex-direction: row;
      align-items: center;

      background-color: var(--message-link-preview-background-color);
      padding-inline-start: 8px;
      padding-inline-end: 8px;
      margin-inline-end: 8px;
    }

    &-warning__icon {
      height: 16px;
      width: 16px;
      @include color-svg('../images/broken-link.svg', var(--message-bubbles-received-text-color));
    }

    &-warning__text {
      margin-inline-start: 6px;
      color: var(--message-bubbles-received-text-color);
      font-size: var(--font-size-sm);
      line-height: 18px;
    }
  }

  /* Misc */
  &--no-click {
    cursor: auto;
  }
}

/* Outgoing messages */
.module-quote--outgoing {
  color: var(--message-bubbles-sent-text-color);
  .module-quote {
    &__primary__type-label {
      color: var(--message-bubbles-sent-text-color);
      border-color: var(--message-bubbles-sent-text-color);
    }
    &__primary__author {
      color: var(--message-bubbles-sent-text-color);
    }
    &__primary__text {
      color: var(--message-bubbles-sent-text-color);

      a {
        color: var(--message-bubbles-sent-text-color);
      }
    }

    &__generic {
      &-file__text {
        color: var(--message-bubbles-sent-text-color);
      }
    }
  }
}

.module-quote-container {
  margin-bottom: var(--margins-xs);
  margin-top: var(--margins-xs);
  min-width: 300px; // if the quoted content is small it doesn't look very good so we set a minimum
  padding-right: var(--margins-xs);

  /* This is not within the module-quote class so we handle it separately */
  .module-quote__reference-warning--outgoing {
    .module-quote__reference-warning__text {
      color: var(--message-bubbles-sent-text-color);
    }
    .module-quote__reference-warning__icon {
      @include color-svg('../images/broken-link.svg', var(--message-bubbles-sent-text-color));
    }
  }
}
