:root {
  --slide-height: 300px;
  --navigation-reserve: 48px;

  @include media-breakpoint-up(md) {
    --slide-height: 500px;
    --navigation-reserve: 56px;
  }
}

.Swiper {
  display: block;
  margin: 2rem 0;
  flex-direction: column;

  &.ArticleCardSwiper {
    margin-bottom: 6rem;
    padding-bottom: 2rem;
  }

  .sliderTitle {
    @include font-size(4.5rem);

    text-align: center;
    padding: 4rem 0 0;
  }

  &.articleMode {
    background: var(--background-color-invert);
    color: var(--default-color-invert);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    a {
      color: var(--default-color-invert);
      border-color: var(--default-color-invert);
    }

    .container {
      margin: auto;
      position: relative;
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: 20px;
      width: 100%;

      .thumbsHolder {
        width: auto;
      }

      .thumbs {
        //overflow: hidden;
        box-sizing: border-box;
        margin: 0;
        position: relative;

        & > swiper-container {
          display: flex;
          flex-direction: row;
          gap: 10px;
        }

        .thumbsNav {
          height: 100%;
          overflow: hidden;
          width: 24px;

          &.prev {
            top: 50%;
            left: 0;
            transform: translateY(-50%);
          }

          &.next {
            top: 50%;
            right: 0;
            left: unset;
            transform: translateY(-50%);
          }
        }
      }
    }

    &.mobileView {
      .container {
        padding: 0;
        .thumbs {
          & swiper-slide {
            // bind to html element <swiper-slide/>
            width: unset !important;
          }
        }
      }
    }
  }

  &.editorMode {
    color: #0d0d0d;

    .holder {
      width: 100%;
    }
  }

  .action {
    border-radius: 50%;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgb(var(--default-color) 0.3);
    cursor: pointer;
    z-index: 12;
    display: none;

    .icon {
      width: 14px;
      height: 14px;
    }
  }

  .holder {
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
    width: 100%;

    .counter {
      @include font-size(1.2rem);

      position: absolute;
      z-index: 2;
      top: 477px;
      right: 0;
      font-weight: 600;
      padding: 0.2rem 0.8rem;
      color: var(--background-color);
      background-color: var(--default-color);
    }

    .image {
      display: flex;
      align-items: center;
      justify-content: center;
      height: var(--slide-height);
      background: var(--placeholder-color-semi);
      position: relative;

      img {
        max-height: 100%;
        width: auto;
        cursor: zoom-in;
      }
    }

    &:hover .action {
      display: flex;
    }
  }

  .navigation {
    display: flex;
    position: absolute;
    top: 0;
    bottom: 0;
    align-items: center;
    cursor: pointer;
    height: 100%;
    width: 10%;
    z-index: 2;

    &.disabled {
      opacity: 0.5;
      cursor: inherit;
    }

    &.prev {
      background-image: linear-gradient(to right, #000, rgb(0 0 0 / 0%));
      left: 0;
    }

    &.next {
      background-image: linear-gradient(to left, #000, rgb(0 0 0 / 0%));
      justify-content: end;
      right: 0;
    }

    .icon {
      height: var(--navigation-reserve);
      width: var(--navigation-reserve);
      transition: 0.3s ease-in-out;
    }

    &:not(.disabled):hover .icon {
      opacity: 0.6;
    }
  }

  &.articleMode .navigation {
    .icon {
      filter: invert(1);
    }
  }

  .slideDescription {
    margin-top: 8px;
    align-self: flex-start;

    .articleTitle {
      @include font-size(1.4rem);
    }

    .source {
      @include font-size(1.2rem);

      color: var(--secondary-color);
    }

    .body {
      @include font-size(1.7rem);

      margin-top: 24px;

      * {
        color: var(--default-color-invert) !important; //Force fix migration errors with inline styles
      }

      @include media-breakpoint-up(md) {
        // margin-left: calc((100% + 130px) * 0.15);
        margin-left: calc(15% + 24px);
      }
    }
  }

  .thumbs {
    margin: 3rem 0;
    max-height: var(--slide-height);
    position: relative;

    .navigation {
      height: auto;

      &.prev {
        left: calc(0px - var(--navigation-reserve));
      }

      &.next {
        right: calc(0px - var(--navigation-reserve));
      }
    }

    .upload {
      border: 1px solid #ccced3;
      box-sizing: border-box;
      cursor: pointer;

      .inner {
        position: relative;
        z-index: 1000;
        width: 110px;
        height: 75px;
        display: flex;
        align-items: center;
        justify-content: center;
      }
    }

    .imageThumb {
      width: 110px;
      height: 75px;
      background-size: cover;
      background-position: 50% 50%;
      background-color: var(--placeholder-color-semi);
      opacity: 0.5;
      filter: grayscale(1);
      transition:
        filter 0.3s ease-in-out,
        opacity 0.5s ease-in-out;

      .thumbAction {
        display: none;
        position: absolute;
        top: 6px;
        right: 6px;
        flex-direction: column;
        gap: 5px;

        .action {
          position: static;
          display: flex;
          width: 18px;
          height: 18px;

          &.hidden {
            display: none;
          }

          .icon {
            width: 8px;
            height: 8px;
          }
        }
      }

      &:hover {
        opacity: 1;
        cursor: pointer;
        filter: none;

        .thumbAction {
          display: flex;
        }
      }
    }
  }

  .addSlides {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2rem auto;
  }

  .description {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
    margin: 1em 0;

    .input {
      @include font-size(1.4rem);

      padding: 0;
      margin: 0;
      border: none;
      height: 1.2em;

      &:focus {
        outline: none;
      }

      &::placeholder {
        color: var(--placeholder-color);
      }

      &.title {
        font-weight: 500;
      }
    }
  }

  :global(.swiper-lazy-preloader) {
    top: calc(var(--slide-height) / 2);
  }
}

:global(.swiper-slide-thumb-active) {
  .imageThumb {
    opacity: 1 !important;
    filter: none !important;

    .thumbAction {
      display: flex !important;
    }
  }

  .swiper-button-prev,
  .swiper-rtl .swiper-button-next {
    top: 200px !important;
  }
}
