@import 'variables';
@import 'mixins';

// High level classes
.chat-page-wrapper {
  margin: 0px auto 0px;
  width: 100%;
  max-width: calc(1540px + 10vw);
}

.live-chat {
  height: calc(100vh - 56px);

  &.live-chat--iossafari {
    height: calc(100vh - 190px);
  }

  overflow-y: hidden;
}

//chat
.chat {
  display: flex;
  height: calc(100vh - 56px);

  &.chat--iossafari {
    height: calc(100vh - 201px);
  }
}

.chat--expanded {
  min-width: 500px;
  width: calc(100%-3px);

  @media screen and (min-width: 500px) {
    min-width: 300px;
  }
}

.chat__notificationsbutton {
  border: 0px;
  font-size: 12px;
  padding: 15px 0px;
  width: 100%;
  color: darken($green, 30%);
  font-weight: bold;
  width: 95%;
  border-radius: 3px;
  border: 1px solid darken($green, 30%);
  box-shadow: 3px 3px 0px darken($green, 30%);
  background: lighten($green, 30%);
  margin-bottom: 5px;

  &:hover {
    @include themeable(
      background,
      theme-container-background-hover,
      lighten($green, 20%)
    );
  }
}

.chat__channels {
  width: 45px;
  min-width: 45px;
  height: inherit;
  position: relative;
  overflow: hidden;
  padding-top: 5px;

  .chat__channelssearchtoggle {
    background: transparent;
    border: 0px;
    margin-left: 2px;
    svg {
      vertical-align: -5px;
      fill: var(--indicator-default-color);
    }
  }
  input {
    outline: 0;
  }
}

.chat__channels--expanded {
  width: 219px;
  min-width: 219px;

  @media screen and (min-width: 1000px) {
    width: 200px;
    min-width: 200px;

    .chat__channelstogglebutt {
      display: none;
    }
  }

  @media screen and (min-width: 1300px) {
    width: calc(220px + 3vw);
    min-width: 220px;
  }

  &.chat__channels--placeholder {
    .chat__channelstogglebutt--placeholderunexpanded {
      display: none;
    }

    @media screen and (max-width: 599px) {
      width: 45px;
      min-width: 45px;

      input {
        display: none;
      }

      .chat__channelstogglebutt {
        display: none;
      }

      .chat__channelstogglebutt--placeholderunexpanded {
        display: block;
        width: 100%;
      }
    }
  }
}

.chat__channelstogglebutt {
  width: 26px;
  height: 38px;
  background: transparent;
  border: 0px;
  -webkit-appearance: none;
  font-size: 18px;
  font-weight: bold;
}

.chat__channels input {
  width: calc(100% - 43px);
  border-radius: 3px;
  border: 1px solid $light-medium-gray;
  box-sizing: border-box;
  padding: 8px;
  font-size: 14px;
  -webkit-appearance: none;
  background: var(--card-bg);
  color: var(--body-color);

  @media screen and (min-width: 1000px) {
    width: 98%;
  }
}

.chat__channeltypefilter {
  padding: 4px 0px 0px;
  width: calc(100% - 5px);
}

.chat__channeltypefilterbutton {
  margin: 1px;
  @media screen and (min-width: 1300px) {
    margin: 5px 4px;
  }
}

.chat_chatconfig {
  position: absolute;
  bottom: 0px;
  left: 0px;
  right: 6px;
  font-size: 12px;
  padding: 3px 12px;
  display: inline-block;
  border-radius: 3px;
  background: var(--body-bg);
  border: 1px solid $light-medium-gray;
  font-weight: bold;
  cursor: default;
}

.chat_chatconfig--on {
  color: $green;
}

.chat_chatconfig--off {
  color: $red;
}

.chat__channels--hidden {
  display: none;
}

.chat__activechat {
  height: inherit;
  width: calc(100% - 45px);
  max-width: calc(100% - 45px);

  @media screen and (min-width: 1300px) {
    min-width: calc(100% - calc(280px + 3vw));
  }
}

.activechatchannel {
  height: inherit;
  max-height: inherit;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  background: var(--card-bg);
  flex-flow: row nowrap;
  position: relative;
  @include themeable(
    border-left,
    theme-container-border,
    1px solid $outline-color
  );
  @media screen and (min-width: 1540px) {
    @include themeable(
      border,
      theme-container-border,
      1px solid $outline-color
    );
    border-top: 0px;
  }
}

.activechatchannel__conversation {
  position: relative;
  order: 1;
  display: flex;
  flex-direction: column;
  flex: 0 1 auto;
  width: 100%;
  min-width: 50%;
  @media screen and (min-width: 1440px) {
    min-width: 35%;
  }
  @media screen and (max-width: 426px) {
    overflow-x: hidden;
  }
}

.activechatchannel__header {
  @include themeable(
    border-bottom,
    theme-container-border,
    1px solid $light-medium-gray
  );
  padding: 10px 12px;
  font-weight: bold;
  font-size: 17px;
  position: relative;

  a {
    color: var(--body-color);
  }

  .activechatchannel__channelconfig {
    height: 17px;
    position: absolute;
    right: 15px;
    top: 12px;
    cursor: pointer;
    @include themeable(filter, theme-social-icon-invert, invert(0));
    img {
      height: 100%;
    }
  }
}

.activechatchannel__messages {
  font-size: calc(15px + 0.05vw);
  padding: 10px 0px;
  flex-grow: 1;
  height: 300px;
  overflow-y: scroll;
  overflow-x: hidden;
  text-align: left;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

.activechatchannel__alerts {
  position: relative;
}

.chatalert__default {
  align-items: center;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  display: flex;
  height: 25px;
  justify-content: center;
  position: absolute;
  top: -25px;
  width: 100%;
  font-size: 13px;
}

.chatalert__default--hidden {
  display: none;
}

.activechatchannel__form {
  width: 100%;
  height: 73px;
  position: relative;
  @media screen and (min-height: 1000px) {
    height: 95px;
  }
}

.activechatchannel__activecontent {
  order: 2;
  flex: 0 1 auto;
  @include themeable(border, theme-border, 1px solid $outline-color);
  padding: 13px;
  min-width: 50%;
  @media screen and (min-width: 1440px) {
    min-width: 45%;
  }
  -webkit-overflow-scrolling: touch;
  background: var(--body-bg);
  z-index: 200;
  position: relative;
  box-sizing: border-box;
  overflow-y: auto;
  max-width: 100%;

  @media screen and (max-width: 426px) {
    padding: 10px;
    min-width: 50%;
    width: calc(100% - 16px);
    position: fixed;
    height: calc(100% - 86px);
    margin-left: -48px;
    margin-top: -1px;
  }

  @media screen and (min-width: 1000px) {
    margin-left: initial;
    padding: 18px;
    max-width: 480px;
  }

  @media screen and (min-width: 1300px) {
    margin-left: initial;
    padding: 18px;
    width: 750px;
    max-width: 750px;
  }
}

.chat--video-visible {
  .activechatchannel__conversation {
    min-width: 20%;
  }
  .activechatchannel__activecontent {
    &.activechatchannel__activecontent--video {
      width: 380px;
      min-width: 380px;
      @media screen and (max-width: 426px) {
        width: calc(100% - 16px);
        min-width: calc(100% - 16px);
      }
      iframe {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        height: 100%;
        width: 100%;
        border: 0px;
      }
    }
    width: 300px;
    min-width: 300px;
    @media screen and (min-width: 1000px) {
      width: 400px;
      min-width: 400px;
    }
    @media screen and (min-width: 1500px) {
      width: 750px;
      min-width: 750px;
    }
  }
}

.chat--content-visible .activechatchannel__conversation {
  max-width: 52%;
}

.chat--content-visible
  .activechatchannel__activecontent.activechatchannel__activecontent--video {
  width: 180px;
  min-width: 180px;
}

.live-chat-wrapper .activechatchannel__activecontent {
  min-width: 310px;
  margin-left: -180px;
  max-width: 96%;
  padding: 13px;
}

.chat--content-visible-full {
  .activechatchannel__activecontent.activechatchannel__activecontent--sidecar {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    min-width: 100%;
  }
  .activechatchannel__activecontent.activechatchannel__activecontent--video {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 200px;
    min-width: 200px;
    height: 300px;
    z-index: 250;
  }
}

.chat--video-visible-full {
  .activechatchannel__activecontent.activechatchannel__activecontent--video {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    min-width: 100%;
  }
  .activechatchannel__activecontent.activechatchannel__activecontent--sidecar {
    display: none;
  }
}

.activechatchannel__activecontentexitbutton {
  font-size: 30px;
  position: absolute;
  left: 4px;
  top: 4px;
  z-index: 10;
  padding: 0px;
  height: 30px;
  width: 30px;
  line-height: 0;
  @media screen and (max-width: 800px) {
    &.activechatchannel__activecontentexitbutton--fullscreen {
      display: none;
    }
  }
}

.activechatchannel__activeArticle {
  position: absolute;
  top: 0px;
  left: 0;
  right: 0;
  bottom: 0;
}

.activechatchannel__activeArticle iframe {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  width: 100%;
  border: 0px;
}

.activechatchannel__activecontentuserdetails {
  margin-top: 20px;
  font-family: $monospace;
  font-size: 0.9em;

  .key {
    color: $medium-gray;
    margin-bottom: 3px;
    font-size: 0.9em;
  }
}

.userdetails__blockreport {
  margin: 10px 0;

  button {
    background-color: rgb(255, 0, 0);
    color: rgb(255, 255, 254);
    font-size: 1em;
    cursor: pointer;
    padding: 5px;
    margin: 2px 5px;
    border-radius: 3px;
    border-width: 0px;
    border-style: initial;
    border-color: initial;
    border-image: initial;

    &:first-child {
      margin-left: 0;
    }
  }
}

.userdetails__reportabuse,
.userdetails__blockmsg {
  a {
    background-color: rgb(255, 0, 0);
    color: rgb(255, 255, 254);
    font-size: 1em;
    cursor: pointer;
    padding: 5px;
    margin: 2px 5px;
    border-radius: 3px;
    border-width: 0px;
    border-style: initial;
    border-color: initial;
    border-image: initial;
  }

  .no {
    background-color: rgb(78, 87, 239);
  }
}

.chat__channelinvitationsindicator a {
  background: linear-gradient(10deg, darken($green, 25%), darken($green, 15%));
  text-align: center;
  padding: 30px 0px;
  display: block;
  border-radius: 3px;
  margin: 3px 0px;
  border: 0px;
  width: 94%;
  color: white;
  font-size: 1.1em;
  font-weight: 700;
  -webkit-appearance: unset;
}

.chatchannels {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: inherit;
  width: 99%;
}

.chatchanneltabbutton {
  width: calc(100% - 2px);
  border: none;
  background: transparent;
  padding: 2px 0px;
  margin-bottom: -12px;
  box-sizing: border-box;
  color: var(--body-color);
  display: block;
  position: relative;
  .crayons-indicator {
    vertical-align: -1px;
    margin-right: 4px;
  }
}

.chatchanneltab {
  display: inline-block;
  width: 100%;
  margin-bottom: 5px;
  background: inherit;
  text-align: start;
  font-size: 11px;
  font-weight: 500;
  padding: 5px 4px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
  border: 1px solid transparent;
  font-size: 13px;
  padding: 8px;
}

.chatchanneltab--active {
  border: 1px solid var(--base-30);
  background: var(--base-10);
  img {
    border: 1px solid var(--base-30);
  }
}

.chatchanneltab--new {
  border: 1px solid var(--accent-brand-darker);
  color: var(--accent-brand-darker);
}

.chatchanneltab--video {
  background: lighten($green, 10%);
  animation: small-pulser 0.5s linear infinite;
}

.chatchanneltabindicator {
  display: inline-block;
  min-height: 0.3em;
  min-width: 0.3em;
  margin-right: 5px;

  img {
    height: calc(22px + 0.3vw);
    width: calc(22px + 0.3vw);
    vertical-align: calc(-6px - 0.14vw);
    border-radius: 100px;
    border: 1px solid var(--base-30);
    background: white;
  }

  .chatchanneltabgroupicon {
    display: inline-block;
    margin-left: calc(20px + 0.3vw);
  }
}

.chat--contracted {
  .chatchannels {
    width: 45px;
  }
  .chatchanneltabbutton {
    margin-left: 1px;
  }
  .chatchanneltab {
    padding: 6px 1px;
    img {
      height: 36px;
      width: 36px;
    }
  }
  .chatchanneltab--active {
    background: var(--base-20);
  }
  .chatchanneltab--new {
    background: var(--accent-brand-darker);
    color: white;
  }
}

.chatchanneltabindicator .chatchanneltabindicatorgroupimage {
  border-radius: 3px;
}

.chatchanneltabindicator--new img {
  border: 1px solid var(--accent-brand);
}

.chatchannels__channelslist {
  padding: 3px 0 10px;
  flex-grow: 1;
  overflow: scroll;
  padding-bottom: 9vw;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.chatchannels__channelslistheader {
  background: lighten($purple, 5%);
  border: 1px solid darken($purple, 20%);
  font-size: 12px;
  color: $dark-purple;
  box-sizing: border-box;
  padding: 5px;
  width: 98%;
  border-radius: 3px;
}

.chatchannels__channelslistfooter {
  font-size: 12px;
  color: $medium-gray;
  padding: 10px;
  opacity: 0.8;
  padding-bottom: 70px;
}

.chatchannels__config {
  position: absolute;
  bottom: -14px;
  left: 0;
  right: 0;
  background: var(--body-bg);
  border-top: 1px solid $light-medium-gray;
  padding: 8px 10px 20px;
  font-weight: bold;
  padding-left: 16px;
  cursor: pointer;

  img {
    opacity: 0.6;
  }

  &:hover {
    .chatchannels__configmenu {
      display: block;
    }
  }
}

.chatchannels__configmenu {
  display: none;
  position: absolute;
  bottom: 42px;
  padding: 12px 10px;
  min-width: 150px;
  left: 0;
  right: 0;
  background: $lightest-gray;
  border-top: 1px solid $light-medium-gray;
  font-size: 13px;

  a {
    color: $dark-gray;
    display: block;
    padding: 5px 0px;
  }
}

.chatchannels__misc {
  height: 70px;
  border-top: 1px solid #c9c9c9;
}

// Chatmessage
.chatmessage {
  padding: 3px 10px;
  display: flex;
  max-width: 100%;
  @media not all and (pointer: coarse) {
    &:hover {
      @include themeable(
        background,
        theme-container-background-hover,
        $light-gray
      );

      .chatmessagebody__username--link {
        @include themeable(
          background,
          theme-container-background-hover,
          transparent
        );
      }
    }
  }
}

.chatmessage__body {
  flex-grow: 1;
  max-width: calc(100% - 37px);
}

.chatmessagebody__username {
  font-weight: 600;
}

.chatmessage__timestamp {
  font-size: 11px;
  color: darken($light-medium-gray, 6%);
  min-width: 85px;
  text-align: right;
  padding-left: 4px;
  vertical-align: 1px;
}

.chatmessage__bodytext {
  margin: 3px 1px 4px;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;

  pre {
    background: #29292e;
  }

  code {
    background: #29292e;
    padding: 0.1em 0.3em;
    border-radius: 2px;
    color: #eff0f9;
    font-size: 0.95em;
    vertical-align: 0.05em;
    max-width: 100%;
    line-height: 1.4em;
    font-family: $monospace;
  }
}

.chatmessagebody__profileimage {
  height: 25px;
  width: 25px;
  margin-right: 6px;
  border-radius: 20px;
  vertical-align: -3px;

  @media screen and (min-width: 400px) {
    height: 31px;
    width: 31px;
  }
}

.chatmessagebody__username--link {
  color: inherit;
  border-radius: 3px;
  padding: 0px 2px;
  display: inline-block;

  &:hover {
    @include themeable(
      background,
      theme-container-background-hover,
      transparent
    );
  }
}

.chatmessagebody__message {
  p {
    margin-top: 0;
    margin-bottom: 9px;

    &:last-child {
      margin-bottom: 0;
    }
  }

  blockquote {
    border-left: 4px solid $black;
    margin-left: 0px;
    padding-left: 8px;
  }

  a h1 {
    color: var(--card-color);
    border-color: var(--card-color);
  }

  img {
    max-width: 100%;
  }
}

.chatmessagebody__currentuser {
  background: black;
  color: white;
  padding: 1px 5px;
  border-radius: 2px;
}

// Messagecomposer
.messagecomposer {
  display: flex;
  height: inherit;
  align-items: stretch;
  position: relative;
}

.messagecomposer__input {
  border-radius: 5px;
  font-size: 16px;
  margin: 0px 4px 4px 6px;
  padding: 5px;
  resize: none;
  flex-grow: 1;
  height: 54px;
  background: var(--card-bg);
  border: 1px solid var(--base-40);
  color: var(--body-color);
  @media screen and (min-width: 600px) {
    height: 44px;
  }
  @media screen and (min-height: 1000px) {
    height: 66px;
  }
}

.messagecomposer__submit {
  margin: 0px 6px 4px 0;
  border-radius: 5px;
  background: var(--accent-brand);
  font-weight: 600px;
  font-family: $helvetica-condensed;
  color: white;
  font-size: 18px;
  border: 0px;

  @media screen and (min-width: 500px) {
    width: 80px;
  }

  @media screen and (min-width: 1500px) {
    width: 100px;
  }
}

.messagelist__sentinel {
  height: 5px;
}

.chatcodeeditor {
  position: absolute;
  top: 40px;
  left: 0px;
  right: 24px;
  bottom: 0px;
}

.chatcodeeditor__header {
  position: absolute;
  top: -27px;
  left: 35px;
  font-family: $monospace;
  @include themeable(color, theme-color, $dark-gray);
}

.CodeMirror {
  padding: 12px;
  font-size: 0.9em;
}

.cursorelement {
  border-left: 3px solid $red;
  animation: blinker 1s linear infinite;
  padding: 0px;
  z-index: 0;
}

@keyframes blinker {
  50% {
    opacity: 0;
  }
}

@keyframes pulser {
  50% {
    opacity: 0.8;
    box-shadow: 2px 2px 0px $green;
    padding: 18px;
  }
}

@keyframes small-pulser {
  50% {
    opacity: 0.6;
    box-shadow: 2px 2px 0px $green;
  }
}

.chatchanneljumpback {
  position: relative;
}

.chatchanneljumpback__messages {
  position: absolute;
  bottom: 12px;
  right: 8px;
  background: var(--body-bg);
  color: var(--body-color);
  border: 2px solid $black;
  padding: 7px 15px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  text-transform: uppercase;
  font-weight: bold;
  z-index: 7;
}

.chatchanneljumpback__hide {
  display: none;
}

.message__info__actions {
  display: grid;
  grid-template-columns: 4fr 1fr;
}

.message__actions {
  display: none;
  justify-content: end;
  -webkit-justify-content: flex-end;
}

.message__actions span {
  margin-left: 7px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
}

.chatmessage:hover .message__actions {
  display: -webkit-flex;
  display: flex;
}

.chatchannels__richlink {
  border: 1px solid darken($light-medium-gray, 15%);
  border-radius: 3px;
  box-shadow: 2px 2px 0px darken($light-medium-gray, 15%);
  color: $black;
  display: block;
  max-width: 670px;
  padding: 0px;
  margin-bottom: 6px;
  background: var(--card-bg);
  font-size: 0.9em;
  &.chatchannels__richlink--base {
    h1 {
      margin: 18px auto;
    }
  }
  .chatchannels__richlinkmainimage {
    position: relative;
    width: 100%;
    margin: auto;
    background: transparent no-repeat center center;
    background-size: cover;
    z-index: 2;
    padding-top: 42%;
  }
  h1 {
    margin-top: 8px;
    padding: 0px calc(10px + 0.2vw);
    line-height: 1.1em;
    font-size: 1.8em;
    img {
      height: 1.2em;
      width: 1.2em;
      margin-right: 5px;
      vertical-align: -0.25em;
      &.chatchannels__richlinkprofilepic {
        border-radius: 100px;
        border: 1px solid var(--card-color-tertiary);
      }
    }
  }
  h4 {
    margin-top: 12px;
    margin-bottom: 15px;
    color: var(--card-color-tertiary);
    font-weight: 500;
    padding: 0px calc(10px + 0.2vw);
    img {
      height: 22px;
      width: 22px;
      border-radius: 100px;
      margin-right: 3px;
      border: 1px solid var(--card-color-tertiary);
      vertical-align: -6px;
    }
  }
}

.message__delete__modal {
  position: fixed;
  background-color: rgba(255, 255, 255, 0.25);
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 999;
  display: block;
  transition: all 0.3s;
}

.modal__content {
  width: 400px;
  position: absolute;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
  padding: 1em;
  border: 2px solid;
  background: var(--body-bg);
  color: var(--body-color);
}

.modal__content h3 {
  margin: 20px 0;
  text-align: center;
}

.delete__action__buttons {
  display: flex !important;
  justify-content: space-around;
  margin: 40px 0px 20px 0;
}

.delete__action__buttons div {
  border: 2px solid var(--body-color);
  padding: 5px 20px;
  cursor: pointer;
  user-select: none;
}

.message__delete__modal__hide {
  display: none;
}

.message__delete__button {
  background: #ff0000;
  color: white;
}

.messageToBeEdited {
  position: absolute;
  display: grid;
  grid-template-columns: 1fr 40px;
  width: calc(100% - 14px);
  top: -53px;
  background: white;
  padding: 0px 5px;
  border: 1px solid var(--header-bg);
  border-left: 3px solid var(--accent-brand);
  height: 50px;
  overflow: hidden;
  p {
    margin: 18px 0;
  }
}

.closeEdit {
  text-align: right;
  user-select: none;
  cursor: pointer;
  padding: 2px 5px;
  color: var(--accent-brand);
  font-weight: bold;
}

.editHead {
  position: absolute;
  color: var(--accent-brand);
  font-size: 14px;
  font-weight: bold;
}

.mention__list {
  position: absolute;
  background: var(--card-bg);
  display: none;
  z-index: 1;
  border-top: 1px solid #dbdbdb;
  bottom: 60px;
  width: 100%;
  max-height: 280px;
  overflow-x: scroll;
}
.mention__list .mention__user {
  padding: 5px 10px;
  border-bottom: 1px solid #dbdbdb;
  cursor: pointer;
}
.compose__outer__container {
  position: relative;
}
.mention__user__image {
  height: 25px;
  width: 25px;
  margin-right: 6px;
  border-radius: 20px;
  align-self: center;
}
.mention__visible {
  display: block;
}
.mention__user {
  display: grid;
  grid-template-columns: 30px 1fr;
}
.mention__user p {
  margin: 0px;
  font-size: 9px;
  color: gray;
  width: max-content;
}
.comment-mentioned-all {
  color: rgb(213, 138, 0);
}

.active__message__list {
  background: var(--theme-container-accent-background, #f5f6f7);
}
.chatmessage__action {
  &:hover {
    background: none;
  }

  .chatmessage__bodytext {
    margin: 0;
    font-size: 12px;
    font-style: italic;
    color: var(--card-color-tertiary);
    a {
      text-decoration: none;
      color: var(--card-color-tertiary);
      &:hover {
        text-decoration: underline;
      }
    }
  }
}
