@import './var.less';
@import (less) '../../node_modules/plyr/dist/plyr.css';

:root {
  --van-video-preview-background: @video-preview-background;
  --van-video-preview-close-icon-color: @video-preview-close-icon-color;
}

.van-video-preview {
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 0;
  background: transparent;
  transform: none;

  &__overlay {
    background: var(--van-video-preview-background);
  }

  &__video {
    position: relative;
    z-index: 1;
    width: 100%;
    max-height: 100%;
    background: #000;

    &--contain {
      object-fit: contain;
    }

    &--cover {
      height: 100%;
      object-fit: cover;
    }
  }

  &__backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
  }

  .van-popup__close-icon {
    position: absolute;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    color: var(--van-black);
    font-size: 20px;
    line-height: 1;
    background: var(--van-white);
    border: 0;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);

    &--top-right {
      top: var(--van-padding-md);
      top: calc(var(--van-padding-md) + env(safe-area-inset-top, 0px));
      right: 36px;
      bottom: auto;
      left: auto;
    }

    &--top-left {
      top: var(--van-padding-md);
      top: calc(var(--van-padding-md) + env(safe-area-inset-top, 0px));
      left: var(--van-padding-md);
      right: auto;
      bottom: auto;
    }

    &--bottom-left {
      top: auto;
      right: auto;
      bottom: var(--van-padding-md);
      left: var(--van-padding-md);
    }

    &--bottom-right {
      top: auto;
      right: 36px;
      bottom: var(--van-padding-md);
      left: auto;
    }
  }

  .plyr {
    position: relative;
    z-index: 1;
    width: 100%;

    &__controls {
      min-width: 0;
      padding-right: 4px;
    }

    &__controls__item.plyr__progress__container {
      flex: 1 1 auto;
      min-width: 48px;
    }

    &__controls__item.plyr__time {
      flex: 0 0 48px;
      min-width: 0;
    }

    &__volume {
      flex: 0 0 76px;
      width: 76px;

      input[type='range'] {
        min-width: 30px;
        max-width: 30px;
      }
    }

    &__volume + &__menu {
      margin-left: 8px;
    }
  }
}
