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

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

.AvatarPreview {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;

  &__avatar {
    @include mixins.button-reset;
    & {
      align-items: center;
      border-radius: 100%;
      cursor: auto;
      display: flex;
      font-size: 32px;
      height: 80px;
      justify-content: center;
      margin-bottom: 16px;
      margin-top: 4px;
      position: relative;
      transition: background-color 100ms ease-out;
      user-select: none;
      width: 80px;
    }

    &--loading {
      background: variables.$color-black;
    }

    &--has-image {
      background-size: cover;
      background-position: center center;
    }

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

  &__group {
    -webkit-mask: url('../images/icons/v3/group/group.svg') no-repeat center;
    -webkit-mask-size: 70%;
    height: 100%;
    width: 100%;
  }

  &__note_to_self {
    -webkit-mask: url('../images/icons/v3/note/note.svg') no-repeat center;
    -webkit-mask-size: 70%;
    height: 100%;
    width: 100%;
  }

  &__upload {
    align-items: center;
    background: variables.$color-gray-02;
    border-radius: 100%;
    bottom: 4px;
    box-shadow:
      0px 4px 16px rgba(0, 0, 0, 0.12),
      0px 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    height: 28px;
    justify-content: center;
    position: absolute;
    inset-inline-end: -7px;
    width: 28px;

    &::after {
      @include mixins.color-svg(
        '../images/icons/v3/camera/camera.svg',
        variables.$color-black
      );
      & {
        content: '';
        display: block;
        height: 16px;
        width: 16px;
      }
    }
  }

  &__clear {
    @include mixins.button-reset;
    & {
      align-items: center;
      background-color: variables.$color-white;
      border-radius: 100%;
      box-shadow:
        0px 4px 16px rgba(0, 0, 0, 0.12),
        0px 2px 4px rgba(0, 0, 0, 0.2);
      display: flex;
      height: 24px;
      justify-content: center;
      position: absolute;
      inset-inline-end: 0;
      top: 0;
      width: 24px;
    }

    &:after {
      @include mixins.color-svg(
        '../images/icons/v3/x/x-compact.svg',
        variables.$color-gray-75
      );
      & {
        content: '';
        height: 16px;
        width: 16px;
      }
    }
  }
}
