@import "ui-variables";
@import "octicon-mixins";

@font-family-monospace: Menlo, Consolas, 'DejaVu Sans Mono', monospace;
@join-leave-button-width: 50px;

.PortalStatusBarIndicator {
  // Remove margin on the icon since there is no text that follows
  &&&:before {
    margin-right: 0;
  }

  &.transmitting {
    color: @text-color-info;

    &:hover {
      color: @text-color-info;
    }
  }

  &.outdated, &.initialization-error {
    color: @text-color-error;

    &:hover {
      color: @text-color-error;
    }
  }
}

.TeletypePopoverTooltip {
  user-select: none;

  &.tooltip {
    width: 315px;
    padding-left: @component-padding;
    padding-right: @component-padding;
    box-sizing: border-box;
  }

  .tooltip-inner.tooltip-inner.tooltip-inner.tooltip-inner {
    padding: @component-padding;
    background-color: @tool-panel-background-color;
    border: 1px solid @base-border-color;
    box-shadow: 0 4px 8px hsla(0, 0, 0, .1);
    color: @text-color;
    max-height: 300px;
    white-space: normal;
    overflow-y: auto;
  }

  &.top .tooltip-arrow.tooltip-arrow {
    width: @component-padding;
    height: @component-padding;
    border-width: 0 0 1px 1px;
    border-color: @base-border-color;
    background-color: @tool-panel-background-color;
    border-bottom-right-radius: 2px;
    transform: rotate(-45deg);
  }
}

.TeletypePopoverComponent {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: @component-padding * -1; // Used to 'undo' the built-in padding
  color: @text-color !important;
}

.PortalListComponent {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.PortalListComponent--initializing {
  text-align: center;
}

.PortalParticipants {
  flex: auto;
  display: flex;
  flex-direction: row;
  align-items: center;

  &-guests {
    flex: auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    align-content: start;
    flex-wrap: wrap;
  }

  &-participant {
    margin: @component-padding / 2;

    img {
      height: 22px;
      border-radius: 50%
    }
  }

  &-site-1 {
    margin-left: 0;

    img {
      height: 28px;
    }
  }
}

.HostPortalComponent {
  flex: none;

  &-status {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0 @component-padding;
  }

  &-share-toggle {
    flex: none;

    label {
      margin: 0;
      font-size: 80%;
    }
  }

  &-connection-info,
  &-GuestPortalsContainer {
    border-bottom: 1px solid @base-border-color;
    padding: 0 @component-padding;
  }

  &-connection-info {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: @component-padding @component-padding (@component-padding / 2);
    position: relative;

    &-heading {
      &.creating-portal {
        visibility: hidden;
      }

      h1 {
        margin-top: 0;
        margin-bottom: @component-padding / 2;
        font-weight: normal;
        font-size: 80%;

        &::before {
          line-height: 1em;
          margin-right: 5px;
        }
      }
    }

    &-portal-url {
      display: flex;
      flex-direction: row;
      margin-bottom: 5px;

      &.creating-portal {
        visibility: hidden;
      }

      .input-text {
        display: flex;
        flex: auto;
      }

      .btn {
        margin-left: @component-padding / 2;
        flex: none;
      }
    }

    &-spinner {
      position: absolute !important;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
    }
  }

  .host-id-input {
    font-family: @font-family-monospace;
    font-size: 80%;
    color: @text-color;
  }
}

.PortalListComponent-GuestPortalsContainer {
  flex: 1;
}

.GuestPortalComponent {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 0 @component-padding;

  &-leave.btn {
    flex: none;
    width: @join-leave-button-width;

    label {
      margin: 0;
      font-size: 80%;
    }
  }
}

.SignInComponent {
  text-align: center;
  padding: @component-padding;

  atom-text-editor {
    font-size: 12px !important;
    margin-bottom: @component-padding;
    text-align: left;
  }
}

.SignInComponent-GitHubLogo {
  .octicon(mark-github, 40px);
}

.JoinViaExternalAppDialog {
  padding: @component-padding;

  &-cancel {
    position: absolute;
    padding: @component-padding;
    top: 0;
    right: 0;
    text-align: right;
    &::before {
      margin-right: 0;
    }
  }

  &-uri {
    padding: @component-padding/2 @component-padding;
    color: @text-color-highlight;
    border: 1px solid @base-border-color;
    border-radius: @component-border-radius;
    background-color: @background-color-highlight;
  }

  &-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .input-label {
    margin-left: 2em;
    margin-right: 3em;
  }

  .input-checkbox {
    margin-left: -2em;
    margin-right: .5em;
  }
}

.JoinPortalComponent--no-prompt,
.JoinPortalComponent--prompt
{
  border-top: 1px solid @base-border-color;
}

.JoinPortalComponent--no-prompt {
  flex: none;
  height: 40px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;

  label {
    color: @text-color-subtle;
    font-size: 12px;
    margin: 0;
  }

  label:hover {
    color: @text-color-selected;
    cursor: pointer;
  }
}

.JoinPortalComponent--prompt {
  flex: none;
  height: 40px;
  text-align: left;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  padding: 0 @component-padding;

  atom-text-editor {
    flex: auto;
    font-size: 80% !important;
  }

  .btn {
    flex: none;
    width: @join-leave-button-width;
    margin-left: 5px;
  }
}

.cursors.blink-off .cursor.non-blinking {
  opacity: 1;
}

.SitePositionsComponent {
  @corner-margin: @component-padding * 1.5;
  @avatar-margin: @component-padding / 2;
  @avatar-size: 40px;

  display: flex;
  flex-direction: row;
  position: absolute;
  justify-content: flex-end;
  font-size: 16px;
  text-align: right;
  left: 0;
  right: @corner-margin;
  bottom: @corner-margin;
  overflow: hidden;
  pointer-events: none;

  img {
    cursor: pointer;
    height: @avatar-size;
    border: 2px solid transparent;
    border-radius: 50%
  }

  .SitePositionsComponent-site {
    margin-left: @avatar-margin;
    pointer-events: auto;
    border: solid 2px transparent;
    border-radius: 50%;

    &.viewing-non-portal-item {
      opacity: 0.5;
    }

    .icon-link {
      position: absolute;
      margin-left: 26px;
      margin-top: 26px;
      color: @text-color-info;
      pointer-events: none;

      &::before {
        position: relative;
        z-index: 2;
      }

      // background cover
      &::after {
        content: "";
        position: absolute;
        z-index: 1;
        left: -2px;
        top: 4px;
        width: 15px;
        height: 11px;
        border-radius: 6px;
        background-color: @syntax-background-color;
      }
    }
  }
}

// Site colors
.cursor.ParticipantCursor, // cursor
.SitePositionsComponent-site.color  { // avatar
  &--site-1  { border-color: @ui-site-color-1; }
  &--site-2  { border-color: @ui-site-color-2; }
  &--site-3  { border-color: @ui-site-color-3; }
  &--site-4  { border-color: @ui-site-color-4; }
  &--site-5  { border-color: @ui-site-color-5; }
  &--site-6  { border-color: spin(@ui-site-color-1, 25); }
  &--site-7  { border-color: spin(@ui-site-color-2, 25); }
  &--site-8  { border-color: spin(@ui-site-color-3, 25); }
  &--site-9  { border-color: spin(@ui-site-color-4, 25); }
  &--site-10 { border-color: spin(@ui-site-color-5, 25); }
  &--site-11 { border-color: spin(@ui-site-color-1, 65); }
  &--site-12 { border-color: spin(@ui-site-color-2, 65); }
  &--site-13 { border-color: spin(@ui-site-color-3, 65); }
  &--site-14 { border-color: spin(@ui-site-color-4, 65); }
  &--site-15 { border-color: spin(@ui-site-color-5, 65); }
}

.PackageOutdatedComponent, .PackageInitializationErrorComponent {
  color: @text-color;
  text-align: center;
  padding: 0 @component-padding @component-padding @component-padding;

  .btn {
    margin-bottom: @component-padding * 1.5;
  }
}
