/*
 * Copyright (c) 2010, 2024 BSI Business Systems Integration AG
 *
 * This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 */
.login-box-content > form {
  & > input,
  & > .button {
    width: calc(100% - 40px);
    height: 40px;
    margin: 4px 20px;
    font-size: @box-font-size;
  }

  & > .button {
    margin-top: 16px;
    margin-bottom: 0;
  }

  & > .message-box {
    margin: 0 20px 12px 20px;
  }

  & > input.alternative:-webkit-autofill {
    /* NOSONAR (for some reason, rule "less:overqualified-elements" is illegitimately triggered here)
       /* Improve Chrome's auto-fill style by overriding the forced yellow background and black text color. */
    /* (Requires some hacks, see http://webagility.com/posts/remove-forced-yellow-input-background-in-chrome) */
    border-top-width: 0;
    padding-top: @text-field-padding-top-compensation + 1px;
    -webkit-box-shadow: inset 0 0 0 1000px @background-color;
    -webkit-text-fill-color: @text-color !important; /* NOSONAR (!important is okay here) */

    &::first-line {
      // Chrome uses a different size and family for the auto filled credentials
      // -> explicitly set size and family so that it won't change when the user clicks into the field
      font-size: @box-font-size;
      font-family: @font-default-family;
    }

    &:focus {
      -webkit-text-fill-color: @focus-color !important; /* NOSONAR (!important is okay here) */
    }

    &::selection {
      -webkit-text-fill-color: @text-selection-color !important; /* NOSONAR (!important is okay here) */
    }
  }
}

/*
 * Login button is a default button -> styles are defined in main.css.
 * Difference to regular default button is the disabled style and the ability to turn red.
 */
.login-button.default {

  &.login-error:not(.disabled) {
    border-color: transparent;
    background-color: @error-color;

    &:hover {
      background-color: @error-default-button-background-hover-color;
    }

    &:active {
      background-color: @error-default-button-background-active-color;
    }

    &:focus {
      #scout.focus-border(@box-shadow-color: @error-focus-box-shadow-color, @border-color: mix(@error-color, @error-focus-box-shadow-color, 25%));
    }
  }

  &.disabled {
    color: @default-button-color;
    border-color: @default-button-background-color;
    background-color: @default-button-background-color;
  }
}

.login-button-loading {
  #scout.animation(pulsate 2s cubic-bezier(0.5, 0.1, 0.1, 0.5) infinite);
  display: inline-block;
  border-radius: 50%;
  border: 1px fade(@default-button-color, 80%) solid;
  width: 18px;
  height: 18px;
  vertical-align: middle;
}

.login-body,
.logout-body {
  overflow: auto;

  & > .box-background-elements.box-background-elements-fadeout {
    #scout.animation(nop 0.05s);
  }
}

@media (max-width: @box-responsive-width) {
  .login-box-content > form {
    & > .message-box,
    & > input,
    & > .button {
      width: 100%;
      margin-left: 0;
      margin-right: 0;
    }
  }
}
