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

.simulation-player-wrapper {
  position: fixed;
  bottom: 32px;
  left: 50%;
  z-index: 2;
  transform: translate(-50%, 0);
  width: 70vw;

  .simulation-player-container {
    background: var(--background-color);
    padding: 7px;
    border-radius: 15px;
    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: 12px;
      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;
            gap: 6px;
          }

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

            .progress {
              border-radius: 5px;
              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;
        min-width: 64px;
        background: var(--background-color);
        border-radius: #{$border-radius-extra-large};
        height: fit-content;
        cursor: pointer;

        &: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;
          border-radius: 1px;
          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: 30px;
          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: 50%;
              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;
      }
    }
  }
}

.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: 14px;
    border-width: 1px;
    background: var(--background-color-accent, #6f42c1);
  }
  .process-wrapper {
    .process-container {
      position: relative;
      display: flex;
      width: 100%;

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