// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) KALEIDOS INC

@use "common/refactor/common-refactor.scss" as *;

.viewer-thumbnails {
  background-color: var(--viewer-background-color);
  grid-row: 1 / span 1;
  grid-column: 1 / span 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: $z-index-10;
}

.expanded {
  grid-row: 1 / span 2;

  .expand-btn svg {
    transform: rotate(-90deg);
  }
}

.thumbnails-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: $s-32;
  margin: $s-24 $s-24 0 $s-24;
}

.counter {
  @include bodySmallTypography;
  color: var(--viewer-thumbnails-control-foreground-color);
}

.actions {
  @include flexRow;
  width: $s-60;
}

.expand-btn,
.close-btn {
  @extend .button-tertiary;
  height: $s-32;
  width: $s-28;
  svg {
    @extend .button-icon;
  }
}

.expand-btn svg {
  transform: rotate(90deg);
}

.thumbnails-content {
  display: grid;
  grid-template-columns: $s-40 auto $s-40;
  grid-template-rows: auto;
}

.thumbnails-list-expanded {
  grid-column: 1 / span 3;
  grid-row: 1 / span 1;
  display: flex;
  flex-wrap: wrap;
  overflow: hidden;
}

.right-scroll-handler,
.left-scroll-handler {
  @extend .button-tertiary;
  @include flexCenter;
  grid-column: 3 / span 1;
  grid-row: 1 / span 1;
  width: $s-32;
  height: $s-60;
  margin: auto 0;
  z-index: $z-index-10;
  opacity: 0;
  &:hover {
    opacity: 1;
  }
  svg {
    @extend .button-icon;
    stroke: var(--icon-foreground);
  }
}

.left-scroll-handler {
  grid-column: 1 / span 1;
  grid-row: 1 / span 1;
  svg {
    transform: rotate(180deg);
  }
}

.thumbnails-list {
  grid-column: 1 / span 3;
  grid-row: 1 / span 1;
  display: flex;
  flex-wrap: nowrap;
  overflow: hidden;
}

.thumbnails-list-inside {
  display: flex;
  position: relative;
}

.thumbnail-item {
  @include buttonStyle;
  display: flex;
  flex-direction: column;
  padding: $s-16;
}

.thumbnail-preview {
  @include flexCenter;
  width: $s-132;
  min-height: $s-132;
  height: $s-132;
  padding: $s-4;

  svg {
    width: 100%;
    height: 100%;
  }

  &.selected {
    background-color: var(--viewer-thumbnail-background-color-selected);
    border-radius: $br-8;
  }

  &:hover {
    border: $s-1 solid var(--viewer-thumbnail-border-color);
    border-radius: $br-8;
  }
}

.thumbnail-info {
  @include bodySmallTypography;
  @include textEllipsis;
  text-align: center;
  color: var(--viewer-thumbnails-control-foreground-color);
  padding: $s-8 0;
  width: 100%;
  max-width: $s-132;
}
