﻿:root {
  --purple-300: #d8b4fe;
  --purple-400: #c084fc;
  --purple-500: #a855f7;
  --purple-700: #7e22ce;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: #000;
  color: #fff;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow-x: hidden;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  position: relative;
}

/* ---------- background: purple glow scene ---------- */
.bg-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: linear-gradient(to bottom, rgba(168,85,247,0.4), rgba(126,34,206,0.5) 45%, #000 100%);
}

.bg-scene::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.05;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

.glow-top {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 120vh; height: 60vh;
  border-radius: 0 0 50% 50%;
  background: rgba(196,132,252,0.2);
  filter: blur(80px);
  animation: pulse-a 8s ease-in-out infinite;
}

.glow-bottom {
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 90vh; height: 90vh;
  border-radius: 50% 50% 0 0;
  background: rgba(168,85,247,0.2);
  filter: blur(60px);
  animation: pulse-b 6s ease-in-out infinite 1s;
}

.glow-spot-l, .glow-spot-r {
  position: absolute;
  width: 22rem; height: 22rem;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.4;
  animation: soft-pulse 4s ease-in-out infinite;
}
.glow-spot-l { left: 20%; top: 22%; }
.glow-spot-r { right: 20%; bottom: 22%; animation-delay: 1.5s; }

@keyframes pulse-a { 0%,100% { opacity: 0.15; transform: translateX(-50%) scale(0.98); } 50% { opacity: 0.3; transform: translateX(-50%) scale(1.02); } }
@keyframes pulse-b { 0%,100% { opacity: 0.3; transform: translateX(-50%) scale(1); } 50% { opacity: 0.5; transform: translateX(-50%) scale(1.1); } }
@keyframes soft-pulse { 0%,100% { opacity: 0.25; } 50% { opacity: 0.5; } }

/* ---------- card ---------- */
.card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 380px;
  animation: card-in 0.8s ease both;
}

@keyframes card-in { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.card-inner {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
}

/* traveling border light beams */
.beam {
  position: absolute;
  z-index: 1;
  background: linear-gradient(90deg, transparent, #fff, transparent);
  opacity: 0.6;
  filter: blur(1px);
  pointer-events: none;
}
.beam-top { top: 0; left: -50%; width: 50%; height: 2px; animation: beam-x 3s ease-in-out infinite; }
.beam-bottom { bottom: 0; right: -50%; width: 50%; height: 2px; background: linear-gradient(90deg, transparent, #fff, transparent); animation: beam-x2 3s ease-in-out infinite 1.2s; }
.beam-left { top: -50%; left: 0; width: 2px; height: 50%; background: linear-gradient(180deg, transparent, #fff, transparent); animation: beam-y 3s ease-in-out infinite 1.8s; }
.beam-right { bottom: -50%; right: 0; width: 2px; height: 50%; background: linear-gradient(180deg, transparent, #fff, transparent); animation: beam-y2 3s ease-in-out infinite 0.6s; }

@keyframes beam-x  { 0% { left: -50%; opacity: 0.2; } 50% { opacity: 0.7; } 100% { left: 100%; opacity: 0.2; } }
@keyframes beam-x2 { 0% { right: -50%; opacity: 0.2; } 50% { opacity: 0.7; } 100% { right: 100%; opacity: 0.2; } }
@keyframes beam-y  { 0% { top: -50%; opacity: 0.2; } 50% { opacity: 0.7; } 100% { top: 100%; opacity: 0.2; } }
@keyframes beam-y2 { 0% { bottom: -50%; opacity: 0.2; } 50% { opacity: 0.7; } 100% { bottom: 100%; opacity: 0.2; } }

.glass {
  position: relative;
  z-index: 2;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.6);
}

/* header */
.logo-badge {
  margin: 0 auto 10px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  font-weight: 700;
  font-size: 1.1rem;
}
.logo-badge span {
  background: linear-gradient(to bottom, #fff, rgba(255,255,255,0.7));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

h1.title {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 4px;
  background: linear-gradient(to bottom, #fff, rgba(255,255,255,0.8));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

p.subtitle {
  text-align: center;
  margin: 0 0 22px;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.6);
}

/* fields */
.field { margin-bottom: 13px; }

.field label {
  display: block;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.55);
  margin-bottom: 5px;
}

.input-wrap { position: relative; display: flex; align-items: center; }

.input-wrap svg.field-icon {
  position: absolute;
  left: 12px;
  width: 16px; height: 16px;
  color: rgba(255,255,255,0.4);
  pointer-events: none;
  transition: color 0.2s;
}

.input-wrap:focus-within svg.field-icon { color: #fff; }

.field input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 36px;
  background: rgba(255,255,255,0.05);
  border: 1px solid transparent;
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
  outline: none;
  transition: background 0.2s, border-color 0.2s;
}
.field input::placeholder { color: rgba(255,255,255,0.3); }
.field input:focus { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }

.field.has-toggle input { padding-right: 34px; }

.toggle-pw {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  display: flex;
  color: rgba(255,255,255,0.4);
}
.toggle-pw:hover { color: #fff; }
.toggle-pw svg { width: 16px; height: 16px; }

.field small { display: block; margin-top: 5px; color: rgba(255,255,255,0.35); font-size: 0.68rem; }

/* row: remember me / forgot */
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 14px;
  font-size: 0.72rem;
}
.row-between a { color: rgba(255,255,255,0.6); text-decoration: none; }
.row-between a:hover { color: #fff; }
.remember { display: flex; align-items: center; gap: 6px; color: rgba(255,255,255,0.6); }
.remember input { width: 14px; height: 14px; accent-color: #fff; }

/* buttons */
button.btn {
  width: 100%;
  height: 40px;
  margin-top: 4px;
  background: #fff;
  color: #000;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 0 0 rgba(255,255,255,0);
}
button.btn:hover { box-shadow: 0 8px 24px rgba(255,255,255,0.15); }
button.btn:active { transform: scale(0.98); }
button.btn:disabled { opacity: 0.6; cursor: not-allowed; }
button.btn svg { width: 13px; height: 13px; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.4);
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.08); }

button.link-btn {
  background: none;
  border: none;
  color: #fff;
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
  padding: 0;
  font-weight: 600;
}

.switcher { text-align: center; margin-top: 16px; font-size: 0.78rem; color: rgba(255,255,255,0.55); }

.spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(0,0,0,0.3);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.msg {
  margin-top: 12px;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 0.76rem;
  line-height: 1.5;
  display: none;
}
.msg.show { display: block; }
.msg.error { background: rgba(168,85,247,0.12); border: 1px solid rgba(216,180,254,0.4); color: #f3e8ff; }
.msg.info  { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.15); color: #e5e5e5; }
.msg.ok    { background: rgba(80,255,140,0.08); border: 1px solid rgba(80,255,140,0.4); color: #bfffd6; }

.step { display: none; }
.step.active { display: block; }

/* request-access thank-you state */
.request-done { text-align: center; padding: 10px 0 4px; }
.req-check {
  width: 56px; height: 56px;
  margin: 4px auto 14px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #4ade80;
  border: 1.5px solid rgba(80,255,140,0.45);
  background: rgba(80,255,140,0.07);
  box-shadow: 0 0 26px rgba(80,255,140,0.2);
}
.req-check svg { width: 26px; height: 26px; }
.request-done h2 { margin: 0 0 8px; font-size: 1.15rem; }
.request-done p { margin: 0; color: rgba(255,255,255,0.6); font-size: 0.85rem; line-height: 1.6; }

/* ---------- dashboard / hub ---------- */
.hub { position: relative; z-index: 2; width: 100%; max-width: 860px; }

.hub-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 22px; flex-wrap: wrap; gap: 12px;
}
.hub-header h1 {
  font-size: 1.3rem; margin: 0; font-weight: 700;
  background: linear-gradient(to bottom, #fff, rgba(255,255,255,0.75));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hub-header .user-chip {
  font-size: 0.78rem; color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  padding: 6px 12px; border-radius: 20px;
}

.grid-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}

.tile {
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 20px 18px;
  text-decoration: none;
  color: #fff;
  display: block;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}
.tile:hover { border-color: rgba(255,255,255,0.25); transform: translateY(-2px); box-shadow: 0 12px 30px rgba(168,85,247,0.25); }

.tile .tile-icon { display: flex; margin-bottom: 10px; color: rgba(255,255,255,0.7); }
.tile .tile-icon svg { width: 20px; height: 20px; }
.tile .tile-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 5px; }
.tile .tile-desc { font-size: 0.76rem; color: rgba(255,255,255,0.5); line-height: 1.4; }

/* ---------- dashboard: security / 2FA panel ---------- */
.security-card {
  margin-top: 16px;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 20px 18px;
}
.sec-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.sec-btn { margin-top: 0; white-space: nowrap; }
.mfa-qr {
  display: block;
  width: 160px; height: 160px;
  margin: 14px 0 10px;
  padding: 8px;
  background: #fff;
  border-radius: 10px;
}
.mfa-secret {
  font-size: 0.72rem;
  color: #d8b4fe;
  word-break: break-all;
}
.mfa-form { display: flex; gap: 10px; margin-top: 12px; max-width: 280px; }
.mfa-form input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
  letter-spacing: 3px;
  outline: none;
}
.mfa-form input:focus { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.25); }
.mfa-verify-btn { width: auto; padding: 0 18px; margin-top: 0; }

.logout-btn {
  margin-top: 24px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
}
.logout-btn:hover { background: rgba(255,255,255,0.1); }

/* ---------- ACCESS GRANTED interstitial ---------- */
.granted-wrap {
  position: relative;
  z-index: 1;
  text-align: center;
}

.granted-verifying {
  color: rgba(255,255,255,0.45);
  font-size: 0.9rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  animation: soft-pulse 1.4s ease-in-out infinite;
}
body.granted-go .granted-verifying { display: none; }

/* hidden until the session is verified by app.js */
.granted-main { display: none; }
body.granted-go .granted-main {
  display: block;
  animation: card-in 0.5s ease both;
}

.granted-ring {
  width: 96px;
  height: 96px;
  margin: 0 auto 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4ade80;
  border: 2px solid rgba(80,255,140,0.5);
  background: rgba(80,255,140,0.06);
  box-shadow: 0 0 40px rgba(80,255,140,0.25), inset 0 0 24px rgba(80,255,140,0.08);
  animation: granted-pop 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.granted-ring svg { width: 46px; height: 46px; }
.granted-check {
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  animation: granted-draw 0.5s ease 0.35s forwards;
}

.granted-title {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 6vw, 2.6rem);
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #fff;
  text-shadow: 0 0 24px rgba(80,255,140,0.45);
}

.granted-sub {
  margin: 0 0 26px;
  color: var(--purple-300);
  font-size: 0.95rem;
}

.granted-bar {
  width: min(320px, 70vw);
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  overflow: hidden;
}
.granted-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--purple-500), #4ade80);
}
body.granted-go .granted-bar span { animation: granted-fill 2.4s linear 0.2s forwards; }

.granted-note {
  color: rgba(255,255,255,0.45);
  font-size: 0.82rem;
}
.granted-note a { color: var(--purple-300); }

@keyframes granted-pop  { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }
@keyframes granted-draw { to { stroke-dashoffset: 0; } }
@keyframes granted-fill { to { width: 100%; } }
