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

.room-view {
  &__typing {
    display: flex;
    padding: var(--sp-ultra-tight) var(--sp-normal);
    background: var(--bg-surface);
    transition: transform 200ms ease-in-out;

    & b {
      color: var(--tc-surface-high);
    }

    & .text {
      @extend .cp-txt__ellipsis;
      @extend .cp-fx__item-one;

      margin: 0 var(--sp-tight);
    }

    &--open {
      transform: translateY(-99%);
      box-shadow: 0 4px 0 0 var(--bg-surface);
      & .bouncing-loader {
        & > *,
        &::after,
        &::before {
          animation: bouncing-loader 0.6s infinite alternate;
        }
      }
    }
  }

  .bouncing-loader {
    transform: translateY(2px);
    margin: 0 calc(var(--sp-ultra-tight) / 2);
  }
  .bouncing-loader > div,
  .bouncing-loader::before,
  .bouncing-loader::after {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--tc-surface-high);
    border-radius: 50%;
  }
  
  
  .bouncing-loader::before,
  .bouncing-loader::after {
    content: "";
  }
  
  .bouncing-loader > div {
    margin: 0 4px;
  }
  
  .bouncing-loader > div {
    animation-delay: 0.2s;
  }
  
  .bouncing-loader::after {
    animation-delay: 0.4s;
  }
  
  @keyframes bouncing-loader {
    to {
      opacity: 0.1;
      transform: translate3d(0, -4px, 0);
    }
  }

  &__STB,
  &__unread {
    overflow: hidden;
    background-color: var(--bg-surface-low);
    border-radius: var(--bo-radius);

    & button {
      justify-content: flex-start;
      border-radius: 0;
      box-shadow: none;
      padding: 6px var(--sp-tight);
      & .ic-raw {
        width: 16px;
        height: 16px;
      }
    }
  }

  &__STB {
    position: absolute;
    @include dir.prop(left, 50%, unset);
    @include dir.prop(right, unset, 50%);
    bottom: 0;
    box-shadow: var(--bs-surface-border);
    transition: transform 200ms ease-in-out;
    transform: translate(-50%, 100%);

    &--open {
      transform: translate(-50%, -28px);
    }
  }

  &__unread {
    position: absolute;
    top: var(--sp-extra-tight);
    @include dir.prop(left, var(--sp-normal), unset);
    @include dir.prop(right, unset, var(--sp-normal));
    z-index: 999;

    display: none;
    width: calc(100% - var(--sp-extra-loose));
    box-shadow: 0 0 2px 0 rgba(0, 0, 0, 20%);

    &--open {
      display: flex;
    }
    & button:first-child {
      @extend .cp-fx__item-one;
    }
  }
}