/* ============================================================
   shared.css — MongoEngine Docs
   Used by: ALL pages (WordPress + static HTML)
   ============================================================ */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-bg: #343131;
  --sidebar-width: 300px;
  --link-color: #2980b9;
  --heading-color: #404040;
  --text-color: #404040;
  --border-color: #e1e4e5;
  --body-bg: #fcfcfc;
  --code-red: #e74c3c;
  --note-bg: #e7f2fa;
  --note-border: #2980b9;
  --warn-bg: #ffedcc;
  --warn-border: #f0b37e;
  --shell-bg: #eeffcc;
  --shell-border: #c8dfa0;
}

html, body {
  font-family: 'Lato', sans-serif;
  font-size: 16px;
  color: var(--text-color);
  background: var(--body-bg);
}

a { color: var(--link-color); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.me-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
#me-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

/* Scrollbar styling for sidebar */
#me-sidebar::-webkit-scrollbar { width: 4px; }
#me-sidebar::-webkit-scrollbar-track { background: #2a2828; }
#me-sidebar::-webkit-scrollbar-thumb { background: #555; border-radius: 2px; }

/* Search */
.me-sidebar-search { padding: 1rem 1.2rem 0.8rem; flex-shrink: 0; }
.me-sidebar-search input {
  width: 100%;
  padding: 0.45rem 0.75rem;
  border: 1px solid #aaa;
  border-radius: 3px;
  font-size: 0.9rem;
  background: #fff;
  outline: none;
  font-family: 'Lato', sans-serif;
}
.me-sidebar-search input::placeholder { color: #999; }

/* Nav */
.me-sidebar-nav { padding: 0.3rem 0 1rem; }

/* Level 1 — section titles (Tutorial, User Guide, etc.) */
.me-nav-l1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.42rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #d9d9d9;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  text-decoration: none;
}
.me-nav-l1:hover { background: rgba(255,255,255,0.07); color: #fff; text-decoration: none; }
.me-nav-l1.active { color: #fff; background: rgba(255,255,255,0.05); }

/* Arrow indicator */
.me-nav-l1 .me-arrow {
  font-size: 0.7rem;
  transition: transform 0.2s;
  color: #888;
  flex-shrink: 0;
}
.me-nav-l1.open .me-arrow { transform: rotate(90deg); color: #bbb; }

/* Level 2 — subsections */
.me-nav-children { display: none; }
.me-nav-children.open { display: block; }

.me-nav-l2 {
  display: block;
  padding: 0.3rem 1.2rem 0.3rem 2rem;
  font-size: 0.86rem;
  color: #b8b8b8;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  line-height: 1.4;
}
.me-nav-l2:hover { background: rgba(255,255,255,0.06); color: #fff; text-decoration: none; }
.me-nav-l2.active { color: #fff; font-weight: 700; }

/* Level 3 — sub-subsections */
.me-nav-l3 {
  display: block;
  padding: 0.26rem 1.2rem 0.26rem 2.8rem;
  font-size: 0.81rem;
  color: #999;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  line-height: 1.4;
}
.me-nav-l3:hover { background: rgba(255,255,255,0.05); color: #ddd; text-decoration: none; }
.me-nav-l3.active { color: #fff; }

/* ── Main content area ── */
.me-main {
  flex: 1;
  padding: 2rem 3rem 5rem 3rem;
  max-width: 860px;
  min-width: 0;
}

/* Right spacer panel */
.me-right-panel { width: 200px; flex-shrink: 0; }

/* ── Breadcrumb ── */
.me-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  margin-bottom: 1.4rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.7rem;
  color: #777;
}
.me-breadcrumb a { color: var(--link-color); }
.me-breadcrumb .me-view-source { margin-left: auto; }

/* ── Headings ── */
.me-main h1 {
  font-family: 'Roboto Slab', serif;
  font-size: 1.95rem;
  font-weight: 700;
  color: var(--heading-color);
  margin-bottom: 1.1rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border-color);
}
.me-main h2 {
  font-family: 'Roboto Slab', serif;
  font-size: 1.38rem;
  font-weight: 700;
  color: var(--heading-color);
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border-color);
}
.me-main h3 {
  font-family: 'Roboto Slab', serif;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--heading-color);
  margin: 1.6rem 0 0.6rem;
}

/* ── Body text ── */
.me-main p {
  font-size: 0.97rem;
  line-height: 1.72;
  margin-bottom: 0.9rem;
}

/* ── Inline code ── */
.me-main code {
  background: #f0f2f3;
  border: 1px solid #e1e4e5;
  border-radius: 2px;
  padding: 0.08em 0.32em;
  font-family: 'Courier New', monospace;
  font-size: 0.875em;
  color: var(--code-red);
}

/* ── Code blocks ── */
.me-main pre {
  background: #f8f8f8;
  border: 1px solid #e1e4e5;
  border-radius: 3px;
  padding: 0.85rem 1.1rem;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.58;
  overflow-x: auto;
  margin: 0.5rem 0 1.2rem;
  white-space: pre;
}
.me-main pre code {
  background: none;
  border: none;
  padding: 0;
  color: #333;
  font-size: inherit;
}
.me-main pre.shell { background: var(--shell-bg); border-color: var(--shell-border); }
.me-main pre.shell .prompt { color: #c0392b; }

/* ── Note / Warning boxes ── */
.me-admonition {
  padding: 0.8rem 1rem;
  margin: 0.9rem 0 1.3rem;
  border-radius: 2px;
  font-size: 0.95rem;
  line-height: 1.65;
}
.me-admonition .me-admonition-title {
  font-weight: 700;
  margin-bottom: 0.4rem;
  display: block;
}
.me-admonition.note {
  background: var(--note-bg);
  border-left: 4px solid var(--note-border);
}
.me-admonition.note .me-admonition-title { color: var(--note-border); }
.me-admonition.warning {
  background: var(--warn-bg);
  border-left: 4px solid var(--warn-border);
}
.me-admonition.warning .me-admonition-title { color: #c9710b; }
.me-admonition pre {
  background: #dceefa;
  border-color: #b8d8ee;
  margin: 0.5rem 0 0;
}
.me-admonition.warning pre { background: #fde8c6; border-color: #f0cc9a; }

/* ── Lists ── */
.me-main ul, .me-main ol {
  padding-left: 1.9rem;
  margin-bottom: 1rem;
  font-size: 0.97rem;
  line-height: 1.72;
}
.me-main li { margin-bottom: 0.22rem; }

/* TOC list (User Guide index page) */
.me-toc { list-style: disc; }
.me-toc li { margin-bottom: 0.3rem; font-size: 0.97rem; }
.me-toc ul { list-style: circle; margin-top: 0.3rem; margin-bottom: 0.4rem; }

/* ── Prev / Next navigation ── */
.me-page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}
.me-btn-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.9rem;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 0.91rem;
  color: var(--text-color);
  background: #fff;
  text-decoration: none;
  font-family: 'Lato', sans-serif;
}
.me-btn-nav:hover { background: #f5f5f5; text-decoration: none; }

/* ── Footer (inside main area) ── */
.me-footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: #888;
  line-height: 1.7;
}

/* ── Responsive ── */
@media (max-width: 960px) {
  .me-right-panel { display: none; }
  .me-main { padding: 1.5rem 1.5rem 3rem; }
}
@media (max-width: 700px) {
  #me-sidebar {
    position: static;
    height: auto;
    width: 100%;
  }
  .me-layout { flex-direction: column; }
  .me-main { padding: 1.2rem 1rem 3rem; }
}