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

:root {
  --bg:         #0a0a0f;
  --bg-surface: #15151f;
  --bg-raised:  #1d1d2a;
  --bg-hover:   #232333;
  --border:     #2a2a3a;
  --border-soft: #ffffff0f;

  --accent:      #ff3d6e;
  --accent-2:    #a855f7;
  --accent-dim:  #ff3d6e1f;
  --accent-soft: #ff3d6e3d;
  --gradient-brand: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  --gradient-text:   linear-gradient(135deg, #ff6b94 0%, #c084fc 100%);

  --text:       #f1f1f8;
  --text-muted: #9494b0;
  --text-dim:   #5c5c75;

  --online:  #4ade80;
  --danger:  #ff5d6c;
  --warning: #facc15;

  --font-ui:      'Inter', system-ui, sans-serif;
  --font-display: 'Sora', 'Inter', system-ui, sans-serif;

  --radius:    10px;
  --radius-lg: 18px;
  --radius-xl: 26px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.25);
  --shadow-md: 0 8px 28px rgba(0,0,0,0.38);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.5);
  --glow-accent: 0 0 0 1px var(--accent-soft), 0 8px 24px -4px rgba(255,61,110,0.45);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  position: relative;
  isolation: isolate;
}

/* Subtle animated gradient mesh behind everything — fixed, low opacity, never
   interferes with readability or scroll perf (no layout, just a backdrop). */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 8%, rgba(255, 61, 110, 0.16), transparent 40%),
    radial-gradient(circle at 85% 18%, rgba(168, 85, 247, 0.14), transparent 38%),
    radial-gradient(circle at 50% 95%, rgba(99, 102, 241, 0.10), transparent 45%);
  animation: drift 24s ease-in-out infinite alternate;
}
@keyframes drift {
  0%   { transform: translate3d(0,0,0) scale(1); }
  100% { transform: translate3d(-1.5%, 1.5%, 0) scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  * { scroll-behavior: auto !important; }
}

::selection { background: var(--accent-soft); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-raised); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--border); }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; margin: 0 0 8px; }

a { color: var(--accent); text-decoration: none; transition: color 0.15s var(--ease); }
a:hover { color: #ff6b94; }

img { max-width: 100%; display: block; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

code { font-family: 'SFMono-Regular', Consolas, monospace; background: var(--bg-raised); padding: 2px 6px; border-radius: 4px; font-size: 0.85em; }

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Top nav ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: rgba(10, 10, 15, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border-soft);
}

.navbar .logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.navbar .logo .logo-accent {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.navbar .logo svg { color: var(--accent); }
.logo-icon { display: inline-flex; animation: twinkle-spin 6s ease-in-out infinite; }
.logo-img { height: 30px; width: auto; display: block; }
@keyframes twinkle-spin {
  0%, 100% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(14deg) scale(1.08); }
}

.navbar nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.navbar nav a, .navbar nav button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 999px;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.navbar nav a:hover { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.navbar nav a.active { color: var(--text); background: var(--bg-raised); }
.navbar nav a.nav-cta { color: #fff; background: var(--gradient-brand); box-shadow: var(--glow-accent); }
.navbar nav a.nav-cta:hover { filter: brightness(1.08); }
.navbar nav a.nav-avatar-link { padding: 0; margin-left: 4px; }
.navbar nav a.nav-avatar-link:hover { background: none; }
.navbar .nav-label { display: inline; }

@media (max-width: 640px) {
  .navbar { padding: 12px 14px; }
  .navbar .nav-label { display: none; }
  .navbar nav a, .navbar nav button { padding: 8px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s var(--ease), background 0.15s var(--ease), border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.btn:hover { background: var(--bg-hover); border-color: #3a3a50; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--gradient-brand);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--glow-accent);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 0 0 1px var(--accent-soft), 0 10px 30px -4px rgba(255,61,110,0.55); }

.btn-danger { color: var(--danger); border-color: #ff5d6c44; background: #ff5d6c0f; }
.btn-danger:hover { background: #ff5d6c1f; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-icon { padding: 9px; border-radius: 999px; }

.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
}
input, textarea, select {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.hint { font-size: 0.78rem; color: var(--text-dim); margin-top: 5px; }
.error-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--danger);
  margin-top: 12px;
  padding: 10px 12px;
  background: #ff5d6c14;
  border: 1px solid #ff5d6c33;
  border-radius: var(--radius);
}
.error-text svg { flex-shrink: 0; }

/* ---------- Cards / surfaces ---------- */
.card {
  background: linear-gradient(180deg, var(--bg-surface), var(--bg-surface) 100%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.card-hover { position: relative; overflow: hidden; transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease); }
.card-hover:hover { transform: translateY(-3px); border-color: var(--accent-soft); box-shadow: var(--shadow-md); }
.card-hover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,0.07) 50%, transparent 60%);
  transform: translateX(-120%);
  transition: transform 0.7s var(--ease);
  pointer-events: none;
}
.card-hover:hover::after { transform: translateX(120%); }

/* ---------- Sparkle accents (used sparingly — hero only) ---------- */
.star-field { position: absolute; inset: -20px 0 auto 0; height: 280px; pointer-events: none; overflow: hidden; z-index: -1; }
.star-field .star { position: absolute; opacity: 0; color: var(--accent-2); animation: twinkle 3.2s ease-in-out infinite; }
.star-field .star:nth-child(1) { top: 14%; left: 6%; animation-delay: 0s; color: var(--accent); }
.star-field .star:nth-child(2) { top: 65%; left: 12%; animation-delay: 1.1s; }
.star-field .star:nth-child(3) { top: 28%; left: 22%; animation-delay: 2.1s; color: var(--accent); }
.star-field .star:nth-child(4) { top: 8%; left: 88%; animation-delay: 0.5s; }
.star-field .star:nth-child(5) { top: 55%; left: 92%; animation-delay: 1.7s; color: var(--accent); }
.star-field .star:nth-child(6) { top: 80%; left: 78%; animation-delay: 2.6s; }
.star-field .star:nth-child(7) { top: 40%; left: 50%; animation-delay: 0.9s; }
.star-field .star:nth-child(8) { top: 5%; left: 38%; animation-delay: 1.9s; color: var(--accent); }
.star-field .star:nth-child(9) { top: 75%; left: 45%; animation-delay: 3s; }
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0.4) rotate(0deg); }
  50% { opacity: 0.85; transform: scale(1) rotate(20deg); }
}
@media (prefers-reduced-motion: reduce) {
  .star-field .star, .logo-icon { animation: none; opacity: 0.6; }
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}
.auth-shell::before {
  content: '';
  position: absolute;
  width: 480px; height: 480px;
  background: radial-gradient(circle, rgba(255,61,110,0.18), transparent 70%);
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: -1;
  filter: blur(10px);
}
.auth-card {
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: fade-up 0.5s var(--ease);
}
.auth-card .auth-logo { display: flex; justify-content: center; margin-bottom: 22px; }
.auth-card .auth-logo .logo { font-size: 1.4rem; }
.auth-card .auth-logo .logo-icon svg { width: 24px; height: 24px; }
.auth-card h1 { font-size: 1.6rem; margin-bottom: 4px; }
.auth-card .subtitle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 26px; }

/* ---------- Avatar ---------- */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: var(--font-display);
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
  font-size: 0.95rem;
  position: relative;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 30px; height: 30px; font-size: 0.72rem; }
.avatar-lg { width: 76px; height: 76px; font-size: 1.5rem; }
.avatar-xl { width: 104px; height: 104px; font-size: 2rem; }
.avatar-ai { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--accent-2); }
.avatar-ai::after {
  content: '\2726';
  position: absolute;
  bottom: -1px;
  right: -1px;
  font-size: 0.6em;
  background: var(--accent-2);
  color: #fff;
  width: 1.5em;
  height: 1.5em;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--bg);
}

.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* ---------- Misc ---------- */
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.center { text-align: center; }
.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.text-gradient {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fade-up 0.4s var(--ease) backwards; }

/* ---------- Toasts ---------- */
.toast-host {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  align-items: center;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--online);
  color: var(--text);
  padding: 11px 18px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast.error { border-left-color: var(--danger); color: #ffd7d7; }
.toast svg { color: var(--online); flex-shrink: 0; }
.toast.error svg { color: var(--danger); }

/* ---------- Loading ---------- */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton-line, .skeleton-circle, .skeleton-card {
  background: linear-gradient(100deg, var(--bg-surface) 30%, var(--bg-raised) 50%, var(--bg-surface) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius);
}
.skeleton-line { height: 14px; margin-bottom: 10px; width: 100%; }
.skeleton-line:nth-child(odd) { width: 85%; }
.skeleton-circle { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.skeleton-card { height: 90px; margin-bottom: 12px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 56px 20px;
  font-size: 0.92rem;
}
.empty-state .icon { color: var(--text-dim); margin-bottom: 10px; opacity: 0.7; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
}
.badge-muted { background: var(--bg-raised); color: var(--text-muted); }

hr { border: none; border-top: 1px solid var(--border-soft); margin: 24px 0; }

.toggle-switch { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch .slider {
  position: absolute; inset: 0; background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 999px; transition: background 0.2s var(--ease);
}
.toggle-switch .slider::before {
  content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px;
  background: var(--text-muted); border-radius: 50%; transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}
.toggle-switch input:checked + .slider { background: var(--gradient-brand); border-color: transparent; }
.toggle-switch input:checked + .slider::before { transform: translateX(16px); background: #fff; }
