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

@use '../mixins';
@use '../variables';

.IncomingCallBar {
  &__container {
    -webkit-app-region: no-drag;
    animation: IncomingCallBar--animation 0.2s forwards ease-out;
    position: fixed;
    top: 22px;
    user-select: none;
    width: 100%;
    z-index: variables.$z-index-calling;
    padding-inline: 1rem;
  }

  &__bar {
    -webkit-app-region: no-drag;
    align-items: center;
    background-color: variables.$color-gray-75;
    border-radius: 8px;
    display: flex;
    height: 70px;
    justify-content: space-between;
    margin-block: 0;
    margin-inline: auto;
    max-width: 600px;
    user-select: none;
    width: 100%;
  }

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

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

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

    &--name-header {
      @include mixins.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 mixins.font-body-2;
      color: #ffffff;
      display: -webkit-box;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }

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

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

    &__container {
      border-radius: 40px;
      height: 40px;
      margin-inline: 12px;
      width: 40px;
    }

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

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

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

      div {
        @include mixins.color-svg(
          '../images/icons/v3/video/video-slash-fill.svg',
          variables.$color-white
        );
        & {
          height: 24px;
          width: 24px;
        }
      }
    }

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

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

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

      div {
        @include mixins.color-svg(
          '../images/icons/v3/video/video-fill.svg',
          variables.$color-white
        );
        & {
          height: 24px;
          width: 24px;
        }
      }
    }

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

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

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

      div {
        @include mixins.color-svg(
          '../images/icons/v3/phone/phone-fill.svg',
          variables.$color-white
        );
        & {
          height: 24px;
          width: 24px;
        }
      }
    }

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

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

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

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

@keyframes IncomingCallBar--animation {
  from {
    transform: translateY(-100px);
    opacity: 0;
  }

  to {
    transform: translateY(0px);
    opacity: 1;
  }
}
