@keyframes shine {
  to {
    transform: translateX(100%);
  }
}

.picmo-picker.picker {
  --border-radius: 5px;
  --emoji-area-height: calc(
    (var(--row-count) * var(--emoji-size) * var(--emoji-size-multiplier)) + var(--category-name-height)
  );
  --content-height: var(--emoji-area-height);
  --emojis-per-row: 8;
  --row-count: 6;
  --emoji-preview-margin: 4px;
  --emoji-preview-height: calc(var(--emoji-preview-size) + 1em + 1px);
  --emoji-preview-height-full: calc(var(--emoji-preview-height) + var(--emoji-preview-margin));
  --emoji-preview-size: 2.75em;
  --emoji-size: 2rem;
  --emoji-size-multiplier: 1.3;
  --content-margin: 8px;
  --category-tabs-height: calc(1.5em + 4px + 4px + 1px);
  --category-tabs-offset: 8px;
  --category-tab-size: 1.2rem;
  --category-name-height: 2rem;
  --category-name-padding-y: 6px;
  --search-height: 2em;
  --search-margin: 0.5em;
  --search-margin-bottom: 4px;
  --search-height-full: calc(var(--search-height) + var(--search-margin) + var(--search-margin-bottom));
  --overlay-background-color: rgba(0, 0, 0, 0.8);
  --emoji-font: 'Segoe UI Emoji', 'Segoe UI Symbol', 'Segoe UI', 'Apple Color Emoji', 'Twemoji Mozilla',
    'Noto Color Emoji', 'EmojiOne Color', 'Android Emoji';
  --ui-font: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --ui-font-size: 16px;
  --picker-width: calc(var(--emojis-per-row) * var(--emoji-size) * var(--emoji-size-multiplier) + 2.75rem);

  background: var(--background-color);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  font-family: var(--ui-font);
  font-size: var(--ui-font-size);
  overflow: hidden;
  position: relative;
  width: var(--picker-width);

  display: grid;
  gap: 8px;

  & > * {
    font-family: var(--ui-font);
  }
}

.picmo-picker.skeleton {
  background: var(--background-color);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  font-family: var(--ui-font);
  width: var(--picker-width);
  color: var(--secondary-text-color);

  & * {
    box-sizing: border-box;
  }

  & .placeholder {
    background: var(--placeholder-background-color);
    position: relative;
    overflow: hidden;

    &::after {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      transform: translateX(-100%);
      background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.2) 20%,
        rgba(255, 255, 255, 0.5) 60%,
        rgba(255, 255, 255, 0) 100%
      );
      animation: shine 2s infinite;
      content: '';
    }
  }

  & .headerSkeleton {
    background-color: var(--secondary-background-color);
    padding-top: 8px;
    padding-bottom: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    width: var(--picker-width);
  }

  & .searchSkeleton {
    padding: 0 8px;
    height: var(--search-height);

    & .searchInput {
      width: 100%;
      height: 28px;
      border-radius: 3px;
    }
  }

  & .categoryTabsSkeleton {
    height: var(--category-tabs-height);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-self: center;
    width: calc(2rem * var(--category-count, 1));

    & .categoryTab {
      width: 25px;
      height: 25px;
      padding: 2px;
      border-radius: 5px;
      margin: 0.25em;
    }
  }

  & .contentSkeleton {
    height: var(--content-height);
    padding-right: 8px;
    opacity: 0.7;

    & .categoryName {
      width: 50%;
      height: 1rem;
      margin: 0.5rem;
      box-sizing: border-box;
    }

    & .emojiGrid {
      display: grid;
      justify-content: space-between;
      gap: 1px;
      padding: 0 0.5em;
      grid-template-columns: repeat(var(--emojis-per-row), calc(var(--emoji-size) * var(--emoji-size-multiplier)));
      grid-auto-rows: calc(var(--emoji-size) * var(--emoji-size-multiplier));
      align-items: center;
      justify-items: center;
      width: var(--picker-width);

      & .emoji {
        width: var(--emoji-size);
        height: var(--emoji-size);
        border-radius: 50%;
      }
    }
  }

  & .previewSkeleton {
    height: var(--emoji-preview-height);
    border-top: 1px solid var(--border-color);
    display: grid;
    align-items: center;
    padding: 0.5em;
    gap: 6px;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      'emoji name'
      'emoji tags';

    & .previewEmoji {
      grid-area: emoji;
      border-radius: 50%;
      width: var(--emoji-preview-size);
      height: var(--emoji-preview-size);
    }

    & .previewName {
      grid-area: name;
      height: 0.8em;
      width: 80%;
    }

    & .tagList {
      grid-area: tags;
      list-style-type: none;
      display: flex;
      flex-direction: row;
      padding: 0;
      margin: 0;

      & .tag {
        border-radius: 3px;
        padding: 2px 8px;
        margin-right: 0.25em;
        height: 1em;
        width: 20%;
      }
    }
  }
}

.overlay {
  background: rgba(0, 0, 0, 0.75);
  height: 100%;
  left: 0;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
}

.content {
  position: relative;
  overflow: hidden;
  height: var(--content-height);

  &.fullHeight {
    height: calc(var(--content-height) + var(--category-tabs-height) + var(--category-tabs-offset));
    overflow-y: auto;
    scrollbar-color: var(--scrollbar-color) var(--scrollbar-background-color);
    scrollbar-width: thin;

    &::-webkit-scrollbar {
      background: var(--scrollbar-background-color);
      width: 1.1em;
    }

    &::-webkit-scrollbar-thumb {
      background: var(--scrollbar-color);
      background-clip: padding-box;
      height: 1em;
      border-radius: 0.5em
    }
  }
}

.pluginContainer {
  margin: 0.5em;
  display: flex;
  flex-direction: row;
}

.header {
  background-color: var(--secondary-background-color);
  padding-top: 8px;
  padding-bottom: 8px;
  display: grid;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
}

@media (prefers-reduced-motion: reduce) {
  .placeholder {
    background: var(--placeholder-background-color);
    position: relative;
    overflow: hidden;

    &::after {
      display: none;
    }
  }
}
