/* ==========================================================================
   RouterHub API Documentation — Design System
   ========================================================================== */

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

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #4b5563;
  background: #f9fafb;
  line-height: 1.7;
  font-size: 16px;
}

a { color: #2563eb; text-decoration: none; }
a:hover { color: #1d4ed8; }

img { max-width: 100%; }

/* ---------- Typography ---------- */
h1 { font-size: 40px; font-weight: 800; color: #111827; line-height: 1.2; margin-bottom: 16px; }
h2 { font-size: 24px; font-weight: 700; color: #111827; margin-top: 48px; margin-bottom: 16px; }
h3 { font-size: 18px; font-weight: 600; color: #111827; margin-top: 32px; margin-bottom: 12px; }
h4 { font-size: 16px; font-weight: 600; color: #111827; margin-top: 24px; margin-bottom: 8px; }
p  { margin-bottom: 16px; }
ul, ol { margin-bottom: 16px; padding-left: 24px; }
li { margin-bottom: 6px; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: 260px;
  height: 100vh;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  overflow-y: auto;
  padding: 24px 0;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-logo {
  padding: 0 20px 20px;
  font-size: 17px;
  font-weight: 700;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo span {
  background: #2563eb;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.sidebar-section {
  padding: 12px 20px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
}

.sidebar a {
  display: block;
  padding: 6px 20px;
  font-size: 14px;
  color: #4b5563;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sidebar a:hover {
  background: #f3f4f6;
  color: #111827;
}

.sidebar a.active {
  color: #2563eb;
  border-left-color: #2563eb;
  background: #eff6ff;
  font-weight: 600;
}

/* ---------- Hamburger (mobile) ---------- */
.hamburger {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 200;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  color: #111827;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 90;
}

/* ---------- Content area ---------- */
.content {
  margin-left: 260px;
  max-width: 800px;
  padding: 64px 24px 96px;
}

/* ---------- Inline code ---------- */
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 14px;
  background: #f3f4f6;
  padding: 3px 7px;
  border-radius: 4px;
  color: #111827;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

/* ---------- Code Blocks ---------- */
.code-block {
  position: relative;
  background: #f3f4f6;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
  overflow-x: auto;
}

.code-block pre {
  margin: 0;
  white-space: pre;
  font-size: 14px;
  line-height: 1.6;
}

.copy-btn {
  position: absolute;
  top: 8px; right: 8px;
  background: #e5e7eb;
  border: none;
  border-radius: 9999px;
  padding: 5px 12px;
  font-size: 12px;
  color: #4b5563;
  cursor: pointer;
  transition: background 0.15s;
}

.copy-btn:hover { background: #d1d5db; }
.copy-btn.copied { background: #d1fae5; color: #065f46; }

/* ---------- Code Tabs ---------- */
.code-tabs {
  margin-bottom: 24px;
}

.tab-strip {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 0;
  overflow-x: auto;
}

.tab-strip button {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.tab-strip button:hover { color: #111827; }

.tab-strip button.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
  font-weight: 600;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.tab-panel .code-block {
  border-radius: 0 0 8px 8px;
  margin-bottom: 0;
}

/* ---------- Endpoint Badge ---------- */
.endpoint-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 4px;
  margin-right: 8px;
  letter-spacing: 0.04em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.endpoint-badge.get  { background: #d1fae5; color: #065f46; }
.endpoint-badge.post { background: #dbeafe; color: #1e40af; }

.endpoint-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}

.endpoint-row {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 4px;
}

/* ---------- Parameter Table ---------- */
.param-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 14px;
}

.param-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid #e5e7eb;
  color: #111827;
  font-weight: 600;
  font-size: 13px;
}

.param-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: top;
}

.param-table tr:nth-child(even) td {
  background: #f9fafb;
}

.param-table .param-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
}

.param-table .param-type {
  color: #6b7280;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.param-table .required {
  color: #dc2626;
  font-size: 11px;
  font-weight: 600;
}

.param-table .optional {
  color: #6b7280;
  font-size: 11px;
}

/* ---------- Cards ---------- */
.card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 24px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  margin-bottom: 24px;
}

.card h3 { margin-top: 0; }

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

/* ---------- Callout ---------- */
.callout {
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 24px;
  font-size: 14px;
}

.callout.info {
  background: #eff6ff;
  border-left: 4px solid #2563eb;
  color: #1e40af;
}

.callout.warning {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
  color: #92400e;
}

.callout.tip {
  background: #f0fdf4;
  border-left: 4px solid #22c55e;
  color: #166534;
}

.callout p:last-child { margin-bottom: 0; }

/* ---------- Hero (index page) ---------- */
.hero {
  margin-bottom: 48px;
}

.hero p {
  font-size: 18px;
  color: #6b7280;
  max-width: 600px;
}

/* ---------- Feature list ---------- */
.feature-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 32px;
}

.feature-item {
  padding: 20px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.feature-item h4 { margin-top: 0; margin-bottom: 6px; }
.feature-item p  { margin-bottom: 0; font-size: 14px; color: #6b7280; }

/* ---------- Footer ---------- */
.footer {
  background: #1a1e26;
  color: #ffffff;
  padding: 32px 24px;
  margin-left: 260px;
  font-size: 14px;
}

.footer .secondary { color: #b0b0b0; }

/* ---------- Misc ---------- */
.base-url {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  background: #f3f4f6;
  padding: 12px 20px;
  border-radius: 8px;
  display: inline-block;
  margin-bottom: 24px;
}

hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 32px 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .hamburger { display: block; }

  .sidebar {
    transform: translateX(-100%);
  }

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

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

  .content {
    margin-left: 0;
    padding: 72px 16px 64px;
  }

  .footer { margin-left: 0; }

  .card-grid,
  .feature-list {
    grid-template-columns: 1fr;
  }

  h1 { font-size: 28px; }
  h2 { font-size: 20px; }
}
