/* ============================================
   JWT Module Wiki — Dark Theme Documentation
   ============================================ */

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-card: #1c2128;
  --border-primary: #30363d;
  --border-accent: #58a6ff;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent-blue: #58a6ff;
  --accent-green: #3fb950;
  --accent-purple: #bc8cff;
  --accent-orange: #d29922;
  --accent-red: #f85149;
  --accent-cyan: #39d2c0;
  --code-bg: #0d1117;
  --code-border: #30363d;
  --shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
  --radius: 8px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
  --sidebar-width: 280px;
  --header-height: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent-purple);
  text-decoration: underline;
}

/* ---- Header ---- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-primary);
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.header-inner {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
}

.header-brand .logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  font-weight: 800;
}

.header-nav {
  display: flex;
  gap: 8px;
}

.header-nav a {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.header-nav a:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
  text-decoration: none;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  color: var(--text-primary);
  padding: 0;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.menu-toggle-icon {
  position: relative;
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.menu-toggle-icon::before,
.menu-toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.menu-toggle-icon::before {
  top: -5px;
}

.menu-toggle-icon::after {
  top: 5px;
}

/* ---- Layout ---- */
.page-wrapper {
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
  margin-left: var(--sidebar-width);
  display: flex;
  justify-content: center;
}

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-primary);
  overflow-y: auto;
  padding: 20px 0;
  z-index: 900;
  transition: transform 0.3s ease;
}

.sidebar-section {
  padding: 0 16px;
  margin-bottom: 16px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 8px 12px;
}

.sidebar-link {
  display: block;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.15s;
  border-left: 2px solid transparent;
}

.sidebar-link:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
  text-decoration: none;
}

.sidebar-link.active {
  color: var(--accent-blue);
  background: rgba(88, 166, 255, 0.08);
  border-left-color: var(--accent-blue);
}

.sidebar-search {
  padding: 12px 16px;
}

.sidebar-search input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.sidebar-search input::placeholder {
  color: var(--text-muted);
}

.sidebar-search input:focus {
  border-color: var(--accent-blue);
}

/* ---- Main Content ---- */
.main-content {
  width: 100%;
  max-width: 860px;
  padding: 40px 48px 80px;
}

/* ---- Hero ---- */
.hero {
  text-align: center;
  padding: 60px 0 48px;
  border-bottom: 1px solid var(--border-primary);
  margin-bottom: 48px;
}

.hero h1 {
  font-size: 42px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.hero .tagline {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent-blue);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hero-badges {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid;
}

.badge-blue {
  color: var(--accent-blue);
  border-color: rgba(88, 166, 255, 0.3);
  background: rgba(88, 166, 255, 0.08);
}
.badge-green {
  color: var(--accent-green);
  border-color: rgba(63, 185, 80, 0.3);
  background: rgba(63, 185, 80, 0.08);
}
.badge-purple {
  color: var(--accent-purple);
  border-color: rgba(188, 140, 255, 0.3);
  background: rgba(188, 140, 255, 0.08);
}
.badge-orange {
  color: var(--accent-orange);
  border-color: rgba(210, 153, 34, 0.3);
  background: rgba(210, 153, 34, 0.08);
}

/* ---- Sections ---- */
.wiki-section {
  margin-bottom: 56px;
  animation: fadeInUp 0.5s ease both;
}

.wiki-section h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.wiki-section h2 .section-icon {
  font-size: 22px;
}

.wiki-section h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 28px 0 12px;
  color: var(--accent-blue);
}

.wiki-section h4 {
  font-size: 16px;
  font-weight: 600;
  margin: 20px 0 8px;
}

.wiki-section p {
  margin-bottom: 14px;
  color: var(--text-secondary);
}

.wiki-section ul,
.wiki-section ol {
  margin: 0 0 16px 24px;
  color: var(--text-secondary);
}

.wiki-section li {
  margin-bottom: 6px;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Code Blocks ---- */
.code-block {
  position: relative;
  margin: 16px 0;
  border-radius: var(--radius);
  border: 1px solid var(--code-border);
  overflow: hidden;
}

.code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-tertiary);
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--code-border);
}

.copy-btn {
  background: none;
  border: 1px solid var(--border-primary);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-sans);
}

.copy-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--accent-blue);
}

.copy-btn.copied {
  color: var(--accent-green);
  border-color: var(--accent-green);
}

.code-block pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  background: var(--code-bg);
}

.code-block code {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
}

code:not(.code-block code) {
  font-family: var(--font-mono);
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--accent-cyan);
}

/* ---- Mermaid Diagrams ---- */
.mermaid-wrapper {
  margin: 20px 0;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
}

.mermaid-title {
  background: var(--bg-tertiary);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.mermaid-title::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-purple);
}

.mermaid {
  padding: 24px;
  background: var(--bg-card);
  display: flex;
  justify-content: center;
  overflow-x: auto;
}

.mermaid svg {
  max-width: 100%;
}

/* ---- API Reference Cards ---- */
.endpoint-card {
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.endpoint-card:hover {
  border-color: var(--accent-blue);
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  background: var(--bg-secondary);
  transition: background 0.2s;
  user-select: none;
}

.endpoint-header:hover {
  background: var(--bg-tertiary);
}

.method-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  min-width: 60px;
  text-align: center;
  text-transform: uppercase;
}

.method-GET {
  background: rgba(63, 185, 80, 0.15);
  color: var(--accent-green);
}
.method-POST {
  background: rgba(88, 166, 255, 0.15);
  color: var(--accent-blue);
}
.method-PATCH {
  background: rgba(210, 153, 34, 0.15);
  color: var(--accent-orange);
}
.method-DELETE {
  background: rgba(248, 81, 73, 0.15);
  color: var(--accent-red);
}

.endpoint-path {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  flex: 1;
}

.endpoint-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.endpoint-toggle {
  color: var(--text-muted);
  transition: transform 0.2s;
  font-size: 14px;
}

.endpoint-card.open .endpoint-toggle {
  transform: rotate(180deg);
}

.endpoint-body {
  display: none;
  padding: 18px;
  border-top: 1px solid var(--border-primary);
  background: var(--bg-primary);
}

.endpoint-card.open .endpoint-body {
  display: block;
}

.endpoint-detail-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 14px 0 6px;
}

.endpoint-detail-label:first-child {
  margin-top: 0;
}

.auth-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.auth-required {
  background: rgba(210, 153, 34, 0.15);
  color: var(--accent-orange);
}
.auth-none {
  background: rgba(63, 185, 80, 0.15);
  color: var(--accent-green);
}
.rate-limited {
  background: rgba(188, 140, 255, 0.15);
  color: var(--accent-purple);
}

/* ---- Tables ---- */
.wiki-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}

.wiki-table th {
  background: var(--bg-tertiary);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-primary);
}

.wiki-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-primary);
  color: var(--text-secondary);
}

.wiki-table tr:hover td {
  background: rgba(88, 166, 255, 0.03);
}

/* ---- Callouts / Info Boxes ---- */
.callout {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin: 16px 0;
  border-left: 4px solid;
  font-size: 14px;
}

.callout-title {
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}

.callout-info {
  border-color: var(--accent-blue);
  background: rgba(88, 166, 255, 0.06);
}
.callout-warning {
  border-color: var(--accent-orange);
  background: rgba(210, 153, 34, 0.06);
}
.callout-danger {
  border-color: var(--accent-red);
  background: rgba(248, 81, 73, 0.06);
}
.callout-success {
  border-color: var(--accent-green);
  background: rgba(63, 185, 80, 0.06);
}

.callout-info .callout-title {
  color: var(--accent-blue);
}
.callout-warning .callout-title {
  color: var(--accent-orange);
}
.callout-danger .callout-title {
  color: var(--accent-red);
}
.callout-success .callout-title {
  color: var(--accent-green);
}

/* ---- Collapsible ---- */
.collapsible-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  width: 100%;
  text-align: left;
  transition: all 0.2s;
  margin-bottom: 4px;
}

.collapsible-trigger:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-blue);
}

.collapsible-trigger .arrow {
  transition: transform 0.2s;
  font-size: 12px;
  color: var(--text-muted);
}

.collapsible-trigger.open .arrow {
  transform: rotate(90deg);
}

.collapsible-content {
  display: none;
  padding: 16px;
  border: 1px solid var(--border-primary);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  margin-bottom: 12px;
}

.collapsible-content.open {
  display: block;
}

/* ---- Footer ---- */
.site-footer {
  margin-left: var(--sidebar-width);
  padding: 32px 48px;
  border-top: 1px solid var(--border-primary);
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ---- Wide screens: prevent content from floating left ---- */
@media (min-width: 1600px) {
  .main-content {
    max-width: 900px;
  }
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .page-wrapper {
    margin-left: 0;
  }

  .main-content {
    max-width: 100%;
  }

  .site-footer {
    margin-left: 0;
  }

  .menu-toggle {
    display: flex;
  }

  .header-nav {
    display: none;
  }
}

@media (max-width: 768px) {
  .main-content {
    padding: 24px 16px 60px;
  }

  .hero {
    padding: 36px 0 32px;
    margin-bottom: 32px;
  }

  .hero h1 {
    font-size: 26px;
  }

  .hero .tagline {
    font-size: 15px;
  }

  .hero-stats {
    gap: 16px;
  }

  .stat-value {
    font-size: 22px;
  }

  .wiki-section h2 {
    font-size: 22px;
  }

  .wiki-section h3 {
    font-size: 17px;
  }

  .endpoint-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 14px;
  }

  .endpoint-path {
    font-size: 13px;
    width: 100%;
  }

  .endpoint-desc {
    width: 100%;
  }

  .endpoint-body {
    padding: 14px;
  }

  .wiki-table {
    font-size: 12px;
    display: block;
    overflow-x: auto;
  }

  .wiki-table th,
  .wiki-table td {
    padding: 8px 10px;
    white-space: nowrap;
  }

  .code-block pre {
    padding: 12px;
  }

  .code-block code {
    font-size: 12px;
  }

  .mermaid {
    padding: 16px 8px;
  }

  .callout {
    padding: 12px 14px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 16px 12px 48px;
  }

  .hero h1 {
    font-size: 22px;
  }

  .hero-badges {
    gap: 6px;
  }

  .badge {
    font-size: 11px;
    padding: 3px 8px;
  }

  .hero-stats {
    gap: 12px;
  }

  .stat-value {
    font-size: 18px;
  }

  .stat-label {
    font-size: 10px;
  }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-primary);
}

/* ---- Sidebar overlay for mobile ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 899;
}

.sidebar-overlay.active {
  display: block;
}
