// Unifi-inspired auth layout with skeumorphic touches

.auth-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 2rem 1rem;
  background: #f5f5f5;

  @include dark-mode {
    background: #1a1d23;
  }
  
  &.has-background {
    background: transparent;
  }
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  
  .brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: contain;
    
    &--custom {
      border: 1px solid var(--surface-2-border);
      background: var(--surface-1);
    }
  }
  
  .brand-plus {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    opacity: 0.5;
  }
  
  .brand-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-strong);
    margin-left: 0.25rem;
  }
}

.auth-notice {
  margin-top: 1.5rem;
  
  &:last-child {
    margin-bottom: 0;
  }
  
  .banner {
    margin-bottom: 0;
  }
}

.auth-card {
  background: linear-gradient(165deg, #fafafa 0%, #f5f5f5 100%);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: $radius-xl;
  padding: 2.5rem;
  width: 100%;
  max-width: 610px;
  box-shadow:
    4px 4px 16px rgba(0, 0, 0, 0.04),
    2px 2px 8px rgba(0, 0, 0, 0.02),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);

  @include dark-mode {
    background: linear-gradient(165deg, #252932 0%, #1f2329 100%);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow:
      4px 4px 16px rgba(0, 0, 0, 0.3),
      2px 2px 8px rgba(0, 0, 0, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }

  header {
    text-align: center;
    margin-bottom: $space-7;

    h1 {
      font-size: 1.85rem;
      font-weight: 600;
      margin: 0 0 0.75rem;
      color: var(--text-strong);
      letter-spacing: -0.02em;
    }

    small {
      font-size: 0.95rem;
      color: var(--text-muted-strong);
      display: block;
      line-height: 1.5;

      a {
        color: var(--pico-primary);
        text-decoration: none;
        font-weight: 500;
        @include transition-default(color);

        &:hover {
          color: var(--pico-primary-hover);
          text-decoration: underline;
        }
      }
    }
  }

  fieldset {
    @include form-fieldset;
    margin: 0 0 1.75rem;

    legend {
      font-size: 0.95rem;
      font-weight: 600;
      color: var(--pico-color);
      margin-bottom: $space-4;
      padding: 0;
    }

    label {
      font-size: 0.9rem;
      font-weight: 500;
      margin-bottom: 0.625rem;
      display: block;
      color: var(--pico-color);
    }

    input,
    select,
    textarea {
      margin-bottom: $space-1;
      border-radius: $radius-md;
      background: var(--surface-2);
      @include transition-default(background);

      &:focus {
        background: var(--surface-1);
      }
    }

    small {
      font-size: 0.85rem;
      color: var(--text-muted-strong);
      margin-top: 0.375rem;
      display: block;
    }
  }

  .grid {
    gap: 1rem;
  }

  button[type="submit"],
  input[type="submit"] {
    width: 100%;
    margin-top: $space-1;
    font-weight: 600;
    font-size: 1rem;
    border: none;
  }

  footer {
    text-align: center;
    margin-top: $space-7;
    padding-top: $space-6;
    border-top: 1px solid var(--surface-2-border);

    p {
      margin: $space-1 0;
      font-size: 0.9rem;
      color: var(--text-muted-strong);
    }

    a {
      color: var(--pico-primary);
      text-decoration: none;
      font-weight: 500;
      @include transition-default(color);

      &:hover {
        color: var(--pico-primary-hover);
        text-decoration: underline;
      }
    }
  }
}

.auth-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;

  .brand {
    display: none;
  }

  .auth-flash-wrapper {
    flex-shrink: 0;
    padding: 2rem 1rem 0;
    pointer-events: none;

    .banner {
      max-width: 640px;
      margin-left: auto;
      margin-right: auto;
    }
  }
}

// WebAuthn
.webauthn-button {
  width: 100%;
  padding: 0.7rem 1rem;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;

  .webauthn-icon {
    display: inline-flex;
    align-items: center;
    line-height: 1;

    svg {
      display: block;
    }
  }
}