/* === ProxyServer Documentation Styles === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0c0c0e;
  --surface: #161619;
  --surface2: #1e1e23;
  --surface3: #26262d;
  --border: #2a2a33;
  --text: #e4e4ea;
  --text-dim: #8a8a96;
  --text-muted: #5c5c6a;
  --accent: #5e6ad2;
  --accent-hover: #7078e8;
  --accent-bg: rgba(94, 106, 210, 0.08);
  --green: #4ade80;
  --green-bg: rgba(74, 222, 128, 0.08);
  --yellow: #facc15;
  --yellow-bg: rgba(250, 204, 21, 0.08);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, 0.08);
  --orange: #fb923c;
  --cyan: #22d3ee;
  --cyan-bg: rgba(34, 211, 238, 0.08);
  --purple: #c084fc;
  --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  --radius: 8px;
  --content-width: 860px;
  --sidebar-width: 260px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  display: flex;
  min-height: 100vh;
}

/* === Sidebar Navigation === */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 24px 0;
  z-index: 10;
}
.sidebar-logo {
  font-size: 16px;
  font-weight: 700;
  padding: 0 20px 20px;
  color: var(--text);
  text-decoration: none;
  display: block;
  letter-spacing: -0.3px;
}
.sidebar-logo span { color: var(--accent); }
.sidebar-section {
  padding: 12px 20px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
}
.sidebar a {
  display: block;
  padding: 6px 20px 6px 28px;
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.sidebar a:hover {
  color: var(--text);
  background: var(--accent-bg);
}
.sidebar a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-bg);
}
.sidebar a.sub {
  padding-left: 40px;
  font-size: 12px;
}

/* === Main Content === */
.content {
  margin-left: var(--sidebar-width);
  flex: 1;
  max-width: calc(var(--content-width) + 80px);
  padding: 48px 40px 80px;
}

/* === Typography === */
h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  line-height: 1.2;
}
h1 .subtitle {
  display: block;
  font-size: 16px;
  font-weight: 400;
  color: var(--text-dim);
  margin-top: 8px;
  letter-spacing: 0;
}
h2 {
  font-size: 22px;
  font-weight: 700;
  margin-top: 48px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.3px;
}
h3 {
  font-size: 17px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
}
h4 {
  font-size: 14px;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 8px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
p { margin-bottom: 16px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 600; }
em { font-style: italic; color: var(--text-dim); }

/* === Code === */
code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--surface2);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--cyan);
}
pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 16px 0 24px;
  overflow-x: auto;
  line-height: 1.6;
}
pre code {
  background: none;
  padding: 0;
  font-size: 13px;
  color: var(--text);
}

/* Syntax in code blocks */
.kw { color: var(--purple); }         /* keywords */
.str { color: var(--green); }         /* strings */
.num { color: var(--yellow); }        /* numbers */
.cmt { color: var(--text-muted); font-style: italic; }  /* comments */
.fn { color: #7dd3fc; }               /* function names */
.type { color: var(--orange); }       /* types / classes */
.op { color: var(--text-dim); }       /* operators */

/* === Diagrams (ASCII art in pre) === */
.diagram {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 20px 0 28px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-dim);
  white-space: pre;
}
.diagram .hl { color: var(--accent); font-weight: 600; }
.diagram .hl-green { color: var(--green); }
.diagram .hl-yellow { color: var(--yellow); }
.diagram .hl-red { color: var(--red); }
.diagram .hl-cyan { color: var(--cyan); }
.diagram .hl-orange { color: var(--orange); }

/* === Info Boxes === */
.info-box {
  padding: 16px 20px;
  border-radius: var(--radius);
  margin: 20px 0;
  font-size: 14px;
  line-height: 1.6;
  border-left: 3px solid;
}
.info-box.tip {
  background: var(--green-bg);
  border-color: var(--green);
}
.info-box.warning {
  background: var(--yellow-bg);
  border-color: var(--yellow);
}
.info-box.danger {
  background: var(--red-bg);
  border-color: var(--red);
}
.info-box.note {
  background: var(--cyan-bg);
  border-color: var(--cyan);
}
.info-box strong {
  display: block;
  margin-bottom: 4px;
}

/* === Tables === */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 13px;
}
th {
  text-align: left;
  padding: 10px 12px;
  background: var(--surface2);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
td code {
  font-size: 12px;
  white-space: nowrap;
}
tr:hover td { background: var(--surface); }

/* === Lists === */
ul, ol {
  margin: 0 0 16px 24px;
}
li {
  margin-bottom: 6px;
}
li > ul, li > ol {
  margin-top: 6px;
  margin-bottom: 0;
}

/* === Numbered Steps === */
.steps {
  counter-reset: step;
  list-style: none;
  margin-left: 0;
  padding: 0;
}
.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 48px;
  margin-bottom: 24px;
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.steps > li > strong {
  display: block;
  font-size: 16px;
  margin-bottom: 6px;
}

/* === File Tree === */
.file-tree {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.8;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 16px 0 24px;
}
.file-tree .dir { color: var(--accent); font-weight: 600; }
.file-tree .file { color: var(--text); }
.file-tree .desc { color: var(--text-muted); font-family: var(--sans); font-size: 12px; }

/* === Cards === */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 20px 0 28px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.15s, transform 0.15s;
  text-decoration: none;
  color: var(--text);
  display: block;
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}
.card-icon {
  font-size: 28px;
  margin-bottom: 12px;
  display: block;
}
.card h3 {
  margin: 0 0 6px;
  font-size: 15px;
}
.card p {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0;
}

/* === Breadcrumb === */
.breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.breadcrumb a { color: var(--text-dim); }
.breadcrumb span { margin: 0 6px; }

/* === State Badge === */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--mono);
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-cyan { background: var(--cyan-bg); color: var(--cyan); }
.badge-accent { background: var(--accent-bg); color: var(--accent); }

/* === Page Navigation (prev/next) === */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.page-nav a {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.15s;
  min-width: 180px;
}
.page-nav a:hover { border-color: var(--accent); text-decoration: none; }
.page-nav .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.page-nav .title { font-size: 14px; color: var(--text); font-weight: 500; }
.page-nav .next { text-align: right; margin-left: auto; }

/* === Scrollbar === */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* === Responsive === */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .content { margin-left: 0; padding: 24px 20px 60px; }
}
