/* --------------------------------------------- */
/* ############### 5.4 Chat Page ############### */
/* --------------------------------------------- */

.collapsed-menu {
  .br-chatpanel {
    @include media-breakpoint-up(lg) {
      margin-left: $br-header-height;
    }
  }
}

.show-left {
  .br-chatpanel {
    @include media-breakpoint-down(md) {
      transform: translateX($br-sideleft-width);
    }
  }
}

.br-chatpanel {
  margin-top: $br-header-height;
  height: calc(100vh - #{$br-header-height});
  display: flex;
  align-items: stretch;
  @include transition($transition-base);

  @include media-breakpoint-up(lg) {
    margin-left: $br-sideleft-width;
  }

  &.show-body {
    .br-chatpanel-left { display: none; }
    .br-chatpanel-body { display: block; }
  }
}

.br-chatpanel-left {
  width: 100%;
  background-color: $gray-100;
  border-right: 1px solid $gray-400;

  @include media-breakpoint-up(lg) {
    width: 320px;
  }

  .nav {
    align-items: center;
    //background-color: #fff;
    padding: 20px 20px 0;

    .nav-link {
      font-size: 10px;
      font-weight: 500;
      font-family: $font-family-roboto;
      text-transform: uppercase;
      letter-spacing: 1px;
      padding: 0;
      color: $body-color;

      &.active {
        color: $cyan;
        position: relative;

        &::after {
          content: '';
          position: absolute;
          bottom: -5px; //-11px;
          left: 0;
          right: 0;
          border-bottom: 2px solid $cyan;
        }
      }

      + .nav-link { margin-left: 20px; }
    }
  }
}

.br-active-contacts {
  padding: 20px;
  //border-top: 1px solid $gray-300;
  border-bottom: 1px solid $gray-300;
}

.br-sidebar-label {
  font-size: 10px;
  font-weight: 500;
  font-family: $font-family-roboto;
  text-transform: uppercase;
  color: $gray-500;
}

.br-chat-contacts {
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;

  .br-img-user { margin: auto; }

  > div {
    text-align: center;
    + div { margin-left: 10px; }
  }

  .chat-contacts-more {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    @include border-radius(100%);
    background-color: $gray-300;
    font-size: 11px;
    font-weight: 500;
    font-family: $font-family-roboto;
  }
}

.br-img-user {
  width: 36px;
  height: 36px;
  position: relative;

  img {
    width: 100%;
    height: 100%;
    @include border-radius(100%);
  }

  &::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 5px;
    width: 7px;
    height: 7px;
    background-color: $gray-400;
    @include border-radius(100%);
    box-shadow: 0 0 0 2px $gray-100;
  }

  &.online::after { background-color: $green; }
}

.br-chatlist {
  height: calc(100% - 176px);
  overflow: hidden;
  position: relative;

  .br-img-user {
    width: 40px;
    height: 40px;
    margin-top: 5px;
  }

  .msg-count {
    position: absolute;
    top: -5px;
    left: -5px;
    width: 16px;
    height: 16px;
    @include border-radius(100%);
    background-color: $red;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-family: $font-family-roboto;
    box-shadow: 0 0 0 2px $gray-100;
    display: none;
  }

  .media {
    padding: 10px 20px;
    border-top: 1px solid $gray-300;
    border-bottom: 1px solid $gray-300;
    position: relative;
    margin-top: -1px;

    &.new {
      background-color: #fff;

      .msg-count { display: flex; }
    }

    &.selected {
      background-color: $gray-200;

      .br-img-user::after { box-shadow: 0 0 0 2px $gray-200; }

      &::before {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        border-left: 3px solid $cyan;
      }
    }
  }

  .media-body {
    margin-left: 15px;

    P {
      margin-bottom: 0;
      font-size: 11px;
      line-height: 1.3;
    }
  }

  .media-contact-name {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;

    span:first-child {
      font-size: 13px;
      font-weight: 500;
      color: $gray-900;
    }

    span:last-child {
      font-size: 11px;
      color: $gray-500;
    }
  }
}

.br-chatpanel-body {
  flex: 1;
  position: relative;
  height: 100%;
  display: none;

  @include media-breakpoint-up(lg) { display: block; }
}

.br-chat-header {
  background-color: #fff;
  border-bottom: 1px solid $gray-400;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 20px;

  .br-img-user {
    width: 36px;
    height: 36px;
  }

  .chat-name {
    margin-left: 10px;

    h6 {
      color: $gray-900;
      margin-bottom: 0;
    }
  }

  .nav {
    margin-left: auto;
    align-items: center;
  }

  .nav-link {
    padding: 0;
    font-size: 24px;
    line-height: 1;
    color: $gray-500;
    display: none;

    @include media-breakpoint-up(sm) { display: block; }

    @include hover-focus() { color: $gray-900; }

    + .nav-link { margin-left: 15px; }

    &:first-child {
      font-size: 21px;
      display: block;

      @include media-breakpoint-up(sm) { display: none; }
    }
  }
}

.br-chat-body {
  position: relative;
  height: calc(100% - 130px);
  overflow-y: auto;

  .content-inner { padding: 20px; }
  .br-img-user::after { box-shadow: 0 0 0 2px $gray-200; }

  .media {
    + .media { margin-top: 20px; }

    &.flex-row-reverse {
      .media-body {
        margin-left: 0;
        margin-right: 20px;
        align-items: flex-end;

        @include media-breakpoint-up(sm) { margin-left: 55px; }
      }

      .msg-wrapper {
        background-color: $cyan;
        color: #fff;
      }
    }
  }

  .media-body {
    margin-left: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    @include media-breakpoint-up(sm) { margin-right: 55px; }

    > div:last-child {
      font-size: 11px;
      color: $gray-600;
      display: flex;
      align-items: center;

      a {
        font-size: 16px;
        line-height: 1;
        margin-left: 5px;
        color: $gray-500;
      }
    }
  }

  .chat-time {
    display: block;
    position: relative;
    text-align: center;
    margin: 20px 0;

    &:first-of-type { margin-top: 0; }

    span {
      font-size: 10px;
      font-weight: 500;
      font-family: $font-family-roboto;
      text-transform: uppercase;
      letter-spacing: 1px;
    }
  }

  .msg-wrapper {
    padding: 10px 15px;
    background-color: $gray-400;
    color: $gray-700;
    font-size: 13px;
    margin-bottom: 5px;
    @include border-radius(2px);
    display: inline-block;
  }
}

.br-chat-footer {
  display: flex;
  align-items: center;
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 60px;
  background-color: #fff;
  border-top: 1px solid $gray-400;
  padding: 0 20px;

  .nav {
    display: flex;
    align-items: center;

    &:last-child {
      display: none;
      @include media-breakpoint-up(sm) { display: flex; }
    }
  }

  > div {
    flex: 1;
    margin-left: 20px;
    @include media-breakpoint-up(sm) { margin-right: 20px; }

    .form-control {
      padding: 0;
      border-width: 0;
    }
  }

  .nav-link {
    padding: 0;
    font-size: 24px;
    color: $gray-500;

    @include hover-focus() { color: $gray-900; }

    + .nav-link { margin-left: 10px; }
  }
}
