/* ============================================================
   RapidAuth Documentation — Shared Stylesheet
   ============================================================ */

/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #080c17;
  --bg2:      #0d1220;
  --bg3:      #111827;
  --bg4:      #1a2133;
  --border:   rgba(255,255,255,.07);
  --border2:  rgba(255,255,255,.13);
  --border3:  rgba(255,255,255,.06);

  --primary:    #6366f1;
  --primary-dk: #4f46e5;
  --primary-lt: #818cf8;
  --primary-xlt:#c7d2fe;
  --cyan:       #22d3ee;
  --green:      #34d399;
  --yellow:     #fbbf24;
  --red:        #f87171;
  --orange:     #fb923c;

  --text:   #e2e8f0;
  --muted:  #94a3b8;
  --faint:  #475569;
  --faint2: #334155;

  --radius:   12px;
  --radius-sm: 7px;
  --radius-xs: 4px;

  --sidebar-w: 268px;
  --content-max: 860px;

  --font: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --shadow:    0 4px 20px rgba(0,0,0,.5);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.6);

  --transition: .18s cubic-bezier(.4,0,.2,1);
}

html { scroll-behavior: smooth; font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-lt); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--cyan); }

code, pre, kbd { font-family: var(--mono); }
strong { font-weight: 600; }
em { font-style: italic; color: var(--muted); }

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

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--primary-dk); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

::selection { background: rgba(99,102,241,.3); }

/* ── Typography ────────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 {
  font-weight: 800;
  letter-spacing: -.5px;
  line-height: 1.25;
  color: var(--text);
}

h1 { font-size: clamp(2rem,5vw,3.5rem); letter-spacing: -1.5px; }
h2 { font-size: clamp(1.4rem,3vw,2rem); letter-spacing: -1px; }
h3 { font-size: 1.15rem; font-weight: 700; }
h4 { font-size: .95rem; font-weight: 700; }

p { color: var(--muted); line-height: 1.75; }

/* ── Gradient text ─────────────────────────────────────────── */
.grad {
  background: linear-gradient(135deg, var(--primary-lt), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.grad-green {
  background: linear-gradient(135deg, var(--green), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Layout utilities ─────────────────────────────────────── */
.container { max-width: 1160px; margin: 0 auto; padding: 0 1.5rem; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .6rem 1.3rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: var(--font);
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-dk);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99,102,241,.4);
}

.btn-outline {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border2);
}
.btn-outline:hover {
  color: var(--text);
  border-color: var(--primary);
}

.btn-ghost {
  background: rgba(99,102,241,.1);
  color: var(--primary-lt);
  border: 1px solid rgba(99,102,241,.2);
}
.btn-ghost:hover {
  background: rgba(99,102,241,.18);
  color: var(--primary-xlt);
}

.btn-lg { padding: .85rem 1.8rem; font-size: .95rem; }
.btn-sm { padding: .38rem .85rem; font-size: .78rem; }

/* ── Badges / tags ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .28rem;
  padding: .2rem .65rem;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
}
.badge-indigo { background: rgba(99,102,241,.12);  color: var(--primary-lt); border: 1px solid rgba(99,102,241,.22); }
.badge-green  { background: rgba(52,211,153,.1);   color: var(--green);      border: 1px solid rgba(52,211,153,.2); }
.badge-yellow { background: rgba(251,191,36,.1);   color: var(--yellow);     border: 1px solid rgba(251,191,36,.2); }
.badge-red    { background: rgba(248,113,113,.1);  color: var(--red);        border: 1px solid rgba(248,113,113,.2); }
.badge-cyan   { background: rgba(34,211,238,.1);   color: var(--cyan);       border: 1px solid rgba(34,211,238,.2); }
.badge-orange { background: rgba(251,146,60,.1);   color: var(--orange);     border: 1px solid rgba(251,146,60,.2); }

/* Method badges */
.method {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: var(--radius-xs);
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
}
.method-post { background: rgba(52,211,153,.12); color: var(--green); }
.method-get  { background: rgba(34,211,238,.12); color: var(--cyan); }
.method-del  { background: rgba(248,113,113,.12); color: var(--red); }
.method-put  { background: rgba(251,191,36,.12); color: var(--yellow); }

/* ── Card ──────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.card:hover {
  border-color: rgba(99,102,241,.3);
  transform: translateY(-2px);
  box-shadow: 0 0 28px rgba(99,102,241,.1);
}

/* ── Code blocks ───────────────────────────────────────────── */
.code-block {
  position: relative;
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1rem 0;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem 1rem;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}

.code-block-lang {
  font-size: .72rem;
  font-weight: 700;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .8px;
}

.code-block-dots {
  display: flex;
  gap: .4rem;
}
.code-block-dots span {
  width: 10px; height: 10px;
  border-radius: 50%;
}
.code-block-dots .d1 { background: #ff5f57; }
.code-block-dots .d2 { background: #febc2e; }
.code-block-dots .d3 { background: #28c840; }

.code-block pre {
  padding: 1.25rem 1.4rem;
  overflow-x: auto;
  font-size: .79rem;
  line-height: 1.7;
  margin: 0;
}

.copy-btn {
  position: absolute;
  top: .6rem;
  right: .6rem;
  padding: .22rem .6rem;
  background: var(--bg4);
  border: 1px solid var(--border2);
  border-radius: var(--radius-xs);
  color: var(--muted);
  font-size: .68rem;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  z-index: 2;
}
.copy-btn:hover { color: var(--primary-lt); border-color: var(--primary); }
.copy-btn.copied { color: var(--green); border-color: var(--green); }

code:not(pre code) {
  background: rgba(99,102,241,.12);
  color: var(--primary-lt);
  padding: .1rem .4rem;
  border-radius: var(--radius-xs);
  font-size: .85em;
  border: 1px solid rgba(99,102,241,.18);
}

/* ── Callout boxes ─────────────────────────────────────────── */
.callout {
  display: flex;
  gap: .85rem;
  padding: 1rem 1.2rem;
  border-radius: var(--radius-sm);
  margin: 1.2rem 0;
  font-size: .875rem;
  line-height: 1.65;
  border-left-width: 3px;
  border-left-style: solid;
}
.callout-icon { font-size: 1rem; flex-shrink: 0; margin-top: .08rem; }
.callout p { margin: 0; color: inherit; font-size: inherit; }
.callout strong { color: inherit; }

.callout-info    { background: rgba(34,211,238,.05);  border-color: var(--cyan);   color: #a5f3fc; }
.callout-warning { background: rgba(251,191,36,.05);  border-color: var(--yellow); color: #fef08a; }
.callout-danger  { background: rgba(248,113,113,.05); border-color: var(--red);    color: #fecaca; }
.callout-success { background: rgba(52,211,153,.05);  border-color: var(--green);  color: #a7f3d0; }

/* ── Table ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 1rem 0; border-radius: var(--radius); border: 1px solid var(--border); }

table { width: 100%; border-collapse: collapse; font-size: .84rem; }
thead th {
  background: var(--bg3);
  color: var(--muted);
  font-weight: 600;
  font-size: .73rem;
  letter-spacing: .5px;
  padding: .75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--border3);
  vertical-align: top;
  color: var(--muted);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,.02); }
tbody td:first-child { color: var(--primary-lt); font-family: var(--mono); font-size: .8rem; }

/* ── Steps ─────────────────────────────────────────────────── */
.steps { counter-reset: step; display: flex; flex-direction: column; gap: 0; }

.step {
  display: flex;
  gap: 1rem;
  padding-bottom: 1.5rem;
  position: relative;
}
.step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 14px;
  top: 30px;
  bottom: 0;
  width: 1px;
  background: var(--border2);
}
.step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 1;
  position: relative;
}
.step-body h4 { margin-bottom: .4rem; }
.step-body p  { font-size: .875rem; }

/* ── Navbar (shared) ───────────────────────────────────────── */
#nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 60px;
  background: rgba(8,12,23,.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow .3s;
}
#nav.scrolled { box-shadow: 0 2px 24px rgba(0,0,0,.6); }

.nav-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -.4px;
}
.nav-brand .logo-icon {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .88rem;
  color: #fff;
  flex-shrink: 0;
}
.nav-brand span { background: linear-gradient(135deg, var(--primary-lt), var(--cyan)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

.nav-links { display: flex; gap: 2rem; align-items: center; }
.nav-links a { font-size: .875rem; font-weight: 500; color: var(--muted); transition: color var(--transition); }
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--primary-lt); }

.nav-actions { display: flex; gap: .5rem; align-items: center; }

.nav-version {
  font-size: .72rem;
  font-weight: 700;
  color: var(--faint);
  font-family: var(--mono);
  padding: .18rem .5rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 99px;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: .25rem;
  background: none;
  border: none;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--muted);
  border-radius: 2px;
  transition: all var(--transition);
}

/* ── Footer ────────────────────────────────────────────────── */
footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 3rem 0 2rem;
  text-align: center;
}

.footer-logo {
  font-size: 1.1rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary-lt), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: .4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
}
.footer-logo .logo-icon {
  width: 26px; height: 26px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  color: #fff;
  -webkit-text-fill-color: #fff;
}
.footer-tagline { color: var(--faint); font-size: .85rem; margin-bottom: 1.5rem; }
.footer-links {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.footer-links a {
  color: var(--faint);
  font-size: .82rem;
  display: flex;
  align-items: center;
  gap: .35rem;
  transition: color var(--transition);
}
.footer-links a:hover { color: var(--primary-lt); }
.footer-copy { font-size: .75rem; color: var(--faint); }
.footer-copy a { color: var(--primary-lt); font-weight: 600; }

/* ── Highlight.js theme override ───────────────────────────── */
.hljs { background: transparent !important; padding: 0 !important; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
}

@media (max-width: 640px) {
  #nav { padding: 0 1rem; }
  .container { padding: 0 1rem; }
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes glow {
  0%, 100% { opacity: .4; }
  50%       { opacity: .7; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}
@keyframes pulse-border {
  0%, 100% { border-color: rgba(99,102,241,.2); }
  50%       { border-color: rgba(99,102,241,.5); }
}

.fade-up { animation: fadeUp .5s ease both; }
.fade-up-1 { animation-delay: .1s; }
.fade-up-2 { animation-delay: .2s; }
.fade-up-3 { animation-delay: .3s; }

/* ── Divider ────────────────────────────────────────────────── */
hr.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}
