@use '../../partials/flex';
@use '../../partials/text';
@use '../../partials/dir';

.room-selector {
  @extend .cp-fx__row--s-c;

  border: 1px solid transparent;
  border-radius: var(--bo-radius);
  cursor: pointer;

  &--muted {
    opacity: 0.6;
  }

  &--unread {
    .room-selector__content > .text {
      color: var(--tc-surface-high);
    }
  }
  
  &--selected {
    background-color: var(--bg-surface);
    border-color: var(--bg-surface-border);

    & .room-selector__options {
      display: flex;
    }
  }

  @media (hover: hover) {
    &:hover {
      background-color: var(--bg-surface-hover);
      & .room-selector__options {
        display: flex;
      }
    }
  }
  &:focus-within {
    background-color: var(--bg-surface-hover);
    & button {
      outline: none;
    }
  }
  &:active {
    background-color: var(--bg-surface-active);
  }
  &--selected:hover,
  &--selected:focus,
  &--selected:active {
    background-color: var(--bg-surface);
  }
}

.room-selector__content {
  @extend .cp-fx__item-one;
  @extend .cp-fx__row--s-c;
  padding: 0 var(--sp-extra-tight);
  min-height: 40px;
  cursor: inherit;

  & > .avatar-container .avatar__border--active {
    box-shadow: none;
  }

  & > .text {
    @extend .cp-fx__item-one;
    @extend .cp-txt__ellipsis;
    margin: 0 var(--sp-extra-tight);

    color: var(--tc-surface-normal-low);
  }
}
.room-selector__options {
  @extend .cp-fx__row--s-c;
  @include dir.side(margin, 0, var(--sp-ultra-tight));
  display: none;

  &:empty {
    margin: 0 !important;
  }

  & .ic-btn {
    padding: 6px;
    border-radius: calc(var(--bo-radius) / 2);
  }
}