body {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    display: flex;
    height: 100vh;
    background: #f7f8fa;
    color: #333;
  }

  /* ===================== Sidebar ===================== */
  #sidebar {
    width: 280px;
    max-height: 100vh;
    background: #1e293b;
    color: white;
    /*overflow-y: auto;*/
    padding: 1rem;
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
    transition: transform 0.3s ease;
    z-index: 1000;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(0);
    /*max-height: 100vh;*/
    display: flex;
    flex-direction: column;
  }

.sidebar-top,
.sidebar-bottom {
  flex-shrink: 0; /* fixed size */
  padding: 1rem;
}

.sidebar-middle {
  flex: 1; /* takes remaining space */
  overflow-y: auto; /* scrollable */
  padding: 0 1rem 1rem 1rem;
}

/* optional: spacing for buttons */
.sidebar-top button,
.sidebar-middle button,
.sidebar-bottom button {
  width: 100%;
  margin-bottom: 0.8rem;
  padding: 0.5rem;
  border: none;
  border-radius: 6px;
  background: #43b0b3;
  color: white;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.2s;
}

.sidebar-top button:hover,
.sidebar-middle button:hover,
.sidebar-bottom button:hover {
  background: #475569;
}


  #sidebar h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
  }

  #sidebar.hidden {
    transform: translateX(-100%);
  }

  /* Hamburger button for desktop */
  #menu-toggle {
    position: fixed;
    top: 1rem;
    left: 1rem;
    width: 36px;
    height: 36px;
    background: #1e293b;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: transform 0.3s ease;
  }

  #menu-toggle svg {
    width: 20px;
    height: 20px;
    fill: white;
    transition: transform 0.3s ease;
  }

  /* Mobile arrow button */
  #mobile-arrow {
    position: fixed;
    top: 1rem;
    left: 0;
    width: 28px;
    height: 40px;
    background: #1e293b;
    color: rgb(244, 245, 244);
    border: none;
    border-radius: 0 6px 6px 0;
    font-size: 1.2rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: left 0.3s ease, transform 0.3s ease;
  }

  #overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 900;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  #overlay.active {
    display: block;
    opacity: 1;
  }

  #main {
    flex: 1;
    padding: 2rem;
    margin-left: 280px;
    transition: margin-left 0.3s ease;
  }

  .maindiv {
    margin-left: auto;
    margin-right: auto;
    padding: 0 15px; 
    width: 80%;
  }

  #sidebar.hidden ~ #main {
    margin-left: 0;
  }

  /* Mobile Styles */
  @media (max-width: 768px) {
    #sidebar {
      transform: translateX(-100%);
    }

    #sidebar.active {
      transform: translateX(0);
    }

    #main {
      margin-left: 0;
      padding: 1rem;
    }

    #menu-toggle {
      display: none;
    }

    #mobile-arrow {
      display: flex;
    }

    #sidebar.active + #mobile-arrow {
      left: 280px;
      transform: rotate(180deg);
    }
  }
 /* ===================== end Sidebar ===================== */


.loading-icon {
  width: 22px;
  height: 22px;
  vertical-align: middle;
  margin-left: 8px;
}
