/*
 * https://github.com/morethanwords/tweb
 * Copyright (C) 2019-2021 Eduard Kuzmenko
 * https://github.com/morethanwords/tweb/blob/master/LICENSE
 */

.document {
  --background-color: #{var(--primary-color)};
  $border-radius: .375rem;
  padding-left: 4.25rem;
  height: 70px;

  &-ico {
    background-color: var(--background-color);
    border-radius: $border-radius;
    line-height: 1;
    text-align: center;

    .document:not(.document-with-thumb) & {
      padding: 1.5625rem .25rem 0 .25rem;

      @include respond-to(handhelds) {
        padding: 1.5rem 0px 0px 0px;
        font-size: 14px;

        &:after {
          --size: .875rem;
        }
      }
    }

    &:after {
      --size: 1.125rem;
      content: "";
      display: block;
      position: absolute;
      top: 0;
      right: 0;
      width: var(--size);
      height: var(--size);
      border-bottom-left-radius: .25rem;
      border-style: solid;
      border-width: calc(var(--size) / 2);
      border-left-color: rgba(0, 0, 0, .25);
      border-bottom-color: rgba(0, 0, 0, .25);
      border-top-color: #fff;
      border-right-color: #fff;
    }
  }
  
  &-ico, &-download {
    font-size: 1.125rem;
    background-size: contain;
  }

  &-ico, &-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  &-download {
    background-color: var(--background-color);
    border-radius: $border-radius;
  }

  &.ext-zip {
    --background-color: #FB8C00;
  }

  &.ext-pdf {
    --background-color: #DF3F40;
  }

  &.ext-apk {
    --background-color: #43A047;
  }

  &.document-with-thumb {
    --background-color: #fff;

    .document-ico {
      &:after {
        display: none;
      }
    }

    .document-download {
      background-color: rgba(0, 0, 0, .15);
    }

    .preloader-circular {
      transition: background-color .2s;
    }

    .preloader-container:not(.manual) {
      .preloader-circular {
        background-color: rgba(0, 0, 0, .3) !important;
      }
    }
  }

  &-thumb {
    object-fit: cover;
    width: 100%;
    height: 100%;
  }
  
  &-name {
    white-space: nowrap;
    font-weight: 500;
    line-height: 1.3;
    font-size: 1rem;
  }

  &-size {
    white-space: nowrap;
    color: var(--secondary-text-color);
    font-size: .875rem;
    //padding-right: 32px;
    line-height: 1.3;
  }

  .preloader-container {
    width: 2.5rem;
    height: 2.5rem;

    @include respond-to(handhelds) {
      width: 1.625rem;
      height: 1.625rem;
    }
  }

  .preloader-circular {
    background-color: transparent !important;
  }

  .preloader-path-new {
    stroke-width: 2.5;
  }
}

.document, .audio {
  display: flex;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
  position: relative;
  user-select: none;

  &-ico, &-download {
    position: absolute;
    left: 0;
    width: 3.375rem;
    height: 3.375rem;
    color: #fff;
  }

  &-download {
    z-index: 1;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    transition: opacity .2s ease-in-out/* , transform .2s ease-in-out */;
    opacity: 1;
    //transform: scale(1);

    &.downloaded {
      opacity: 0;
      //transform: scale(0);
    }
  }

  .preloader-container:not(.preloader-streamable) {
    transform: scale(1) !important;
  }
}

.audio {
  &-ico {
    display: flex;
    justify-content: center;

    &.tgico-largeplay:before {
      margin-right: -1px;
    }
  }

  .preloader-circular {
    background-color: transparent !important;
  }

  .preloader-container:not(.preloader-streamable) {
    width: 100%;
    height: 100%;
  }
}
