@import '../../core/mixin.less';
@import './DanmakuInput.less';
@import '../ProgressBar/index.less';

* {
  box-sizing: border-box;
}
.video-player {
  --color-main: #0669ff;
  --area-height: 40px;
  --btn-size: 120px;
  --btn-icon-size: 64px;
  --box-shadow: 0 2px 4px rgba(55, 60, 68, 0.2);
  --c-text-main: rgba(0, 0, 0, 0.85);
  --side-width: 200px;
  .mobile({
    --btn-icon-size: 40px
  });
  .wh(100%);

  position: relative;
  overflow: hidden;
  user-select: none;
  &:focus {
    outline: none;
  }
  .hidden {
    display: none;
  }
  .video-container {
    position: relative;
    height: 100%;
    background: black;
    // padding-bottom: 75%;
    cursor: pointer;
    .video-noti {
      .ab-center();

      z-index: 10;

      & > div {
        padding: 5px 10px;
        background-color: #fffc;
        border-radius: 5px;
      }
      .v-defalut-noti {
        .wh(var(--btn-size));
        .f-center();

        position: relative;
        background: rgba(222, 235, 255, 0.504657);
        border-radius: 60px;
        cursor: pointer;
        backdrop-filter: blur(2.71828px);
        transition: all 0.3s;
        img{
          width: var(--btn-icon-size);
        }        
        .mobile({
          .wh(60px);
          img{
            width: auto;
          }
        });

        @keyframes rotate {
          from {
            transform: rotate(0);
          }
          to {
            transform: rotate(360deg);
          }
        }
        &.v-loading {
          img {
            animation: rotate infinite 3s linear;
          }
        }
      }
      &.speed-mode-noti{
        top: 20px;
        transform: translate(-50%,0);
        opacity: .5;
      }
    }
    video {
      position: absolute !important;
      top: initial !important;
      right: initial !important;
      bottom: initial !important;
      left: initial !important;
      width: 100% !important;
      height: 100% !important;
      margin: 0 auto !important;
      cursor: pointer !important;
      filter: contrast(1) !important;
      pointer-events: none;
    }
  }

  // ---full---
  &.action-area-show {
    .video-action-area {
      bottom: 0;
    }
    .side-dragger{
      opacity: 1;
    }
  }
  // ---full---
  .video-action-area {
    position: absolute;
    bottom: calc(-1 * (var(--area-height) + 5px));
    width: 100%;
    transition: bottom 0.5s, opacity 0.2s;
    .component-icon{
      cursor: pointer;
    }
    .danmaku_close{
      opacity: 0.5;
    }
    .played-progress-bar {
      .wh(100%,5px);

      position: relative;
      flex: 1;
      border-radius: 4px;
      .progress-bar.is-dragging {
        .bar-played {
          transition: none;
        }
      }
      .mobile({
        --offset:38px;
        width: calc(100% - var(--offset));
        flex: none;
        position: absolute;
        bottom: 38px;
        left: calc(var(--offset) / 2);
        margin: 0;
      });
      .bar-played {
        position: absolute;
        top: 0;
        z-index: 2;
        height: 100%;
        overflow: hidden;
        background: #0669ff;
        border-radius: 4px;
        transition: width 0.2s;
      }
      .rc-slider-handle {
        z-index: 3;
        display: block;
        margin-top: -4px;
        opacity: 0;
        transition: opacity 0.2s;
      }
      &:hover,
      .progress-bar.is-dragging {
        .rc-slider-handle {
          opacity: 1;
        }
      }
      .progress-bar {
        border-radius: 4px;
      }
      // &:hover{
      //   .bar-played {

      //   }
      // }
      .rc-slider-step,
      .rc-slider-rail,
      .rc-slider-track {
        top: 0;
      }
      .rc-slider-rail {
        border-radius: 4px;
        .mobile({
          opacity: .5;
        })
      }
      .rc-slider {
        padding: 0;
      }
      .bar-loaded {
        position: absolute;
        top: 0;
        z-index: 1;
        width: 100%;
        height: 100%;
        overflow: hidden;
        border-radius: 4px;
        & > span {
          position: absolute;
          height: 100%;
          background: #80bfff;
          transition: all 0.2s;
        }
      }
    }
    .mask {
      .wh(100%,50px);

      position: absolute;
      bottom: 0;
      z-index: 1;
      background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, #000 100%);
      opacity: 0.7;
    }
    .actions {
      z-index: 2;
      display: flex;
      gap: 16px;
      align-items: center;
      height: var(--area-height);
      padding: 0 20px;
      color: #fff;
      & > * {
        z-index: 2;
      }
      .func {
        & > .common-select {
          margin-left: 25px;
          cursor: pointer;
        }
      }
      .barrage-input input{
        display: none;
      }
      &.is-input{
        .played-progress-bar{
          display: none;
          .mobile({
            display: block;
          })
        }
        .barrage-input{
          flex: 1;
        }
        .barrage-input input{
          display: block;
        }
      }
    }
  }
  .side-action-area{
    position: absolute;
    top: 50%;
    right: 0;
    z-index: 1000;
    transform: translateY(-50%);
    &:hover{
      .side-dragger{
        opacity: 0;
      }
    }
  }
  .side-dragger{
    position: absolute;
    top: 50%;
    width: 10px;
    height: 30px;
    background-color: #0007;
    border-radius: 5px 0 0 5px;
    transform: translateY(-50%);
    opacity: 0;
    transition: all .2s;
  }

  .func {
    display: flex;
    align-items: center;
    .mobile({
      margin-left: auto;
    });
    .volume {
      position: relative;
      z-index: 10;
      .volume-progress {
        position: absolute;
        bottom: -4px;
        left: 50%;
        display: none;
        width: 26px;
        height: 0;
        color: var(--c-text-main);
        background-color: white;
        border-radius: 22px;
        box-shadow: var(--box-shadow);
        transform: translateX(-50%);
        .text {
          font-size: 10px;
          text-align: center;
        }
        .rc-slider-rail{
          border-radius: 10px;
        }
      }
      &:hover,
      &.active {
        color: var(--color-main);
        .volume-progress {
          display: block;
          height: 150px;
          padding-top: 5px;
          .progress-bar {
            // overflow: hidden;
            border-radius: 10px;
          }
          .rc-slider-handle{
            z-index: 2;
            margin-left: -3px;
          }
          .click-area {
            z-index: 11;
            border-radius: 4px;
          }
        }
      }
      .v-icon {
        position: relative;
        cursor: pointer;
        .muted {
          display: none;
        }
      }
      &.mute {
        .v-icon {
          .normal {
            display: none;
          }
          .muted {
            display: initial;
          }
        }
      }
    }
    .icon {
      .wh(22px);
      .f-center();

      border-radius: 22px;

      &:hover {
        box-shadow: var(--box-shadow);
      }
      &:last-child {
        margin-right: 0;
      }
      &.simple {
        cursor: pointer;
      }
    }
  }
  .video-cover {
    position: absolute;
    // display: flex;
    width: 100%;
    height: 100%;
    // background-color: black;
    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }

  &.buffer-test:not(.is-firstplay){
    .video-cover {
      display: none;
    }
  }
  &.buffer-test{
    video::-webkit-media-controls-panel {
      display: flex !important;
      opacity: 1 !important;
    }
    video::-webkit-media-controls-overlay-play-button {
      display: none;
    }
    .video-action-area{
      bottom: 40px;
      .actions{
        padding: 0 16px;
        &>span{
          display: none;
        }
        .played-progress-bar{
          margin-left: 0;
        }
        .func{
          display: none;
        }
      }
    }
  }

  .bottom-played-bar{
    position: absolute;
    bottom: 0;
  }

  .anticon-spin{
    @keyframes loadingCircle {
      100% {
        transform: rotate(360deg);
      }
    }

    display: inline-block;
    animation: loadingCircle 1s infinite linear;
  }

  .live-dot{
    .wh(12px);

    background-color: red;
    border-radius: 50%;
  }

  &.is-live{
    .played-progress-bar{
      display: none !important;
    }
  }


  .side-action-area{
    right: calc(var(--side-width) * -1) !important;
    z-index: 10;
    width: calc(var(--side-width) + 10px);
    height: 100%;
    transition: all .5s;
    &:hover{
      right: 0 !important;
    }
    .side-outer-container{
      height: 100%;
    }
    .side-inner-container{
      width: var(--side-width);
      height: 100%;
      margin-left: auto;
      padding: 8px;
      overflow: auto;
      color: #fff;
      background-color: #0007;
      border-left: 1px solid #fff7;
      &::-webkit-scrollbar{
        width: 10px;
        height: 10px;
      }
      &::-webkit-scrollbar-corner{
        background: transparent;
      }
      &::-webkit-scrollbar-thumb{
        background: #fff7;
        background-clip: content-box;
        border: 2px solid transparent;
        border-radius: 16px;
      
        &:hover {
          background-color: #fffa;
        }
      }
      
      &::-webkit-scrollbar-track{
        display: none;
      }
  
      .select-list{
        display: flex;
        flex-direction: column;
        gap: 4px;
        margin: 0;
        padding-left: 0;
        list-style: none;
      }
      .select{
        &.cover-title{
          .f-i-center();

          gap: 4px;
        }

        padding: 2px 8px;
        overflow: hidden;
        font-size: 12px;
        white-space: nowrap;
        text-overflow: ellipsis;
        border: 1px solid #fff7;
        border-radius: 2px;
        cursor: pointer;
        &.active{
          background-color: #80bfff;
        }

        .img-container{
          .wh(99px,66px);

          position: relative;
          font-size: 12px;
          img{
            .wh(100%);

            object-fit: contain;
          }
          .duration{
            right: 4px;
            bottom: 4px;
          }
          .info{
            bottom: 4px;
            left: 4px;
          }
          .duration,.info{
            position: absolute;
            padding: 1px 2px;
            background-color: #0005;
            border-radius: 4px;
          }
        }
        .right{
          flex: 1;
          overflow: hidden;
          .title{
            .line-clamp(2);

            margin-bottom: 4px;
            text-wrap: wrap;
          }
          .name{
            color: #fffc;
            font-size: 12px;
          }
        }
      }
      h3{
        margin-bottom: 12px;
        font-size: 14px;
      }
    }
  }
}
