// Variables
// --------------------------------------
$scrollbar-width : 10px;
$chat-bubble-color : #fffaf0;
$chat-text-color : #2b3a42;
$chat-thread-msg-arrow-size : 15px;
$chat-thread-avatar-size : 50px;
$chat-thread-offset : #{$chat-thread-avatar-size + 30px};
.content.Chat {
  padding: 0;
  border-top-left-radius: 6px;

  .syncSpinner { // override default spinner location
    height: 32px !important;
    width: 32px !important;
    bottom: initial !important;
    top: 6px !important;
    right: 66px !important;
  }
  form {
    margin: 8px auto 0 auto;
    width: 90%;
    max-width: 760px;
    position: relative;

    .sendButton {
      top: 0;
      position: absolute;
      width: 42px;
      height: 42px;
      color: cornflowerblue;
      background-color: floralwhite;
      cursor: pointer;
      border-radius: 5px;
      right: 5px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 2.4em;

      &:hover {
        border: 2px solid cornflowerblue;
      }
    }
  }

  &.compact {
    border-top-left-radius: initial;
  }
}

.chat-thread {
  margin: 25px auto 0 auto;
  padding: 0 20px 4px 0; // scroll bar pad.
  list-style: none;
  overflow-y: auto;
  overflow-x: hidden;
  height: calc(100% - 100px);
  width: 90%;
  max-width: 760px;
  border-bottom-style: solid;
  border-bottom-width: thin;
  border-bottom-color: honeydew;
  border-bottom-left-radius: 15px;
  border-bottom-right-radius: 15px;

  .bubble {
    margin-top: 2px;
    position: relative;
    clear: both;
    display: inline-block;
    padding: 12px 14px 4px 12px;
    font: 16px/20px 'Noto Sans', sans-serif;
    border-radius: 10px;
    background-color: $chat-bubble-color;
    color: $chat-text-color;
  }

  .unreadMessageTicker {
    display: inline-block;
    background-color: #fffaf0;
    height: 40px;
    width: 40px;
    text-align: center;
    line-height: 40px;
    border-radius: 50%;
    cursor: pointer;
    position: absolute;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
    bottom: 90px;
    left: calc(50% - 20px);
    color: #6495ed;
    font-weight: 500;
  }
}

.bubble {
  .avatar {
    display: none;
    color: #ffffff;
    position: absolute;
    top: 0;
    width: $chat-thread-avatar-size;
    height: $chat-thread-avatar-size;
    line-height: $chat-thread-avatar-size;
    text-align: center;
    border-radius: 50%;
    background-size:     cover;
    background-repeat:   no-repeat;
    background-position: center center;
  }

  &.begining {
    margin-top: 10px;

    .avatar {
      display: initial;
    }
    &:after {
      position: absolute;
      top: $chat-thread-msg-arrow-size;
      content: '';
      width: 0;
      height: 0;
      border-top: $chat-thread-msg-arrow-size solid $chat-bubble-color;
    }
  }

  &.sent {
    animation: show-chant-sent 0.4s ease-in;
    float: right;
    margin-right: $chat-thread-offset;
    .avatar {
      right: -$chat-thread-offset;
    }
    &:after {
      border-right: $chat-thread-msg-arrow-size solid transparent;
      right: -$chat-thread-msg-arrow-size;
    }
  }
  &.recepient {
    animation: show-chat-recieved 0.4s ease-in;
    float: left;
    margin-left: $chat-thread-offset;
    .avatar {
      left: -$chat-thread-offset;
    }
    &:after {
      border-left: $chat-thread-msg-arrow-size solid transparent;
      left: -$chat-thread-msg-arrow-size;
    }
  }
}

.chat-input {
  width: calc(100% - 60px);
  padding-left: 5px;
  padding-right: 5px;
  max-width: 720px;
  height: 42px;
  font-size: 18px;
  font-family: 'Noto Sans', sans-serif;
  background-color: $chat-bubble-color;
  color: $chat-text-color;
  border: 0;
  border-radius: 6px;
  outline: none;
}

@keyframes show-chat-recieved {
  0% {
    margin-left: -480px;
  }
  100% {
    margin-left: 0;
  }
}

@keyframes show-chant-sent {
  0% {
    margin-right: -480px;
  }
  100% {
    margin-right: 0;
  }
}
