@import '_variables';
@import '_mixins';
@import '_miniature';

$more-button-width: 40px;
$more-margin-right: 15px;

.video-miniature {
  display: inline-flex;
  flex-direction: column;
  padding-bottom: $video-miniature-margin-bottom;
  vertical-align: top;

  .video-bottom {
    display: flex;

    .video-miniature-information {
      width: $video-miniature-width - $more-button-width - $more-margin-right;
      line-height: normal;

      .avatar {
        margin: 10px 10px 0 0;

        img {
          @include avatar(40px);
        }
      }

      .video-miniature-name {
        @include miniature-name;
        width: calc(100% - #{$more-button-width});
      }

      .video-miniature-meta {
        width: calc(100% + #{$more-button-width});
        overflow: hidden;
      }

      .video-miniature-created-at-views {
        display: block;
        font-size: 13px;
      }

      .video-miniature-account,
      .video-miniature-channel {
        @include disable-default-a-behaviour;
        @include ellipsis;

        display: block;
        font-size: 13px;
        color: pvar(--greyForegroundColor);

        &:hover {
          color: $grey-foreground-hover-color;
        }
      }

      .video-info-privacy,
      .video-info-blocked .blocked-label,
      .video-info-nsfw {
        font-weight: $font-semibold;
      }

      .video-info-blocked {
        color: red;

        .blocked-reason::before {
          content: ' - ';
        }
      }

      .video-info-nsfw {
        color: red;
      }
    }

    .video-actions {
      margin-top: 3px;
      width: $more-button-width;
      height: 30px;

      ::ng-deep .dropdown-root:not(.show) {
        opacity: 0;
      }

      ::ng-deep .playlist-dropdown.show + my-action-dropdown .dropdown-root {
        opacity: 1;
      }

      ::ng-deep .more-icon {
        opacity: .6;

        &:hover {
          opacity: 1;
        }
      }
    }

    @media screen and (max-width: $small-view) {
      .video-miniature-information {
        margin: 0 10px;
      }

      .video-actions {
        margin: 0;
        top: -3px;

        ::ng-deep .dropdown-root {
          opacity: 1 !important;
        }
      }
    }
  }

  &:hover ::ng-deep .video-thumbnail .video-thumbnail-actions-overlay,
  &:hover .video-bottom .video-actions ::ng-deep .dropdown-root {
    opacity: 1;
  }

  &.fit-width {
    width: 100%;

    .video-bottom {
      width: 100% !important;

      .video-miniature-information {
        width: calc(100% - #{$more-button-width}) !important;
      }
    }

    my-video-thumbnail {
      @include large-screen-ratio($selector: '::ng-deep .video-thumbnail');
    }
  }

  &.display-as-row {
    flex-direction: row;
    padding-bottom: 0;
    height: auto;
    display: flex;
    flex-grow: 1;

    my-video-thumbnail {
      margin-right: 10px;
    }

    .video-bottom {
      .video-miniature-information {
        @media screen and (min-width: $small-view) {
          width: auto;
          min-width: 500px;
        }

        .video-miniature-name {
          @include ellipsis-multiline(1.3em, 2);

          margin-top: 2px;
          margin-bottom: 5px;
        }

        .video-miniature-created-at-views,
        .video-miniature-account,
        .video-miniature-channel {
          font-size: 95%;
          width: fit-content;
        }

        .video-miniature-created-at-views + .video-miniature-channel {
          margin-top: 5px;
        }

        .video-info-privacy {
          margin-top: 5px;
        }

        .video-info-blocked {
          margin-top: 3px;
        }
      }

      .video-actions {
        margin: 0;
        top: -3px;
      }
    }

    @media screen and (max-width: $small-view) {
      flex-direction: column;
      height: auto;

      my-video-thumbnail {
        margin-right: 0;
      }

      .video-miniature-information {
        min-width: initial;
      }
    }
  }
}
