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

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

.MediaQualitySelector {
  &__popper {
    @include mixins.module-composition-popper;
    & {
      padding-block: 12px;
      padding-inline: 16px;
      width: auto;
    }
  }

  &__title {
    @include mixins.font-body-1-bold;
    margin-bottom: 12px;
  }

  &__button {
    @include mixins.button-reset();
    & {
      align-items: center;
      border-radius: 4px;
      display: flex;
      height: 32px;
      justify-content: center;
      width: 32px;
    }

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

    & {
      outline: none;
    }

    &::after {
      content: '';
      display: block;
      flex-shrink: 0;
      height: 20px;
      width: 20px;

      @include mixins.light-theme {
        @include mixins.color-svg(
          '../images/icons/v3/quality/quality-standard.svg',
          variables.$color-gray-75
        );
      }
      @include mixins.dark-theme {
        @include mixins.color-svg(
          '../images/icons/v3/quality/quality-standard.svg',
          variables.$color-gray-15
        );
      }
    }

    &--hq {
      &::after {
        @include mixins.light-theme {
          @include mixins.color-svg(
            '../images/icons/v3/quality/quality-high.svg',
            variables.$color-gray-75
          );
        }
        @include mixins.dark-theme {
          @include mixins.color-svg(
            '../images/icons/v3/quality/quality-high.svg',
            variables.$color-gray-15
          );
        }
      }
    }

    &--active {
      opacity: 1;

      @include mixins.light-theme() {
        background-color: variables.$color-gray-05;
      }

      @include mixins.dark-theme() {
        background-color: variables.$color-gray-75;
      }
    }
  }

  &__option {
    @include mixins.button-reset();

    & {
      align-items: center;
      border-radius: 6px;
      display: flex;
      height: 42px;
      margin-block: 2px;
      margin-inline: 0;
      min-width: 200px;
    }

    &--checkmark {
      height: 12px;
      margin-block: 0;
      margin-inline: 6px;
      width: 16px;
    }

    &--selected {
      @include mixins.color-svg(
        '../images/icons/v3/check/check-compact.svg',
        variables.$color-ultramarine
      );
    }

    &--title {
      @include mixins.font-body-2;
    }

    &--description {
      @include mixins.font-subtitle;
    }

    &:hover {
      @include mixins.light-theme() {
        background-color: variables.$color-gray-05;
      }

      @include mixins.dark-theme() {
        background-color: variables.$color-gray-65;
      }
    }

    &--focused,
    &:focus,
    &:active {
      border-radius: 6px;
      box-shadow: 0 0 1px 1px variables.$color-ultramarine;
      outline: none;
    }
  }
}
