/* 登录页面样式 - 基于 UIPro Figma 设计 */
@use '@/styles/variables' as *;
@use '@/styles/mixins' as *;

.login {
  width: 100%;
  min-height: 100vh;
  position: relative;
  background-color: $white;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 30px;
  box-sizing: border-box;
  gap: 27.5px;
  text-align: left;
  font-family: 'Noto Sans SC', $font-family-base;

  &__header {
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    align-content: center;
    gap: 12px;
  }

  &__logo {
    height: 44px;
    width: 36px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;

    img {
      width: 100%;
      height: 100%;
      object-fit: contain;
    }
  }

  &__brandName {
    margin: 0;
    position: relative;
    font-size: 24px;
    line-height: 32px;
    font-weight: 700;
    color: #0f172a;
  }

  &__card {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2.5px 0;
    box-sizing: border-box;
    gap: 23.5px;
    max-width: 448px;
  }

  &__titleWrapper {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  &__title {
    margin: 0;
    position: relative;
    font-size: 30px;
    letter-spacing: -0.75px;
    line-height: 36px;
    font-weight: 700;
    color: $black;
  }

  &__form {
    margin: 0;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-top: 8.5px;
    gap: 24px;
  }

  &__inputGroup {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  &__fieldWrapper {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  &__inputWrapper {
    align-self: stretch;
    background-color: $white;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);

    &--error {
      border-color: $error-color;
    }
  }

  &__input {
    width: 100%;
    border: none;
    outline: none;
    background-color: transparent;
    align-self: stretch;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 2px 0 1px;
    box-sizing: border-box;
    font-family: 'Noto Sans SC', $font-family-base;
    font-size: 14px;
    color: $text-primary;

    &::placeholder {
      color: #6b7280;
    }
  }

  &__error {
    font-size: 12px;
    color: $error-color;
    margin-top: 4px;
    padding-left: 12px;
  }

  &__options {
    align-self: stretch;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
  }

  &__link {
    position: relative;
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    font-family: 'Noto Sans SC', $font-family-base;
    color: #005a9c;
    text-decoration: none;
    cursor: pointer;

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

  &__button {
    cursor: pointer;
    border: none;
    padding: 13px 16px;
    background-color: #005a9c;
    align-self: stretch;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    @include transition-fast;

    &:hover {
      background-color: #004a80;
    }

    &:disabled {
      opacity: 0.7;
      cursor: not-allowed;
    }
  }

  &__buttonText {
    flex: 1;
    position: relative;
    font-size: 14px;
    line-height: 20px;
    font-weight: 700;
    font-family: 'Noto Sans SC', $font-family-base;
    color: $white;
    text-align: center;
  }

  &__footer {
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 14px;
    color: #4b5563;
  }

  &__footerText {
    position: relative;
    line-height: 20px;
  }

  &__registerLink {
    position: relative;
    line-height: 20px;
    font-weight: 500;
    color: #005a9c;
    text-decoration: none;
    cursor: pointer;

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

  /* Loading spinner */
  &__spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: $white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
