// Copyright (c) 2016-2019 VMware, Inc. All Rights Reserved.
// This software is released under MIT license.
// The full license information can be found in LICENSE in the root directory of this project.

@include exports('login.clarity') {
  .login-wrapper {
    display: flex;
    height: 100%;
    background: generateLoginBackground();
    background-size: 100%;
    background-position: $clr-login-width 0;
    background-repeat: no-repeat;

    .login {
      background: $clr-login-background-color;
      position: relative;
      display: flex;
      flex-direction: column;
      justify-content: center;
      padding: 1rem 2.5rem;
      height: auto;
      min-height: 100vh;
      width: $clr-login-width;

      .title {
        color: $clr-login-title-color;
        font-weight: $clr-login-title-font-weight;
        font-family: $clr-login-title-font-family;
        font-size: $clr-login-title-font-size;
        letter-spacing: $clr-login-title-letter-spacing;
        line-height: $clr-login-title-line-height;

        .welcome {
          line-height: $clr-login-title-line-height;
        }

        .hint {
          color: $clr-login-title-color;
          margin-top: 1.25rem;
          font-size: 0.5833rem;
        }
      }

      // @TODO Is this used?
      .trademark {
        color: $clr-login-trademark-color;
        font-weight: $clr-login-trademark-font-weight;
        font-family: $clr-login-trademark-font-family;
        font-size: $clr-login-trademark-font-size;
        letter-spacing: $clr-login-trademark-letter-spacing;
      }

      // @TODO Is this used?
      .subtitle {
        color: $clr-login-subtitle-color;
        font-weight: $clr-login-subtitle-font-weight;
        font-family: $clr-login-subtitle-font-family;
        font-size: $clr-login-subtitle-font-size;
        letter-spacing: $clr-login-subtitle-letter-spacing;
        line-height: $clr-login-subtitle-line-height;
      }

      .login-group {
        display: flex;
        flex-direction: column;
        padding: 2rem 0 0 0;

        .auth-source,
        .username,
        .password,
        .checkbox,
        .clr-form-control,
        .clr-checkbox-wrapper {
          margin: 0.25rem 0 0.75rem 0;
        }

        // Overrides for new forms layouts to match original login layout
        .clr-control-container {
          display: block;
          width: 100%;

          // Override to make select full width
          .clr-select-wrapper,
          .clr-select {
            width: 100%;
          }

          // Override to make input full width
          .clr-input-wrapper > .clr-input {
            width: 100%;
          }

          // Override to make password full width
          .clr-input-wrapper {
            width: 100%;

            & > .clr-input-group {
              max-width: 100%;
              width: 100%;
              padding-right: 0.4rem;

              & > .clr-input {
                width: calc(100% - 1rem);
              }
            }
          }
        }

        // @TODO Is this used?
        .tooltip-validation {
          margin-top: 0.25rem;
        }

        // @TODO Is this used?
        .tooltip-validation .username,
        .tooltip-validation .password {
          width: 100%;
          margin-top: 0; //Since the top margin is now handled by the tooltip itself
        }

        .error {
          display: none;
          margin: 0.25rem 0 0 0;
          padding: 0.375rem 0.5rem;
          // TODO: use contrast checker vs. known background?
          background: $clr-color-danger-800;
          color: $clr-login-background-color;
          border-radius: $clr-global-borderradius;
          line-height: 0.75rem;

          &:before {
            display: inline-block; //needed for IE. display: none to display:flex on parent doesnt work
            content: '';
            background: generateErrorIcon($clr-login-background-color);
            margin: $clr-rem-1px 0.25rem 0 0;
            height: $clr-login-icon-size;
            width: $clr-login-icon-size;
          }

          &.active {
            display: flex;

            &:before {
              flex: 0 0 $clr-login-icon-size;
            }
          }
        }

        .btn {
          margin: 3rem 0 0 0;
          max-width: none;
        }

        .error + .btn {
          margin: 1rem 0 0 0;
        }

        .signup {
          margin-top: 0.5rem;
          font-size: 0.5833rem;
          text-align: center;
        }
      }

      &:after {
        position: absolute;
        content: '';
        display: block;
        width: 1px;
        height: 100%;
        background: rgba($clr-color-neutral-1000, 0.1);
        top: 0;
        right: -2px;
      }
    }
  }

  @media screen and (max-width: map-get($clr-grid-breakpoints, md)) {
    .login-wrapper {
      justify-content: center;
      background: $clr-login-background-color;

      .login {
        width: 100%;
        margin-left: 0;
        padding: 1rem 20%;

        &:after {
          content: none;
        }
      }
    }
  }

  @media screen and (max-width: map-get($clr-grid-breakpoints, sm)) {
    .login-wrapper {
      .login {
        padding: 1rem 15%;
      }
    }
  }
}
