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

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

.SendStoryModal {
  &__body {
    // force
    .module-Modal & {
      padding-bottom: 0;
    }
  }

  // Used to ensure that a set of spans reverse order under RTL
  &__rtl-span {
    display: inline-block;
  }

  // don't re-layout buttons on wrap,
  // since we have things beyond same-sized-rectangles in the footer
  .module-Modal__button-footer {
    &--one-button-per-line {
      flex-direction: row;
      align-items: center;
    }
  }

  .module-SearchInput__container {
    margin-inline: 0;
  }

  &__story-preview {
    height: 140px;
    width: 80px;
    border-radius: 12px;
    margin-block: 0 16px;
    margin-inline: auto;
    background-size: cover;
  }

  &__item--contact-or-conversation {
    height: 52px;
    padding-block: 0;
    padding-inline: 6px;
  }

  &__top-bar {
    align-items: center;
    display: flex;
    min-height: 40px;
    justify-content: space-between;
    user-select: none;
  }

  &__top-bar-title {
    flex: 1;
  }

  &__new-story {
    &__button {
      font-weight: 500;
      padding-block: 5px;
      padding-inline: 10px;
      &::before {
        @include mixins.color-svg(
          '../images/icons/v3/plus/plus.svg',
          variables.$color-white
        );
        & {
          content: '';
          height: 16px;
          width: 16px;
          margin-inline-end: 8px;
          display: inline-block;
          vertical-align: text-bottom;
        }
      }
    }

    &__option {
      padding: 10px;

      &--icon {
        margin-inline-end: 15px;
      }

      &--container {
        align-items: center;
      }

      &--description {
        color: variables.$color-gray-25;
      }
    }
  }

  &__icon {
    &--delete {
      @include mixins.color-svg(
        '../images/icons/v3/trash/trash.svg',
        variables.$color-white
      );
      & {
        height: 14px;
        width: 14px;
      }
    }

    &--custom {
      @include mixins.color-svg(
        '../images/icons/v3/stories/stories.svg',
        variables.$color-white
      );
      & {
        height: 16px;
        width: 16px;
      }
    }

    &--group {
      @include mixins.color-svg(
        '../images/icons/v3/group/group.svg',
        variables.$color-white
      );
      & {
        height: 16px;
        width: 16px;
      }
    }

    &--settings {
      @include mixins.color-svg(
        '../images/icons/v3/settings/settings.svg',
        variables.$color-white
      );
      & {
        height: 14px;
        width: 14px;
      }
    }
  }

  &__distribution-list-context {
    &__container {
      width: 100%;
    }

    &__button {
      align-items: center;
      display: flex;
      width: 100%;
    }
  }

  &__distribution-list {
    height: 52px;
    &__container {
      justify-content: space-between;
      padding-block: 8px;
      padding-inline: 0;
      user-select: none;
    }

    &__info {
      margin-inline-start: 8px;
    }

    &__label {
      align-items: center;
      display: flex;
      justify-content: flex-start;
      flex: 1;
    }

    &__name {
      @include mixins.font-body-1-bold;
      font-weight: 400;
    }

    &__description {
      @include mixins.font-body-2;
      font-size: 12px;
      color: variables.$color-gray-25;
    }

    &__checkbox {
      margin-inline-end: 0;
      position: relative;
    }

    &__checkbox input[type='checkbox'] {
      cursor: pointer;
      height: 0;
      position: absolute;
      width: 0;

      @include mixins.keyboard-mode {
        &:focus {
          &::before {
            border-color: variables.$color-ultramarine;
          }
          outline: none;
        }
      }

      &::before {
        @include mixins.rounded-corners;
        background: inherit;
        border: 1.5px solid variables.$color-gray-60;
        content: '';
        display: block;
        height: 20px;
        position: absolute;
        width: 20px;
      }

      &:checked {
        &::before {
          background: variables.$color-ultramarine;
          border: 1.5px solid variables.$color-ultramarine;
        }

        &::after {
          border: solid variables.$color-white;
          border-width: 0 2px 2px 0;
          content: '';
          display: block;
          height: 11px;
          inset-inline-start: 7px;
          position: absolute;
          top: 3px;
          transform: rotate(45deg);
          width: 6px;
        }
      }
    }
  }

  &__selected-lists {
    @include mixins.font-body-2;
    color: variables.$color-gray-15;
    padding-inline-end: 16px;
    user-select: none;
    flex: 1;
    display: flex;
    align-items: center;
    min-height: 32px;
  }

  &__ok {
    @include mixins.button-reset;
    & {
      @include mixins.rounded-corners;
      align-items: center;
      background: variables.$color-ultramarine;
      display: flex;
      height: 32px;
      justify-content: center;
      width: 32px;
    }

    &::disabled {
      background: variables.$color-gray-60;
    }

    &::after {
      @include mixins.color-svg(
        '../images/icons/v3/check/check.svg',
        variables.$color-white
      );
      & {
        content: '';
        height: 18px;
        width: 18px;
      }
    }
  }

  &__send {
    @include mixins.button-reset;
    & {
      @include mixins.rounded-corners;
      align-items: center;
      background: variables.$color-ultramarine;
      display: flex;
      height: 32px;
      justify-content: center;
      width: 32px;
    }

    &::disabled {
      background: variables.$color-gray-60;
    }

    &::after {
      @include mixins.color-svg(
        '../images/icons/v3/send/send-fill.svg',
        variables.$color-white
      );
      & {
        content: '';
        height: 18px;
        width: 18px;
      }
    }
  }

  // more specific to override StoryImage
  .SendStoryModal {
    &__story {
      border-radius: 12px;
      backdrop-filter: blur(45px);
      &__image {
        object-fit: contain;
      }
    }
  }
}
