@use "../abstracts/mixins";
@use "../abstracts/theme";
@use "../base/typography";
@use "../form/checkbox";
@use "../form/input";
@use "../components/buttons";

@property --opacity {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

.app-sign-in-register {
  width: 100vw;
  height: 100vh;
  padding: 0;
  margin: 0;
}

.app-sign-in-register__branding {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 40vw;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;

  @media (width < 992px) {
    display: none;
  }

  &::before,
  &::after {
    content: "";
    position: absolute;
    min-height: 130%;
    min-width: 130%;
    aspect-ratio: 1;
    object-fit: cover;
    z-index: -1;
  }

  &::before {
    background-image:
      radial-gradient(at 40% 20%, var(--orange) 0, transparent 50%),
      radial-gradient(at 80% 0%, var(--cyan) 0, transparent 50%),
      radial-gradient(at 0% 50%, var(--light-pink) 0, transparent 50%),
      radial-gradient(at 80% 50%, var(--light-red) 0, transparent 50%),
      radial-gradient(at 0% 100%, var(--light-yellow) 0, transparent 50%),
      radial-gradient(at 80% 100%, var(--dark-purple) 0, transparent 50%),
      radial-gradient(at 0% 0%, var(--pink) 0, transparent 50%);
  }

  &::after {
    background-image:
      radial-gradient(at 40% 20%, var(--light-cyan) 0, transparent 50%),
      radial-gradient(at 80% 0%, var(--dark-orange) 0, transparent 50%),
      radial-gradient(at 0% 50%, var(--light-blue) 0, transparent 50%),
      radial-gradient(at 80% 50%, var(--light-green) 0, transparent 50%),
      radial-gradient(at 0% 100%, var(--light-red) 0, transparent 50%),
      radial-gradient(at 80% 100%, var(--light-yellow) 0, transparent 50%),
      radial-gradient(at 0% 0%, var(--cyan) 0, transparent 50%);
  }

  &__starburst {
    position: absolute;
    inset: 0;
    z-index: 1;
    backdrop-filter: invert(2%) blur(100px);
    mask-image: repeating-conic-gradient(
      from var(--opacity),
      var(--background) 0deg,
      transparent 20deg
    );
  }

  img {
    min-height: 15rem;
    height: 25vh;
    max-height: 30rem;
    z-index: 1;
  }
}

.app-sign-in-register__content {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;

  @media (width >= 992px) {
    margin-left: 40vw;
  }

  @media (height <= 600px) {
    align-items: stretch;
  }
}

.app-sign-in-register__content-inner {
  display: flex;
  align-items: stretch;
  flex-direction: column;
  gap: 1.6rem;
  margin: calc(var(--section-padding) * 3) var(--section-padding);
  width: 100%;

  @media (width >= 430px) {
    width: 430px;
  }

  * {
    box-sizing: border-box;
  }

  h1 {
    font-size: 1.8rem;
    font-family: Georgia, serif;
    text-align: left;
    margin-bottom: 0;

    @media (width <= 600px) {
      font-size: 1.6rem;
    }
  }

  input {
    padding: 0.6rem 0.75rem;
    border-radius: var(--form-input-border-radius);
    font-size: 0.95rem;

    @media (width <= 600px) {
      font-size: 1rem;
    }
  }

  .app-sign-in-register__form-label {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    font-weight: var(--font-bold-weight);
  }

  button {
    padding: 0.9rem 1rem;
    font-size: 0.95rem;
  }

  form {
    display: contents;
  }

  .app-sign-in-register__switcher {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;

    &::before {
      content: "";
      position: absolute;
      inset: calc(50% + 1px) 0;
      height: 2px;
      border-radius: var(--form-input-border-radius);
      background-color: var(--input-border);
    }

    a {
      @include mixins.link;

      z-index: 1;
      padding: 0 0.2rem;
      font-weight: var(--font-bold-weight);
      font-size: 0.95rem;
      margin: 0;
      color: var(--link-color);
      text-underline-offset: 2px;
      text-decoration-thickness: 2px;
      position: relative;
      outline: none;

      &::before {
        content: "";
        position: absolute;
        inset: 0 -0.5rem;
        background-color: var(--background);
        z-index: -1;
      }

      &::after {
        content: "";
        position: absolute;
        inset: 0 -0.1rem;
        border-radius: 0.4rem;
        box-shadow: 0 0 0 0.625rem transparent;
        transition: var(--standard-transition);
        pointer-events: none;
      }

      &:focus-visible {
        text-decoration: none;

        &::after {
          box-shadow: 0 0 0 0.2rem var(--text-color);
        }
      }
    }
  }

  .jenkins-checkbox {
    font-size: 0.95rem;
  }

  & > div {
    &:empty {
      display: none;
    }
  }
}

@keyframes aurora-one {
  0% {
    opacity: 0.3;
  }

  50% {
    opacity: 0.15;
    transform: rotate(-180deg);
  }

  100% {
    opacity: 0.3;
    transform: rotate(-360deg);
  }
}

@keyframes aurora-two {
  0% {
    opacity: 0.15;
  }

  50% {
    opacity: 0.5;
    transform: rotate(180deg);
  }

  100% {
    opacity: 0.15;
    transform: rotate(360deg);
  }
}

.app-sign-in-register__error {
  font-size: 0.95rem;
  color: var(--error-color);
  font-weight: var(--font-bold-weight);

  &:empty {
    display: none;
  }

  &:not(:empty) {
    & + input {
      margin-top: 0.7rem;
    }
  }
}

.app-sign-in-register__password-notice {
  font-size: 0.95rem;
  color: var(--text-color-secondary);
}

.jenkins-input--error {
  border-color: var(--error-color);
}

.inputHeader {
  display: flex;
  justify-content: space-between;
}

#passwordStrengthWrapper {
  margin-top: 0.75rem;
  font-size: 0.95rem;

  #passwordStrength {
    transition: var(--standard-transition);
  }
}
