@layer base, components, utilities;

:root {
  --bg: #0a0a0f;
  --bg-elev: #111118;
  --card: #1a1a24;
  --text: #f0f0f5;
  --muted: #9ca3af;
  --primary: #3b82f6; /* blue */
  --accent: #10b981;  /* emerald */
  --danger: #ef4444;  /* red */
  --warning: #f59e0b; /* amber */
  --ring: rgba(59, 130, 246, 0.35);
  --gradient: linear-gradient(135deg, #3b82f6, #10b981);
}

/* Base */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  line-height: 1.6;
  font-weight: 400;
  letter-spacing: -0.01em;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: 0 20px;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* Decorative backgrounds */
.bg-aurora {
  position: fixed; inset: 0; pointer-events: none; z-index: -2;
  background: 
    radial-gradient(circle at 20% 80%, rgba(16,185,129,.15), transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(59,130,246,.12), transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(147,51,234,.08), transparent 50%);
  filter: blur(40px);
  animation: floatSlow 25s ease-in-out infinite;
}
.bg-glow {
  position: fixed; inset: 0; pointer-events: none; z-index: -3;
  background: 
    radial-gradient(ellipse 800px 600px at 50% 0%, rgba(59,130,246,.06), transparent),
    radial-gradient(ellipse 600px 400px at 0% 100%, rgba(16,185,129,.04), transparent),
    radial-gradient(ellipse 400px 300px at 100% 50%, rgba(147,51,234,.03), transparent);
  filter: blur(60px);
  animation: pulse 15s ease-in-out infinite;
}
@keyframes floatSlow {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(-10px, -20px) rotate(1deg); }
  50% { transform: translate(20px, -10px) rotate(-0.5deg); }
  75% { transform: translate(-15px, 15px) rotate(0.5deg); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

/* Additional light effects */
.hero::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(2px 2px at 20% 30%, rgba(59,130,246,0.3), transparent),
    radial-gradient(2px 2px at 40% 70%, rgba(16,185,129,0.3), transparent),
    radial-gradient(1px 1px at 60% 20%, rgba(147,51,234,0.3), transparent),
    radial-gradient(1px 1px at 80% 80%, rgba(59,130,246,0.2), transparent),
    radial-gradient(2px 2px at 90% 40%, rgba(16,185,129,0.2), transparent);
  background-size: 400px 400px, 600px 600px, 300px 300px, 500px 500px, 350px 350px;
  animation: sparkle 20s linear infinite;
  pointer-events: none;
}

@keyframes sparkle {
  0%, 100% { background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%; }
  25% { background-position: 100% 100%, 0% 0%, 100% 0%, 0% 100%, 50% 50%; }
  50% { background-position: 0% 100%, 100% 0%, 50% 100%, 100% 50%, 100% 100%; }
  75% { background-position: 100% 0%, 50% 100%, 0% 50%, 50% 0%, 0% 100%; }
}

/* Nav */
.nav { 
  position: sticky; top: 20px; z-index: 50;
  margin: 0 auto;
  max-width: 1200px;
  background: linear-gradient(135deg, rgba(10,10,15,0.8), rgba(15,15,25,0.6));
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(59,130,246,0.15);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15), 0 1px 0 rgba(255,255,255,0.08) inset;
  transition: all 300ms ease;
  margin-top: 20px;
}
.nav::before {
  content: '';
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59,130,246,0.4), transparent);
  border-radius: 16px 16px 0 0;
}
.nav-inner { 
  display: flex; align-items: center; justify-content: space-between; 
  height: 68px; padding: 0 32px;
}
.brand { 
  display: inline-flex; align-items: center; gap: 14px; 
  text-decoration: none; color: var(--text); 
  font-weight: 600; font-size: 19px; letter-spacing: -0.02em;
  transition: all 200ms ease;
  padding: 8px 12px; border-radius: 12px;
}
.brand:hover {
  background: rgba(59,130,246,0.08);
  transform: translateY(-1px);
}
.logo { 
  width: 34px; height: 34px; border-radius: 10px;
  box-shadow: 0 2px 8px rgba(59,130,246,0.2);
  transition: all 200ms ease;
}
.brand:hover .logo {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(59,130,246,0.3);
}
.nav-links { display: flex; gap: 16px; align-items: center; }
.link { 
  color: var(--muted); text-decoration: none; 
  padding: 12px 18px; border-radius: 12px; 
  transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1); 
  font-weight: 500; font-size: 14px; letter-spacing: -0.01em;
  position: relative; overflow: hidden;
}
.link::before {
  content: '';
  position: absolute;
  top: 0; left: -100%; right: 100%; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(59,130,246,0.1), transparent);
  transition: all 300ms ease;
}
.link:hover::before {
  left: 0; right: 0;
}
.link:hover { 
  color: var(--text); 
  background: rgba(59,130,246,0.08);
  transform: translateY(-1px);
}
.btn { 
  color: white; text-decoration: none; cursor: pointer;
  padding: 12px 24px; border-radius: 14px; font-weight: 600;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  box-shadow: 0 3px 16px rgba(59,130,246,.25), 
             inset 0 1px 0 rgba(255,255,255,.2),
             inset 0 -1px 0 rgba(0,0,0,.1);
  border: 1px solid rgba(59,130,246,0.3);
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 14px; letter-spacing: -0.01em;
  font-family: inherit;
  position: relative; overflow: hidden;
}
.btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%; right: 100%; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: all 400ms ease;
}
.btn:hover::before {
  left: 0; right: 0;
}
.btn:hover { 
  background: linear-gradient(135deg, #4f46e5, #3730a3);
  transform: translateY(-2px) scale(1.02); 
  box-shadow: 0 8px 32px rgba(59,130,246,.4), 
             inset 0 1px 0 rgba(255,255,255,.25),
             inset 0 -1px 0 rgba(0,0,0,.15);
}
.btn:active {
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 4px 16px rgba(59,130,246,.3);
}

/* Hero */
.hero { 
  padding: 100px 0 60px; text-align: center; 
  position: relative;
}
.hero::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(59,130,246,0.03), transparent 70%);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  filter: blur(80px);
  animation: heroGlow 8s ease-in-out infinite;
}
@keyframes heroGlow {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
  50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.8; }
}
.headline { 
  font-size: clamp(36px, 6vw, 60px); 
  line-height: 1.1; margin: 0 0 24px; 
  font-weight: 700; letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--text) 0%, var(--muted) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  position: relative;
}
.headline::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, var(--text), var(--muted));
  -webkit-background-clip: text; background-clip: text;
  filter: blur(20px);
  opacity: 0.3;
}
.subhead { 
  color: var(--muted); 
  font-size: clamp(16px, 2.5vw, 20px); 
  margin: 0 auto 48px; 
  max-width: 640px; 
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.pill { 
  display: inline-flex; align-items: center; gap: 10px; 
  padding: 10px 16px; font-size: 14px; color: var(--text); 
  border-radius: 999px; margin-bottom: 24px;
  border: 1px solid rgba(59,130,246,.3); 
  background: linear-gradient(135deg, rgba(59,130,246,.15), rgba(16,185,129,.15)); 
  font-weight: 500;
}
.dot { 
  width: 8px; height: 8px; border-radius: 50%; 
  background: var(--accent); 
  box-shadow: 0 0 12px rgba(16,185,129,.8);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

/* Cards */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 20px; }
.card { 
  grid-column: span 12; 
  background: linear-gradient(145deg, rgba(26,26,36,0.9), rgba(17,17,24,0.7)); 
  border: 1px solid rgba(59,130,246,0.15); 
  border-radius: 24px; padding: 32px; 
  box-shadow: 0 8px 40px rgba(0,0,0,0.4), 
             inset 0 1px 0 rgba(255,255,255,0.08),
             0 1px 0 rgba(59,130,246,0.05); 
  transition: all 400ms cubic-bezier(.2,.8,.2,1); 
  backdrop-filter: blur(16px) saturate(150%);
  position: relative; overflow: hidden;
}

.card:hover { 
  transform: translateY(-12px) scale(1.02); 
  box-shadow: 0 24px 80px rgba(0,0,0,0.6), 
             inset 0 1px 0 rgba(255,255,255,0.12),
             0 0 0 1px rgba(59,130,246,0.3),
             0 2px 0 rgba(59,130,246,0.1); 
  border-color: rgba(59,130,246,0.3); 
  background: linear-gradient(145deg, rgba(26,26,36,0.95), rgba(17,17,24,0.8)); 
}
.card h3 { 
  margin: 0 0 12px; font-size: 16px; 
  color: var(--muted); font-weight: 600; 
  text-transform: uppercase; letter-spacing: 0.05em;
}
.stat { font-size: 32px; font-weight: 900; letter-spacing: -0.02em; }
.stat strong { 
  background: var(--gradient); 
  -webkit-background-clip: text; background-clip: text; color: transparent; 
}

@media (min-width: 640px) { .card { grid-column: span 6; } }
@media (min-width: 960px) { .card { grid-column: span 3; } }

/* Sections */
.section { margin-top: 60px; }

/* Footer */
footer { 
  margin-top: 80px; padding: 32px 0; 
  border-top: 1px solid rgba(59,130,246,0.12); 
  color: var(--muted); 
}
footer a { color: var(--primary); text-decoration: none; transition: color 200ms ease; }
footer a:hover { color: var(--accent); }
.footer-inner { 
  display: flex; align-items: center; justify-content: space-between; 
  gap: 16px; flex-wrap: wrap; 
}

/* Reveal animation */
.reveal { 
  opacity: 0; transform: translateY(20px); 
  animation: reveal 0.8s ease forwards; 
}
.reveal:nth-child(1) { animation-delay: .1s; }
.reveal:nth-child(2) { animation-delay: .2s; }
.reveal:nth-child(3) { animation-delay: .3s; }
.reveal:nth-child(4) { animation-delay: .4s; }
@keyframes reveal { to { opacity: 1; transform: translateY(0); } }

/* Simplified Stats */
.stats-simple {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin: 40px 0;
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
  opacity: 0;
  animation: reveal 0.8s ease forwards;
}

.stat-item:first-child { animation-delay: 0.1s; }
.stat-item:last-child { animation-delay: 0.2s; }

.stat-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-value {
  display: block;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #3b82f6, #10b981, #3b82f6);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientShift 3s ease-in-out infinite;
}
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Tabs */
.tabs {
  width: 100%;
  z-index: 2;
}

.tab-buttons {
  display: flex;
  border-bottom: 1px solid rgba(59,130,246,0.15);
  margin-bottom: 24px;
  gap: 2px;
}

.tab-btn {
  background: none;
  border: none;
  padding: 12px 24px;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 200ms ease;
  border-radius: 8px 8px 0 0;
  font-family: inherit;
  letter-spacing: -0.01em;
}

.tab-btn:hover {
  color: var(--text);
  background: rgba(59,130,246,0.05);
}

.tab-btn.active {
  color: var(--primary);
  background: rgba(59,130,246,0.1);
  border-bottom: 2px solid var(--primary);
  font-weight: 600;
}

.tab-content {
  position: relative;
}

.tab-pane {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: all 300ms ease;
}

.tab-pane.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}



/* Docs styling */
.docs { display: grid; gap: 24px; }
.endpoint {
  display: inline-flex; align-items: center; gap: 12px; 
  font-weight: 700; color: var(--text); margin-bottom: 12px;
}
.badge {
  font-size: 11px; font-weight: 800; letter-spacing: .8px;
  border-radius: 6px; padding: 6px 12px; 
  border: 1px solid rgba(255,255,255,.2);
}
.badge-post { 
  background: rgba(16,185,129,.15); color: #34d399; 
  border-color: rgba(16,185,129,.4); 
}
.badge-get { 
  background: rgba(59,130,246,.15); color: #60a5fa; 
  border-color: rgba(59,130,246,.4); 
}

.endpoint-url { 
  color: var(--primary); word-break: break-all; 
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.codebox {
  position: relative;
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 16px; overflow: hidden;
  background: linear-gradient(145deg, rgba(26,26,36,0.6), rgba(17,17,24,0.6));
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
}
.codebox::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--gradient);
}
.codebox-title {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); padding: 12px 16px;
  border-bottom: 1px solid rgba(59,130,246,0.15);
  background: linear-gradient(90deg, rgba(59,130,246,.1), rgba(16,185,129,.1));
}
.codebox pre { 
  margin: 0; padding: 16px; overflow: auto; 
  background: rgba(10,10,15,0.4);
  text-align: left;
}
.codebox code { 
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; 
  font-size: 13px; line-height: 1.6; 
}

/* JSON syntax highlighting */
.tok-key { color: #60a5fa; }
.tok-str { color: #34d399; }
.tok-num { color: #fbbf24; }

/* Form styles */
.auth-wrap { 
  min-height: 100svh; display: grid; place-items: center; 
  padding: 24px; 
}
.auth-card { width: 100%; max-width: 480px; }
.field { display: grid; gap: 10px; margin: 16px 0; }
.label { color: var(--muted); font-size: 14px; font-weight: 500; }
.input { 
  background: rgba(26,26,36,0.6); color: var(--text); 
  border: 1px solid rgba(59,130,246,0.2); 
  border-radius: 12px; padding: 14px 16px; outline: none; width: 100%;
  transition: all 200ms ease;
  backdrop-filter: blur(10px);
}
.input:focus { 
  border-color: var(--primary); 
  box-shadow: 0 0 0 4px rgba(59,130,246,.15); 
  background: rgba(26,26,36,0.8);
}
.actions { 
  display: flex; gap: 12px; align-items: center; 
  justify-content: space-between; margin-top: 20px; 
}
.muted { color: var(--muted); font-size: 14px; }

/* Input wrapper for toggles */
.input-wrap { position: relative; }
.input-wrap > .input { padding-right: 48px; }
.toggle-visibility {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  padding: 8px; border-radius: 8px; transition: all 200ms ease;
}
.toggle-visibility:hover { 
  color: var(--text); background: rgba(59,130,246,0.1); 
}
.toggle-visibility svg { width: 18px; height: 18px; display: block; }

/* Loading overlay */
.loading-overlay { 
  position: fixed; inset: 0; z-index: 2000; display: none; 
  align-items: center; justify-content: center; 
  background: rgba(0,0,0,0.6); backdrop-filter: blur(8px); 
}
.loading-box { 
  display: flex; align-items: center; gap: 16px; 
  padding: 20px 24px; border-radius: 16px; 
  background: rgba(26,26,36,0.9); 
  border: 1px solid rgba(59,130,246,0.3);
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}
.spinner { 
  width: 20px; height: 20px; border-radius: 50%; 
  border: 2px solid rgba(59,130,246,0.2); 
  border-top-color: var(--primary); 
  animation: spin 1s linear infinite; 
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Admin/Dashboard specific styles */
.grid-3 { 
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 20px; 
}
.grid-3 > .card { grid-column: span 12; }
@media (min-width: 900px) { .grid-3 > .card { grid-column: span 4; } }

table { 
  width: 100%; border-collapse: collapse; font-size: 14px; 
}
th, td { 
  padding: 12px 16px; 
  border-bottom: 1px solid rgba(59,130,246,0.15); 
  text-align: left; white-space: nowrap; 
}
thead th { 
  position: sticky; top: 0; 
  background: var(--bg-elev);
  font-weight: 600; color: var(--muted);
  text-transform: uppercase; font-size: 12px;
  letter-spacing: 0.05em;
}
.row { 
  display: flex; gap: 12px; align-items: center; 
  justify-content: space-between; flex-wrap: wrap; 
}
.mono { 
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; 
}
.pill { 
  display: inline-flex; align-items: center; gap: 8px; 
  padding: 8px 12px; border-radius: 999px; 
  border: 1px solid rgba(59,130,246,.3); 
  background: rgba(59,130,246,.1);
  font-size: 13px; font-weight: 500;
}
.controls { display: flex; gap: 12px; flex-wrap: wrap; }
input, select { 
  background: rgba(26,26,36,0.6); color: var(--text); 
  border: 1px solid rgba(59,130,246,0.2); 
  border-radius: 10px; padding: 10px 12px;
  transition: all 200ms ease;
}
input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
  outline: none;
}
label { font-size: 12px; color: var(--muted); font-weight: 500; }
.field { display: flex; flex-direction: column; gap: 6px; }
.scroll { overflow: auto; max-height: 400px; }
.btn.small { padding: 8px 12px; font-size: 13px; }

/* Overlay styles */
.overlay { 
  position: fixed; inset: 0; z-index: 1000; 
  display: flex; align-items: center; justify-content: center; 
  background: rgba(0,0,0,0.7); backdrop-filter: blur(8px); 
}
.modal { 
  max-width: 500px; width: 90%; 
  background: var(--card); 
  border: 1px solid rgba(59,130,246,0.2);
  box-shadow: 0 25px 100px rgba(0,0,0,0.8);
}