@import '../../_variables.scss';
@import '../../_logical.scss';

.Notification {
  .emoji-picker {
    min-inline-size: 160%;
    inline-size: 150%;
    overflow: hidden;
    inset-inline-start: -70%;
    max-inline-size: 100%;
    @media (min-width: 800px) and (max-width: 1300px) {
      inset-inline-start: -50%;
      min-inline-size: 50%;
      max-inline-size: 130%;
    }
    @media (min-height: 800px) and (max-height: 1300px) {
      [class^=#{$writing-mode-vertical}] & {
        inset-inline-start: -50%;
        min-inline-size: 50%;
        max-inline-size: 130%;
      }
    }

    @media (max-width: 800px) {
      inset-inline-start: -10%;
      min-inline-size: 50%;
      max-inline-size: 130%;
    }
    @media (max-height: 800px) {
      [class^=#{$writing-mode-vertical}] & {
        inset-inline-start: -10%;
        min-inline-size: 50%;
        max-inline-size: 130%;
      }
    }
  }
}
.emoji-picker {
  display: flex;
  flex-direction: column;
  position: absolute;
  inset-inline-end: 0;
  inset-inline-start: 0;
  margin: 0 !important;
  z-index: 100;
  background-color: $fallback--bg;
  background-color: var(--popover, $fallback--bg);
  color: $fallback--link;
  color: var(--popoverText, $fallback--link);
  --lightText: var(--popoverLightText, $fallback--faint);
  --faint: var(--popoverFaintText, $fallback--faint);
  --faintLink: var(--popoverFaintLink, $fallback--faint);
  --lightText: var(--popoverLightText, $fallback--lightText);
  --icon: var(--popoverIcon, $fallback--icon);

  .keep-open,
  .too-many-emoji {
    padding: 7px;
    line-height: normal;
  }

  .too-many-emoji {
    display: flex;
    flex-direction: column;
  }

  .keep-open-label {
    padding-block: 0;
    padding-inline: 7px;
    display: flex;
  }

  .heading {
    margin-block-start: 10px;
    block-size: 4.8em;
  }

  .content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-block-size: 0px;
  }

  .emoji-tabs {
    flex-grow: 1;
  }

  .emoji-groups {
    min-block-size: 200px;
  }

  .additional-tabs {
    border-inline-start: 1px solid;
    border-inline-start-color: $fallback--icon;
    border-inline-start-color: var(--icon, $fallback--icon);
    padding-inline-start: 7px;
    flex: 0 0 auto;
  }

  .additional-tabs,
  .emoji-tabs {
    display: block;
    flex-wrap: nowrap;

    overflow: auto;
    inline-size: 100%;

    white-space: nowrap;

    &-item {
      vertical-align: top;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      inline-size: 32px;
      block-size: 32px;
      padding: .4em;
      cursor: pointer;

      img {
        max-inline-size: 100%;
        max-block-size: 100%;
        object-fit: contain;
      }

      span {
        font-size: 1.9em;
      }

      &.disabled {
        opacity: 0.5;
        pointer-events: none;
      }

      &.active {
        border-block-end: 4px solid;

        svg {
          color: $fallback--lightText;
          color: var(--lightText, $fallback--lightText);
        }
      }
      .fa-sticky-note {
        font-size: 2em;
      }
    }
  }

  .sticker-picker {
    flex: 1 1 auto
  }

  .stickers,
  .emoji {
    &-content {
      display: flex;
      flex-direction: column;
      flex: 1 1 auto;
      min-block-size: 0;

      &.hidden {
        opacity: 0;
        pointer-events: none;
        position: absolute;
      }
    }
  }

  .emoji {
    &-search {
      padding: 5px;
      flex: 0 0 auto;

      input {
        inline-size: 100%;
      }
    }

    &-groups {
      flex: 1 1 1px;
      position: relative;
      overflow: auto;
      user-select: none;
      mask: linear-gradient(to top, white 0, transparent 100%) bottom no-repeat,
            linear-gradient(to bottom, white 0, transparent 100%) top no-repeat,
            linear-gradient(to top, white, white);
      transition: mask-size 150ms;
      mask-size: 100% 20px, 100% 20px, auto;
      // Autoprefixed seem to ignore this one, and also syntax is different
      -webkit-mask-composite: xor;
      mask-composite: exclude;

      .#{$writing-mode-vertical}lr & {
        mask: linear-gradient(to left, white 0, transparent 100%) right no-repeat,
              linear-gradient(to right, white 0, transparent 100%) left no-repeat,
              linear-gradient(to left, white, white);
        mask-size: 20px 100%, 20px 100%, auto;
        mask-composite: exclude;
      }
      .#{$writing-mode-vertical}rl & {
        mask: linear-gradient(to right, white 0, transparent 100%) left no-repeat,
              linear-gradient(to left, white 0, transparent 100%) right no-repeat,
              linear-gradient(to right, white, white);
        mask-size: 20px 100%, 20px 100%, auto;
        mask-composite: exclude;
      }
      &.scrolled {
        &-top {
          mask-size: 100% 20px, 100% 0, auto;
          [class^=#{$writing-mode-vertical}] & {
            mask-size: 20px 100%, 0 100%, auto;
          }
        }
        &-bottom {
          mask-size: 100% 0, 100% 20px, auto;
          [class^=#{$writing-mode-vertical}] & {
            mask-size: 0 100%, 20px 100%, auto;
          }
        }
      }
    }

    &-group {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      padding-inline-start: 5px;
      justify-content: start;

      &-title {
        font-size: 0.85em;
        inline-size: 100%;
        margin: 0;

        &.disabled {
          display: none;
        }
      }
    }

    &-item {
      inline-size: 32px;
      block-size: 32px;
      box-sizing: border-box;
      display: flex;
      font-size: 32px;
      align-items: center;
      justify-content: center;
      margin: 4px;

      cursor: pointer;

      img {
        object-fit: contain;
        max-inline-size: 100%;
        max-block-size: 100%;
      }
    }

  }

}
