.sidebar {
  height: 100%;
  width: 100%;
  padding: var(--mantine-spacing-md);
  display: flex;
  flex-direction: column;
  gap: var(--mantine-spacing-xs);
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--mantine-spacing-xs);
}

.title {
  margin: 0;
  font-weight: 600;
  font-size: var(--mantine-font-size-sm);
}

.searchInput {
  margin-bottom: var(--mantine-spacing-xs);
}

.chatList {
  flex: 1;
  overflow-y: auto;
}

.chatGroup + .chatGroup {
  margin-top: var(--mantine-spacing-sm);
}

.chatGroupLabel {
  margin: 0;
  padding: 4px var(--mantine-spacing-xs);
  font-size: var(--mantine-font-size-xs);
  font-weight: 600;
  color: var(--mantine-color-dimmed);
  user-select: none;
}

.chatListEmpty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--mantine-spacing-xl) var(--mantine-spacing-md);
  text-align: center;
  gap: 4px;
  user-select: none;
}

.chatListEmptyIcon {
  color: light-dark(var(--mantine-color-gray-5), var(--mantine-color-dark-3));
  margin-bottom: var(--mantine-spacing-xs);
}

.chatListEmptyTitle {
  font-size: var(--mantine-font-size-sm);
  font-weight: 600;
  color: light-dark(var(--mantine-color-gray-7), var(--mantine-color-dark-1));
}

.chatListEmptyHint {
  font-size: var(--mantine-font-size-xs);
  color: light-dark(var(--mantine-color-gray-6), var(--mantine-color-dark-3));
  line-height: 1.4;
}

.chatItem {
  display: flex;
  align-items: center;
  padding: 8px var(--mantine-spacing-xs);
  border-radius: var(--mantine-radius-sm);
  cursor: pointer;
  text-decoration: none;
  color: light-dark(var(--mantine-color-gray-7), var(--mantine-color-dark-1));
  font-size: var(--mantine-font-size-sm);
  user-select: none;
  gap: var(--mantine-spacing-xs);

  @mixin hover {
    background-color: light-dark(
      var(--mantine-color-gray-1),
      var(--mantine-color-dark-6)
    );
  }

  &[data-active] {
    background-color: light-dark(
      var(--mantine-color-gray-2),
      var(--mantine-color-dark-6)
    );
  }
}

.chatItemTitle {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chatItemDate {
  font-size: var(--mantine-font-size-xs);
  color: var(--mantine-color-dimmed);
  white-space: nowrap;
  transition: opacity 150ms;
}

.chatItemRenameInput {
  font-size: var(--mantine-font-size-sm);
  padding: 0;
  height: auto;
  min-height: 0;
  background: transparent;
  color: inherit;
}

.chatItem:hover .chatItemDate,
.chatItem:focus-within .chatItemDate {
  opacity: 0;
}

.chatItemActions {
  position: absolute;
  right: var(--mantine-spacing-xs);
  opacity: 0;
  transition: opacity 150ms;
}

.chatItem {
  position: relative;
}

.chatItem:hover .chatItemActions,
.chatItem:focus-within .chatItemActions {
  opacity: 1;
}

.chatItemActions :global(.mantine-ActionIcon-root):focus-visible {
  outline: 2px solid var(--mantine-primary-color-filled);
  outline-offset: 2px;
}
