@layer cinder.tokens, cinder.foundation, cinder.components, cinder.utilities;
@layer cinder.components {
  .cinder-chat-conversation-list {
    display: block;
  }

  .cinder-chat-conversation-list__items {
    display: flex;
    flex-direction: column;
    gap: var(--cinder-space-1);
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .cinder-chat-conversation-list__item {
    list-style: none;
  }

  .cinder-chat-conversation-list__button {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: var(--cinder-space-0-5) var(--cinder-space-2);
    align-items: start;
    width: 100%;
    min-height: 3.25rem;
    padding: var(--cinder-space-2) var(--cinder-space-3);
    text-align: start;
    color: var(--cinder-text);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--cinder-radius-md);
  }

  .cinder-chat-conversation-list__button[data-cinder-conversation-interactive] {
    cursor: pointer;
  }

  .cinder-chat-conversation-list__button[data-cinder-conversation-selected] {
    background: var(--cinder-surface-raised);
    border-color: var(--cinder-border);
  }

  @media (hover: hover) {
    .cinder-chat-conversation-list__button[data-cinder-conversation-interactive]:hover {
      background: var(--cinder-surface-hover);
    }
  }

  .cinder-chat-conversation-list__button[data-cinder-conversation-interactive]:focus-visible {
    outline: var(--cinder-ring-width) solid transparent;
    box-shadow: var(--_cinder-focus-ring-shadow);
  }

  @media (forced-colors: active) {
    .cinder-chat-conversation-list__button[data-cinder-conversation-interactive]:focus-visible {
      outline: var(--cinder-ring-width) solid ButtonText;
      /* ButtonText is correct here: this is a button/navigation control using
         aria-current="page" (page-nav semantics, not aria-selected list-selection).
         Highlight/HighlightText would be wrong — those are for selected listbox items.
         3px separates the ring from ButtonBorder, which renders in forced-colors
         mode on all button elements regardless of their standard-mode border color. */
      outline-offset: 3px;
      box-shadow: none;
    }
  }

  .cinder-chat-conversation-list__title {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    overflow: hidden;
    font-weight: var(--cinder-font-medium);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .cinder-chat-conversation-list__preview {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    overflow: hidden;
    color: var(--cinder-text-muted);
    font-size: var(--cinder-text-sm);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .cinder-chat-conversation-list__badge {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    justify-self: end;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    min-height: 1.5rem;
    inline-size: max-content;
    max-inline-size: max-content;
    padding-inline: var(--cinder-space-1);
    color: var(--cinder-accent-text);
    background: color-mix(in oklch, var(--cinder-accent), transparent 88%);
    border-radius: var(--cinder-radius-full);
    font-size: var(--cinder-text-xs);
    font-weight: var(--cinder-font-medium);
  }

  .cinder-chat-conversation-list__empty {
    margin: 0;
    color: var(--cinder-text-muted);
    font-size: var(--cinder-text-sm);
  }

  .cinder-chat-conversation-list .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}
