.sidebar {
  width: 100px;
  position: relative;
  background-color: var(--sidebar-bg);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  transition: width 0.3s ease;
  overflow: hidden;
  padding: 1rem 0.5rem;
}

.sidebar:hover {
  width: 240px;
  padding-left: 1rem;
}

.sidebar nav h1 {
  position: sticky;
  display: flex;
  font-size: 1.4rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar:hover nav h1 {
  opacity: 1;
}

.sidebar nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  width: 100px;
  position: fixed;
  padding-left: 0;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  color: var(--text-light);
  text-decoration: none;
  padding: 0rem 0.75rem;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background-color: var(--sidebar-hover-bg);
  color: var(--accent);
}

.sidebar nav .icon {
  position: sticky;
  width: 30px;
  height: 30px;
  stroke: var(--text-light);
  transition: stroke 0.2s ease;
  flex-shrink: 0;
}

.sidebar nav a:hover .icon,
.sidebar nav a.active .icon {
  stroke: var(--accent);
}

.sidebar nav .label {
  margin-left: 2rem;
  width: 100%;
  position: sticky;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar nav li {
  position: relative;
  padding-top: 1rem;
}

.sidebar:hover nav .label {
  opacity: 1;
}

.sidebar-separator {
  position: relative;
  width: 50%; /* small width when collapsed */
  border: none;
  border-top: 1px solid var(--separator-color);
  opacity: 0.2;
  transition: width 0.3s ease;
  margin-left: 0.4rem;
}


.sidebar:hover .sidebar-separator{
  padding-right: 1rem;
  width: 100%; /* small width when collapsed */
}


  .sidebar:hover .visit-count {
    opacity: 1;
  }
  

@media (max-width: 768px) {
    body, .content {
    padding-top: 3.5rem; /* equal to navbar height */
  }
  /* Sidebar becomes top navbar */
  .sidebar {
    width: 100%;
    position: fixed;      /* stay at top */
    top: 0;
    left: 0;
    right: 0;
    padding: 0.5rem 1rem;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: row;  /* horizontal */
    align-items: center;
    overflow: visible;    /* show all content */
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  }

  /* Remove hover expand behavior on mobile */
  .sidebar:hover {
    width: 100%;
    padding-left: 1rem;
  }

  /* nav inside sidebar becomes flex row */
  .sidebar nav ul {
    position: static;  /* no fixed position */
    display: flex;
    flex-direction: row;
    padding-left: 0;
    width: auto;
    margin: 0;
  }

  /* nav list items in row */
  .sidebar nav li {
    padding: 0 0.75rem;
  }

  /* links align center vertically and horizontally */
  .sidebar nav a {
    padding: 0.5rem 0.5rem;
    justify-content: center;
  }

  /* icon and label align horizontally */
  .sidebar nav .icon {
    position: static;
    margin-right: 0.3rem;
    width: 24px;
    height: 24px;
  }

  /* Show labels fully on mobile */
  .sidebar nav .label {
    position: static;
    opacity: 1 !important;
    margin-left: 0;
    display: inline-block;
    font-size: 1rem;
  }

  /* Hide sidebar separator on mobile */
  .sidebar-separator {
    display: none;
  }

  /* Adjust visit count */
  .visit-count {
    opacity: 1 !important;
    font-size: 0.75rem;
    margin-left: 0.5rem;
  }
  
  /* Adjust project content padding to avoid overlap */
  .content {
    padding-top: 3.5rem; /* adjust to navbar height */
  }
}