/*
 * auth.css
 * Shared styles for all authentication pages (login, register, reset, etc.)
 * Dark theme — consistent with the Prompt Architect aesthetic.
 */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=Manrope:wght@400;500;600&display=swap');

:root {
  --bg:            #080808;
  --surface:       #101010;
  --surface-2:     #161616;
  --border:        #1f1f1f;
  --border-focus:  #a78bfa;
  --text:          #f0f0f0;
  --text-muted:    #6b7280;
  --text-subtle:   #3a3a3a;
  --accent:        #a78bfa;
  --accent-dim:    rgba(167, 139, 250, 0.12);
  --accent-hover:  #c4b5fd;
  --error:         #f87171;
  --error-dim:     rgba(248, 113, 113, 0.1);
  --success:       #4ade80;
  --success-dim:   rgba(74, 222, 128, 0.1);
  --input-bg:      #0c0c0c;
  --radius:        8px;
}

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

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

/* ── Noise texture overlay ───────────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ── Auth card ───────────────────────────────────────────────────────────── */
.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem 2rem;
}

/* ── Brand mark ──────────────────────────────────────────────────────────── */
.auth-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-brand__wordmark {
  font-family: 'Syne', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

.auth-brand__title {
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 0.5rem;
}

.auth-brand__subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ── Form elements ───────────────────────────────────────────────────────── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-field label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.form-field input {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Manrope', sans-serif;
  font-size: 0.9375rem;
  padding: 0.6875rem 0.875rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
  outline: none;
}

.form-field input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-field input::placeholder {
  color: var(--text-subtle);
}

/* ── Submit button ───────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #0a0a0a;
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
  font-size: 0.9375rem;
  font-weight: 700;
  padding: 0.75rem 1.25rem;
  transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
  width: 100%;
  margin-top: 0.25rem;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.99);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary.loading {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius);
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
  display: none;
}

.alert.visible {
  display: block;
}

.alert--error {
  background: var(--error-dim);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: var(--error);
}

.alert--success {
  background: var(--success-dim);
  border: 1px solid rgba(74, 222, 128, 0.25);
  color: var(--success);
}

/* ── Divider & footer links ──────────────────────────────────────────────── */
.auth-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

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

.auth-footer a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--text-subtle);
  font-size: 0.75rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── TOTP step ───────────────────────────────────────────────────────────── */
.totp-step {
  display: none;
}

.totp-step.visible {
  display: block;
}

.totp-code-input {
  font-size: 1.5rem !important;
  letter-spacing: 0.3em;
  text-align: center;
}

/* ── Password strength hint ──────────────────────────────────────────────── */
.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .auth-card {
    padding: 2rem 1.25rem;
    border-radius: 8px;
  }
}
