@use '../../shared/styles/variables' as *;

.login-page {
  position: relative;
  isolation: isolate;

  width: 100%;
  height: 100dvh;
  min-height: 0;
  padding: 24px;
  box-sizing: border-box;
  overflow: hidden;

  display: flex;
  align-items: center;
  justify-content: center;

  background:
    radial-gradient(
      95% 70% at 50% 118%,
      rgba(3, 29, 154, 0.18) 0%,
      rgba(66, 93, 232, 0.14) 32%,
      rgba(47, 128, 237, 0.1) 52%,
      rgba(239, 242, 247, 0.45) 72%,
      transparent 86%
    ),
    radial-gradient(
      70% 48% at 18% 100%,
      rgba(24, 184, 155, 0.1) 0%,
      transparent 68%
    ),
    linear-gradient(
      180deg,
      #fbfcff 0%,
      #f4f7fc 45%,
      #eff2f7 100%
    );

  [data-theme='dark'] & {
    background:
      radial-gradient(
        95% 70% at 50% 125%,
        rgba($color-primary-rgb, 0.34) 0%,
        rgba(72, 96, 180, 0.22) 36%,
        rgba($color-bg-rgb, 0.55) 62%,
        transparent 82%
      ),
      linear-gradient(
        180deg,
        #242a33 0%,
        #242a33 12%,
        #222832 18%,
        #1f252e 30%,
        #1d232c 55%,
        #171b22 100%
      );
  }
}

.login-theme-button {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 2;

  width: 42px;
  height: 42px;
  padding: 0;
  border: none;
  border-radius: 14px;
  background: $color-surface-glass;
  backdrop-filter: blur(12px);
  box-shadow:
    inset 0 0 1px 1px rgba($gray50-rgb, 0.18),
    0 10px 28px rgba($color-shadow-rgb, 0.12);

  display: inline-flex;
  align-items: center;
  justify-content: center;

  color: $orange;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;

  svg {
    flex: 0 0 auto;
    transition: transform 0.2s ease;
  }

  &:hover {
    background: $color-surface;
    color: $blue;
    transform: translateY(-1px);

    svg {
      transform: rotate(-8deg) scale(1.05);
    }
  }

  &:active {
    transform: scale(0.96);
  }

  &.is-dark {
    color: $blue;
    box-shadow:
      inset 0 0 0 1px rgba($white, 0.08),
      0 12px 30px rgba($black, 0.24);
  }
}

.login-card {
  position: relative;
  z-index: 1;

  width: min(100%, 430px);
  padding: 30px;
  border: 1px solid rgba($color-border-rgb, 0.74);
  border-radius: 22px;
  background: $color-surface-glass;
  backdrop-filter: blur(16px);
  box-shadow: $shadow-card;

  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-card__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  text-align: center;

  p {
    margin: 6px 0 0;
    color: $color-text-muted;
    font-size: $font-size-14;
    font-weight: 500;
    line-height: 1.35;
  }
}

.login-card__logo {
  flex: 0 0 auto;
  width: 60px;
  height: 60px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  img {
    display: block;
    width: 90%;
    height: 90%;
  }
}

.login-field {
  position: relative;
  display: block;
  text-align: left;
}

.login-field__label {
  position: absolute;
  z-index: 2;
  top: -8px;
  left: 44px;

  padding: 0 7px;
  border-radius: 999px;
  background: $color-surface-glass;

  color: $color-text-muted;
  font-size: $font-size-11;
  font-weight: 500;
  line-height: 16px;
  //text-transform: uppercase;
  letter-spacing: 0;

  transition:
    color 0.18s ease,
    background 0.18s ease;
}

.login-field__control {
  height: 52px;
  padding: 0 12px 0 14px;
  border: 1px solid $color-border-strong;
  border-radius: 15px;
  background: $color-surface-muted;

  display: flex;
  align-items: center;
  gap: 10px;

  color: $color-text-muted;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    color 0.18s ease;

  input {
    min-width: 0;
    flex: 1;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;

    color: $color-text-strong;
    font-size: $font-size-15;
    font-weight: 600;
    font-family: inherit;

    &::placeholder {
      color: $color-text-muted;
      font-weight: 500;
    }
  }
}

.login-field:focus-within {
  .login-field__label {
    color: $blue;
    background: $color-surface;
  }

  .login-field__control {
    border-color: $blue;
    background: $color-surface;
    color: $blue;
    box-shadow: 0 0 0 3px rgba($color-primary-rgb, 0.12);
  }
}

.login-field__password-toggle {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: transparent;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  color: $color-text-muted;
  cursor: pointer;
  transition:
    background 0.18s ease,
    color 0.18s ease;

  &:hover,
  &[aria-pressed='true'] {
    background: $color-surface-hover;
    color: $blue;
  }
}

.login-error {
  padding: 10px 12px;
  border-radius: 12px;
  background: $color-danger-bg;

  color: $red;
  font-size: $font-size-13;
  font-weight: 600;
  text-align: left;
}

.login-button {
  height: 54px;
  border: none;
  border-radius: 14px;
  background: $blue;

  color: $color-text-inverse;
  font-size: $font-size-16;
  font-weight: 550;

  cursor: pointer;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;

  &:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary);
  }

  &:active:not(:disabled) {
    transform: translateY(0);
  }

  &:disabled {
    opacity: 0.65;
    cursor: default;
  }
}

@media (max-width: 520px) {
  .login-page {
    padding: 16px;
  }

  .login-theme-button {
    top: 16px;
    right: 16px;
  }

  .login-card {
    padding: 24px;
  }

  .login-card__header {
    align-items: flex-start;
    flex-direction: column;
  }
}
