@import '../../style/themes/index.less';
@import (css) '/node_modules/lightgallery/css/lightgallery.css';
@import (css) '/node_modules/lightgallery/css/lg-zoom.css';
@import (css) '/node_modules/lightgallery/css/lg-thumbnail.css';
@import (css) '/node_modules/lightgallery/css/lg-fullscreen.css';
@import (css) '/node_modules/lightgallery/css/lg-video.css';
@import (css) '/node_modules/lightgallery/css/lg-autoplay.css';
@import (css) '/node_modules/lightgallery/css/lg-rotate.css';

.lm_image_viewer_wrapper {
  position: fixed;
  z-index: 1001;
  inset: 0;

  .lm_image_viewer_mask {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.5);
    inset: 0;
  }

  .lm_image_viewer_container {
    position: relative;
    z-index: 2;
    display: flex;
    flex-flow: column;
    gap: @gap-base;
    align-items: center;
    height: 100vh;
    padding: 50px 0;

    .preview_list {
      flex: 1;
      width: 51%;
      max-height: 100%;
      overflow: hidden;
      touch-action: none;

      // 防止图片的高度超出
      div {
        height: 100%;
      }

      .preview_item {
        overflow: hidden;
        text-align: center;
        // height: calc(100vh - 100px - 80px - 94px);
        border-radius: 2px;

        img {
          display: inline-block;
          width: 100%;
          height: 100%;
          object-fit: contain; // 大图展示全貌
          transition: 0.3s;
        }
      }
    }

    .thumb_list {
      display: flex;
      gap: @gap-base;
      width: 51%;
      overflow-x: auto;
      overflow-y: hidden;
      // transform: rotateZ(90deg);

      .thumb_item {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 98px;
        height: 98px;
        text-align: center;
        background-color: @body-background;
        border: 2px solid transparent;
        border-radius: 2px;
        transition: 0.3s;

        .thumb_item_icon {
          color: @text-color-secondary-new;
          font-size: 34px;
        }

        img {
          display: inline-block;
          width: 94px;
          height: 94px;
          object-fit: cover; // 小图占满父元素
        }

        &.active {
          border-color: @primary-color;
        }
      }
    }

    // 图片操作区
    .image_viewer_action {
      position: absolute;
      bottom: 50px;
      left: 50%;
      display: flex;
      gap: 24px;
      align-items: center;
      justify-content: space-between;
      padding: 8px 12px;
      font-size: 24px;
      background-color: #fff;
      border-radius: 100px;
      transform: translateX(-50%);

      .anticon {
        cursor: pointer;
        transition: 0.3s;

        &:hover {
          color: @primary-color;
        }
      }
    }

    // 左右箭头
    .arrow {
      position: absolute;
      top: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      height: 48px;
      color: @body-background;
      font-size: 32px;
      background-color: @text-color;
      transform: translateY(-50%);
      cursor: pointer;
      transition: 0.3s;

      &.arrow_left {
        left: 40px;
      }

      &.arrow_right {
        right: 40px;
      }

      &:hover {
        color: @primary-color;
      }
    }
  }
}

.lg-outer .lg-thumb-item.active,
.lg-outer .lg-thumb-item:hover {
  border-color: @primary-color;
}
