/* =========================
   Profile item
   Figma: Profile.
   Horizontal rounded action row: avatar/icon, title, trailing chevron.
========================= */

@use "sass:color";
@use "../kit-deps" as *;

.profile-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: $space-4;
  width: 100%;
  padding: $space-4 $space-5;
  border: $border-width-base $border-style-base $neutral-200;
  border-radius: $radius-xl;
  background-color: $neutral-0;
  color: $neutral-900;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color $motion-base $motion-ease,
    border-color $motion-base $motion-ease,
    color $motion-base $motion-ease;

  &:hover:not(.is-danger):not(:disabled),
  &.is-active {
    background-color: $mint-50;
    border-color: rgba($mint-500, 0.5);
  }

  &:focus-visible {
    @include focus_ring;
    outline-offset: 2px;
  }

  &:disabled,
  &.is-disabled {
    opacity: 0.6;
    cursor: not-allowed;
  }

  &.is-danger {
    border-color: rgba($danger-text, 0.2);
    background-color: $neutral-0;
    color: $danger-text;

    .profile-item__icon {
      background-color: rgba($danger-text, 0.08);
      color: $danger-text;
    }

    &:hover:not(:disabled) {
      background-color: rgba($danger-text, 0.06);
      border-color: rgba($danger-text, 0.3);
    }
  }

  &__main {
    display: flex;
    align-items: center;
    gap: $space-4;
    min-width: 0;
  }

  &__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: $radius-full;
    background-color: $neutral-100;
    color: $neutral-700;

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

    img {
      width: 100%;
      height: 100%;
      border-radius: inherit;
      object-fit: cover;
    }
  }

  &__content {
    display: flex;
    flex-direction: column;
    gap: $space-1;
    min-width: 0;
  }

  &__title {
    margin: 0;
    font-size: $font-size-md;
    font-weight: $font-weight-regular;
    line-height: $line-height-tight;
    color: currentColor;
  }

  &__meta {
    color: $neutral-500;
    font-size: $font-size-sm;
    line-height: $line-height-tight;
  }

  &__chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    color: $color-secondary;
  }
}
