@use "../../abstracts/variables" as *;
@use "../../abstracts/mixins" as *;

.simulation-player-wrapper {
  position: fixed;
  bottom: 32px;
  left: 50%;
  z-index: 2;
  transform: translate(-50%, 0);
  max-width: calc(100vw - (2 * 328px));
  width: 100%;
  transition: all 0.3s;

  &.hide {
    width: fit-content;

    .simulation-player-container .controls-container .simulation-button-container {
      width: 32px;
      height: 24px;
    }
  }

  .simulation-player-container {
    background: var(--background-color);
    padding: 7px;
    border-radius: #{$border-radius-xlarge};
    display: flex;
    flex-direction: column;
    gap: 8px;
    backdrop-filter: blur(10px);
    outline: 1px solid var(--border-color);

    .progresser-wrapper {
      outline: 1px solid var(--border-color);
      background: var(--background-color);
      border-radius: #{$border-radius-large};
      display: flex;
      flex-direction: column;
      gap: 12px;
      padding: 12px 5px;
      padding-top: 38px;
      transition: height 0.2s linear;
    }

    .controls-container {
      @include flex-space-between;
      gap: 12px;
      justify-content: space-between;

      .header {
        @include flex-center;
        gap: 6px;
        padding: 0 8px;

        svg {
          scale: 1.3;
        }
      }

      .production-details,
      .controls-wrapper {
        @include flex-center;
        gap: 6px;
      }

      .production-details {
        .production-wrapper {
          display: flex;
          // align-items: center;
          flex-direction: column;
          gap: 6px;

          .header {
            display: flex;
            flex-direction: row;
            justify-content: start;
            gap: 6px;
          }

          .progress-wrapper {
            width: 164px;
            height: 8px;
            border-radius: #{$border-radius-small};
            background: var(--background-color-solid);

            .progress {
              border-radius: #{$border-radius-small};
              height: 100%;
              background-color: var(--background-color-accent);
            }
          }
        }
      }

      .expand-icon-container {
        @include flex-center;
        padding: 0 8px;
        cursor: pointer;
      }

      .simulation-button-container {
        @include flex-center;
        gap: 2px;
        padding: 4px 8px;
        width: 64px;
        background: var(--background-color);
        border-radius: #{$border-radius-extra-large};
        height: fit-content;
        cursor: pointer;
        transition: all 0.2s;
        outline: 1px solid transparent;

        &:hover {
          outline: 1px solid var(--border-color);
          background: var(--background-color);
          color: var(--accent-color);

          path {
            stroke: var(--accent-color);
          }
        }
      }
    }

    .speed-control-container {
      @include flex-center;
      gap: 32px;
      padding: 5px 16px;
      border-radius: #{$border-radius-medium};
      box-sizing: #{$box-shadow-medium};
      position: relative;

      .min-value,
      .max-value {
        display: flex;
        align-items: center;
        font-weight: var(--font-weight-bold);
      }

      .slider-container {
        width: 100%;
        max-width: 80vw;
        height: 28px;
        border-radius: #{$border-radius-small};
        position: relative;

        .speed-label {
          font-size: var(--font-size-tiny);
          position: absolute;
          bottom: -7px;
          transform: translate(-50%, -0%);

          &:first-child {
            left: 0;
          }

          &:last-child {
            right: -10px;
          }
        }

        &::after {
          content: "";
          background: var(--background-color-solid);
          opacity: 0.4;
          position: absolute;
          top: 50%;
          transform: translate(0, -50%);
          width: 100%;
          height: 3px;
        }

        .custom-slider-wrapper {
          height: 100%;
          width: 100%;
          padding: 0 26px;
          background: transparent;
          border-radius: #{$border-radius-large};
        }

        .custom-slider {
          height: 100%;
          width: 100%;
          position: relative;

          .slider-input {
            position: absolute;
            width: 100%;
            height: 100%;
            opacity: 0;
            z-index: 3;
            cursor: pointer;
          }

          .slider-handle {
            position: absolute;
            top: 50%;
            min-width: 44px;
            padding: 0 8px;
            line-height: 20px;
            text-align: center;
            background: var(--background-color-button);
            color: var(--text-button-color);
            border-radius: #{$border-radius-large};
            transform: translate(-50%, -50%);
            font-size: var(--font-size-small);
            cursor: pointer;
            z-index: 2;
          }
        }

        .marker {
          position: absolute;
          background: var(--background-color-solid);
          opacity: 0.6;
          width: 2px;
          height: 12px;
          top: 8px;
          z-index: 1;
        }

        .marker.marker-10 {
          left: 10%;
        }

        .marker.marker-20 {
          left: 20%;
        }

        .marker.marker-30 {
          left: 30%;
        }

        .marker.marker-40 {
          left: 40%;
        }

        .marker.marker-50 {
          left: 50%;
        }

        .marker.marker-60 {
          left: 60%;
        }

        .marker.marker-70 {
          left: 70%;
        }

        .marker.marker-80 {
          left: 80%;
        }

        .marker.marker-90 {
          left: 90%;
        }
      }
    }

    .time-displayer {
      @include flex-space-between;
      gap: 24px;
      height: auto;
      opacity: 1;
      transition: all 0.5s ease;

      .start-time-wrappper,
      .end-time-wrappper {
        @include flex-center;
        gap: 4px;

        .icon {
          @include flex-center;
        }
      }

      .time-progresser {
        flex: 1;

        .timeline {
          padding: 16px;
          outline: 1px solid var(--border-color);
          background: var(--background-color);
          border-radius: #{$border-radius-xxx};
          display: flex;
          align-items: center;
          width: 100%;
          height: 33px;

          .label-dot-wrapper {
            @include flex-center;
            position: relative;

            .label {
              position: absolute;
              top: -36px;
              transform: translate(0, -0);
              font-size: 12px;
              color: var(--text-color);
              white-space: nowrap;
            }

            .dot {
              width: 14px;
              height: 14px;
              border-radius: #{$border-radius-circle};
              background-color: #d3d3e2;

              &.filled {
                background-color: var(--accent-color);
                border: 4px solid #8f5cf2;
              }
            }
          }

          .line {
            flex-grow: 1;
            height: 4px;
            background-color: #d3d3e2;
            margin: 0 4px;

            &.filled {
              background-color: #8f5cf2;
            }
          }
        }
      }
    }
  }

  .open {

    .start-displayer,
    .end-displayer {
      display: none;
    }

    .timmer {
      display: none;
    }

    .progresser-wrapper {
      padding-top: 4px;
    }

    .time-displayer {
      height: 0;
      opacity: 0;
      pointer-events: none;
      display: none;
    }

    .processDisplayer {
      padding: 0 8px;
      background: transparent;

      .process-player {
        width: 0;
        display: none !important;
      }
    }
  }
}

.controls-player-container {
  min-width: 26vw;
  max-width: 80vw;
  border-radius: 15px;
  gap: 40px;
  background: var(--background-color);
  backdrop-filter: blur(20px);
  cursor: pointer;
  @include flex-center;
  justify-content: space-between;
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translate(-50%, 0);
  color: var(--accent-color);
  z-index: 2;
  isolation: isolate;
  font-weight: 700;
  padding: 8px;
  transition: all 0.2s;

  &.hide {
    min-width: auto;
    width: 92px;
  }

  .controls-left,
  .controls-right {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: var(--font-size-small);

    .label {
      text-transform: capitalize;
      font-size: var(--font-size-small);
    }

    .walkMode-wrapper {
      display: flex;
      align-items: center;
      gap: 4px;

      .input-toggle-container {
        padding: 0;
        gap: 4px;

        .label {
          font-size: var(--font-size-small);
        }
      }
    }

    .btn-wrapper {
      @include flex-center;
      gap: 2px;
      padding: 4px 8px;
      width: 64px;
      background: var(--background-color);
      border-radius: 20px;
      height: fit-content;
      cursor: pointer;
      transition: all 0.2s;
      outline: 1px solid transparent;

      &:hover {
        outline: 1px solid var(--border-color);
        color: var(--accent-color);
      }

      &.hide {
        width: 32px;
      }

      .icon {
        width: 16px;
        height: 16px;
        @include flex-center;
      }
    }
  }
}

.processDisplayer {
  border-radius: #{$border-radius-large};
  outline: 1px solid var(--border-color);
  background: var(--background-color);
  padding: 20px 6px;
  position: relative;

  .timmer {
    width: auto;
    position: absolute;
    bottom: 0;
    font-size: var(--font-size-tiny);
  }

  .start-displayer {
    bottom: 4px;
    left: 16px;
  }

  .end-displayer {
    bottom: 4px;
    width: auto;
    right: 16px;
  }

  .process-player {
    position: absolute;
    top: 50%;
    transform: translate(0, -50%);
    width: 3.946108102798462px;
    height: 26px;
    left: 86.81px;
    border-radius: #{$border-radius-large};
    border-width: 1px;
    background: var(--background-color-accent, #6f42c1);
  }

  .process-wrapper {
    .process-container {
      position: relative;
      display: flex;
      width: 100%;

      .process {
        height: 5px;
        border-radius: #{$border-radius-small};
        color: white;
        text-align: center;
        line-height: 30px;
        transition: width 0.3s ease;
      }
    }
  }
}

.asset-details-card-wrapper {
  pointer-events: none;

  .asset-details-card-container {
    position: relative;
    padding: 8px;
    background: var(--background-color);
    backdrop-filter: blur(6px);
    border-radius: #{$border-radius-large};
    transform: translate(0, -100%);
    z-index: 0;
    box-shadow: inset 0px 10px 50px #80808075;
    min-width: 124px;

    &::before {
      content: "";
      position: absolute;
      inset: 0;
      border-radius: inherit;
      background: linear-gradient(135deg, var(--accent-color), #ff00f000);
      background-size: 400% 400%;
      animation: borderAnimation 5s linear infinite;
      -webkit-mask: linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
      mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
      -webkit-mask-composite: xor;
      mask-composite: exclude;
      z-index: -1;
      padding: 1px;
    }

    .asset-details-header {
      @include flex-space-between;
      gap: 12px;

      .content {
        .name {
          text-wrap: nowrap;
          max-width: 140px;
          overflow: hidden;
          text-overflow: ellipsis;
          margin-bottom: 4px;
          text-transform: capitalize;
        }

        .status-container {
          .status {
            display: flex;
            align-items: center;
            gap: 6px;
            padding-top: 4px;

            .icon {
              @include flex-center;
            }
          }
        }

        .active-time {
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
          .value {
            color: var(--highlight-text-color);
          }
        }

        .storage-container {
          font-size: var(--font-size-tiny);
          color: var(--highlight-text-color);
        }
        
      }
    }

    .process-running-container {
      width: 100%;
      height: 8px;
      background: var(--background-color-solid);
      margin-top: 12px;
      border-radius: #{$border-radius-small};
      overflow: hidden;
      position: relative;

      .process-running {
        height: 100%;
        width: 35%;
        border-radius: #{$border-radius-small};
        background: var(--process-color);
        animation: playing-process 1s ease-in-out infinite;
      }
    }

    .indication-arrow {
      position: absolute;
      left: 50%;
      bottom: 0;
      transform: translate(-50%, 10px);
      filter: drop-shadow(0px 0px 4px #ffffff);
    }

    .count-ui-wrapper {
      position: absolute;
      right: -16px;
      top: -2px;
      padding: 4px;
      padding-right: 8px;

      .count-ui-container {
        background: var(--background-color-solid);
        padding: 8px;
        outline: 1px solid var(--border-color);
        border-radius: #{$border-radius-large};
        box-shadow: inset 0px 10px 50px #8080803a;
        max-width: 80px;
        position: absolute;
        left: 0;

        .content {
          @include flex-center;
          gap: 2px;

          .icon {
            @include flex-center;
          }

          .display {
            font-size: var(--font-size-small);
          }
        }

        .value-container {
          @include flex-center;
          gap: 4px;

          .progress-bar {
            display: flex;
            align-items: center;
            gap: 1px;
            height: 10px;
          }

          .block {
            width: 5px;
            height: 100%;
            border-radius: 2px;
            transition: background-color 0.3s;
            background: var(--background-color);
            overflow: hidden;
            position: relative;

            .fill {
              height: 100%;
              background: linear-gradient(to top,
                  var(--background-color-accent) var(--process-fill-percentage),
                  transparent var(--process-fill-percentage));
            }
          }

          .value {
            font-size: var(--font-size-tiny);
            color: var(--input-text-color);
          }
        }
      }
    }
  }
}

@keyframes playing-process {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(300%);
  }
}

@keyframes borderAnimation {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}