/* ── Layout general ── */
#page-wrapper {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}

/* ── Sidebar ── */
#sidebar-toc {
  width: 260px;
  min-width: 220px;
  max-width: 260px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
  background: #f0f4f8;
  border-right: 2px solid #c0cdd8;
  padding: 1em 0.8em;
  box-sizing: border-box;
  font-size: 0.88em;
  font-family: 'PT Sans Narrow', Arial, sans-serif;
  transition: width 0.25s ease;
  z-index: 100;
}

#sidebar-toc.collapsed {
  width: 42px;
  min-width: 42px;
  padding: 0.6em 0.3em;
  overflow: hidden;
}
#sidebar-toc.collapsed #toc-content {
  display: none;
}

/* ── Botón toggle ── */
#toc-toggle-btn {
  background: none;
  border: none;
  font-size: 1.3em;
  cursor: pointer;
  color: #2a5db0;
  display: block;
  margin-bottom: 0.6em;
  padding: 0;
  line-height: 1;
}

/* ── Contenido del TOC ── */
#toc-content a {
  color: #2a5db0;
  text-decoration: none;
}
#toc-content a:hover {
  text-decoration: underline;
  color: #1a3a80;
}
#toc-content ul, #toc-content ol {
  list-style: none;
  padding-left: 0.8em;
  margin: 0.2em 0;
}
#toc-content li {
  margin: 0.25em 0;
  line-height: 1.3;
}

/* Nivel 1 (capítulo) */
#toc-content > ul > li > a,
#toc-content > ol > li > a {
  font-weight: bold;
  color: #00112b;
  font-size: 1em;
}

/* Nivel 2 (sección) */
#toc-content ul ul li a,
#toc-content ol ol li a {
  font-size: 0.95em;
  padding-left: 0.5em;
}

/* Entrada activa */
#toc-content a.toc-active {
  color: #20948B;
  font-weight: bold;
  border-left: 3px solid #20948B;
  padding-left: 4px;
}

/* ── Contenido principal ── */
#main-content {
  flex: 1;
  min-width: 0;
  padding: 1.5em 2.5em;
  box-sizing: border-box;
}

/* ── Responsive ── */
@media (max-width: 700px) {
  #sidebar-toc {
    position: fixed;
    left: 0; top: 0;
    height: 100vh;
    z-index: 200;
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
  }
  #sidebar-toc.collapsed {
    width: 36px;
    min-width: 36px;
  }
  #main-content {
    padding: 1em;
  }
}
