/* Authentication screens: login, password reset */

.auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 200px);
  padding: 40px 20px;
}

.auth__card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 36px 32px 30px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

/* Line the flash message up with the card instead of the 720px content column. */
.site-main:has(.auth) .flash {
  box-sizing: border-box;
  width: min(420px, 100% - 40px);
}

.auth__card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
}

/* Header */

.auth__header {
  margin-bottom: 28px;
  text-align: center;
}

.auth__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border-radius: 16px;
  font-size: 1.6rem;
  line-height: 1;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  box-shadow: var(--shadow-md);
}

.auth__title {
  margin: 0 0 6px;
  font-size: 1.5rem;
  font-weight: 700;
}

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

/* Fields */

.auth__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.auth__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
}

.auth__input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth__input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font-size: 1rem;
  background: #fff;
  color: var(--color-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth__input::placeholder {
  color: #9ca3af;
}

.auth__input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.auth__input--with-toggle {
  padding-right: 52px;
}

.auth__toggle {
  position: absolute;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--color-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.auth__toggle:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.auth__toggle:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.auth__toggle svg {
  width: 18px;
  height: 18px;
}

/* The UA `[hidden]` rule is not guaranteed for SVG elements, so state it here. */
.auth__toggle svg[hidden] {
  display: none;
}

.auth__hint {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.8rem;
}

/* Remember me / forgot password row */

.auth__options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 22px;
}

.auth__checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--color-text);
  cursor: pointer;
  user-select: none;
}

.auth__checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.auth__link {
  color: var(--color-primary);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.auth__link:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

/* Submit button sits a little taller than the default .btn */

.auth__form .btn {
  padding: 12px 18px;
  font-size: 1rem;
}

/* Validation errors */

.auth__errors {
  margin-bottom: 20px;
  padding: 12px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  color: #991b1b;
}

.auth__errors ul {
  margin: 0;
  padding-left: 20px;
  font-size: 0.85rem;
}

/* Footer */

.auth__footer {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-muted);
}

@media (max-width: 480px) {
  .auth {
    min-height: 0;
    padding: 24px 16px;
  }

  .auth__card {
    padding: 28px 20px 24px;
  }

  /* Side by side these two wrap onto several lines on narrow screens. */
  .auth__options {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}
