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

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

.ContactModal {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-top: 4px;
  margin-bottom: 24px;
  padding-inline: 24px;

  &__name {
    @include mixins.button-reset();
    & {
      @include mixins.font-title-1;
      font-weight: 400;
      display: flex;
      flex-direction: row;
      align-items: baseline;
      max-width: 100%;

      margin-top: 12px;
      cursor: pointer;
    }
  }

  &__name__text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  &__name__contact-icon {
    height: 22px;
    width: 22px;
    @include mixins.any-theme {
      background-color: currentColor;
    }
  }

  &__name__chevron {
    flex-shrink: 0;

    display: inline-block;
    height: 20px;
    width: 20px;

    // Align with the text
    position: relative;
    inset-block-start: 2px;

    @include mixins.light-theme {
      @include mixins.color-svg(
        '../images/icons/v3/chevron/chevron-right-bold.svg',
        variables.$color-gray-90
      );
    }
    @include mixins.dark-theme {
      @include mixins.color-svg(
        '../images/icons/v3/chevron/chevron-right-bold.svg',
        variables.$color-gray-05
      );
    }
  }

  &__info {
    text-align: center;
    max-width: 248px;
    margin-top: 8px;
  }

  &__button-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-top: 12px;
    width: 100%;
  }

  &__button {
    @include mixins.button-reset;
    & {
      display: flex;
      align-items: center;
      padding-block: 6px;
      width: 100%;
    }

    &:last-child {
      margin-bottom: 0;
    }

    &:hover {
      background-color: variables.$color-gray-02;

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

    &:focus {
      @include mixins.keyboard-mode {
        background-color: variables.$color-gray-02;
      }

      @include mixins.dark-keyboard-mode {
        background-color: variables.$color-gray-80;
      }
    }
  }

  &__bubble-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-inline-end: 12px;
    width: 20px;
  }

  &__nickname__bubble-icon {
    height: 20px;
    width: 20px;

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

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

  &__send-message__bubble-icon {
    height: 20px;
    width: 20px;

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

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

  &__safety-number__bubble-icon {
    height: 20px;
    width: 20px;

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

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

  &__block__bubble-icon {
    height: 20px;
    width: 20px;

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

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

  &__make-admin__bubble-icon {
    height: 20px;
    width: 20px;

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

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

  &__add-to-another-group__bubble-icon {
    height: 20px;
    width: 20px;

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

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

  &__remove-from-group__bubble-icon {
    height: 20px;
    width: 20px;

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

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

  &__official-badge,
  &__official-badge__large {
    display: inline-block;
    position: relative;

    &::before,
    &::after {
      content: '';
      display: block;
      position: absolute;
    }

    // white background behind the icon
    &::before {
      top: 2px;
      inset-inline-start: 2px;
      width: 10px;
      height: 10px;
      border-radius: 5px;
      background: variables.$color-white;
    }
  }

  &__official-badge {
    height: 14px;
    margin-inline-start: 4px;
    width: 14px;

    &::after {
      top: 0;
      inset-inline-start: 0;
      width: 100%;
      height: 100%;
      @include mixins.color-svg(
        '../images/icons/v3/official/official-compact.svg',
        variables.$color-ultramarine
      );
    }
  }

  &__official-badge__large {
    height: 24px;
    margin-inline-start: 9px;
    width: 24px;

    &::before {
      top: 4px;
      inset-inline-start: 4px;
      width: 16px;
      height: 16px;
      border-radius: 8px;
    }

    &::after {
      top: 0;
      inset-inline-start: 0;
      width: 100%;
      height: 100%;
      @include mixins.color-svg(
        '../images/icons/v3/official/official.svg',
        variables.$color-ultramarine
      );
    }
  }

  &__quick-actions {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 16px;

    margin-block: 16px;
  }

  &__divider {
    width: 100%;

    border-style: solid;
    border-bottom: none;
    border-width: 1px;

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

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

    & {
      margin-block: 8px 5px;
    }
  }
}
