@import '../custom.less';
@import './vars.less';

@guide-prefix-cls: ~'@{css-prefix}guide';
.@{guide-prefix-cls} {
  .inject-Guide-vars();

  .shepherd-arrow {
    height: calc(var(--tv-Guide-arrow-height) * 1.4);
    position: absolute;
    width: calc(var(--tv-Guide-arrow-width) * 1.4);
    z-index: -10;
    overflow: hidden;

    &:before {
      width: var(--tv-Guide-arrow-width);
      position: absolute;
      height: var(--tv-Guide-arrow-height);
      background-color: var(--tv-Guide-header-bg-color);
      transform: translate(-50%, -50%) rotate(45deg);
      left: 50%;
      top: 50%;
      z-index: -10;
      content: '';
    }
  }

  .shepherd-content {
    width: 100%;
    padding: 0;
    outline: none;

    .shepherd-header {
      align-items: center;
      border-top-left-radius: var(--tv-Guide-header-border-radius);
      border-top-right-radius: var(--tv-Guide-header-border-radius);
      display: flex;
      justify-content: flex-end;
      line-height: var(--tv-Guide-header-line-height);
      padding: 24px 24px 0;
      background-color: var(--tv-Guide-header-bg-color);

      .shepherd-title {
        font-size: var(--tv-Guide-title-text-font-size);
        color: var(--tv-Guide-title-text-color);
        line-height: var(--tv-Guide-title-line-height);
        font-weight: var(--tv-Guide-title-font-weight);
        display: flex;
        margin: 0;
        padding: 0;
        flex: 1 0 auto;
      }

      .shepherd-cancel-icon {
        display: flex;
        background-color: transparent;
        border: none;
        cursor: pointer;
        margin: 0;
        padding: 0;
        transition: color 0.5s ease;

        span {
          display: inline-flex;
          justify-content: center;
          margin-top: -12px;
          margin-right: -4px;

          svg {
            width: var(--tv-Guide-cancel-icon-width);
            height: var(--tv-Guide-cancel-icon-height);
            fill: var(--tv-Guide-cancel-icon-color);
          }
        }

        span:hover {
          svg {
            fill: var(--tv-Guide-cancel-hover-icon-color);
          }
        }
      }
    }

    .shepherd-text {
      line-height: var(--tv-Guide-text-line-height);
      color: var(--tv-Guide-text-text-color);
      font-size: var(--tv-Guide-text-font-size);
      padding: 8px 24px 24px;

      .scrollBox {
        width: 100%;
        overflow: auto;
        text-align: justify;
        padding-right: 8px;

        &::-webkit-scrollbar {
          width: 4px;
          height: 40px;
        }

        &::-webkit-scrollbar-thumb {
          width: 8px;
          height: 8px;
          border-radius: 2px;
          background-clip: padding-box;
          border: 4px solid var(--tv-Guide-text-scrollbar-border-color);
        }
      }

      p {
        margin-top: 0;

        &:last-child {
          margin-bottom: 0;
        }
      }
    }

    .shepherd-footer {
      border-bottom-right-radius: var(--tv-Guide-footer-border-bottom-right-radius);
      border-bottom-left-radius: var(--tv-Guide-footer-border-bottom-left-radius);
      display: flex;
      justify-content: flex-end;
      padding: 0 24px 24px;
      align-items: center;
      position: relative;

      &.shepherd-button:last-child {
        margin-right: 0;
      }

      .progress-style {
        position: absolute;
        left: 24px;
        font-size: 14px;
        color: var(--tv-Guide-progresss-text-color);
        font-weight: 400;
      }

      .shepherd-button {
        color: var(--tv-Guide-button-text-color);
        background-color: var(--tv-Guide-button-bg-color);
        cursor: pointer;
        border-radius: var(--tv-Guide-button-border-radius);
        border: 1px solid var(--tv-Guide-button-border-color);
        width: var(--tv-Guide-button-width);
        height: var(--tv-Guide-button-height);
        margin-left: 8px;
        text-align: center;
        transition: all 0.5s ease;
        font-size: var(--tv-Guide-button-font-size);

        &:hover {
          border-color: var(--tv-Guide-button-hover-border-color);
        }

        &:disabled {
          background-color: var(--tv-Guide-button-disable-bg-color);
          color: var(--tv-Guide-button-disable-text-color);
          cursor: not-allowed;
        }
      }
    }
  }

  &.only-content {
    .shepherd-header {
      padding-top: 0;

      .shepherd-cancel-icon {
        position: absolute;
        top: 24px;
      }
    }

    .shepherd-text {
      padding-right: 52px;
      margin-top: 12px;
    }
  }

  .@{guide-prefix-cls}__z-top {
    z-index: 9999;
    position: relative;
    background-color: var(--tv-Guide-header-bg-color);
  }

  &.shepherd-element.shepherd-has-title[data-popper-placement^='bottom'] {
    & > .shepherd-arrow:before {
      background-color: var(--tv-Guide-header-bg-color);
    }
  }

  &.shepherd-element {
    height: auto;
    box-shadow: 0 16px 48px 0 rgba(0, 0, 0, 0.16);
    background-color: var(--tv-Guide-header-bg-color);
    opacity: 0;
    visibility: hidden;
    z-index: 9999;
    width: var(--tiny-guide-shepherd-element-size);
    outline: none;
    border-radius: var(--tv-Guide-shepherd-element-border-radius);
    transition:
      opacity 0.3s,
      visibility 0.3s;
  }

  &.shepherd-enabled.shepherd-element {
    opacity: 1;
    visibility: visible;
  }

  &.shepherd-element[data-popper-reference-hidden]:not(.shepherd-centered) {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
  }

  &.shepherd-element,
  &.shepherd-element *,
  &.shepherd-element :after,
  &.shepherd-element :before {
    box-sizing: border-box;
  }

  &.shepherd-element[data-popper-placement^='top'] > .shepherd-arrow {
    bottom: calc(-0.7 * var(--tv-Guide-arrow-width));
  }

  &.shepherd-element[data-popper-placement^='bottom'] > .shepherd-arrow {
    top: calc(-0.7 * var(--tv-Guide-arrow-width));
  }

  &.shepherd-element[data-popper-placement^='left'] > .shepherd-arrow {
    right: calc(-0.7 * var(--tv-Guide-arrow-width));
  }

  &.shepherd-element[data-popper-placement^='right'] > .shepherd-arrow {
    left: calc(-0.7 * var(--tv-Guide-arrow-width));
  }

  &.shepherd-element.shepherd-centered > .shepherd-arrow {
    opacity: 0;
  }

  &.shepherd-target-click-disabled.shepherd-enabled.shepherd-target,
  &.shepherd-target-click-disabled.shepherd-enabled.shepherd-target * {
    pointer-events: none;
  }
}

.shepherd-modal-overlay-container {
  pointer-events: none;
  width: 100%;
  overflow: hidden;
  height: 100%;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0;
  position: fixed;
  z-index: 9997;
  top: 0;
  transition:
    all 0.3s ease-out,
    height 0ms 0.3s,
    opacity 0.3s 0ms;

  &.shepherd-modal-is-visible {
    opacity: 0.5;
    transform: translateZ(0);
    transition:
      all 0.3s ease-out,
      height 0s 0s,
      opacity 0.3s 0s;

    path {
      pointer-events: all;
    }
  }
}

.@{guide-prefix-cls}__z-top {
  z-index: 9999;
  position: relative;
  background-color: var(--tv-Guide-header-bg-color);
}
