$convos-input-height: 46px;

.convos-chat {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden; // This fixes some weird horizontal scrolling in Chrome on iPhone
}

.convos-dialog-container,
.convos-settings {
  position: relative;
  height: 100%;
  overflow: auto;
}

@media #{$large-and-up} {
  .convos-dialog-container, .convos-settings {
    margin-left: $main-menu-width;
  }
  body.has-sidebar {
    .convos-dialog-container, .convos-settings {
      margin-right: $sidebar-width;
    }
  }
}

.convos-dialog-container,
.convos-settings {
  main {
    position: absolute;
    top: $navbar-height-mobile;
    width: 100%;
    padding: $gutter-width $gutter-width / 2;
    z-index: 10;

    @media #{$large-and-up} {
      top: $navbar-height;
    }
  }
}

.scroll-element {
  @include overflow;
}

.convos-dialog-container main { height: auto; bottom: $convos-input-height; }
.convos-dialog-container.inactive { display: none; }
.convos-settings main { bottom: 0; }

.convos-input {
  background-color: $body-bg;
  border-top: 1px solid lighten($input-border-color, 20%);
  padding: 8px $gutter-width / 2 0 $gutter-width / 2;
  width: 100%;
  position: absolute;
  bottom: 0;
  z-index: $z-index-header - 1;

  &.loading {
    @include input-placeholder-color($primary-color);
    @include progress-bar($body-bg, darken($sidebar-bg, 1%));
  }

  // send button
  i {
    font-size: 2rem;
    cursor: pointer;
    width: 2rem;
    float: right;
    transition: color .2s;
    &, &.active { color: $input-focus-color; }
  }

  textarea.materialize-textarea {
    padding: 0;
    margin: 0;
    box-shadow: none;
    width: calc(100% - 2rem);
    height: $convos-input-height - 22px;
    min-height: 2rem;
    max-height: 9.5rem;
    overflow: auto;

    &, &:focus { border: 0; }
  }
}

.convos-settings {
  main > div,
  main > form {
    max-width: $readable-width;
    margin-left: 0;
  }
  .divider { margin: 2rem 0; }
}

.convos-message {
  $dialog-spacing: 4px;

  clear: both;
  display: block;
  position: relative;
  padding: $dialog-spacing 0;
  word-wrap: break-word;

  &.error, &.notice {
    padding-left: $gutter-width / 2;
    border-left: 2px solid $input-border-color;
  }
  &.action {
    .message, .title {
      font-style: italic;
      display: inline;
    }
    .link-embedder {
      font-style: normal;
    }
  }
  &.day-changed {
    color: lighten($off-black, 40%);
    font-size: 0.8rem;
    text-align: center;
    border-bottom: 1px solid lighten($input-border-color, 24%);
    margin: -0.2rem 0 0.5rem 0;
    height: 0.9rem;
    &:hover { background: transparent; }
    span { background: $body-bg; padding: 0 8px; line-height: 1rem; }
  }
  &.error {
    border-left: 2px solid $error-border-color;
    color: $notice-text-color;
    a { color: lighten($error-text-color, 20%); }
  }
  &.highlight {
    background-color: $highlight-bg-color;
    margin-left: -($gutter-width / 4);
    margin-right: -($gutter-width / 4);
    padding-left: ($gutter-width / 4);
    padding-right: ($gutter-width / 4);
  }
  &.action.highlight .message {
    margin-left: 0;
    padding-left: 0;
  }
  &.notice {
    border-left: 2px solid $notice-border-color;
    color: lighten($text-color, 40%);
    a { color: lighten($link-color, 20%); }
  }
  &.inactive-user {
    &, .secondary-container {
      color: lighten($text-color, 40%);
    }
    a.title {
      color: lighten($link-color, 25%);
      text-decoration: line-through;
    }
  }
  &.motd .message {
    font-family: $font-family-monospace;
    font-size: 0.9rem;
    div {
      font-family: $font-family-default;
      font-size: 1rem;
    }
  }
  &.same-user {
    margin-top: -$dialog-spacing;
    .title { display: none; }
    .secondary-content { opacity: 0; transition: opacity 1000ms; }
    &:hover .secondary-content {
      display: block;
      opacity: 1;
      color: lighten($text-color, 40%);
      transition: opacity 300ms;
    }
  }
  &.same-user.action {
    .title { display: inline; }
  }

  .message {
    a { color: inherit; text-decoration: underline; }
    a:hover { text-decoration: none; }

    .material-icons {
      vertical-align: text-top;
      font-size: 18px;
      margin-left: 4px;
    }
  }

  code {
    background: darken($body-bg, 5%);
    outline: 1px solid darken($body-bg, 15%);
    padding: 1px 3px;
  }

  .secondary-content {
    padding-top: 2px;
    &, a {
      color: lighten($text-color, 10%);
      font-size: 0.8rem;
      overflow: hidden;
      display: block;
    }
    i {
      vertical-align: bottom;
    }
  }
}

.convos-help {
  @media #{$medium-and-up} {
    h5 {
      clear: left;
    }
    dl {
      overflow: hidden;
    }
    dl dt {
      width: 15.5em;
      clear: left;
      float: left;
    }
    dl dd {
      margin-left: 16em;
    }
  }
}

body.no-header {
  .convos-dialog-container,
  .convos-settings {
    main { top: 0; }
  }
}

body.no-menu {
  .convos-dialog-container,
  .convos-settings {
    margin-left: 0;
  }
}
