/* Sign-in page (body.auth-page): one centered column in the Home style. */
html:has(body.auth-page),
body.auth-page {
  background: var(--background);
  color: var(--foreground);
}

body.auth-page:not(.auth-nav) #nav {
  display: none;
}

body.auth-page {
  #sidebar,
  #rooms-sidebar,
  #app-logo,
  #footer,
  .flash {
    display: none;
  }

  #main-content {
    align-items: center;
    background: var(--background);
    border: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 0;
    min-block-size: 100dvh;
    padding:
      calc(1.5rem + env(safe-area-inset-top, 0px))
      calc(1.25rem + env(safe-area-inset-right, 0px))
      calc(1.5rem + env(safe-area-inset-bottom, 0px))
      calc(1.25rem + env(safe-area-inset-left, 0px));
  }
}

.auth {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  inline-size: 100%;
  max-inline-size: 22rem;
}

.auth__header {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-block-end: 1.25rem;
  text-align: center;
}

.auth__logo {
  block-size: 4.5rem;
  border-radius: 1.25rem;
  inline-size: 4.5rem;
  margin-block-end: 0.85rem;
  object-fit: cover;
}

.auth__title {
  font-size: 1.6rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}

.auth__subtitle {
  color: var(--muted-foreground);
  font-size: 0.95rem;
  margin: 0;
}

.auth__error {
  align-items: center;
  background: color-mix(in srgb, var(--destructive) 16%, transparent);
  border-radius: 1rem;
  color: hsl(0 85% 78%);
  display: flex;
  font-size: 0.9rem;
  gap: 0.55rem;
  margin: 0 0 0.25rem;
  padding: 0.75rem 1rem;

  & .icon {
    flex-shrink: 0;
  }
}

.auth form {
  margin: 0;
}

.auth__button {
  align-items: center;
  block-size: 3rem;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  font: inherit;
  font-size: 1rem;
  font-weight: 650;
  gap: 0.5rem;
  inline-size: 100%;
  justify-content: center;
  padding-inline: 1.25rem;
  transition: filter 150ms ease, transform 150ms ease;

  &:hover {
    filter: brightness(1.08);
  }

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

  &:focus-visible {
    outline: 2px solid var(--ring, var(--foreground));
    outline-offset: 2px;
  }
}

.auth__button--primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

.auth__button--secondary {
  background: var(--secondary);
  color: var(--foreground);
}

.auth__divider {
  align-items: center;
  color: var(--muted-foreground);
  display: flex;
  font-size: 0.8rem;
  gap: 0.75rem;
  margin-block: 0.75rem 0.25rem;

  &::before,
  &::after {
    background: var(--border, var(--secondary));
    block-size: 1px;
    content: "";
    flex: 1;
  }
}

.auth__form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.auth__field {
  align-items: center;
  background: var(--card);
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted-foreground);
  display: flex;
  gap: 0.65rem;
  padding-inline: 1.1rem;
  transition: border-color 150ms ease;

  &:focus-within {
    border-color: var(--muted-foreground);
    color: var(--foreground);
  }

  & .icon {
    flex-shrink: 0;
  }

  & input {
    background: transparent;
    block-size: 3rem;
    border: 0;
    color: var(--foreground);
    flex: 1;
    font: inherit;
    font-size: 1rem;
    min-inline-size: 0;
    outline: 0;
    padding: 0;
  }

  & input::placeholder {
    color: var(--muted-foreground);
  }
}

.auth__avatar {
  cursor: pointer;
  display: block;
  margin-block-end: 0.85rem;
  position: relative;

  & img {
    block-size: 4.5rem;
    border-radius: 50%;
    inline-size: 4.5rem;
    object-fit: cover;
  }

  & input {
    inset: 0;
    opacity: 0;
    position: absolute;
    inline-size: 100%;
    block-size: 100%;
    cursor: pointer;
  }

  &:focus-within img {
    outline: 2px solid var(--ring, var(--foreground));
    outline-offset: 2px;
  }
}

.auth__avatar-badge {
  align-items: center;
  background: var(--primary);
  border-radius: 50%;
  color: var(--primary-foreground);
  display: flex;
  block-size: 1.75rem;
  inline-size: 1.75rem;
  inset: auto 0 0 auto;
  justify-content: center;
  position: absolute;
}

.auth--wide {
  max-inline-size: 30rem;
}

.auth__device {
  align-items: center;
  background: var(--card);
  border-radius: 1.35rem;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  padding: 0.85rem 1rem;
}

.auth__device-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-inline-size: 0;
}

.auth__device-endpoint {
  color: var(--muted-foreground);
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth__device-actions {
  display: flex;
  flex-shrink: 0;
  gap: 0.4rem;
}

.auth__icon-button {
  align-items: center;
  background: var(--secondary);
  block-size: 2.5rem;
  border: 0;
  border-radius: 50%;
  color: var(--foreground);
  cursor: pointer;
  display: flex;
  inline-size: 2.5rem;
  justify-content: center;
  padding: 0;
}

.auth__icon-button--danger {
  color: hsl(0 85% 72%);
}

.auth__empty {
  color: var(--muted-foreground);
  margin: 0;
  text-align: center;
}

.auth__browsers {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(2, 1fr);
}

.auth__browser {
  align-items: center;
  background: var(--card);
  border-radius: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1rem;

  & span {
    color: var(--muted-foreground);
    font-size: 0.85rem;
  }
}
