/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

.text-message-view {
  position: relative;
  width: 100%;
  min-height: 48px;

  .text-message-wrapper {
    padding: 0 8px 8px 8px;
    overflow: hidden;
    white-space: pre;
    text-align: left;
    word-wrap: break-word;
    word-break: break-all;
    cursor: default;

    .message-time {
      color: #333;
      font-size: 12px;

      &.sender {
        text-align: right;
      }

      &.receiver {
        text-align: left;
      }
    }

    &.sender {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
    }

    &.receiver {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
    }

    .bubble {
      display: flex;

      &.sender {
        align-items: flex-end;
        justify-content: flex-end;
      }

      &.receiver {
        align-items: flex-end;
        justify-content: flex-start;
      }

      .text-item {
        border-radius: 10px;
        width: fit-content;
        max-width: 500px;
        padding: 8px;
        overflow: hidden;
        font-size: 14px;
        white-space: break-spaces;
        text-overflow: ellipsis;
        background-color: aliceblue;
      }

      .image-item {
        // max-width: 128px;
        // max-height: 128px;
        border-radius: 10px;
        padding: 8px;
        background-color: aliceblue;

        img {
          width: 100%;
          height: 100%;
        }
      }
      .show-popmenu {
        width: 16px;
        height: 16px;
        cursor: pointer;
        opacity: 0;

        img {
          width: 100%;
          height: 100%;
        }

        &.sender {
          margin-right: 8px;
        }
        &.receiver {
          margin-left: 8px;
        }
      }
    }
  }

  &:hover {
    .text-message-wrapper {
      .bubble {
        .show-popmenu {
          opacity: 1;
          transition: opacity 1s;
        }
      }
    }
  }
}
