/*
 * https://github.com/morethanwords/tweb
 * Copyright (C) 2019-2021 Eduard Kuzmenko
 * https://github.com/morethanwords/tweb/blob/master/LICENSE
 */

@keyframes scaleIn {
  0% {
    transform: scale(.2);
  }

  to {
    transform: scale(1);
  }
}

.selector {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;

  &-search-container {
    flex: 0 0 auto;
    //flex: 1 1 auto;
    position: relative;
    max-height: 132px;
    overflow: hidden;

    .scrollable {
      position: relative;
      max-height: inherit; // fix safari
    }
  }

  &-search {
    padding: 0 24px 0 24px;
    display: flex;
    flex-flow: wrap;
    position: relative;

    &-input {
      border: none;
      outline: none;
      flex: 1 1 auto;
    }

    // ! only in this container need this padding
    .selector-search-input {
      padding: 7px 0px 19px 0px;
    }
  }

  &-user {
    color: var(--primary-text-color);
    background-color: var(--light-secondary-text-color);
    font-size: 16px;
    padding: 0 17px 0px 0px;
    line-height: 31px;
    margin-left: -4px;
    margin-right: 12px;
    height: 32px;
    margin-bottom: 7px;
    border-radius: 24px;
    user-select: none;
    flex: 0 0 auto;
    transition: .2s opacity, .2s transform, .2s background-color;
    max-width: 10rem;

    @include text-overflow();

    body.animation-level-0 & {
      transition: none;
    }

    @include hover() {
      background-color: var(--light-danger-color);
      cursor: pointer;

      .selector-user-avatar:after {
        opacity: 1;
        transform: scaleX(-1) rotate(-90deg);
      }
    }

    body:not(.animation-level-0) & {
      &.scale-in {
        animation: scaleIn .15s ease forwards;
      }
  
      &.scale-out {
        animation: scaleIn .1s ease forwards;
        animation-direction: reverse;
      }
    }

    &-avatar {
      float: left;
      margin-right: 8px;
      overflow: hidden;
      position: relative;
      
      html.is-safari & {
        -webkit-mask-image: -webkit-radial-gradient(circle, white 100%, black 100%); // fix safari overflow
      }

      &:after {
        position: absolute;
        content: $tgico-close;
        left: 0;
        top: 0;
        background-color: var(--danger-color);
        height: 100%;
        width: 100%;
        z-index: 2;
        font-size: 23px;
        line-height: 32px !important;
        opacity: 0;
        transition: .2s opacity, .2s transform;
        transform: scaleX(-1) rotate(0deg);

        body.animation-level-0 & {
          transition: none;
        }
      }
    }
  }

  .chatlist-container {
    height: 100%;
    flex: 1 1 auto;

    .scrollable > :first-child {
      margin-top: .5rem;
    }
  }

  .chatlist {
    li {
      padding-top: .75rem;
      padding-bottom: .75rem;

      @include respond-to(handhelds) {
        height: 66px;
        padding-top: 9px;
        padding-bottom: 9px;
      }
    }

    .user-caption {
      padding-left: .75rem;
      padding-right: 0;
    }

    p {
      height: 24px !important;
    }
    
    span.user-last-message {
      font-size: 14px;
    }
  }

  > hr {
    margin: 0;
    padding: 0;
  }

  .checkbox {
    margin-top: 11px;
    padding-left: 11px;
  }

  .checkbox-field {
    margin: 0;
    padding: 0;
    transform: translateY(-50%);
    top: 50%;

    &:first-child {
      margin-right: 1.6875rem;
      margin-left: .6875rem;
    }
  }

  .checkbox-field-round {
    pointer-events: none;
    position: absolute;
    right: 1.125rem;
    --size: 1.25rem;

    .checkbox-box-border {
      z-index: unset;
    }

    .checkbox-box-check {
      --offset: 6px;
    }
  }
}
