.Trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding-inline: 1rem;
  padding-block: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.25rem;
  border-radius: 0.375rem;

  user-select: none;
  white-space: nowrap;
  transition:
    background 150ms,
    border-color 150ms,
    color 150ms;

  background: transparent;
  border: 1px solid var(--demo-border-emphasized);
  color: var(--demo-neutral-fg);

  &:is(:hover, [data-state='open']):not(:disabled, [data-disabled]) {
    background: var(--demo-neutral-subtle);
  }

  &:focus-visible {
    outline: 2px solid var(--demo-coral-focus-ring);
    outline-offset: -1px;
  }

  &:is(:disabled, [data-disabled]) {
    opacity: 0.5;
    filter: grayscale(100%);
  }
}

.Indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  & svg {
    width: 1rem;
    height: 1rem;
  }
}

.ContextTrigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 15rem;
  height: 12rem;
  font-size: 0.875rem;
  border: 1px dashed var(--demo-border-emphasized);
  border-radius: 0.375rem;
  user-select: none;
}

.Content {
  --arrow-size: 10px;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0.25rem;
  min-width: max(var(--reference-width), 10rem);
  max-height: min(var(--available-height, 300px), 300px);
  background: var(--demo-bg-popover);
  border: 1px solid var(--demo-border-emphasized);
  border-radius: 0.375rem;
  box-shadow: var(--demo-shadow-md);
  z-index: calc(var(--demo-popover-z-index) + var(--layer-index, 0));
  outline: none;
  transform-origin: var(--transform-origin);

  &[data-state='open'] {
    animation: scale-fade-in 0.15s ease-out;
  }

  &[data-state='closed'] {
    animation: scale-fade-out 0.1s ease-in;
  }
}

.Arrow {
  --arrow-background: var(--demo-bg-popover);
  --arrow-shadow-color: var(--demo-border-emphasized);
  z-index: -1;
}

.ArrowTip {
  border-top: 1px solid var(--demo-border-emphasized);
  border-left: 1px solid var(--demo-border-emphasized);
}

.ItemGroup {
  display: flex;
  flex-direction: column;

  & + & {
    margin-top: 0.5rem;
  }
}

.ItemGroupLabel {
  padding: 0.375rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--demo-neutral-emphasized);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.Item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2rem;
  padding-inline: 0.725rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  border-radius: 0.25rem;

  user-select: none;
  outline: none;
  color: var(--demo-neutral-fg);
  text-decoration: none;

  &[data-highlighted] {
    background: var(--demo-neutral-subtle);
  }

  &[data-disabled] {
    color: var(--demo-neutral-emphasized);

    opacity: 0.5;
  }
}

.TriggerItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  border-radius: 0.25rem;

  user-select: none;
  outline: none;

  &[data-highlighted] {
    background: var(--demo-neutral-subtle);
  }

  &::after {
    content: '›';
    font-size: 1rem;
    color: var(--demo-neutral-emphasized);
  }
}

.CheckboxItem,
.RadioItem {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  border-radius: 0.25rem;

  user-select: none;
  outline: none;

  &[data-highlighted] {
    background: var(--demo-neutral-subtle);
  }

  &[data-state='checked'] {
    color: var(--demo-coral-fg);
  }

  &[data-disabled] {
    color: var(--demo-neutral-emphasized);

    opacity: 0.5;
  }
}

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

.ItemIndicator {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--demo-coral-solid);
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;

  & svg {
    width: 0.875rem;
    height: 0.875rem;
  }
}

.Separator {
  height: 1px;
  margin-block: 0.25rem;
  border: 0;
  background: var(--demo-border);
}

.MessageList {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
  max-width: 24rem;
}

.MessageItem {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--demo-border);
  border-radius: 0.375rem;
}

.MessageContent {
  flex: 1;
  min-width: 0;
}

.MessageSender {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--demo-neutral-fg);
}

.MessagePreview {
  font-size: 0.75rem;
  color: var(--demo-neutral-emphasized);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.MessageAction {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border: none;
  border-radius: 0.25rem;
  background: transparent;
  color: var(--demo-neutral-emphasized);
  cursor: pointer;
  transition: background 150ms;

  & svg {
    width: 1rem;
    height: 1rem;
  }

  &:hover {
    background: var(--demo-neutral-subtle);
  }
}

@keyframes scale-fade-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes scale-fade-out {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.96);
  }
}
