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

@use 'sass:color';
@use '../mixins';
@use '../variables';

.AudioCapture {
  display: flex;
  text-align: center;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  background: none;

  &__microphone {
    height: 32px;
    width: 32px;
    border-radius: 4px;
    text-align: center;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;
    border: none;

    @include mixins.keyboard-mode {
      &:focus {
        outline: 2px solid variables.$color-ultramarine;
      }
    }

    outline: none;

    &:before {
      content: '';
      display: inline-block;
      height: 20px;
      width: 20px;

      @include mixins.color-svg(
        '../images/icons/v3/mic/mic.svg',
        var(--color-label-primary)
      );
    }
  }

  &__recorder-button {
    flex-grow: 0;
    flex-shrink: 0;

    width: 32px;
    height: 32px;
    border-radius: 32px;
    opacity: 0.3;
    text-align: center;
    padding: 0;

    &:focus,
    &:hover {
      opacity: 1;
    }

    outline: none;

    .icon {
      display: inline-block;
      width: 24px;
      height: 24px;
      margin-bottom: -3px;
    }

    &--complete {
      background: color.adjust(variables.$color-accent-green, $lightness: 20%);
      border: 1px solid variables.$color-accent-green;

      .icon {
        @include mixins.color-svg(
          '../images/icons/v3/check/check.svg',
          variables.$color-accent-green
        );
      }
    }

    &--cancel {
      background: color.adjust(variables.$color-accent-red, $lightness: 20%);
      border: 1px solid variables.$color-accent-red;

      .icon {
        @include mixins.color-svg(
          '../images/icons/v3/x/x.svg',
          variables.$color-accent-red
        );
      }
    }
  }

  &__time {
    color: variables.$color-gray-60;
    font-variant: tabular-nums;
    line-height: 36px;
    margin-block: 0;
    margin-inline: 15px;

    @keyframes pulse {
      0% {
        opacity: 0;
      }
      50% {
        opacity: 1;
      }
      100% {
        opacity: 0;
      }
    }

    &::before {
      content: '';
      display: inline-block;
      border-radius: 10px;
      width: 10px;
      height: 10px;
      background: variables.$color-accent-red;
      margin-inline-end: 10px;
      opacity: 0;
      animation: pulse 2s infinite;
    }
  }
}
