/* ==========================================================================
   Auth Pages — Login / 2FA / Setup
   Standalone styles matching the NAS Dashboard dark navy theme.
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: #0f1923;
  color: #e8ecf1;
  min-height: 100vh;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Background ---- */
.auth-bg {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(0, 111, 255, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(0, 212, 170, 0.04) 0%, transparent 40%),
    #0f1923;
}

/* ---- Card ---- */
.auth-card {
  background: #17222e;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: cardEnter 400ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ---- Brand ---- */
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.auth-brand__icon {
  width: 40px;
  height: 40px;
  background: rgba(0, 111, 255, 0.12);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #006fff;
}

.auth-brand__name {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #e8ecf1;
}

/* ---- Title ---- */
.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 0.875rem;
  color: #8899aa;
  margin-bottom: 28px;
}

/* ---- Error ---- */
.auth-error {
  background: rgba(255, 71, 87, 0.10);
  border: 1px solid rgba(255, 71, 87, 0.20);
  color: #ff6b7a;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.8125rem;
  margin-bottom: 16px;
  animation: shake 400ms ease;
}

@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-3px); }
  40%, 60% { transform: translateX(3px); }
}

/* ---- Form Fields ---- */
.auth-field {
  margin-bottom: 20px;
}

.auth-field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #8899aa;
  margin-bottom: 6px;
}

.auth-field input {
  width: 100%;
  padding: 11px 14px;
  background: #121c27;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  color: #e8ecf1;
  font-size: 0.9375rem;
  font-family: inherit;
  outline: none;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.auth-field input:focus {
  border-color: #006fff;
  box-shadow: 0 0 0 3px rgba(0, 111, 255, 0.15);
}

.auth-field input::placeholder {
  color: #556677;
}

/* ---- TOTP Input ---- */
.auth-field input.totp-input {
  text-align: center;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0.5em;
  padding: 14px;
  font-family: 'JetBrains Mono', monospace;
}

/* ---- Buttons ---- */
.auth-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 200ms ease, transform 100ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
}

.auth-btn:active {
  transform: scale(0.98);
}

.auth-btn--primary {
  background: #006fff;
  color: #fff;
}

.auth-btn--primary:hover {
  background: #0058cc;
}

.auth-btn--primary:disabled {
  background: #2a4060;
  color: #556677;
  cursor: not-allowed;
  transform: none;
}

.auth-btn--secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #e8ecf1;
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.auth-btn--secondary:hover {
  background: rgba(255, 255, 255, 0.10);
}

/* ---- Spinner ---- */
.auth-btn__spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- User Pill ---- */
.auth-user-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 111, 255, 0.08);
  border: 1px solid rgba(0, 111, 255, 0.15);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 20px;
}

.auth-user-pill__email {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #b8c8d8;
}

.auth-user-pill__change {
  background: none;
  border: none;
  color: #006fff;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 150ms ease;
}

.auth-user-pill__change:hover {
  background: rgba(0, 111, 255, 0.12);
}

/* ---- Alt Actions ---- */
.auth-alt-actions {
  margin-top: 16px;
  display: flex;
  justify-content: center;
}

.auth-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: #8899aa;
  font-size: 0.8125rem;
  font-family: inherit;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: color 150ms ease, background 150ms ease;
}

.auth-link:hover {
  color: #006fff;
  background: rgba(0, 111, 255, 0.08);
}

.auth-link svg {
  flex-shrink: 0;
}

/* ---- Step Transitions ---- */
.auth-step {
  animation: stepIn 300ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes stepIn {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.auth-step--exit {
  animation: stepOut 200ms ease both;
}

@keyframes stepOut {
  to {
    opacity: 0;
    transform: translateX(-16px);
  }
}

/* ---- Footer ---- */
.auth-footer {
  margin-top: 32px;
  font-size: 0.75rem;
  color: #556677;
}

/* ---- 2FA Specific ---- */
.auth-2fa-info {
  font-size: 0.8125rem;
  color: #8899aa;
  margin-bottom: 24px;
  line-height: 1.5;
}

.auth-recovery-link {
  text-align: center;
  margin-top: 16px;
}

/* ---- QR Code Container ---- */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.qr-container canvas,
.qr-container img,
.qr-container svg {
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.secret-display {
  background: #121c27;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  word-break: break-all;
  color: #e8ecf1;
  text-align: center;
  user-select: all;
  cursor: pointer;
}

/* ---- Recovery Codes ---- */
.recovery-codes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0;
}

.recovery-codes code {
  background: #121c27;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 8px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  color: #e8ecf1;
}

/* ---- Passkey List (settings) ---- */
.passkey-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  margin-bottom: 8px;
}

.passkey-item__name {
  font-size: 0.875rem;
  font-weight: 500;
}

.passkey-item__date {
  font-size: 0.75rem;
  color: #8899aa;
}

.passkey-item__delete {
  background: none;
  border: none;
  color: #ff4757;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 150ms ease;
}

.passkey-item__delete:hover {
  background: rgba(255, 71, 87, 0.12);
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .auth-card {
    padding: 28px 24px;
    border-radius: 12px;
  }

  .auth-title {
    font-size: 1.25rem;
  }

  .auth-bg {
    padding: 16px;
  }
}
