main {
  display: flex;
  height: 100%;
  flex-direction: column;
  position: relative;
}

.messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  height: 100%;
  position: relative;

  > .row {
    flex: 1;
  }

  .author__name {
    font-weight: 500;
  }

  .author {
    position: relative;
  }

  .user--online .author {
    &::before {
      background: #2bb452;
      border: 5px solid #fff;
      border-radius: 100%;
      content: '';
      height: 5px;
      left: 20px;
      position: absolute;
      top: 0;
      width: 5px;
      z-index: 1;
    }
  }

  .circlewrap {
    position: absolute;
  }
}

.chat-list {
  border-right: 1px solid #141414;
  display: flex;
  flex-direction: column;

  .author__name {
    @include font-size(1.5rem);
  }
}

.chat-list__search,
.interlocutor {
  border-bottom: 3px solid #141414;
  padding: 1em 0;
}

.chat-list__search {
  display: flex;

  input,
  .button {
    border-radius: 2px;
    height: 5.6rem;
    line-height: 5.6rem;
    vertical-align: bottom;
  }

  input {
    border: 2px solid #e8e8e8;
    flex: 1;
    @include font-size(1.7rem);

    margin-right: 1.6rem;
    padding: 1.6rem 1.2rem;
  }

  .button {
    @include font-size(4rem);

    font-weight: 100;
    padding: 0;
    width: 5.6rem;
  }
}

.chat-list__types {
  @include font-size(1.7rem);

  margin-bottom: 1.5em;
  padding-top: 1em;

  ul {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  li {
    margin-right: 1em;
  }

  strong {
    border-bottom: 3px solid;
    font-weight: normal;
  }
}

.chat-list__users {
  flex: 1;
  position: relative;

  ul {
    height: 100%;
    list-style: none;
    margin: 0;
    overflow: auto;
    padding: 0;
    position: absolute;
    width: 100%;
  }

  li {
    align-items: baseline;
    background: #fff;
    cursor: pointer;
    display: flex;
    flex-wrap: wrap;
    @include font-size(1.5rem);

    padding: 2.4rem 0.8rem;
    position: relative;
    transition: background-color 0.3s;

    &:hover {
      background: #f6f6f6;
    }
  }

  .chat-list__user--current {
    background: #f6f6f6;
    cursor: default;
  }

  .author {
    flex: 1;
    margin-bottom: 0;
  }

  .author__details {
    margin-left: 4.2rem;
  }

  .last-message-date {
    color: rgb(0 0 0 / 30%);
    @include font-size(1rem);
  }

  .last-message-text {
    color: rgb(0 0 0 / 30%);
    flex: 1 100%;
    margin-left: 4.2rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.interlocutor {
  height: 56px;
  box-sizing: content-box;

  .circlewrap {
    height: 56px;
    max-width: 56px;
    width: 56px;
  }

  .author {
    margin-bottom: 0;

    &::before {
      left: 40px !important;
      height: 8px !important;
      width: 8px !important;
    }
  }

  .author__name {
    @include font-size(1.7rem);

    margin: 0.4em 0 0;
  }

  .author__details,
  .user-status {
    margin-left: 6.8rem;
  }

  .user-status {
    @include font-size(1.2rem);

    color: #ccc;
  }
}

.conversation {
  display: flex;
  flex-direction: column;
}

.conversation__messages {
  flex: 1;
  min-height: 20em;
  overflow: auto;
  position: relative;
}

.conversation__message-form {
  border-top: 1px solid #141414;
  display: flex;
  padding: 1em 1em 1em 0;

  input {
    border: none;
    @include font-size(2rem);

    height: 5.6rem;
    width: 100%;
  }

  button {
    border: none;
    cursor: pointer;
    padding: 0 0 0 0.4em;
    text-align: center;
    width: 5.6rem;

    &:hover {
      .icon {
        opacity: 0.5;
      }
    }

    .icon {
      height: 50%;
      margin: 0 auto;
      opacity: 0.2;
      transition: opacity 0.3s;
      width: 50%;
    }
  }
}

.conversation__messages-container {
  left: 0;
  height: 100%;
  overflow: auto;
  position: absolute;
  top: 0;
  width: 100%;
}

.conversation__date {
  position: relative;
  text-align: center;

  &::before {
    background: #141414;
    content: '';
    height: 1px;
    left: 0;
    position: absolute;
    top: 0.8em;
    width: 100%;
    z-index: -1;
  }

  time {
    background: #fff;
    @include font-size(1.5rem);

    color: #9fa1a7;
    padding: 0 0.5em;
  }
}

.conversation__message-container {
  display: flex;
  margin: 3.2rem 0;
}

.conversation__message {
  @include font-size(1.5rem);

  max-width: 60%;
  padding: 1.6rem 2.4rem;
  position: relative;

  &:hover {
    .conversation__context-popup-control {
      opacity: 1;
    }
  }
}

.conversation__message-details {
  color: #9fa1a7;
  @include font-size(1rem);

  left: 0;
  padding-top: 0.2em;
  position: absolute;
  top: 100%;
}

.conversation__message-container--other {
  .conversation__message {
    background: #f6f6f6;
    border-right: 0.3em solid #fff;
  }

  .conversation__context-popup-control {
    left: 100%;
    margin-left: 0.3em;
  }
}

.conversation__message-container--own {
  justify-content: flex-end;

  .conversation__message {
    background: #000;
    border-left: 0.3em solid #fff;
    color: #fff;
  }

  .conversation__context-popup-control {
    margin-right: 0.3em;
    right: 100%;
  }
}

.conversation__context-popup-control {
  background: #f6f6f6;
  border: none;
  cursor: pointer;
  height: 2.4rem;
  margin-top: -1.2rem;
  opacity: 0;
  top: 50%;
  position: absolute;
  transition: opacity 0.3s;
  width: 2.4rem;

  &:hover {
    .icon {
      opacity: 0.5;
    }
  }

  .icon {
    opacity: 0.3;
    transition: opacity 0.2s;
  }

  img {
    vertical-align: middle;
  }
}
