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

$thumbnail-width: 130px;
$thumbnail-height: 72px;

my-timestamp-input {
  width: 100px;
}

my-video-thumbnail {
  @include thumbnail-size-component($thumbnail-width, $thumbnail-height);
}

.fake-thumbnail {
  width: $thumbnail-width;
  height: $thumbnail-height;
  background-color: #ececec;
}

my-video-thumbnail,
.fake-thumbnail {
  display: flex; // Avoids an issue with line-height that adds space below the element

  @include margin-right(10px);
}

.nsfw-warning {
  my-global-icon {
    @include global-icon-size(18px);
  }
}

.video {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  background-color: pvar(--bg);
  padding: 10px;
  border-bottom: 1px solid $separator-border-color;

  &.playing {
    background-color: rgba(0, 0, 0, 0.02);
  }

  a {
    color: pvar(--fg);

    @include disable-default-a-behaviour;
  }

  > a {
    display: flex;
    min-width: 0;
    align-items: center;
    cursor: pointer;

    .position {
      font-weight: $font-semibold;
      color: pvar(--fg-300);
      min-width: 25px;

      my-global-icon {
        position: relative;
        left: -2px;
        color: pvar(--fg-300);

        @include global-icon-size(17px);
      }
    }
  }

  .more {
    cursor: pointer;
    min-width: 24px;

    @include margin-left(auto);
  }

  .more-button {
    opacity: 0;

    &::after {
      border: 0;
    }

    my-global-icon {
      color: pvar(--fg-300);
    }
  }

  &:hover,
  &:focus {
    background-color: rgba(0, 0, 0, 0.05);
  }

  &:hover,
  &:focus-within,
  .show {
    .more-button {
      opacity: 1;
    }
  }

  @media not all and (hover: hover) and (pointer: fine) {
    .more-button {
      opacity: 1 !important;
    }
  }
}

.video-info-name {
  font-size: 18px;
  font-weight: $font-semibold;
  display: inline-block;

  @include ellipsis;
}

.video-info {
  display: flex;
  flex-direction: column;
  align-self: flex-start;
  min-width: 0;

  .video-info-header {
    display: flex;
    align-items: baseline;

    a {
      width: auto;
    }

    .pt-badge {
      margin: 0 5px;
      white-space: nowrap;
    }
  }

  .video-info-owner,
  .video-info-timestamp {
    color: pvar(--fg-300);
  }
}

.video-info-owner,
.video-info-timestamp,
.date-and-views {
  font-size: 14px;
}

.dropdown-menu {

  .dropdown-item {
    cursor: pointer;

    @include dropdown-with-icon-item;
  }

  .timestamp-options {
    padding-top: 0;
    margin-top: 5px;
    margin-bottom: 15px;

    @include padding-left(35px);

    > div {
      display: flex;
      align-items: center;
      margin-bottom: 5px;
    }

    my-peertube-checkbox {
      @include margin-right(5px);
    }
  }
}

@mixin more-dropdown-control {
  .video {
    my-edit-button {
      display: none;

      + .more-button {
        display: inline-flex;
      }
    }
  }
}

@mixin edit-button-control {
  .video {
    my-edit-button {
      display: none;
    }

    &.playing {
      my-edit-button {
        display: inline-flex;
        height: max-content;
        margin: auto;
      }
    }

    my-edit-button + .more-button {
      display: none;
    }
  }
}

@mixin edit-button-in-mobile-view {
  .video {
    my-edit-button {
      ::ng-deep .action-button-edit {
        padding: 0 13px;

        .button-label {
          display: none;
        }
      }
    }
  }
}

@media screen and (min-width: $small-view) {
  @include more-dropdown-control();
  @include edit-button-control();
}

@media screen and (max-width: $mobile-view) {
  @include edit-button-in-mobile-view();
}
