/**
 * Page Navigation Styles
 * Styles for the "On this page" navigation block that sticks to the viewport
 */

.page-navigation {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  width: 250px;
  float: right;
  background-color: #f8f9fa;
  border-radius: 5px;
  padding: 15px;
  margin-left: 20px;
  margin-bottom: 20px;
  overflow-y: auto;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  font-size: 14px;
  line-height: 1.4;
  z-index: 100;
}

.navigation-title {
  font-weight: bold;
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid #ddd;
  font-size: 16px;
  color: #333;
}

.page-navigation ul {
  list-style-type: none;
  padding-left: 0;
  margin-top: 5px;
  margin-bottom: 0;
}

.page-navigation ul ul {
  padding-left: 15px;
  margin-top: 3px;
}

.page-navigation li {
  margin-bottom: 5px;
}

.page-navigation .nav-link {
  text-decoration: none;
  color: #444;
  display: block;
  padding: 3px 5px;
  border-radius: 3px;
  transition: all 0.2s ease;
}

.page-navigation .nav-link:hover {
  background-color: #eaecef;
  color: #0056b3;
}

.page-navigation .nav-link.active {
  font-weight: 600;
  color: #0056b3;
  background-color: rgba(0, 86, 179, 0.08);
  border-left: 3px solid #0056b3;
  padding-left: 7px;
}

/* Adjust heading spacing to account for the navigation */
.main-content h2, .main-content h3 {
  scroll-margin-top: 80px; /* Provides space when scrolling to headings */
}

/* Dark theme compatibility */
body.dark-theme .page-navigation {
  background-color: #252525;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

body.dark-theme .navigation-title {
  color: #e0e0e0;
  border-bottom-color: #444;
}

body.dark-theme .page-navigation .nav-link {
  color: #b0b0b0;
}

body.dark-theme .page-navigation .nav-link:hover {
  background-color: #333;
  color: #4da6ff;
}

body.dark-theme .page-navigation .nav-link.active {
  color: #4da6ff;
  background-color: rgba(77, 166, 255, 0.15);
  border-left-color: #4da6ff;
}

/* Responsive styles */
@media (max-width: 992px) {
  .page-navigation {
    width: 200px;
  }
}

@media (max-width: 768px) {
  .page-navigation {
    position: static;
    width: 100%;
    float: none;
    margin-left: 0;
    margin-top: 20px;
    max-height: none;
  }
}