/**
 * Copyright © 2016-2026 The Thingsboard Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
.tb-dashboard-widget-select {
  background-color: #cfd8dc;
  position: absolute;
  inset: 0;

  .mat-mdc-card.tb-widget-preview-card {
    cursor: pointer;
    transition: box-shadow 0.2s;
    padding: 12px;

    &:hover {
      box-shadow: 0 2px 6px 6px rgb(0 0 0 / 20%), 0 1px 4px 2px rgb(0 0 0 / 14%), 0 1px 6px 0 rgb(0 0 0 / 12%)
    }

    .title-container {
      height: 32px;
      display: flex;
      flex-direction: row;
      gap: 4px;

      .widget-title {
        flex: 1;
        color: rgba(0, 0, 0, 0.76);
        font-size: 12px;
        font-style: normal;
        font-weight: 500;
        line-height: 16px;
        letter-spacing: 0.2px;
        overflow: hidden;
        text-overflow: ellipsis;
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
      }

      .title-items-container {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 2px;
      }

      .widget-deprecated {
        display: flex;
        height: 12px;
        padding: 0 2px;
        justify-content: flex-end;
        align-items: center;
        align-self: stretch;
        color: rgba(209, 39, 48, 0.72);
        font-size: 11px;
        font-style: normal;
        font-weight: 400;
        letter-spacing: 0.2px;
      }

      .title-items {
        display: flex;
        align-items: flex-start;
        gap: 8px;

        .widget-type {
          padding: 1px 4px;
          border-radius: 4px;
          background: rgba(236, 236, 236, 0.64);
          color: rgba(0, 0, 0, 0.54);
          font-size: 11px;
          font-style: normal;
          font-weight: 500;
          line-height: 16px;
          letter-spacing: 0.017px;
        }

        .info-banner {
          display: flex;
          width: 18px;
          padding: 1px 0;
          justify-content: center;
          align-items: center;
          border-radius: 4px;
          color: #fff;
          font-size: 11px;
          font-style: normal;
          font-weight: 600;
          line-height: 16px;
          letter-spacing: 0.017px;
          &:before {
            opacity: 0.5;
          }
          & > span {
            z-index: 1;
          }
        }
      }
    }

    &.loading-cell {
      height: 100%;
      min-height: 200px;

      .preview-container, .title-container {
        background: linear-gradient(110deg, #ececec 8%, #f5f5f5 18%, #ececec 33%);
        border-radius: 5px;
        background-size: 200% 100%;
        animation: 1s shine linear infinite;
      }
    }

    .preview-container {
      position: relative;
    }

    .preview-spacer {
      margin-top: 80%;
    }

    .preview {
      position: absolute;
      inset: 0;
      object-fit: contain;
      width: 100%;
      height: 100%;
    }
  }
}

@keyframes shine {
  to {
    background-position-x: -200%;
  }
}
