// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only

.IncomingCallBar {
  &__container {
    animation: IncomingCallBar--animation 0.2s forwards ease-out;
    position: fixed;
    width: 100%;
    z-index: 2;
    padding: {
      left: 1rem;
      right: 1rem;
    }
  }

  &__bar {
    align-items: center;
    background-color: $color-gray-75;
    border-radius: 8px;
    display: flex;
    height: 70px;
    justify-content: space-between;
    margin: 0 auto;
    max-width: 600px;
    width: 100%;
  }

  &__conversation {
    align-items: center;
    display: flex;
    min-width: 0;

    &--avatar {
      margin-bottom: 8px;
      margin-left: 16px;
      margin-top: 8px;
      position: relative;
    }

    &--name {
      align-items: stretch;
      display: flex;
      flex-direction: column;
      margin-left: 12px;
      min-width: 0;
    }

    &--name-header {
      @include font-body-1-bold;
      color: #ffffff;
      overflow-x: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    &--message-text {
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      @include font-body-2;
      color: #ffffff;
      display: -webkit-box;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }

  &__actions {
    display: flex;
    margin-right: 16px;
  }

  &__button {
    align-items: center;
    border-radius: 40px;
    border: none;
    display: flex;
    height: 40px;
    justify-content: center;
    margin-left: 12px;
    margin-right: 12px;
    outline: none;
    width: 40px;

    &--accept-video-as-audio {
      background-color: $color-gray-45;

      @include keyboard-mode {
        &:focus {
          box-shadow: 0px 0px 0px 4px $color-ultramarine;
        }
      }

      @include mouse-mode {
        &:hover {
          box-shadow: 0px 0px 0px 2px $color-ultramarine;
        }
      }

      div {
        @include color-svg(
          '../images/icons/v2/video-off-solid-24.svg',
          $color-white
        );
        height: 24px;
        width: 24px;
      }
    }

    &--accept-video {
      background-color: $color-accent-green;

      @include keyboard-mode {
        &:focus {
          box-shadow: 0px 0px 0px 4px $color-ultramarine;
        }
      }

      @include mouse-mode {
        &:hover {
          box-shadow: 0px 0px 0px 2px $color-ultramarine;
        }
      }

      div {
        @include color-svg(
          '../images/icons/v2/video-solid-24.svg',
          $color-white
        );
        height: 24px;
        width: 24px;
      }
    }

    &--accept-audio {
      background-color: $color-accent-green;

      @include keyboard-mode {
        &:focus {
          box-shadow: 0px 0px 0px 4px $color-ultramarine;
        }
      }

      @include mouse-mode {
        &:hover {
          box-shadow: 0px 0px 0px 2px $color-ultramarine;
        }
      }

      div {
        @include color-svg(
          '../images/icons/v2/phone-right-solid-24.svg',
          $color-white
        );
        height: 24px;
        width: 24px;
      }
    }

    &--decline {
      background-color: $color-accent-red;

      @include keyboard-mode {
        &:focus {
          box-shadow: 0px 0px 0px 4px $color-ultramarine;
        }
      }

      @include mouse-mode {
        &:hover {
          box-shadow: 0px 0px 0px 2px $color-ultramarine;
        }
      }

      div {
        @include color-svg(
          '../images/icons/v2/phone-down-24.svg',
          $color-white
        );
        height: 24px;
        width: 24px;
      }
    }
  }
}

@keyframes IncomingCallBar--animation {
  from {
    top: -100px;
    opacity: 0;
  }

  to {
    top: 22px;
    opacity: 1;
  }
}
