.sidebar {
  display: flex;
  flex-direction: column;
  width: 200px;
  border-right: 1px solid var(--color-border);
  background: var(--color-bg-root);
  transition: width 150ms ease;
  overflow: hidden;
}

.collapsed {
  width: 52px;

  .top {
    padding-top: 38px;
    justify-content: center;
  }

  .collapseBtn {
    position: static;
  }

  .navItem {
    justify-content: center;
    padding: var(--spacing-1-5);
  }

  .bottom {
    padding: var(--spacing-2) var(--spacing-1);
  }
}

.top {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: calc(var(--spacing-8) + var(--spacing-1-5)) var(--spacing-2) var(--spacing-2);
  -webkit-app-region: drag;
}

.logo {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.logoClickable {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  opacity: 0.7;
  cursor: pointer;
  -webkit-app-region: no-drag;
  transition: opacity 200ms ease;

  &:hover {
    opacity: 1;
  }
}

.logoWordmark {
  height: 20px;
  width: auto;
  flex-shrink: 0;
  cursor: pointer;
  -webkit-app-region: no-drag;
  opacity: 0.85;
  transition: opacity 200ms ease;

  &:hover {
    opacity: 1;
  }
}

.collapseBtn {
  -webkit-app-region: no-drag;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-text-tertiary);
  cursor: pointer;
  position: absolute;
  right: 8px;

  &:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-secondary);
  }
}

.nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-1) var(--spacing-2);
  -webkit-app-region: no-drag;

  &::-webkit-scrollbar {
    width: 4px;
  }

  &::-webkit-scrollbar-track {
    background: transparent;
  }

  &::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 2px;
  }
}

.category {
  margin-bottom: 8px;
}

.categoryLabel {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--spacing-1) var(--spacing-2);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
}

.navItem {
  -webkit-app-region: no-drag;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: var(--spacing-1-5) var(--spacing-2);
  border-radius: var(--radius-md);
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-size: var(--font-size-base);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  transition: background var(--duration-fast) var(--ease-default),
    color var(--duration-fast) var(--ease-default);

  &:hover {
    background: var(--color-bg-hover);
  }

  &:focus-visible {
    outline: 2px solid var(--color-border-hover);
    outline-offset: -2px;
  }
}

.navItemActive {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.iconWrap {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}

.label {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  flex: 1;
}

.checkmark {
  position: absolute;
  top: -3px;
  right: -3px;
  background: transparent;
  border-radius: 50%;
  flex-shrink: 0;
}

.divider {
  height: 1px;
  background: var(--color-border);
  margin: 10px 8px 4px;
}

.bottom {
  margin-top: auto;
  padding: var(--spacing-2);
}

.updateLabel {
  margin-left: auto;
  padding: var(--spacing-half) var(--spacing-2);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-base);
  white-space: nowrap;
  line-height: 1.4;
}

.updateBadge {
  position: absolute;
  top: -4px;
  right: -4px;
  color: var(--color-accent);

  svg {
    width: 10px;
    height: 10px;
  }
}

.collapsedLogo {
  display: flex;
  justify-content: center;
  padding-top: var(--spacing-2);
}

/* Dev Panel button */
.devItem {
  background: color-mix(in srgb, var(--color-dev-accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-dev-accent) 20%, transparent);
  color: color-mix(in srgb, var(--color-dev-accent) 70%, var(--color-text-secondary));

  &:hover {
    background: color-mix(in srgb, var(--color-dev-accent) 15%, transparent);
    border-color: color-mix(in srgb, var(--color-dev-accent) 30%, transparent);
  }
}

.devItemActive {
  background: color-mix(in srgb, var(--color-dev-accent) 18%, transparent);
  border-color: color-mix(in srgb, var(--color-dev-accent) 35%, transparent);
  color: color-mix(in srgb, var(--color-dev-accent) 85%, var(--color-text-primary));
}

.warningDot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-error);
}

.devHidden {
  filter: blur(3px);
  opacity: 0.15;
  pointer-events: none;
  user-select: none;
}

.devOverrideDot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-error);
}

.devOverrideLabel {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-error);
  margin-left: auto;
}

.updateLabel {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-accent);
  margin-left: auto;
}

.updateBadge {
  position: absolute;
  top: -4px;
  right: -4px;
  color: var(--color-accent);

  svg {
    width: 10px;
    height: 10px;
  }
}
