/* 2FA sandbox demo UI. Demo only: the real Admin site gets its screens from the Figma designs. */

:root {
  --bg: #070b1a;
  --bg-2: #0e1530;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-strong: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.12);
  --text: #eef1fb;
  --muted: #9ba7c9;
  --faint: #5d6890;
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #fb7185;
  --info: #60a5fa;
  --radius: 22px;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.45), 0 2px 0 rgba(255, 255, 255, 0.04) inset;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1200px 800px at 10% -10%, #1b1f4a 0%, transparent 60%),
              radial-gradient(900px 700px at 110% 110%, #0b3b4a 0%, transparent 55%),
              var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- drifting colour blobs behind everything ------------------------------------------------- */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.backdrop span {
  position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%;
  filter: blur(70px); opacity: 0.45; mix-blend-mode: screen;
  animation: drift 22s ease-in-out infinite alternate;
}
.backdrop span:nth-child(1) { background: #5b3cf5; top: -18vmax; left: -12vmax; }
.backdrop span:nth-child(2) { background: #0ea5b7; bottom: -22vmax; right: -14vmax; animation-duration: 26s; }
.backdrop span:nth-child(3) { background: #c026d3; top: 30%; left: 55%; width: 28vmax; height: 28vmax; opacity: 0.25; animation-duration: 30s; }
@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(6vmax, 4vmax) scale(1.08); }
  100% { transform: translate(-4vmax, 7vmax) scale(0.95); }
}
.grid-overlay {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.08;
  background-image: linear-gradient(rgba(255,255,255,.4) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.4) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

/* ---- top bar ---------------------------------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 18px 28px; max-width: 1180px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; letter-spacing: 0.2px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px rgba(124, 92, 255, 0.45);
}
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  font-size: 12.5px; color: var(--muted); background: var(--glass); border: 1px solid var(--border);
  white-space: nowrap;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }

/* ---- layout ----------------------------------------------------------------------------------- */
.center { min-height: calc(100vh - 90px); display: grid; place-items: center; padding: 20px 16px 60px; }
.card {
  width: 100%; max-width: 440px; padding: 34px 32px 30px;
  background: linear-gradient(180deg, var(--glass-strong), var(--glass));
  border: 1px solid var(--border); border-radius: var(--radius);
  backdrop-filter: blur(22px) saturate(140%); -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow: var(--shadow);
  animation: rise 0.6s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(0.98); } to { opacity: 1; transform: none; } }
.card h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.3px; }
.card p.lead { margin: 0 0 22px; color: var(--muted); line-height: 1.5; }
.hidden { display: none !important; }
.fade-in { animation: rise 0.45s cubic-bezier(.2,.8,.2,1) both; }

/* ---- stepper: 1 password, 2 email link, 3 signed in ------------------------------------------ */
.stepper { display: flex; align-items: center; gap: 0; margin: 0 0 26px; }
.step { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 0 0 auto; width: 78px; }
.step .bubble {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: var(--faint);
  border: 1.5px solid var(--border); background: rgba(255,255,255,0.03);
  transition: all 0.35s ease;
}
.step .label { font-size: 11.5px; color: var(--faint); text-align: center; transition: color 0.35s; }
.step.current .bubble { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--accent), var(--accent-2)); animation: glow 1.8s ease-in-out infinite; }
.step.current .label { color: var(--text); }
.step.done .bubble { color: #052e22; background: var(--ok); border-color: transparent; }
.step.done .label { color: var(--muted); }
.step.skipped .bubble { color: var(--faint); border-style: dashed; }
.step.skipped .label { text-decoration: line-through; }
.step-line { flex: 1; height: 2px; background: var(--border); margin-bottom: 20px; position: relative; overflow: hidden; border-radius: 2px; }
.step-line.filled::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--ok), var(--accent-2)); animation: fill 0.6s ease forwards; transform-origin: left; }
@keyframes fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(124,92,255,.55); } 50% { box-shadow: 0 0 0 9px rgba(124,92,255,0); } }

/* ---- form ------------------------------------------------------------------------------------- */
.field { position: relative; margin-bottom: 16px; }
.field input {
  width: 100%; padding: 22px 46px 8px 16px; font-size: 15.5px; font-family: inherit; color: var(--text);
  background: rgba(5, 9, 25, 0.55); border: 1px solid var(--border); border-radius: 14px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field label {
  position: absolute; left: 16px; top: 15px; font-size: 15px; color: var(--muted);
  pointer-events: none; transition: all 0.18s ease;
}
.field input:focus, .field input:not(:placeholder-shown) { background: rgba(5, 9, 25, 0.75); }
.field input:focus { border-color: rgba(124, 92, 255, 0.8); box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.18); }
.field input:focus + label, .field input:not(:placeholder-shown) + label { top: 7px; font-size: 11.5px; color: var(--accent-2); }
.field.invalid input { border-color: var(--err); box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.15); animation: shake 0.4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.eye {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px;
}
.eye:hover { color: var(--text); background: rgba(255,255,255,0.06); }

/* ---- buttons ---------------------------------------------------------------------------------- */
.btn {
  position: relative; width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 18px; border-radius: 14px; border: 0; cursor: pointer; font: 600 15.5px var(--font);
  color: #fff; background: linear-gradient(135deg, var(--accent), #5b8cff 55%, var(--accent-2));
  background-size: 160% 160%; box-shadow: 0 12px 30px rgba(91, 60, 245, 0.35);
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-position 0.6s ease, opacity 0.2s;
}
.btn:hover { transform: translateY(-1px); background-position: 100% 0; box-shadow: 0 16px 36px rgba(91, 60, 245, 0.45); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { cursor: default; opacity: 0.55; transform: none; }
.btn.ghost { background: transparent; box-shadow: none; border: 1px solid var(--border); color: var(--text); }
.btn.ghost:hover { background: rgba(255,255,255,0.05); }
.btn.small { width: auto; padding: 9px 14px; font-size: 13.5px; border-radius: 11px; }
.btn .spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--text); }
.row { display: flex; gap: 12px; align-items: center; }
.row > .btn { flex: 1; }
.hint { margin-top: 18px; text-align: center; color: var(--faint); font-size: 12.5px; }

/* ---- waiting animation: an envelope with radar rings ---------------------------------------- */
.radar { position: relative; width: 150px; height: 150px; margin: 4px auto 22px; display: grid; place-items: center; }
.radar .ring {
  position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(34, 211, 238, 0.55);
  animation: ripple 2.6s cubic-bezier(.2,.6,.3,1) infinite; opacity: 0;
}
.radar .ring:nth-child(2) { animation-delay: 0.85s; }
.radar .ring:nth-child(3) { animation-delay: 1.7s; }
@keyframes ripple { 0% { transform: scale(0.45); opacity: 0.9; } 100% { transform: scale(1.15); opacity: 0; } }
.radar .core {
  position: relative; width: 74px; height: 74px; border-radius: 22px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 16px 40px rgba(34, 211, 238, 0.35); animation: bob 2.6s ease-in-out infinite;
}
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-7px) rotate(3deg); } }
.dots::after { content: ""; display: inline-block; width: 1.4em; text-align: left; animation: dots 1.4s steps(4, end) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75%, 100% { content: "..."; } }
.address { display: inline-block; padding: 3px 10px; border-radius: 8px; background: rgba(34, 211, 238, 0.12); color: #a5f3fc; font-family: var(--mono); font-size: 13.5px; }

/* countdown ring inside the resend button */
.count { display: inline-grid; place-items: center; width: 22px; height: 22px; position: relative; }
.count svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.count circle { fill: none; stroke-width: 3; }
.count .track { stroke: rgba(255,255,255,0.15); }
.count .bar { stroke: var(--accent-2); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }

/* ---- success burst ---------------------------------------------------------------------------- */
.success { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; background: rgba(4, 7, 18, 0.55); backdrop-filter: blur(6px); animation: rise 0.3s ease both; }
.success .badge { position: relative; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #6ee7b7, var(--ok)); display: grid; place-items: center; box-shadow: 0 0 0 0 rgba(52,211,153,.6); animation: pop 0.55s cubic-bezier(.2,1.4,.4,1) both, halo 1.6s ease-out 0.2s; }
.success svg path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw 0.5s 0.3s ease forwards; }
.success .caption { position: absolute; top: calc(50% + 86px); width: 100%; text-align: center; font-weight: 600; font-size: 18px; animation: rise 0.5s 0.35s both; }
@keyframes pop { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes halo { to { box-shadow: 0 0 0 40px rgba(52,211,153,0); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.confetti { position: absolute; width: 9px; height: 14px; border-radius: 2px; top: 50%; left: 50%; opacity: 0; animation: burst 1.1s cubic-bezier(.1,.7,.3,1) 0.25s forwards; }
@keyframes burst {
  0% { transform: translate(-50%, -50%) rotate(0); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) rotate(var(--r)); opacity: 0; }
}

/* ---- toasts and modal ------------------------------------------------------------------------- */
.toasts { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 10px; width: min(460px, calc(100vw - 32px)); }
.toast {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: start; position: relative; overflow: hidden;
  padding: 14px 14px 16px; border-radius: 16px; background: rgba(13, 19, 44, 0.92); border: 1px solid var(--border);
  box-shadow: 0 18px 50px rgba(0,0,0,.45); backdrop-filter: blur(12px); animation: slide 0.35s cubic-bezier(.2,.9,.3,1.2) both;
}
.toast.leaving { animation: leave 0.3s ease forwards; }
@keyframes slide { from { transform: translateY(-16px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes leave { to { transform: translateY(-12px); opacity: 0; } }
.toast .icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; }
.toast.error .icon { background: rgba(251,113,133,.16); color: var(--err); }
.toast.warn .icon { background: rgba(251,191,36,.16); color: var(--warn); }
.toast.success .icon { background: rgba(52,211,153,.16); color: var(--ok); }
.toast.info .icon { background: rgba(96,165,250,.16); color: var(--info); }
.toast strong { display: block; margin-bottom: 3px; }
.toast p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.toast code, .modal code { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.toast .close { background: none; border: 0; color: var(--faint); cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 4px; }
.toast .timer { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; transform-origin: left; animation: shrink linear forwards; }
.toast.error .timer { background: var(--err); } .toast.warn .timer { background: var(--warn); }
.toast.success .timer { background: var(--ok); } .toast.info .timer { background: var(--info); }
@keyframes shrink { to { transform: scaleX(0); } }

.modal-back { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(3, 6, 16, 0.6); backdrop-filter: blur(8px); animation: rise 0.25s ease both; }
.modal { width: min(440px, 100%); padding: 28px; border-radius: var(--radius); background: linear-gradient(180deg, #151d3d, #0f1530); border: 1px solid var(--border); box-shadow: var(--shadow); animation: pop 0.35s cubic-bezier(.2,1.2,.4,1) both; text-align: center; }
.modal .big-icon { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px; display: grid; place-items: center; font-size: 30px; font-weight: 800; }
.modal.error .big-icon { background: rgba(251,113,133,.15); color: var(--err); }
.modal.warn .big-icon { background: rgba(251,191,36,.15); color: var(--warn); }
.modal.info .big-icon { background: rgba(96,165,250,.15); color: var(--info); }
.modal h2 { margin: 0 0 8px; font-size: 20px; }
.modal p { margin: 0 0 18px; color: var(--muted); line-height: 1.55; }
.modal details { margin: -6px 0 18px; color: var(--faint); font-size: 12.5px; }

/* ---- navigation, result boxes, settings ------------------------------------------------------- */
.nav { display: flex; gap: 6px; }
.nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: 14px; }
.nav a:hover { color: var(--text); background: rgba(255,255,255,.05); }
.nav a.active { color: var(--text); background: rgba(124,92,255,.18); }
.result { display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: center; padding: 16px; border-radius: 16px; margin-top: 16px; border: 1px solid var(--border); animation: rise .35s ease both; }
.result .r-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; font-weight: 800; }
.result.ok { background: rgba(52,211,153,.08); border-color: rgba(52,211,153,.35); }
.result.ok .r-icon { background: rgba(52,211,153,.18); color: var(--ok); }
.result.no { background: rgba(251,113,133,.08); border-color: rgba(251,113,133,.35); }
.result.no .r-icon { background: rgba(251,113,133,.18); color: var(--err); }
.result strong { display: block; }
.result span { color: var(--muted); font-size: 13.5px; }
.presenter { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); text-align: center; }
.presenter .tag { display: inline-block; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--warn); border: 1px solid rgba(251,191,36,.35); border-radius: 6px; padding: 1px 6px; margin-right: 6px; }
.state-box { display: grid; gap: 14px; }
.big-status { display: flex; align-items: center; gap: 14px; }
.big-status .dot { width: 14px; height: 14px; border-radius: 50%; }
.big-status .dot.on { background: var(--ok); box-shadow: 0 0 14px var(--ok); }
.big-status .dot.off { background: var(--faint); }
.big-status strong { font-size: 22px; }

/* ---- dashboard -------------------------------------------------------------------------------- */
.dash { max-width: 1180px; margin: 0 auto; padding: 10px 28px 60px; display: grid; gap: 22px; grid-template-columns: 1.15fr 1fr; }
.dash .card { max-width: none; }
.hero { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.hero h1 { font-size: 30px; margin: 0; }
.avatar { flex: 0 0 56px; width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; font-weight: 800; font-size: 20px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 10px 30px rgba(124,92,255,.4); }
.status { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: 13.5px; }
.status.ok { background: rgba(52,211,153,.14); color: #6ee7b7; border: 1px solid rgba(52,211,153,.35); }
.status.off { background: rgba(155,167,201,.12); color: var(--muted); border: 1px solid var(--border); }
.status.warn { background: rgba(251,191,36,.12); color: #fcd34d; border: 1px solid rgba(251,191,36,.35); }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 12px 16px; margin: 6px 0 0; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.mono { font-family: var(--mono); font-size: 13px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 0 0 14px; font-size: 16px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ok); }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.timeline li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; }
.timeline .tick { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-size: 14px; background: rgba(255,255,255,.05); border: 1px solid var(--border); }
.timeline .tick.ok { background: rgba(52,211,153,.15); border-color: rgba(52,211,153,.4); color: var(--ok); }
.timeline .tick.wait { background: rgba(251,191,36,.12); border-color: rgba(251,191,36,.35); color: var(--warn); }
.timeline .t-title { font-weight: 600; }
.timeline .t-sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
pre.card-json { margin: 0; padding: 16px; border-radius: 14px; background: rgba(3, 6, 16, 0.6); border: 1px solid var(--border); font-family: var(--mono); font-size: 12.5px; line-height: 1.6; color: #c7d2fe; overflow-x: auto; }
.flash { animation: flash 1.2s ease; }
@keyframes flash { 0% { box-shadow: 0 0 0 0 rgba(34,211,238,.7); } 100% { box-shadow: 0 0 0 18px rgba(34,211,238,0); } }
.note { color: var(--faint); font-size: 12.5px; margin-top: 12px; line-height: 1.5; }

@media (max-width: 900px) { .dash { grid-template-columns: 1fr; padding: 10px 16px 40px; } .kv { grid-template-columns: 130px 1fr; } }
@media (max-width: 480px) { .card { padding: 26px 20px; } .topbar { padding: 14px 16px; } .step { width: 66px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
