/* Sidebar styles */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 220px;
  height: 100vh;
  background: #2563eb;
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: 2px 0 8px rgba(44,62,80,0.06);
  font-size: 0.93em;
  overflow-y: auto;
  transition: transform 0.3s cubic-bezier(.4,2.2,.2,1), box-shadow 0.3s;
}

.sidebar.hide {
  transform: translateX(-100%);
  box-shadow: none;
}

.sidebar-logo {
  display: block;
  margin: 2em auto 1.5em auto;
  height: 64px;
  width: auto;
  max-width: 160px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(37,99,235,0.08);
  padding: 0.5em;
  object-fit: contain;
}

.sidebar-link {
  color: #fff !important;
  text-decoration: none;
  padding: 0.7em 1.2em;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.95em;
  transition: background 0.2s;
  margin: 0.2em 0.5em;
  display: block;
}

.sidebar-link:hover, .sidebar-link.active {
  background: #1e40af;
}

.sidebar-user {
  padding: 1em 1.5em;
  border-top: 1px solid #1e40af;
  font-size: 0.92em;
}

/* Custom scrollbar */
.sidebar::-webkit-scrollbar {
  width: 8px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: #1e40af;
  border-radius: 4px;
}
.sidebar::-webkit-scrollbar-track {
  background: #2563eb;
}

/* Place hamburger inside the sidebar, top right */
.hamburger {
  position: absolute;
  top: 1.2em;
  right: 1.2em;
  left: auto;
  z-index: 300;
  width: 36px;
  height: 36px;
  background: #2563eb;
  border: none;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  box-shadow: 0 2px 8px rgba(44,62,80,0.10);
}


.hamburger span, .hamburger span:before, .hamburger span:after {
  display: block;
  background: #fff;
  height: 2px;
  width: 22px;
  border-radius: 2px;
  position: absolute;
  transition: all 0.3s cubic-bezier(.4,2.2,.2,1);
}
.hamburger span {
  position: relative;
}
.hamburger span:before {
  content: '';
  position: absolute;
  top: -7px;
}
.hamburger span:after {
  content: '';
  position: absolute;
  top: 7px;
}
.hamburger.active span {
  background: transparent;
}
.hamburger.active span:before {
  transform: rotate(45deg) translate(5px,5px);
  top: 0;
}
.hamburger.active span:after {
  transform: rotate(-45deg) translate(5px,-5px);
  top: 0;
}

/* Right-facing arrow when collapsed */
.hamburger.collapsed span {
  background: transparent; /* Hide the middle line */
}

.hamburger.collapsed span::before,
.hamburger.collapsed span::after {
  content: '';
  position: absolute;
  width: 12px; /* Adjust width for the arrow lines */
  height: 2px;
  background: #fff; /* Arrow color */
  padding-right: 10px;
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(.4, 2.2, .2, 1);
}

.hamburger.collapsed span::before {
  transform: rotate(-45deg) translate(5px, 9px); /* Top line of the arrow */
}

.hamburger.collapsed span::after {
  transform: rotate(45deg) translate(5px, -9px); /* Bottom line of the arrow */
}

/* Main content shifts right */
.main-content {
  margin-left: 220px;
  min-height: 100vh;
  transition: margin-left 0.3s cubic-bezier(.4,2.2,.2,1);
  background: #f7f8fa;
  overflow-x: auto;      /* Enable horizontal scrolling */
  overflow-y: visible;
  padding-top: 2.5em;
  padding-bottom: 2.5em;
  scrollbar-color: #1e40af #2563eb;
  scrollbar-width: thin;
}

.main-content::-webkit-scrollbar {
  height: 8px;
  background: #2563eb;
}
.main-content::-webkit-scrollbar-thumb {
  background: #1e40af;
  border-radius: 4px;
}
.main-content::-webkit-scrollbar-track {
  background: #2563eb;
}

.sidebar-role {
  background: #ffd700;
  color: #2d3748;
  font-weight: 700;
  font-size: 1em;
  text-align: center;
  border-radius: 8px;
  margin: 0.5em auto 1.2em auto;
  padding: 0.5em 1em;
  max-width: 90%;
  letter-spacing: 0.03em;
  box-shadow: 0 2px 8px rgba(44,62,80,0.06);
}

/* Collapsed sidebar styles */
.sidebar.collapsed {
  width: 64px;
  min-width: 64px;
  max-width: 64px;
  transition: width 0.3s cubic-bezier(.4,2.2,.2,1);
}

.sidebar.collapsed .sidebar-nav {
  padding-top: 4.5em; /* Keep the same or adjust if you want less space when collapsed */
}
.sidebar.collapsed .sidebar-logo,
.sidebar.collapsed .sidebar-role {
  display: none !important;
}
.sidebar.collapsed .sidebar-link-text {
  display: none !important;
}
.sidebar.collapsed .sidebar-link {
  justify-content: center;
  text-align: center;
  padding-left: 0.5em;
  padding-right: 0.5em;
}
.sidebar.collapsed .sidebar-link i {
  margin-right: 0;
  font-size: 1.3em;
}

/* Animate width for smooth transition */
.sidebar, .sidebar.collapsed {
  transition: width 0.3s cubic-bezier(.4,2.2,.2,1), transform 0.3s cubic-bezier(.4,2.2,.2,1), box-shadow 0.3s;
}

/* Adjust main-content margin when collapsed */
body.sidebar-collapsed .main-content {
  margin-left: 64px !important;
  transition: margin-left 0.3s cubic-bezier(.4,2.2,.2,1);
}

/* Hide sidebar on mobile */
@media (max-width: 900px) {
  .sidebar {
    width: 80vw;
    min-width: 180px;
    max-width: 320px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    transition: transform 0.3s cubic-bezier(.4,2.2,.2,1);
  }
  .main-content {
    margin-left: 0;
  }
  .hamburger {
    display: flex;
  }
}

/* When sidebar is hidden, main-content is full width */
body.sidebar-hidden .main-content {
  margin-left: 0 !important;
}