/* ==========================================================================
   BASE HELP-DOCUMENTATION STYLES
   ========================================================================== */

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #3D405B;
}

.post-header {
  padding-top: 6rem;
  background: #333547;
}

.post-header h1 {
  color: #f1f1f8;
  font: 700 2.5rem/2.625rem "Montserrat", sans-serif;
}

.page-layout {
  display: flex;
  gap: 2rem;
}

.sidebar-column {
  width: 25%;
  flex-shrink: 0;
}

.search-control {
  width: 25%;
  margin-bottom: 0.35rem;
}

.search__toggle {
  border: 0;
  padding: 0;
  outline: none;
  color: white;
  background-color: transparent;
  cursor: pointer;
  display: inline-flex;
  transition: 0.2s;
  -webkit-transition: 0.2s;
  width: 100%;
}

.search__wrapper {
  background-color: #3D405B;
  border: 1px solid #C2C2C2;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 300;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #C2C2C2;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
  width: 100%;
  justify-content: flex-start;
}

.search__toggle .icon {
  width: 16px;
  height: 16px;
}

/* Main Content */
.main-content {
  flex-grow: 1;
  width: 75%; /* Matches col-lg-9 */
}

/* Basic sidebar structure */
.sidebar {
  background: #333547;
  padding: 10px;
}

.sidebar ul {
  list-style-type: none;
  padding-left: 0px;
}

.sidebar li {
  margin-bottom: 16px;
}

/* Base styles for all navigation items */
.sidebar a {
  text-decoration: none;
  color: #f1f1f8;
  display: block;
  border-radius: 2px;
}

#sidebar-navigation {
  scroll-margin-top: 100px;
}

/* Header styles */
.nav-header {
  font-weight: bold;
  padding: 2px 10px;
  margin-bottom: 2px;
}

.nav-header:hover,
.nav-header-selected {
  background: #4b4e63;
  color: #f1f1f8;
}

/* Subitem styles */
.nav-subheader {
  padding: 1px 8px;
  border-radius: 2px;
}

.nav-subheader:hover {
  background: rgba(75, 78, 99, 0.5);
}

.nav-subheader-selected {
  background: rgba(75, 78, 99, 0.7);
  border-left: 3px solid #f1f1f8;
  margin-left: -3px;
}

/* Details and nested list structure */
.sidebar details[open] > summary > .nav-header {
  background: #4b4e63;
}

.sidebar details ul {
  padding-left: 20px;
}

.sidebar details ul li {
  margin-bottom: 3px;
}

details summary::-webkit-details-marker {
  display: none;
}

details summary {
  list-style: none;
  cursor: pointer;
}

/* Content styles */
.text-container h2 {
  color: hsl(240, 33%, 96%);
  font: 700 1.75rem/2.125rem "Montserrat", sans-serif;
  margin-bottom: 20px;
  margin-top: 40px;
}

.text-container h3,
.text-container h4 {
  color: #f1f1f8;
  font: 700 1.375rem/1.75rem "Montserrat", sans-serif;
  margin-bottom: 15px;
  margin-top: 20px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.jump-to-nav {
  display: none; /* Hidden by default for all screens */
}

/* ==========================================================================
  SEARCH FEATURE
   ========================================================================== */

/* Make both containers fill vertical space between header and footer */
.documentation-content,
.search-content {
  flex: 1 0 auto;
}

/* Show the normal page content by default */
.documentation-content {
  display: block;
  padding-top: 1rem;
  padding-bottom: 4rem;
  background-color: #3D405B;
}

/* When toggled, hide the normal content */
.documentation-content.is--hidden {
  display: none;
  visibility: hidden;
}

.search-content {
  background-color: #3D405B;
  display: none;
  padding-top: 1em;
  padding-bottom: 1em;
}

.search-content.is--visible {
  display: block;
}

.search-content__inner-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  animation: fade-in 0.8s;
}

.search-content__form {
  background-color: transparent;
}

.search-input {
  display: block;
  width: 100%;
  margin-bottom: 1rem;
  padding: 1rem;
  border: none;
  outline: none;
  box-shadow: none;
  background-color: transparent;
  font-size: 1.75rem;
  line-height: 1.3;
  color: #fff;
}

.search-input::placeholder {
  color: #fff;
}

/* Search Results styling */
.results__found {
  margin-top: 0.5em;
  font-size: 12px;
}

.archive__item {
  margin-bottom: 2em;
}

.archive__item-title {
  margin-top: 0;
}

.archive__item-excerpt {
  margin-bottom: 0;
}

@keyframes fade-in {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

input[type="search"] {
  box-sizing: border-box;
  -webkit-appearance: textfield;
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

/* Instructional Text Styling */
.cancel-instruction {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #ccc;
}

.cancel-instruction strong {
  color: #fff;
}

/* ==========================================================================
  NAVIGATION BUTTONS
   ========================================================================== */

.nav-buttons {
  margin-top: 40px;
  margin-bottom: 40px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-buttons a {
  width: 100%;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-buttons a.prev-button {
  margin-right: auto;
}

.nav-buttons a.next-button {
  margin-left: auto;
}


/* ==========================================================================
  MEDIA QUERIES
   ========================================================================== */


@media (min-width: 768px) {
  .nav-buttons {
    flex-direction: row; /* Align buttons side by side on mid-large screens */
    justify-content: space-between;
  }
}

/* Desktop Layout */
@media (min-width: 768px) {
  .nav-buttons a {
    width: auto;
    max-width: 40%;
  }
}

@media (max-width: 767px) {
  /* Search stays at top */
  .search-control {
    width: 100%;
    position: sticky;
    top: 0;
    background: #3D405B;
    padding: 1rem 0;
    z-index: 10;
  }

  /* Layout changes for mobile */
  .page-layout {
    flex-direction: column;
  }

  .sidebar-column {
    width: 100%;
    order: 3; /* Move sidebar to bottom */
  }

  .main-content {
    width: 100%;
    order: 2; /* Move content below search but above sidebar */
  }

  .jump-to-nav {
    display: block;
    margin-bottom: 10px;
    order: 1;
    text-align: right;
  }
}
