// 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

@import "refactor/common-refactor.scss";

.graphics-group {
  .drop-space {
    height: $s-12;
  }
  .asset-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: $s-4;
    margin-left: $s-8;
    .grid-cell {
      @include flexCenter;
      position: relative;
      padding: $s-8;
      border: $s-2 solid transparent;
      border-radius: $br-8;
      aspect-ratio: 1/1;
      background-color: var(--color-foreground-secondary);
      overflow: hidden;
      cursor: pointer;
      img {
        height: auto;
        width: auto;
        max-height: 100%;
        max-width: 100%;
        pointer-events: none;
      }
      svg {
        height: 10vh;
      }
      .cell-name {
        @include bodySmallTypography;
        @include textEllipsis;
        display: none;
        position: absolute;
        left: 0;
        bottom: 0;
        width: 100%;
        padding: $s-2;

        &.editing {
          display: block;
        }

        .editable-label-input {
          height: unset;
          width: 100%;
          padding: $s-2;
          margin: 0;
        }

        .editable-label-close {
          display: none;
        }
      }

      &:hover {
        background-color: var(--assets-item-background-color-hover);
        .cell-name {
          display: block;
          color: var(--assets-item-name-foreground-color-hover);
          background: linear-gradient(to top, rgba(52, 57, 59, 1) 0%, rgba(52, 57, 59, 0) 100%);
        }
      }

      &.selected {
        border: $s-1 solid var(--assets-item-border-color);
      }

      .dragging {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: $s-8;
        background-color: var(--assets-item-background-color-drag);
        border: $s-2 solid var(--assets-item-border-color-drag);
      }
    }
  }
  .asset-enum {
    padding-bottom: $s-4;
    .enum-item {
      position: relative;
      display: flex;
      align-items: center;
      height: $s-36;
      margin-bottom: $s-4;
      padding: $s-2;
      border-radius: $br-8;
      background-color: var(--assets-item-background-color);
      cursor: pointer;

      svg,
      img {
        @include flexCenter;
        padding: $s-2;
        height: $s-32;
        width: $s-32;
        border-radius: $br-6;
        background-color: var(--assets-component-background-color);
      }

      .item-name {
        @include bodySmallTypography;
        @include textEllipsis;
        padding-left: $s-8;
        color: var(--assets-item-name-foreground-color);

        &.editing {
          display: flex;
          align-items: center;

          .editable-label-input {
            height: $s-24;
          }

          .editable-label-close {
            display: none;
          }
        }
      }
      &:hover {
        background-color: var(--assets-item-background-color-hover);
        .item-name {
          color: var(--assets-item-name-foreground-color-hover);
        }
      }
      &.selected {
        border: $s-1 solid var(--assets-item-border-color);
      }
    }
  }
  .grid-placeholder {
    height: $s-2;
    background-color: var(--color-accent-primary);
    margin-bottom: $s-2;
  }
}
.listing-options {
  display: flex;
  align-items: center;

  .listing-option-btn {
    @include flexCenter;
    cursor: pointer;

    &.first {
      margin-left: auto;
    }

    svg {
      height: $s-16;
      width: $s-16;
    }
  }
}
.add-component {
  @extend .button-tertiary;
  height: $s-32;
  width: $s-28;
  margin-left: $s-2;
  border-radius: $br-8;
  svg {
    @extend .button-icon;
    stroke: var(--icon-foreground);
  }
}

.assets-btn {
  @extend .button-tertiary;
  height: $s-32;
  width: calc($s-24 + $s-4);
  padding: 0;
  border-radius: $br-8;
  svg {
    @extend .button-icon;
    stroke: var(--icon-foreground);
  }
}
