/* =============================================================================
   AUTH.CSS  —  Login, registration, passkeys, trust-device, recovery access
   Loaded in {% block extra_head %} on auth page templates only.
   ============================================================================= */

@layer components {

/* ── Login / Sign-in Card ─────────────────────────────────────────────────── */
.auth-wrap {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 64px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--c-white);
  border: 1px solid var(--c-rule);
  border-radius: 12px;
  padding: 36px 32px 32px;
}

/* ── Trusted-device header ── */
.auth-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--tier-pro-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  color: var(--tier-pro);
}
.auth-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--c-ink);
  margin: 0 0 4px;
}
.auth-email {
  font-size: 14px;
  color: var(--c-muted);
  margin: 0 0 24px;
}

/* ── Passkey button ── */
.btn-passkey {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 20px;
  background: var(--tier-pro);
  color: var(--c-white);
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 12px;
}
.btn-passkey:hover  { background: var(--tier-pro-dk); }
.btn-passkey:active { background: var(--pck-grade-b-text); }
.btn-passkey:disabled {
  background: var(--tier-pro-accent);
  cursor: not-allowed;
}

/* ── Error banner ── */
.auth-error {
  display: none;
  font-size: 13px;
  color: var(--status-err-mid);
  background: var(--status-err-bg);
  border: 1px solid var(--pck-grade-d-border);
  border-radius: 6px;
  padding: 9px 12px;
  margin-bottom: 12px;
}

/* ── Divider ── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--c-muted);
  margin: 18px 0;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--c-rule);
}

/* ── Form elements ── */
.auth-form { display: flex; flex-direction: column; gap: 0; }
.auth-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-muted);
  margin-bottom: 5px;
  margin-top: 12px;
  display: block;
}
.auth-label:first-child { margin-top: 0; }

/* ── Password-fallback (collapsed by default) ── */
.auth-details summary {
  font-size: 13px;
  color: var(--tier-pro);
  cursor: pointer;
  list-style: none;
  margin: 6px 0 14px;
  text-align: center;
}
.auth-details summary::-webkit-details-marker { display: none; }
.auth-details[open] summary { margin-bottom: 16px; }

/* ── Footer links ── */
.auth-foot {
  margin-top: 18px;
  font-size: 13px;
  color: var(--c-muted);
  text-align: center;
}
.auth-foot a { color: var(--tier-pro); text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }

.auth-forget {
  display: block;
  text-align: center;
  font-size: 12px;
  color: var(--c-muted);
  margin-top: 16px;
  text-decoration: none;
}
.auth-forget:hover { color: var(--c-ink); }

/* ── Notice / disclaimer block (e.g. terms warning) ── */
.auth-notice {
  margin: 0 0 10px;
  line-height: 1.6;
  background: var(--status-warn-bg);
  padding: 10px 12px;
  border-left: 3px solid var(--status-warn);
}

/* ── Consent checkbox rows ── */
.auth-consent-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  margin-top: 10px;
}
.auth-consent-row input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  accent-color: var(--tier-pro);
}
.auth-consent-row .hint {
  margin: 0;
  line-height: 1.6;
}

/* ── Consent section divider ── */
.auth-consent-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--c-rule);
}

/* ── Trust Device Page ─────────────────────────────────────────────────────── */
.td-wrap {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 64px;
}
.td-card {
  width: 100%;
  max-width: 420px;
  background: var(--c-white);
  border: 1px solid var(--c-rule);
  border-radius: 12px;
  padding: 36px 32px 32px;
  text-align: center;
}
.td-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--status-ok-bg);
  color: var(--status-ok-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.td-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--c-ink);
  margin: 0 0 8px;
}
.td-sub {
  font-size: 14px;
  color: var(--c-muted);
  line-height: 1.6;
  margin: 0 0 28px;
}
.td-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.td-detail {
  margin-top: 20px;
  font-size: 12px;
  color: var(--c-muted);
  line-height: 1.55;
}
.td-detail a {
  color: var(--tier-pro);
  text-decoration: none;
}
.td-detail a:hover { text-decoration: underline; }

/* ── Recovery Login (Emergency Access) ───────────────────────────────────── */
.recovery-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--auth-warm-surface-lt);
}
.recovery-card {
  background: var(--c-white);
  border: 1px solid var(--mkt-surface-warm);
  border-radius: 14px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}
.recovery-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}
.recovery-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--mkt-ink-deep);
  margin-bottom: 6px;
}
.recovery-sub {
  font-size: 0.875rem;
  color: var(--mkt-text-gray);
  margin-bottom: 28px;
  line-height: 1.5;
}
.recovery-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--mkt-text-dark-alt);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.recovery-input {
  display: block;
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--auth-warm-border-dk);
  border-radius: 8px;
  font-size: 0.95rem;
  margin-bottom: 16px;
  background: var(--auth-warm-surface);
  color: var(--mkt-ink-deep);
  box-sizing: border-box;
}
.recovery-input:focus {
  outline: none;
  border-color: var(--auth-teal);
  background: var(--c-white);
}
.recovery-input--mono {
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}
.recovery-submit {
  width: 100%;
  padding: 11px;
  background: var(--auth-teal);
  color: var(--c-white);
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
}
.recovery-submit:hover { background: var(--auth-teal-hover); }
.recovery-error {
  background: var(--status-err-bg);
  border: 1px solid var(--status-err-border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.875rem;
  color: var(--status-err-dk);
  margin-bottom: 18px;
}
.recovery-warning-bar {
  background: var(--status-warn-bg);
  border: 1px solid var(--status-warn-border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.8rem;
  color: var(--status-warn-text);
  margin-bottom: 22px;
  line-height: 1.5;
}
.recovery-back {
  display: block;
  text-align: center;
  margin-top: 20px;
  font-size: 0.82rem;
  color: var(--mkt-text-gray);
  text-decoration: none;
}
.recovery-back:hover { color: var(--mkt-ink-navy); }

/* ── Passkeys Management Page ─────────────────────────────────────────────── */
.pk-page {
  max-width: 680px;
  margin: 48px auto;
  padding: 0 20px;
}
.pk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 12px;
  flex-wrap: wrap;
}
.pk-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--mkt-ink-deep);
  margin: 0;
}
.pk-subtitle {
  font-size: 0.875rem;
  color: var(--c-muted);
  margin: 4px 0 0;
}
.btn-add-key {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  background: var(--auth-teal);
  color: var(--c-white);
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-add-key:hover { background: var(--auth-teal-hover); }

/* Key cards */
.pk-list { display: flex; flex-direction: column; gap: 10px; }
.pk-card {
  background: var(--c-white);
  border: 1px solid var(--auth-warm-border);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.pk-card__icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: rgba(27,58,64,0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--auth-teal);
}
.pk-card__body { flex: 1; min-width: 0; }
.pk-card__name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--mkt-ink-deep);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pk-card__meta {
  font-size: 0.78rem;
  color: var(--c-muted);
  margin-top: 2px;
}
.pk-card__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Toggle switch */
.pk-toggle {
  position: relative;
  width: 40px;
  height: 22px;
  cursor: pointer;
}
.pk-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.pk-toggle__track {
  position: absolute;
  inset: 0;
  border-radius: 11px;
  background: var(--auth-warm-border-dk);
  transition: background 0.2s;
}
.pk-toggle input:checked ~ .pk-toggle__track { background: var(--status-ok-bright); }
.pk-toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--c-white);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: left 0.2s;
}
.pk-toggle input:checked ~ .pk-toggle__thumb { left: 21px; }

/* Status badges */
.pk-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(22,163,74,0.1);
  color: var(--status-ok-text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pk-badge--off {
  background: rgba(220,38,38,0.07);
  color: var(--status-err-dk);
}

/* Delete button */
.btn-del {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--mkt-text-faint);
  border-radius: 6px;
  display: flex;
  align-items: center;
}
.btn-del:hover { color: var(--status-err-mid); background: rgba(220,38,38,0.07); }

/* Empty state */
.pk-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--c-muted);
  font-size: 0.9rem;
  border: 1px dashed var(--auth-warm-border);
  border-radius: 12px;
}

/* Overlay dialog */
.pk-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(14,20,27,0.4);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.pk-overlay.open { display: flex; }
.pk-dialog {
  background: var(--c-white);
  border-radius: 14px;
  padding: 32px 28px 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
  position: relative;
}
.pk-dialog__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--mkt-ink-deep);
  margin: 0 0 16px;
}
.pk-dialog__body { font-size: 0.9rem; color: var(--mkt-text-dark-alt); }
.pk-dialog input[type=text] {
  display: block;
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--auth-warm-border-dk);
  border-radius: 8px;
  font-size: 0.95rem;
  margin-top: 10px;
  background: var(--auth-warm-surface);
  color: var(--mkt-ink-deep);
  box-sizing: border-box;
}
.pk-dialog input:focus {
  outline: none;
  border-color: var(--auth-teal);
  background: var(--c-white);
}
.pk-dialog__msg { margin-top: 12px; font-size: 0.85rem; min-height: 22px; }
.pk-dialog__msg--ok { color: var(--status-ok-text); }
.pk-dialog__msg--err { color: var(--status-err-dk); }
.pk-dialog__foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* Dialog action buttons */
.btn-primary-sm {
  padding: 8px 18px;
  background: var(--auth-teal);
  color: var(--c-white);
  border: none;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary-sm:hover { background: var(--auth-teal-hover); }
.btn-primary-sm:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost-sm {
  padding: 8px 14px;
  background: none;
  border: 1px solid var(--auth-warm-border-dk);
  border-radius: 8px;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--mkt-text-dark-alt);
}
.btn-ghost-sm:hover { background: var(--auth-warm-hover); }

.btn-danger-sm {
  padding: 8px 18px;
  background: var(--status-err-mid);
  color: var(--c-white);
  border: none;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger-sm:hover { background: var(--status-err-dk); }

.pk-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--mkt-text-faint);
  padding: 2px 6px;
  border-radius: 6px;
}
.pk-close:hover { color: var(--mkt-ink-deep); background: var(--auth-warm-hover-dk); }

/* ── Generic auth link (used where no ancestor .auth-foot or .td-detail applies) ── */
.auth-link {
  color: var(--tier-pro);
  text-decoration: none;
}
.auth-link:hover { text-decoration: underline; }

} /* end @layer components */
