$color-black-light: #1e1f22;
$color-blue-dark: #4752c4;
$color-blue: #5865f2;
$color-blue-light: #107ff1;
$color-blue-lighter: #00a7fa;
$color-gray-dark: #313338;
$color-gray: #b5bac1;
$color-gray-light: #dddee1;
$color-purple-dark: #18014e;
$color-purple-darker: #18014e;
$color-red: #d10000;

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  align-items: center;
  animation: gradientShift 30s ease infinite;
  background: linear-gradient(
    120deg,
    $color-purple-dark,
    $color-blue-light,
    $color-blue-lighter,
    $color-purple-darker
  );
  background-size: 300% 300%;
  display: flex;
  font-family: 'gg sans', 'Noto Sans', 'Helvetica Neue', Helvetica, Arial,
    sans-serif;
  height: 100vh;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

svg.logo {
  position: absolute;
  top: 2rem;
  left: 2rem;
}

main {
  align-items: center;
  background-color: $color-gray-dark;
  border-radius: 0.5rem;
  display: flex;
  gap: 2rem;
  justify-content: center;
  min-width: 800px;
  padding: 2rem;
  position: relative;

  section.form-container {
    display: flex;
    flex-direction: column;
    flex: 2;
    justify-content: center;

    header {
      text-align: center;

      h1 {
        color: $color-gray-light;
        font-size: 1.5rem;
        font-weight: bold;
        margin-bottom: 0.75rem;
      }

      p {
        color: $color-gray;
        font-size: 1rem;
        margin-bottom: 1rem;
      }
    }

    form {
      display: flex;
      flex-direction: column;

      .input-group {
        margin-top: 1.125rem;

        label {
          color: $color-gray;
          display: block;
          font-size: 0.8rem;
          font-weight: bold;

          .required {
            color: $color-red;
          }
        }

        input {
          background-color: $color-black-light;
          border-radius: 0.3125rem;
          border: none;
          color: $color-gray-light;
          font-size: 1rem;
          font-weight: 500;
          height: 2.5rem;
          margin-top: 0.375rem;
          padding: 0 0.625rem;
          width: 100%;

          &:focus {
            outline: 0.0625rem solid $color-blue;
          }

          &:hover {
            cursor: text;
          }
        }
      }

      > a {
        margin-top: 0.25rem;
      }

      button {
        background-color: $color-blue;
        border-radius: 0.1875rem;
        border: none;
        color: $color-gray-light;
        cursor: pointer;
        font-size: 1rem;
        font-weight: bold;
        margin-top: 1.5rem;
        padding: 0.75rem;
        width: 100%;

        &:hover {
          background-color: $color-blue-dark;
        }
      }

      .links {
        font-size: 0.8rem;
        margin-top: 0.625rem;

        span {
          color: $color-gray;
        }
      }
    }
  }

  section.qr-container {
    align-items: center;
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: center;
    margin-top: 1rem;
    text-align: center;

    .loading {
      animation: scale 1.4s infinite ease-in-out;
      background: transparent;
      height: 3.125rem;
      margin-bottom: 1.25rem;
      position: relative;
      width: 3.125rem;

      &::before,
      &::after {
        content: '';
        background: $color-blue;
        height: 0.9375rem;
        position: absolute;
        width: 0.9375rem;
      }

      &::before {
        animation: top 3s infinite ease-in-out;
        left: -0.625rem;
        top: -0.625rem;
      }

      &::after {
        animation: bottom 3s infinite ease-in-out;
        bottom: -0.625rem;
        right: -0.625rem;
      }
    }

    h2 {
      color: $color-gray-light;
      font-size: 1.35rem;
      font-weight: bold;
      margin-top: 3rem;
    }

    p {
      color: $color-gray;
      font-size: 1rem;
      margin-top: 0.625rem;
      text-align: center;

      strong {
        color: $color-gray-light;
        font-weight: bold;
      }
    }

    a {
      margin-top: 1rem;
    }
  }
}

a {
  color: $color-blue-lighter;
  font-size: 0.9rem;
  text-decoration: none;

  &:hover {
    text-decoration: underline;
  }
}

@keyframes top {
  0% {
    top: -0.625rem;
  }
  20% {
    left: 100%;
    top: -0.625rem;
  }
  40% {
    left: 100%;
    top: 100%;
    transform: rotate(-90deg);
  }
  60% {
    left: -0.625rem;
    top: 100%;
    transform: rotate(180deg);
  }
  80% {
    left: -0.625rem;
    top: -0.625rem;
    transform: rotate(90deg);
  }
  100% {
    top: -0.625rem;
  }
}

@keyframes bottom {
  0% {
    bottom: -0.625rem;
  }
  20% {
    bottom: -0.625rem;
    right: 100%;
  }
  40% {
    bottom: 100%;
    right: 100%;
    transform: rotate(-90deg);
  }
  60% {
    bottom: 100%;
    right: -0.625rem;
    transform: rotate(180deg);
  }
  80% {
    bottom: -0.625rem;
    right: -0.625rem;
    transform: rotate(90deg);
  }
  100% {
    bottom: -0.625rem;
  }
}

@keyframes scale {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.7);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 768px) {
  main {
    border-radius: 0;
    flex-direction: column;
    min-width: 100%;
    padding: 1rem;
    height: 100vh;

    > section.form-container {
      padding: 1rem;
      width: 100%;
    }

    > section.qr-container {
      display: none;
    }
  }
}

footer {
  bottom: 0;
  font-size: 0.75rem;
  position: absolute;
  text-align: center;
}
