/* Auth pages */
.auth-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  padding: 32px 28px;
  border-radius: var(--radius);
  background: var(--gradient-surface);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
}

.auth-card--wide {
  width: min(100%, 480px);
}

.auth-card__brand {
  text-align: center;
  margin-bottom: 24px;
}

.auth-card__title {
  margin: 12px 0 6px;
  font-size: 1.5rem;
  font-weight: 800;
}

.auth-card__subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field__label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.auth-field__input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}

.auth-field__input:focus {
  outline: 2px solid rgba(108, 158, 255, 0.5);
  outline-offset: 1px;
}

.auth-role-picker {
  border: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.auth-role-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}

.auth-role-option:has(input:checked) {
  border-color: rgba(108, 158, 255, 0.5);
  background: color-mix(in srgb, var(--accent-tutorial) 18%, transparent);
}

.auth-btn {
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.2s ease;
}

.auth-btn--primary {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: 0 8px 28px rgba(108, 158, 255, 0.35);
}

.auth-btn--primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.auth-btn--ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.auth-alert {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
}

.auth-alert--error {
  background: rgba(255, 80, 80, 0.15);
  border: 1px solid rgba(255, 80, 80, 0.35);
  color: #ffb4b4;
}

.auth-alert--success {
  background: rgba(94, 224, 168, 0.15);
  border: 1px solid rgba(94, 224, 168, 0.35);
  color: #b8f5d8;
}

.auth-footer {
  margin: 20px 0 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--accent-tutorial);
  font-weight: 700;
  text-decoration: none;
}

.auth-demo {
  margin-top: 20px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.auth-demo summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
}

.auth-demo ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

.user-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-nav__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.user-nav__role {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-progress);
}

.user-nav__name {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-nav__logout {
  flex-shrink: 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
}

.user-nav__logout:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
}

/* ============================================================
   UI polish (additive — no markup changes)
   ============================================================ */

@keyframes auth-rise {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes auth-logo-pop {
  0% {
    transform: scale(0.6) rotate(-12deg);
    opacity: 0;
  }
  60% {
    transform: scale(1.08) rotate(4deg);
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

.auth-card {
  animation: auth-rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(108, 158, 255, 0.18), transparent 60%),
    var(--gradient-surface);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.auth-card__brand .header__logo {
  animation: auth-logo-pop 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s both;
}

.auth-field__input {
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.auth-field__input:hover {
  border-color: rgba(255, 255, 255, 0.26);
}

.auth-field__input:focus {
  outline: none;
  border-color: rgba(108, 158, 255, 0.8);
  background: rgba(0, 0, 0, 0.32);
  box-shadow: 0 0 0 4px rgba(108, 158, 255, 0.18);
}

.auth-role-option {
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.12s ease;
}

.auth-role-option:hover {
  border-color: rgba(108, 158, 255, 0.4);
  transform: translateY(-1px);
}

.auth-btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.auth-btn--primary::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    120deg,
    transparent 20%,
    rgba(255, 255, 255, 0.35) 50%,
    transparent 80%
  );
  transform: translateX(-120%);
  transition: transform 0.6s ease;
}

.auth-btn--primary:hover::before {
  transform: translateX(120%);
}

.auth-btn--primary:active {
  transform: translateY(1px);
}

.auth-demo {
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 0.2s ease;
}

.auth-demo[open] {
  background: rgba(0, 0, 0, 0.28);
}

.auth-demo ul {
  list-style: none;
  padding-left: 0;
  display: grid;
  gap: 6px;
}

.auth-demo li {
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

@media (prefers-reduced-motion: reduce) {
  .auth-card,
  .auth-card__brand .header__logo {
    animation: none;
  }
  .auth-btn--primary::before {
    transition: none;
  }
}
