/**
 * 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.
 */
@import "../../../scss/constants";

$containerHeight: 96px !default;
$previewSize: 78px !default;

:host {

  .tb-container {
    margin-top: 0;
    padding: 0 0 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    label.tb-title {
      display: block;
      padding-bottom: 0px;
    }
  }

  .tb-image-select-container {
    width: 100%;
    height: $containerHeight;
    display: flex;
    gap: 12px;
    align-items: center;
  }

  .image-container {
    background: #F3F6FA;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 8px 12px 8px 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    &.disabled {
      padding: 8px;
    }
  }

  .tb-image-preview-container {
    width: $previewSize;
    height: $previewSize;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .tb-image-preview-text {
    font-size: 14px;
    text-align: center;
  }

  .tb-image-preview {
    width: auto;
    max-width: $previewSize - 2px;
    height: auto;
    max-height: $previewSize  - 2px;
  }

  .tb-image-info-container {
    display: flex;
    gap: 12px;
    font-size: 13px;
    font-style: normal;
    line-height: 16px;
    letter-spacing: normal;
  }

  .tb-image-file-name {
    width: 136px;
    color: rgba(0, 0, 0, 0.54);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .tb-image-file-hint {
    color: rgba(0, 0, 0, 0.38);
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .file-input {
    display: none;
  }

  .tb-flow-drop {
    height: 100%;
    flex: 1;
    overflow: hidden;
    border: 2px dashed rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    box-sizing: border-box;

    .upload-label {
      width: 100%;
      height: 100%;
      padding: 0 16px;
      display: flex;
      flex-direction: row;
      justify-content: center;
      align-items: center;
      gap: 8px;
      .mat-icon {
        color: rgba(0,0,0,0.12);
      }
      .upload-text-area {
        display: flex;
        flex-direction: column;
        align-items: center;
        font-size: 16px;
        line-height: 24px;
        color: rgba(0, 0, 0, 0.54);
        text-align: center;
        .hide-xs {
          @media #{$mat-xs} {
            display: none;
          }
        }
      }
      .upload-button-area {
        display: flex;
        justify-content: center;
        align-items: flex-start;
        gap: 6px;
      }
    }
  }

  .tb-hint{
    margin-top: 8px;
    padding-bottom: 0;
  }
}

:host ::ng-deep {
  button.mat-mdc-button.mat-mdc-button-base.browse-file {
    padding: 0;
    min-width: 0;
    height: 24px;
    font-size: 16px;
    label {
      display: block;
      cursor: pointer;
    }
  }
}
