/* identity_oidc/auth.css
 * Aggarly Identity — premium "aurora glass" auth surface.
 *
 * Deliberately NOT neumorphic: no soft inset/outset shadow pairs miming
 * physical buttons. The look is a deep-navy canvas with a single cyan aurora,
 * a crisp glass card with a thin luminous edge, and a gradient brand button.
 *
 * Palette is the Aggarly Design System token set (services/aggarly-frontend
 * design tokens), inlined here as CSS variables because the Identity service
 * is a separate Django app and cannot import the frontend SCSS. Keep these
 * values in sync with --ds-color-* if the brand palette changes.
 */

:root {
  /* ---- Brand palette (mirrors --ds-color-* dark theme) ---- */
  --ds-primary: #00f2e4;
  --ds-primary-hover: #00c9be;
  --ds-on-primary: #0a1626;
  --ds-secondary: #00d1b2;
  --ds-accent-green: #22c55e;

  --ds-bg-page: #0b1222;          /* deep navy canvas */
  --ds-bg-page-2: #161e32;        /* token bg-page (dark) */
  --ds-surface: rgba(30, 39, 64, 0.72);   /* token bg-surface @ glass */
  --ds-surface-strong: #1e2740;
  --ds-border: rgba(51, 65, 95, 0.6);      /* token border-soft (dark) */
  --ds-border-bright: rgba(0, 242, 228, 0.55);

  --ds-text: #e5e7eb;             /* token text-main (dark) */
  --ds-text-soft: #94a3b8;        /* token text-soft */
  --ds-text-muted: #9ca3af;       /* token text-muted (dark) */

  --ds-danger: #dc2626;
  --ds-danger-rgb: 220 38 38;
  --ds-success: #16a34a;
  --ds-success-rgb: 22 163 74;

  --auth-radius: 20px;
  --auth-radius-inner: 13px;
  --auth-shadow: 0 24px 60px -12px rgba(2, 6, 23, 0.7), 0 8px 24px -8px rgba(0, 0, 0, 0.4);
  --auth-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji";
}

* { box-sizing: border-box; }

html, body { block-size: 100%; }

body {
  margin: 0;
  min-block-size: 100vh;
  color: var(--ds-text);
  font-family: var(--auth-font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Aurora: one cyan glow top-center, a fainter teal lower-left, over navy. */
  background:
    radial-gradient(1100px 620px at 50% -8%, rgba(0, 242, 228, 0.16), transparent 62%),
    radial-gradient(820px 480px at 6% 108%, rgba(0, 209, 178, 0.10), transparent 60%),
    linear-gradient(180deg, var(--ds-bg-page) 0%, var(--ds-bg-page-2) 100%);
  background-attachment: fixed;
}

.auth-shell {
  min-block-size: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 5vw, 40px) 18px;
}

.auth-card {
  position: relative;
  inline-size: 100%;
  max-inline-size: 452px;
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--auth-radius);
  box-shadow: var(--auth-shadow);
  padding: clamp(24px, 4vw, 34px) clamp(22px, 4vw, 30px);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  animation: auth-rise 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Luminous hairline along the top edge — the premium "tell". */
.auth-card::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 16px;
  block-size: 1px;
  background: linear-gradient(90deg, transparent, var(--ds-border-bright), transparent);
  border-radius: 1px;
}

.auth-brand {
  display: flex;
  justify-content: center;
  margin-block-end: 18px;
}

.auth-logo { display: block; inline-size: 148px; block-size: auto; }

.auth-title {
  margin: 0 0 8px;
  text-align: center;
  font-size: clamp(22px, 4vw, 26px);
  font-weight: 750;
  letter-spacing: -0.01em;
  line-height: 1.18;
}

.auth-subtitle {
  margin: 0 0 22px;
  text-align: center;
  color: var(--ds-text-soft);
  font-size: 14px;
  line-height: 1.55;
}

.auth-alert {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  background: rgb(var(--ds-danger-rgb) / 0.12);
  border: 1px solid rgb(var(--ds-danger-rgb) / 0.34);
  color: #fecaca;
  border-radius: var(--auth-radius-inner);
  padding: 11px 13px;
  margin: 0 0 16px;
  font-size: 13.5px;
  line-height: 1.45;
}

.auth-alert--success {
  background: rgb(var(--ds-success-rgb) / 0.13);
  border-color: rgb(var(--ds-success-rgb) / 0.36);
  color: #bbf7d0;
}

/* ---- "Check your inbox" — bespoke confirmation screen ---- */
.auth-inbox {
  text-align: center;
}
.auth-inbox__badge {
  position: relative;
  inline-size: 76px;
  block-size: 76px;
  margin: 2px auto 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ds-primary);
  background: radial-gradient(circle at 50% 36%,
    rgb(0 242 228 / 0.24), rgb(0 242 228 / 0.04) 70%);
  border: 1px solid rgb(0 242 228 / 0.38);
  box-shadow:
    0 0 0 6px rgb(0 242 228 / 0.05),
    0 12px 26px -10px rgb(0 242 228 / 0.45),
    inset 0 0 18px rgb(0 242 228 / 0.14);
}
.auth-inbox__badge svg {
  inline-size: 32px;
  block-size: 32px;
}
/* Soft outward "sent" pulse. */
.auth-inbox__badge::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid rgb(0 242 228 / 0.5);
  animation: auth-inbox-pulse 2.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes auth-inbox-pulse {
  0%   { transform: scale(1);    opacity: 0.55; }
  70%  { transform: scale(1.4);  opacity: 0; }
  100% { transform: scale(1.4);  opacity: 0; }
}
.auth-inbox__lead {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ds-text);
}
.auth-inbox__email {
  display: inline-block;
  margin-block-start: 10px;
  padding: 6px 12px;
  border-radius: 9px;
  background: rgb(0 242 228 / 0.10);
  border: 1px solid rgb(0 242 228 / 0.30);
  color: var(--ds-primary);
  font-weight: 650;
  font-size: 14px;
  line-height: 1.3;
  word-break: break-all;     /* long emails wrap inside the chip, never overflow */
}
.auth-inbox__hint {
  margin: 16px 0 22px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ds-text-soft);
}
.auth-inbox__resend {
  margin: 20px 0 0;
  padding-block-start: 16px;
  border-block-start: 1px solid var(--ds-border);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ds-text-muted);
}
@media (prefers-reduced-motion: reduce) {
  .auth-inbox__badge::after { animation: none; }
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin: 0;
}

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

.auth-label {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ds-text-soft);
}

.auth-input {
  inline-size: 100%;
  padding: 12px 13px;
  border-radius: var(--auth-radius-inner);
  border: 1px solid var(--ds-border);
  background: rgba(2, 6, 23, 0.45);
  color: var(--ds-text);
  font-size: 15px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.auth-input::placeholder { color: var(--ds-text-muted); }

.auth-input:focus-visible {
  border-color: var(--ds-border-bright);
  box-shadow: 0 0 0 4px rgba(0, 242, 228, 0.18);
  background: rgba(2, 6, 23, 0.6);
}

.auth-hint { margin-block-start: -2px; color: var(--ds-text-muted); font-size: 12px; }

.auth-button {
  inline-size: 100%;
  padding: 12px 14px;
  border-radius: var(--auth-radius-inner);
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--ds-primary) 0%, var(--ds-secondary) 100%);
  color: var(--ds-on-primary);
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 8px 20px -8px rgba(0, 242, 228, 0.55);
  transition: filter 140ms ease, transform 80ms ease, box-shadow 140ms ease;
}

.auth-button:hover { filter: brightness(1.06); box-shadow: 0 10px 26px -8px rgba(0, 242, 228, 0.65); }
.auth-button:active { transform: translateY(1px); }
.auth-button:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(0, 242, 228, 0.3); }

.auth-button--ghost {
  background: transparent;
  border-color: var(--ds-border);
  color: var(--ds-text);
  box-shadow: none;
}
.auth-button--ghost:hover { filter: none; border-color: var(--ds-border-bright); background: rgba(0, 242, 228, 0.06); }

/* Token / one-time code presentation (verify-email, future backup codes). */
.auth-code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 13.5px;
  word-break: break-all;
  background: rgba(2, 6, 23, 0.5);
  border: 1px dashed var(--ds-border);
  border-radius: var(--auth-radius-inner);
  padding: 10px 12px;
  color: var(--ds-text-soft);
}

.auth-footer {
  margin-block-start: 18px;
  text-align: center;
  color: var(--ds-text-soft);
  font-size: 13px;
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

/* A single-line secondary action row (e.g. "Forgot password?"). */
.auth-aside {
  display: flex;
  justify-content: flex-end;
  margin-block-start: -4px;
}

/* "or" divider between password sign-in and the passkey option. */
.auth-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-block: 16px;
  color: var(--ds-text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.auth-or::before,
.auth-or::after {
  content: "";
  flex: 1;
  block-size: 1px;
  background: var(--ds-border);
}

.auth-link {
  color: #5eead4;
  text-decoration: none;
  font-weight: 600;
  border-radius: 4px;
}
.auth-link:hover { text-decoration: underline; }
.auth-link:focus-visible { outline: 2px solid var(--ds-border-bright); outline-offset: 2px; }

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

/* ---- Account center (identity_account) — shares this surface ---- */
.acct-card { max-inline-size: 560px; }

.acct-section {
  border: 1px solid var(--ds-border);
  border-radius: var(--auth-radius-inner);
  background: rgba(2, 6, 23, 0.28);
  padding: 16px;
  margin-block-start: 14px;
}
.acct-section-title { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.acct-section-sub { margin: 0 0 12px; font-size: 13px; color: var(--ds-text-soft); line-height: 1.5; }

.acct-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  flex-wrap: wrap;
}
.acct-row + .acct-row { border-block-start: 1px solid var(--ds-border); }
.acct-row-label { font-size: 13px; color: var(--ds-text-soft); }
.acct-row-value { font-size: 14px; color: var(--ds-text); font-weight: 600; }

.acct-status {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 750;
  padding: 3px 11px;
  border-radius: 999px;
}
.acct-status--on { background: rgb(var(--ds-success-rgb) / 0.16); color: #86efac; }
.acct-status--off { background: rgba(148, 163, 184, 0.16); color: var(--ds-text-soft); }

.acct-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-block-start: 12px; }
.acct-actions .auth-button { inline-size: auto; padding-inline: 18px; }

.acct-link-row { display: flex; flex-direction: column; gap: 9px; margin-block-start: 4px; }
.acct-link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 15px;
  border: 1px solid var(--ds-border);
  border-radius: var(--auth-radius-inner);
  color: var(--ds-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: border-color 140ms ease, background 140ms ease;
}
.acct-link-item:hover { border-color: var(--ds-border-bright); background: rgba(0, 242, 228, 0.05); }
.acct-link-chev { color: var(--ds-text-soft); font-size: 18px; }

.acct-qr-wrap { text-align: center; }
.acct-qr {
  display: inline-block;
  background: #fff;
  padding: 10px;
  border-radius: 12px;
  margin: 4px auto 12px;
  line-height: 0;
}
.acct-qr svg { display: block; inline-size: 184px; block-size: 184px; }

.acct-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-block: 14px; }
.acct-code-chip {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 13.5px;
  text-align: center;
  padding: 9px;
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.5);
  border: 1px solid var(--ds-border);
  color: var(--ds-text);
}

.acct-session { padding: 4px 0; }
.acct-session + .acct-session { border-block-start: 1px solid var(--ds-border); }
.acct-session-meta { font-size: 12px; color: var(--ds-text-soft); margin-block-start: 3px; word-break: break-word; }

.acct-back { display: inline-block; margin-block-start: 18px; }

/* ---- Account center chrome (topbar + sidebar + main panel) ---- */
.acct-body { margin: 0; }

.acct-topbar {
  position: sticky;
  inset-block-start: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px clamp(16px, 4vw, 32px);
  background: rgba(11, 18, 34, 0.72);
  border-block-end: 1px solid var(--ds-border);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.acct-topbar__left { display: inline-flex; align-items: center; gap: 14px; min-inline-size: 0; }
.acct-topbar__brand { display: inline-flex; align-items: center; }
.acct-topbar__logo { display: block; inline-size: 120px; block-size: auto; }
.acct-topbar__back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 650;
  color: var(--ds-text);
  text-decoration: none;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--ds-border);
  background: rgba(2, 6, 23, 0.35);
  transition: border-color 0.14s ease, background 0.14s ease;
}
.acct-topbar__back:hover { border-color: var(--ds-border-bright); background: rgba(0, 242, 228, 0.08); }
.acct-topbar__back-arrow { font-size: 15px; line-height: 1; }
.acct-topbar__right { display: inline-flex; align-items: center; gap: 14px; }
.acct-topbar__user { display: inline-flex; align-items: center; gap: 9px; }
.acct-topbar__avatar {
  inline-size: 30px;
  block-size: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--ds-primary), var(--ds-secondary));
  color: var(--ds-on-primary);
  font-size: 13px;
  font-weight: 750;
}
.acct-topbar__email { font-size: 13px; color: var(--ds-text-soft); }
.acct-topbar__signout {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 650;
  color: var(--ds-text);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid var(--ds-border);
  transition: border-color 0.14s ease, background 0.14s ease;
}
.acct-topbar__signout:hover { border-color: var(--ds-border-bright); background: rgba(0, 242, 228, 0.06); }

.acct-layout {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  gap: clamp(22px, 3vw, 40px);
  inline-size: 100%;
  max-inline-size: 1180px;
  margin-inline: auto;
  padding: clamp(24px, 4vw, 44px) clamp(18px, 4vw, 40px);
  align-items: start;
}

.acct-nav {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  inset-block-start: 82px;
}
.acct-nav__group { display: flex; flex-direction: column; gap: 3px; }
.acct-nav__group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ds-text-muted);
  padding-inline: 14px;
  margin-block-end: 5px;
}
.acct-nav__link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 13px;
  border-radius: 11px;
  color: var(--ds-text-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: color 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}
.acct-nav__icon { display: inline-flex; align-items: center; color: var(--ds-text-muted); flex-shrink: 0; }
.acct-nav__link:hover { color: var(--ds-text); background: rgba(2, 6, 23, 0.4); }
.acct-nav__link:hover .acct-nav__icon { color: var(--ds-text-soft); }
.acct-nav__link.is-active {
  color: var(--ds-text);
  background: rgba(0, 242, 228, 0.1);
  border-color: var(--ds-border-bright);
}
.acct-nav__link.is-active .acct-nav__icon { color: var(--ds-primary); }
.acct-nav__link--danger { color: #fca5a5; }
.acct-nav__link--danger .acct-nav__icon { color: #f87171; }
.acct-nav__link--danger:hover { background: rgba(220, 38, 38, 0.1); color: #fecaca; }
.acct-nav__link--danger.is-active {
  background: rgba(220, 38, 38, 0.14);
  border-color: rgba(220, 38, 38, 0.4);
}

.acct-main {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--auth-radius);
  box-shadow: var(--auth-shadow);
  padding: clamp(24px, 3vw, 40px);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  min-inline-size: 0;
}
.acct-page-head {
  margin-block-end: 10px;
  padding-block-end: 16px;
  border-block-end: 1px solid var(--ds-border);
}
.acct-page-title {
  margin: 0 0 5px;
  font-size: clamp(22px, 3vw, 27px);
  font-weight: 750;
  letter-spacing: -0.01em;
}
.acct-page-sub { margin: 0; font-size: 14px; color: var(--ds-text-soft); }
.acct-main .acct-section:first-of-type { margin-block-start: 16px; }

/* Status dashboard cards (overview) */
.acct-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-block-start: 18px;
}
.acct-card2 {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--ds-border);
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.3);
  color: var(--ds-text);
  text-decoration: none;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.08s ease;
}
.acct-card2:hover { border-color: var(--ds-border-bright); background: rgba(0, 242, 228, 0.05); }
.acct-card2:active { transform: translateY(1px); }
.acct-card2__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 42px;
  block-size: 42px;
  border-radius: 12px;
  background: rgba(0, 242, 228, 0.1);
  color: var(--ds-primary);
  flex-shrink: 0;
}
.acct-card2__main { display: flex; flex-direction: column; gap: 3px; flex: 1; min-inline-size: 0; }
.acct-card2__title { font-size: 14px; font-weight: 700; }
.acct-card2__desc {
  font-size: 12px;
  color: var(--ds-text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acct-card2__meta { flex-shrink: 0; }

/* Extra status-pill tones */
.acct-status--warn { background: rgba(245, 158, 11, 0.16); color: #fcd34d; }
.acct-status--neutral { background: rgba(148, 163, 184, 0.16); color: var(--ds-text-soft); }

/* Roomy inline status line (e.g. passkeys feedback) — never cramped. */
.acct-statusline {
  margin-block-start: 16px;
  font-size: 13px;
  color: var(--ds-text-soft);
  line-height: 1.55;
  min-block-size: 1.2em;
}

@media (max-width: 720px) {
  .acct-layout { grid-template-columns: 1fr; }
  .acct-nav { position: static; gap: 12px; }
  .acct-nav__group { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .acct-nav__group-label { flex-basis: 100%; margin-block-end: 0; }
  .acct-nav__link { padding: 8px 12px; }
}

@media (max-width: 560px) {
  .acct-cards { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .acct-topbar__email { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card { animation: none; }
  .auth-button, .auth-input, .auth-link, .acct-link-item,
  .acct-nav__link, .acct-topbar__signout, .acct-card2 { transition: none; }
}
