/* Reset defaults */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* Wrapper fills viewport height */
.wrapper {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}

/* Sidebar base */
#sidebar {
  width: 250px;
  background: #343a40; /* dark sidebar background */
  color: white;
  transition: all 0.3s ease;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 999;
  padding-top: 20px;
  margin-left: 0; /* visible by default */
}

/* Sidebar hidden when toggled */
#sidebar.active {
  margin-left: -250px;
}

/* Content area next to sidebar */
#content {
  width: 100%;
  padding: 20px;
  margin-left: 250px;
  transition: all 0.3s ease;
}

/* Content expands when sidebar hidden */
#content.active {
  margin-left: 0;
}

/* Sidebar links style */
#sidebar ul.components {
  padding-left: 0;
  margin: 0;
}

#sidebar ul.components li a {
  padding: 10px 20px;
  display: block;
  color: #ddd;
  text-decoration: none;
}

#sidebar ul.components li a:hover {
  background: #495057;
  color: white;
}

/* Sidebar header */
.sidebar-header {
  position: relative; /* needed for absolute positioning */
  display: flex;
  justify-content: flex-start; /* Home link on left */
  align-items: center;
  padding: 0 20px;
  height: 50px;
}

.sidebar-header h4 a {
  color: white;
  text-decoration: none;
  margin: 0;
}

/* Toggle button styles */
#sidebarCollapse {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: #ffffff;
  color: #343a40;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 5px 10px;
  z-index: 1001;
  transition: left 0.3s ease, right 0.3s ease;
}

/* When sidebar is hidden, move toggle button to fixed position on left top */
#sidebarCollapse.collapsed {
  position: fixed;
  left: 10px;
  top: 10px;
  right: auto;
  transform: none;
  z-index: 1100;
}

/* Show toggle button always */
#sidebarCollapse {
  display: block;
}

/* Responsive: small screens */
@media (max-width: 768px) {
  #sidebar {
    margin-left: -250px; /* hidden by default on small screen */
  }
  #sidebar.active {
    margin-left: 0;
  }
  #content {
    margin-left: 0;
  }
  #content.active {
    margin-left: 250px;
  }
}

