@use '_variables' as *;
@use '_mixins' as *;
@use '_miniature' as *;

$more-button-width: 40px;

.video-miniature {
  font-size: 14px;
}

.video-miniature-name {
  @include miniature-name;
}

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

my-actor-avatar {
  @include margin(10px, 10px, 0, 0);
}

.video-miniature-created-at-views {
  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: #ff0000;

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

.video-info-nsfw {
  color: #ff0000;
}

.video-actions {
  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;
    }
  }
}

.video-miniature:hover {
  ::ng-deep .video-thumbnail-actions-overlay,
  .video-actions ::ng-deep .dropdown-root {
    opacity: 1 !important;
  }
}

// Grid mode
// Takes all the width on mobile
.video-miniature:not(.display-as-row) {
  display: flex;
  flex-direction: column;
  padding-bottom: $video-miniature-margin-bottom;
  width: 100%;

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

  .video-bottom {
    display: flex;
    width: 100%;
    min-width: 1px;
  }

  .video-miniature-name {
    margin-top: 10px;
    margin-bottom: 5px;
  }

  .video-miniature-created-at-views {
    display: block;
  }

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

  @media screen and (max-width: $small-view) {
    width: 100%;
    margin-bottom: 25px;

    .video-miniature-information {
      margin: 0 10px;

      width: 100%;
      text-align: left;
    }

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

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

    ::ng-deep .video-thumbnail {
      border-radius: 0;
    }
  }
}

.video-miniature.display-as-row {
  --rowThumbnailWidth: #{$video-thumbnail-width};
  --rowThumbnailHeight: #{$video-thumbnail-height};

  display: flex;
  flex-direction: row;

  .video-bottom {
    display: flex;
    min-width: 1px;
  }

  // We don't display avatar in row mode
  .channel-avatar {
    display: none;
  }

  my-video-thumbnail {
    @include margin-right(1rem);

    min-width: var(--rowThumbnailWidth);
    max-width: var(--rowThumbnailWidth);
    height: var(--rowThumbnailHeight);
  }

  .video-miniature-name {
    font-size: $video-miniature-row-name-font-size;
  }

  .video-miniature-created-at-views,
  .video-miniature-account,
  .video-miniature-channel {
    font-size: $video-miniature-row-info-font-size;
  }

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

.contained-in-playlists {
  display: flex;
  flex-wrap: wrap;
  column-gap: 5px;
  row-gap: 5px;
  font-size: 1rem;
}

@include on-small-main-col {
  .video-miniature.display-as-row {
    --rowThumbnailWidth: #{$video-thumbnail-medium-width};
    --rowThumbnailHeight: #{$video-thumbnail-medium-height};
  }
}

@include on-mobile-main-col {
  .video-miniature.display-as-row {
    --rowThumbnailWidth: #{$video-thumbnail-small-width};
    --rowThumbnailHeight: #{$video-thumbnail-small-height};

    .video-miniature-name {
      font-size: $video-miniature-row-info-font-size;
    }

    .video-miniature-created-at-views,
    .video-miniature-account,
    .video-miniature-channel {
      font-size: $video-miniature-row-mobile-info-font-size;
    }
  }
}
