@import "../common/variables";

.@{css-prefix} {
  &-video {
    width: 600rpx;
    height: 450rpx;
    display: inline-block;
    line-height: 0;
    overflow: hidden;
    position: relative;
  }

  &-video-container {
    width: 100%;
    height: 100%;
    background-color: black;
    display: inline-block;
    position: absolute;
    top: 0;
    left: 0; // overflow: hidden;

    &.fullscreen {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      z-index: 999;

      &.rotate-left {
        transform: translate(-50%, -50%) rotate(-90deg);
      }

      &.rotate-right {
        transform: translate(-50%, -50%) rotate(90deg);
      }
    }

    video {
      width: 100%;
      height: 100%;
    }

    .@{css-prefix}-video-cover {
      position: absolute;
      top: 0;
      left: 0;
      bottom: 0;
      width: 100%;
      display: -webkit-flex;
      display: flex;
      -webkit-flex-direction: column;
      flex-direction: column;
      -webkit-justify-content: center;
      justify-content: center;
      -webkit-align-items: center;
      align-items: center;
      background-color: rgba(1, 1, 1, 0.5);
      z-index: 1;

      .@{css-prefix}-video-cover-play-button {
        width: 80rpx;
        height: 80rpx;
        background-image: url('img/play.png');
        background-size: 50%;
        background-repeat: no-repeat;
        background-position: 50% 50%;
      }

      .@{css-prefix}-video-cover-duration {
        color: #fff;
        font-size: .8rem;
        line-height: 1;
        margin-top: 20rpx;
      }
    }

    .@{css-prefix}-video-bar {
      height: 88rpx;
      background-color: rgba(0, 0, 0, 0.5);
      overflow: hidden;
      position: absolute;
      bottom: 0;
      right: 0;
      display: flex;
      display: flex;
      align-items: center;
      align-items: center;
      padding: 0 20rpx;
      z-index: 0;

      &.full {
        left: 0;
      }

      >.@{css-prefix}-video-controls {
        display: flex;
        display: flex;
        flex-grow: 1;
        flex-grow: 1;
        margin: 0 17rpx;

        >.@{css-prefix}-video-control-button {
          width: 26rpx;
          height: 30rpx;
          padding: 29rpx 25rpx 29rpx 25rpx;
          margin-left: -17rpx;
          box-sizing: content-box;

          &::after {
            content: '';
            display: block;
            width: 100%;
            height: 100%;
            background-size: 100%;
            background-position: 50% 50%;
            background-repeat: no-repeat;
          }

          &.play {
            &::after {
              background-image: url('img/play.png');
            }
          }

          &.pause {
            &::after {
              background-image: url('img/pause.png');
            }
          }
        }

        >.@{css-prefix}-video-current-time,
        >.@{css-prefix}-video-duration {
          height: 29rpx;
          line-height: 29rpx;
          margin-top: 30rpx;
          margin-bottom: 29rpx;
          font-size: .6rem;
          color: #cbcbcb;
        }

        >.@{css-prefix}-video-progress-container {
          flex-grow: 2;
          flex-grow: 2;
          position: relative;

          >.@{css-prefix}-video-progress {
            height: 4rpx;
            margin: 42rpx 24rpx;
            background-color: rgba(255, 255, 255, 0.4);
            position: relative;

            >.buffered {
              position: absolute;
              left: 0;
              top: 0;
              width: 0;
              height: 100%;
              transition: width 0.1s;
              background-color: rgba(255, 255, 255, 0.8);
            }

            >.@{css-prefix}-video-ball {
              width: 32rpx;
              height: 32rpx;
              padding: 28rpx;
              position: absolute;
              top: -42rpx;
              box-sizing: content-box;
              left: 0%;
              margin-left: -44rpx;

              >.@{css-prefix}-video-inner {
                width: 100%;
                height: 100%;
                background-color: #ffffff;
                border-radius: 50%;
              }
            }
          }
        }

        >.@{css-prefix}-video-duration {
          height: 29rpx;
          line-height: 29rpx;
          margin-top: 30rpx;
          margin-bottom: 29rpx;
          font-size: .6rem;
          color: #cbcbcb;
        }
      }

      >.@{css-prefix}-video-danmu-btn {
        white-space: nowrap;
        line-height: 1;
        padding: 4rpx 20rpx;
        border: 1px solid #fff;
        border-radius: 10rpx;
        font-size: .65rem;
        color: #fff;
        margin: 0 17rpx;

        &.active {
          border-color: #48c23d;
          color: #48c23d;
        }
      }

      >.@{css-prefix}-video-fullscreen {
        width: 34rpx;
        height: 34rpx;
        padding: 17rpx;
        box-sizing: content-box;
        background-image: url('img/enterFullscreen.png');
        background-size: 50%;
        background-position: 50% 50%;
        background-repeat: no-repeat;

        &.fullscreen {
          background-image: url('img/leaveFullscreen.png');
        }
      }
    }

    .@{css-prefix}-video-danmu {
      position: absolute;
      top: 0;
      left: 0;
      bottom: 0;
      width: 100%;
      margin-bottom: 88rpx;
      overflow: hidden;

      >.@{css-prefix}-video-danmu-item {
        line-height: 1;
        position: absolute;
        color: #ffffff;
        white-space: nowrap;
        left: 100%;
        transform: translateX(0);
        transition-property: left, transform;
        transition-duration: 3s;
        transition-timing-function: linear;
      }
    }

    .toast {
      @color: black;
      pointer-events: none;
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      border-radius: 10rpx;
      background-color: rgba(255, 255, 255, 0.8);
      color: @color;
      display: none;

      &.volume,
      &.brightness {
        @w: 200rpx;
        width: @w;
        height: @w;
        display: block;

        .title {
          width: 100%;
          font-size: 24rpx;
          line-height: 32rpx;
          text-align: center;
          margin-top: 20rpx;
          display: none;
        }

        svg {
          fill: @color;
          width: 50%;
          height: 50%;
          margin-left: 25%;
          display: none;
        }

        .size {
          @w: 160rpx;
          @h: 10rpx;
          width: @w;
          height: @h;
          margin-top: 10rpx;
          margin-left: 20rpx;

          >.content {
            overflow: hidden;

            >.grids {
              width: @w;
              height: @h;

              >div {
                float: left;
                width: (@w - 9)/10;
                height: @h;
                background-color: @color;

                &:not(:first-child) {
                  margin-left: 1px;
                }
              }
            }
          }
        }
      }

      &.volume {

        >.title.volume,
        >svg.volume {
          display: block;
        }
      }

      &.brightness {

        >.title.brightness,
        >svg.brightness {
          display: block;
        }
      }

      &.progress {
        display: block;
        background-color: rgba(0, 0, 0, 0.8);
        color: white;
        font-size: .7rem;
        line-height: 36rpx;
        padding: 12rpx;
      }
    }
  }
}
