.sidebar {
  background: #0e4a63;
  color: #ffffff;
  z-index: 1000;
  width: 210px;
  position: relative;
}

.sidebar-header {
  background: #0a3142;
  padding: 24px 20px 24px 20px;
  border-bottom: 3px solid #ffffff;
}

.sidebar-header h4 {
  margin: 0;
}

.sidebar-header h4 a {
  color: #3EEE22;
  font-size: 16px;
  font-weight: 600;
}

.sidebar-content {
  flex: 1;
  padding: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  color: #ffffff;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  font-family: "Open Sans", "Verdana", sans-serif;
  transition: background 0.2s;
}

.section-header {
  padding: 0;
}

.section-link {
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  text-indent:20px;
  display: block;
  padding: 10px 24px;
  margin: 10px 0;
  transition: all 0.2s;
  background: transparent;
  font-family: "Open Sans", "Verdana", sans-serif;
}

.section-link:hover {
  background: #0a3142;
  color: #ffffff;
}

.section.active .section-link {
  background: #0a3142;
  color: #ffffff;
}

.submenu {
  position: absolute;
  left: 100%;
  top: 0;
  width: 340px;
  background: #ffffff;
  display: none;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
  margin-top: 73px;
  height: calc(100% - 73px);
  z-index:1001;
}

.section.active .submenu {
  display: block;
  z-index:1002;
}

.submenu-link {
  display: block;
  padding: 10px 24px;
  color: #187ba5;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  border-left: 4px solid transparent;
  white-space: nowrap;
}

.submenu-link:hover {
  background: #e8f2f6;
  color: #187ba5;
  text-decoration: none;
  margin-left: 15px;
  margin-right: 15px;
}

.submenu-section {
  margin-bottom: 5px;
}

.submenu-section:last-child {
  margin-bottom: 0;
}

.submenu-section-header {
  color: #1c1f27;
  font-size: 19px;
  font-weight: 600;
  padding: 20px 24px 8px;
  border-top: 1px solid #eee;
  margin-bottom: 8px;
}

.single-section {
  margin-top: 20px;
}

/* Hamburger toggle button - hidden by default */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1003;
  margin: 0;
  background: #0e4a63;
  color: #ffffff;
  padding: 10px;
  cursor: pointer;
  border-radius: 0 0 5px 0;
  border: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  line-height: 1;
}

.sidebar-toggle .bar {
  display: block;
  width: 25px;
  height: 3px;
  background-color: #ffffff;
  margin: 5px 0;
  transition: 0.4s;
}

/* Animate hamburger to X when sidebar is open */
.sidebar-toggle.active .bar:nth-child(1) {
  transform: rotate(-45deg) translate(-5px, 5px);
}

.sidebar-toggle.active .bar:nth-child(2) {
  opacity: 0;
}

.sidebar-toggle.active .bar:nth-child(3) {
  transform: rotate(45deg) translate(-6px, -7px);
}

/* Mobile styles */
@media screen and (max-width: 1025px) {
  .sidebar {
    width: 0;
    overflow-x: hidden;
    overflow-y: auto; /* Allow vertical scrolling */
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transition: width 0.3s ease-in-out;
    z-index: 1002;
    display: flex;
    flex-direction: column;
  }

  .sidebar.open {
    width: 280px; /* Slightly wider for mobile to accommodate submenus */
  }

  .sidebar-header h4,
  #contentContainer h1,
  .training-banner h1 {
    margin-left: 65px;
  }

  .sidebar-content {
    flex: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
  }

  .sidebar-toggle {
    display: block; /* Show toggle button on mobile */
  }
  
  /* Ensure main content div takes full width */
  #all {
    width: 100%;
    margin-left: 0;
    padding-left: 0;
  }

  /* Additional specific overrides for assessment page template */
  #container,
  div[style*="grid-template-columns"] {
    display: block !important;
  }

  /* Reposition submenu for mobile - show inline instead of overlay */
  .submenu {
    position: static; /* Change from absolute to static */
    left: auto;
    top: auto;
    width: 100%; /* Full width of sidebar */
    background: #f8f9fa; /* Slightly different background */
    display: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1); /* Inset shadow */
    margin-top: 0;
    height: auto; /* Auto height */
    z-index: auto;
    border-left: 3px solid #187ba5; /* Left border to indicate submenu */
    padding-left: 10px;
  }

  .section.active .submenu {
    display: block;
  }

  /* Adjust submenu links for mobile */
  .submenu-link {
    display: block;
    padding: 8px 16px;
    color: #187ba5;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: none;
    white-space: normal; /* Allow text wrapping */
    line-height: 1.4;
  }

  .submenu-link:hover {
    background: #e8f2f6;
    color: #187ba5;
    text-decoration: none;
    margin-left: 0;
    margin-right: 0;
  }

  /* Adjust submenu section headers for mobile */
  .submenu-section-header {
    color: #1c1f27;
    font-size: 16px;
    font-weight: 600;
    padding: 12px 16px 6px;
    border-top: 1px solid #dee2e6;
    margin-bottom: 4px;
  }

  /* Add some spacing for better mobile UX */
  .section {
    margin-bottom: 0;
    display: block;
    width: 100%;
  }

  .section-link {
    padding: 15px 20px;
    font-size: 16px;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(10, 49, 66, 0.3);
    touch-action: manipulation;
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  /* Ensure section links are properly styled on mobile */
  .section-link:active {
    background: #0a3142;
    color: #ffffff;
  }

  /* Add overlay to prevent interaction with content when sidebar is open */
  .sidebar.open::after {
    content: '';
    position: fixed;
    top: 0;
    left: 280px; /* Updated to match new sidebar width */
    width: calc(100vw - 280px);
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
  }

  /* Remove hardcoded minimum widths that force 930px and cause horizontal scroll */
  #header,
  #footer,
  .training-banner {
    min-width: 0;
  }

  /* Training banner: h1 takes its own row so banner-right gets maximum width */
  .training-banner {
    flex-wrap: wrap;
    padding: 12px 16px 12px 0;
  }

  .training-banner h1 {
    font-size: 18px;
    padding-left: 0;
    width: 100%;
    flex: none;
    margin-bottom: 4px;
  }

  /* banner-right sits on the row below h1; keep items in one line */
  .training-banner .banner-right {
    margin-left: 65px;
    flex-wrap: nowrap;
    gap: 4px;
  }

  /* Tighten spacing between banner links and star on mobile */
  .training-banner .banner-right > * {
    margin-right: 12px;
  }

  /* Stack the assessment workflow nav column above the content instead of beside it */
  .content-grid {
    display: flex;
    flex-direction: column;
    height: auto;
  }

  .content-grid .top,
  .content-grid .main-content {
    width: 100%;
  }

  /* Workflow phases: equal-width row of 5 boxes, all the same height */
  #workFlowWrap .phase {
    display: inline-block;
    vertical-align: top;
    width: 19%;
    height: 50px;
    font-size: 0.75em;
    padding: 0 2px;
    box-sizing: border-box;
    overflow: hidden;
  }

  /* Override table/table-cell so a fixed height is respected */
  #workFlowWrap .phase > div {
    display: flex !important;
    align-items: center;
    justify-content: center;
    height: 100% !important;
    width: 100%;
  }

  #workFlowWrap .phase div div {
    display: block !important;
    height: auto !important;
    text-align: center;
  }

  /* Hide the vertical arrow separators between phases */
  #workFlowWrap .seperator {
    display: none;
  }

  /* Collapse spacers so action buttons sit closer to the phases */
  #workFlowWrap .spacer_30 {
    height: 0;
    overflow: hidden;
  }

  /* Assessment info box (JA #, dates): full width so it doesn't float oddly */
  #workFlowWrap .note {
    width: 100%;
    box-sizing: border-box;
    margin-top: 0.5rem;
    font-size: 0.85em;
  }

  /* Action buttons: compact inline elements in a wrapping row */
  #workFlowWrap .center,
  #workFlowWrap .flagLinkWrap.center {
    display: inline-block;
    width: auto;
    padding-top: 0.375rem !important;
    margin: 0 0.25rem 0 0;
  }
}
