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

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

.ContextMenu {
  &__container {
    align-items: center;
    display: flex;
    justify-content: center;
  }

  &__popper {
    @include mixins.module-composition-popper;
    & {
      margin: 0;
      padding-block: 6px;
      padding-inline: 0px;
      width: auto;
    }

    &--single-item {
      padding: 0;
    }
  }

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

  &__button {
    @include mixins.button-reset();
    &:focus {
      outline: none;
      @include mixins.keyboard-mode {
        @include mixins.axo-focus-ring;
      }
    }
  }

  &__option {
    @include mixins.button-reset();
    & {
      @include mixins.font-body-2;
      @include mixins.dark-theme {
        color: variables.$color-gray-05;
      }

      align-items: center;
      display: flex;
      justify-content: space-between;
      min-width: 150px;
      width: 100%;
    }

    &--container {
      display: flex;
      align-items: center;
      padding-block: 7px;
      padding-inline: 12px;
      &--with-selection {
        padding-inline-start: 8px;
        padding-inline-end: 24px;
        &::before {
          content: '';
          width: 16px;
          height: 16px;
          margin-inline-end: 8px;
        }
      }
      &--selected::before {
        @include mixins.light-theme {
          @include mixins.color-svg(
            '../images/icons/v3/check/check.svg',
            variables.$color-black
          );
        }
        @include mixins.dark-theme {
          @include mixins.color-svg(
            '../images/icons/v3/check/check.svg',
            variables.$color-white
          );
        }
      }
    }

    &--icon {
      height: 16px;
      margin-inline-end: 8px;
      width: 16px;
    }

    &--container--with-selection &--icon {
      margin-inline-end: 12px;
    }

    &--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 {
      outline: none;
      @include mixins.keyboard-mode {
        @include mixins.axo-focus-ring;
      }
    }
  }
  &__popper--single-item &__option--container {
    padding-block: 12px;
  }
  &__popper--single-item &__divider {
    border-style: solid;
    border-width: 0 0 1px 0;
    margin-top: 2px;
    margin-bottom: 2px;

    @include mixins.light-theme {
      border-color: variables.$color-gray-15;
    }

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