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

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

.StoryViewsNRepliesModal {
  min-width: 320px;
  max-height: 80vh;

  &--group {
    min-height: min(400px, 80vh);

    .StoryViewsNRepliesModal__content {
      display: flex;
      flex-direction: column;
      flex: 1;
    }
  }

  &__body {
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  &__body_inner {
    display: flex;
    flex-direction: column;
    flex: 1;
  }

  &__content {
    &:not(:has(.Tabs)) {
      padding-block-start: 16px;
    }

    // When picking from full emoji set, compensate for for hidden quick picker
    &:has(.module-emoji-picker)::before {
      content: '';
      display: block;
      height: 52px;
    }

    padding-block-end: 16px;
    padding-inline: 16px;
  }

  &__replies {
    flex: 1;
    margin-block: 0;
    margin-inline: -16px;

    &--none {
      align-items: center;
      color: variables.$color-gray-45;
      display: flex;
      flex: 1;
      justify-content: center;
      padding-block: 80px;
      padding-inline: 0;
      user-select: none;
    }
  }

  &__overlay-container {
    align-items: flex-end;
    justify-content: flex-end;
  }

  &__compose-container {
    display: flex;
    align-items: center;
  }

  &__composer {
    flex: 1;
    margin-top: 6px;
  }

  &__emoji-button {
    height: 24px;
    margin-inline-start: 10px;
    width: 24px;

    &::after {
      @include mixins.dark-theme {
        @include mixins.color-svg(
          '../images/icons/v3/emoji/emoji.svg',
          variables.$color-white
        );
      }
    }
  }

  &__not-a-member {
    margin-block: 24px 8px;
    margin-inline: 4px;
    font-size: 12px;
    text-align: center;
    color: variables.$color-gray-25;
  }

  &__input {
    &__input {
      // For specificity because StoryViewsNRepliesModal is always in dark-theme
      @include mixins.dark-theme {
        background: variables.$color-gray-75;
        border: 1px solid variables.$color-gray-75;
        color: variables.$color-white;
      }

      .ql-editor.ql-blank::before {
        color: variables.$color-gray-25;
      }

      display: flex;
      align-items: center;
      min-height: 36px;

      &--with-children {
        flex: 1;
      }

      .quill {
        flex: 1;
      }
    }
  }

  &__view {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-block: 8px;
    margin-inline: 0;

    &--name {
      @include mixins.font-body-2;
      margin-inline-start: 12px;
    }

    &--timestamp {
      @include mixins.font-body-2;
      color: variables.$color-gray-45;
    }
  }

  &__reply {
    align-items: flex-end;
    display: flex;
    padding-bottom: 12px;

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

    &--timestamp {
      @include mixins.font-subtitle;
      color: variables.$color-gray-25;
      margin-inline-start: 6px;
    }
  }

  &__reaction {
    align-items: center;
    display: flex;
    justify-content: space-between;
    padding-block: 12px;
    padding-inline: 16px;

    &--container {
      display: flex;
    }

    &--body {
      margin-inline-start: 20px;
    }
  }

  &__message-bubble {
    background: variables.$color-gray-75;
    border-radius: 18px;
    margin-inline-start: 8px;
    padding-block: 7px;
    padding-inline: 12px;

    &--doe {
      background: none;
      border: 1px solid variables.$color-gray-75;
    }
  }

  &__quote {
    &__container {
      margin-block: 8px;
      margin-inline: 0;
      margin-inline-end: 38px;
    }

    &--outgoing-ultramarine {
      @include mixins.dark-theme {
        background-color: variables.$color-gray-60;
        background-image: none;
      }
    }

    &__primary {
      min-height: 64px;

      color: variables.$color-gray-05;
      font-size: 12px;
      font-weight: 400;
      &__author,
      &__text {
      }
    }

    &__icon-container {
      flex: 0 0 40px;
      height: 64px;
      width: 40px;
    }
  }

  &__debugger__button {
    color: variables.$color-gray-25;
    display: block;
    font-weight: 600;
    height: auto;
    opacity: 1;
    width: auto;

    &--active {
      @include mixins.dark-theme {
        background: inherit;
      }
    }

    &::after {
      display: none;
    }

    &__text {
      font-weight: normal;
    }
  }

  &__copy-icon {
    @include mixins.color-svg(
      '../images/icons/v3/copy/copy.svg',
      variables.$color-white
    );
  }

  &__read-receipts-off {
    color: variables.$color-gray-25;
    margin-block: 160px;
    margin-inline: 16px;
  }

  .module-ReactionPickerPicker {
    background: inherit;
    border: none;
    box-shadow: none;
    justify-content: space-between;
    width: 100%;
  }

  .module-emoji-picker {
    position: absolute;
    bottom: 55px;
    max-height: calc(100vh - 100px);
  }
}

.Tabs.StoryViewsNRepliesModal__tabs {
  position: sticky;
  top: 0;
  z-index: variables.$z-index-base;
  padding-block: 16px;
  background: variables.$color-gray-80;
  border-bottom: none;
  justify-content: center;
}

.Tabs__tab.StoryViewsNRepliesModal__tabs__tab {
  @include mixins.font-body-1-bold;
  padding-block: 4px;
  padding-inline: 12px;
  margin-block: 0;
  margin-inline: 12px;
}

.Tabs__tab--selected.StoryViewsNRepliesModal__tabs__tab--selected {
  background: variables.$color-gray-65;
  border-radius: 24px;
  border-bottom: none;
}
