/* ================================================================
   Theme variables (matches frontend/static/app.css)
   ================================================================ */
:root {
  --bg:        #f8fafc;
  --card:      #ffffff;
  --border:    #e2e8f0;
  --text:      #1e293b;
  --muted:     #64748b;
  --accent:    #2563eb;
  --accent-fg: #ffffff;
  --radius:    8px;
  --shadow:    0 1px 3px rgba(0,0,0,.08);
}

[data-theme="dark"] {
  --bg:      #0f172a;
  --card:    #1e293b;
  --border:  #334155;
  --text:    #f1f5f9;
  --muted:   #94a3b8;
  --accent:  #3b82f6;
  --shadow:  0 1px 3px rgba(0,0,0,.3);
}

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ================================================================
   Header
   ================================================================ */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 52px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo { font-size: 1rem; font-weight: 700; letter-spacing: .03em; }

.btn-icon {
  padding: .35rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  border-radius: var(--radius);
}
.btn-icon:hover { color: var(--text); }

/* ================================================================
   Layout: left nav | content | right nav
   ================================================================ */
.layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 220px;
  gap: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  align-items: start;
}

.nav-main, .nav-sub {
  position: sticky;
  top: 70px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.nav-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: .5rem;
}

.nav-main a, .nav-sub a {
  display: block;
  padding: .35rem .6rem;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.4;
}
.nav-main a:hover, .nav-sub a:hover { color: var(--text); background: var(--card); }
.nav-main a.active, .nav-sub a.active { color: var(--accent); background: var(--card); font-weight: 600; }

.nav-sub a.sub {
  padding-left: 1.5rem;
  font-size: 12px;
}

/* ================================================================
   Content
   ================================================================ */
.content-area {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 2.5rem;
  min-width: 0;
}

.doc-page { display: none; }
.doc-page.active { display: block; }

.content-area h1 {
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
}

.content-area section {
  padding-top: 1.5rem;
  margin-bottom: 1.5rem;
  border-top: 1px solid var(--border);
}
.content-area section:first-of-type {
  padding-top: 0;
  border-top: none;
}

.content-area h2 {
  font-size: 1.2rem;
  margin-bottom: .75rem;
  scroll-margin-top: 70px;
}

.content-area h3 {
  font-size: 1rem;
  margin: 1.25rem 0 .6rem;
  scroll-margin-top: 70px;
}

.content-area p {
  margin-bottom: .75rem;
  line-height: 1.6;
}

.content-area ul, .content-area ol {
  margin: 0 0 .75rem 1.4rem;
  line-height: 1.6;
}
.content-area li { margin-bottom: .35rem; }
.content-area li > ul, .content-area li > ol { margin-top: .35rem; }
.content-area li > p { margin-top: .35rem; margin-bottom: .35rem; }

.content-area a { color: var(--accent); text-decoration: none; }
.content-area a:hover { text-decoration: underline; }

.content-area code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1rem .3rem;
}

.content-area pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  overflow-x: auto;
  margin-bottom: .75rem;
}
.content-area pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 12.5px;
}

.content-area table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: .75rem;
  font-size: 13px;
}
.content-area th, .content-area td {
  border: 1px solid var(--border);
  padding: .5rem .65rem;
  text-align: left;
  vertical-align: top;
}
.content-area th {
  background: var(--bg);
  font-weight: 600;
  white-space: nowrap;
}

/* ================================================================
   Responsive
   ================================================================ */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 200px minmax(0, 1fr); }
  .nav-sub { display: none; }
}

.badge-premium {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #fff;
  background: #2563eb;
  border-radius: 4px;
  padding: .1em .45em;
  vertical-align: middle;
  margin-left: .4em;
  line-height: 1.5;
}

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; padding: 1rem; }
  .nav-main {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    max-height: none;
    overflow: visible;
  }
  .content-area { padding: 1.25rem; }
}
