/* Sidebar Container */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 90vw;
  height: 100vh;
  background: #fff;
  transition: width 0.3s ease;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding-top: 60px;
  transition: transform 0.3s ease;
  transform: translateX(-100%);
  z-index: 2000;
  border: none;
}
@media (min-width: 768px) {
  .sidebar {
    width: 250px;
    transform: translateX(0);
    border-right: 1px solid var(--border);
  }
}

/* Opened State */
.sidebar.opened {
  transform: translateX(0);
  border-right: 1px solid var(--border);
}

/* Toggle Button */
.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--text);
  margin: 1rem; /* Some spacing around the icon */
  /* We can absolutely position this to ensure it stays accessible */
  position: relative;
  z-index: 1100; /* Above the sidebar background */
}

/* Client Info Section */
.client-info {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.client-name {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
}

.client-id {
  font-size: 0.9rem;
  color: var(--muted-foreground);
  margin-top: 2px;
}

/* Navigation Links */
.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav .nav-item {
  width: 100%;
}

.sidebar-nav .nav-link {
  display: block;
  padding: 12px 20px;
  color: #202124;
  text-decoration: none;
  font-size: 0.95rem;
  transition: background 0.2s ease;
  white-space: nowrap; /* Prevent text wrap when narrow */
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hover/Active States */
.sidebar-nav .nav-link:hover {
  background-color: var(--card);
}

.sidebar-nav .nav-link.active {
  background-color: var(--card);
  color: var(--primary);
  font-weight: 500;
}

/* Submenu styles */
.submenu {
  display: none;
  list-style: none;
  padding-left: 2.5rem;
  margin: 0.2rem 0;
  transition: max-height 0.3s ease;
  overflow: hidden;
}

.submenu .submenu-item a,
.submenu .submenu-item button {
  display: block;
  padding: 8px;
  margin-right: 16px;
  color: var(--muted-foreground);
  font-size: 0.88rem;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.submenu .submenu-item a:hover,
.submenu .submenu-item button:hover {
  color: var(--primary);
  background-color: oklch(from var(--primary) l c h / 0.1);
  border-radius: 4px;
}

/* When submenu is open */
.submenu.open {
  display: block;
}

/* Sidebar nav-link as a button */
.nav-link {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  text-align: left;
  padding: 12px 20px;
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.2s ease;
}

.nav-link:hover {
  background-color: var(--card);
  border-radius: 6px;
}

/* Left content inside nav-link (icon + label) */
.nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.submenu-arrow {
  margin-left: auto;
  font-size: 0.85rem;
  transition: transform 0.3s ease;
}

/* Optional: Rotate arrow when open */
.nav-link[aria-expanded="true"] .submenu-arrow {
  transform: rotate(180deg);
}

/* Chevron icon */
.submenu-arrow {
  font-size: 0.85rem;
  transition: transform 0.3s ease;
}

/* Rotate arrow when expanded */
.nav-link[aria-expanded="true"] .submenu-arrow {
  transform: rotate(180deg);
}

/* Sidebar Footer */
.sidebar-nav.sidebar-footer {
  margin-top: auto;
}
/* Hide sidebar footer on desktop */
@media (min-width: 768px) {
  .sidebar-nav.sidebar-footer {
    display: none;
  }
}

/* If sidebar-footer is hidden via media query, cancel it for this one */
.sidebar-footer.always-visible-footer {
  display: block !important;
}

/* Optional: ensure consistent spacing and border on all screen sizes */
.sidebar-footer.always-visible-footer {
  margin-top: auto;
  padding: 1rem 0;
  border-top: 1px solid #ddd;
}

.submenu .submenu-item a.active,
.submenu .submenu-item button.active {
  color: var(--primary);
  background-color: oklch(from var(--primary) l c h / 0.1);
  border-radius: 4px;
}

