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

.sidebar-left-wrapper {
  width: 270px;
  position: fixed;
  top: 32px;
  left: 8px;
  background-color: var(--background-color);
  backdrop-filter: blur(150px);
  border-radius: #{$border-radius-extra-large};
  box-shadow: #{$box-shadow-medium};
  z-index: #{$z-index-tools};

  .header-container {
    @include flex-space-between;
    padding: 10px;
    width: 100%;

    .header-content {
      @include flex-center;
      width: calc(100% - 34px);

      .logo-container {
        @include flex-center;
      }

      .header-title {
        padding: 0 8px;
        width: 100%;
        max-width: calc(100% - 32px);

        .input-value {
          color: var(--accent-color);
        }
      }
    }

    .toggle-sidebar-ui-button {
      @include flex-center;
      cursor: pointer;
      height: 32px;
      width: 32px;
      min-height: 32px;
      min-width: 32px;
      border-radius: #{$border-radius-small};

      &:hover {
        background-color: var(--background-color-secondary);
      }
    }

    .active {
      background-color: var(--background-color-secondary);
      outline: 1px solid var(--accent-color);
      outline-offset: -1px;
    }
  }

  .sidebar-left-container {
    min-height: 50vh;
    padding-bottom: 12px;
    position: relative;
    display: flex;
    flex-direction: column;

    .sidebar-left-content-container {
      border-bottom: 1px solid var(--border-color);
      // flex: 1;
      // height: calc(100% - 36px);
      position: relative;
      // overflow: auto;

      .template-list {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
        min-height: 50vh;
        max-height: 60vh;
      }

      .template-item {
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 1rem;
        transition: box-shadow 0.3s ease;
      }

      .template-image-container {
        position: relative;
        padding-bottom: 56.25%; // 16:9 aspect ratio
      }

      .template-image {
        position: absolute;
        width: 100%;
        height: 100%;
        object-fit: contain;
        border-radius: 4px;
        cursor: pointer;
        transition: transform 0.3s ease;
      }

      .template-details {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 0.5rem;
      }

      .template-name {
        cursor: pointer;
        font-weight: 500;
      }

      .delete-button {
        padding: 0.25rem 0.5rem;
        background: #ff4444;
        color: white;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        transition: opacity 0.3s ease;
      }

      .no-templates {
        text-align: center;
        color: #666;
        padding: 2rem;
        grid-column: 1 / -1;
      }

      .widgets-wrapper {
        min-height: 50vh;
        max-height: 60vh;
        overflow: auto;
      }

      .widget-left-sideBar {
        .widget2D {
          overflow: auto;

          .chart-container {
            display: flex;
            flex-direction: column;
            gap: 8px;
            padding: 6px;
            flex-wrap: nowrap;
            overflow: auto;

            .chart {
              min-height: 170px;
              background: var(--background-color);
              border: 1.23px solid var(--border-color);
              box-shadow: 0px 4.91px 4.91px 0px #0000001c;
              border-radius: $border-radius-medium;
              padding: 12px 6px;
            }

            .progressBar {
              height: auto !important;
              padding: 12px 10px 41px 10px;
              display: flex;
              flex-direction: column;
              gap: 16px;

              .header {
                display: flex;
                justify-content: start;
                align-items: center;
                border-bottom: none;
              }

              .stock {
                padding: 13px 5px;
                background-color: var(--background-color-secondary);
                border-radius: 6.33px;
                display: flex;
                justify-content: space-between;

                .stock-item {
                  .stockValues {
                    display: flex;
                    flex-direction: row-reverse;
                    align-items: flex-end;
                    gap: 3px;

                    .value {
                      color: var(--accent-color);
                      font-size: var(--font-size-large);
                    }
                  }

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

        .widget3D {
          display: flex;
          flex-direction: column;
          gap: 6px;
          padding: 6px;

          .widget-item {
            height: 170px;
            background: var(--background-color);
            border: 1.23px solid var(--border-color);
            box-shadow: 0px 4.91px 4.91px 0px #0000001c;
            border-radius: $border-radius-medium;
            padding: 12px 6px;

            .widget-image {
              width: 100%;
              height: 90%;
              object-fit: contain;
            }
          }
        }
      }
    }

    .outline-container {
      height: 100%;

      .outline-content-container {
        position: relative;
        height: 100%;
        overflow: auto;
        max-height: 60vh;
      }
    }
  }
}

.sidebar-right-wrapper {
  width: 320px;
  position: fixed;
  top: 32px;
  right: 8px;
  background-color: var(--background-color);
  backdrop-filter: blur(150px);
  border-radius: #{$border-radius-extra-large};
  box-shadow: #{$box-shadow-medium};
  z-index: #{$z-index-tools};

  .header-container {
    @include flex-space-between;
    padding: 10px;
    width: 100%;
    gap: 12px;
    height: 52px;

    .options-container {
      @include flex-center;
      gap: 8px;

      .share-button {
        padding: 4px 12px;
        color: var(--primary-color);
        background-color: var(--accent-color);
        font-weight: var(--font-weight-regular);
        border-radius: #{$border-radius-large};
        cursor: pointer;
      }

      .app-docker-button {
        @include flex-center;
      }
    }

    .split {
      height: 20px;
      width: 2px;
      background: var(--background-color-secondary);
    }

    .users-container {
      width: 100%;
      @include flex-space-between;

      .user-profile {
        @include flex-center;
        height: 26px;
        width: 26px;
        min-height: 26px;
        min-width: 26px;
        border-radius: 50%;
        font-weight: var(--font-weight-bold);
        color: white;
        text-transform: capitalize;
      }

      .guest-users-container {
        display: flex;
        width: 100%;
        justify-content: flex-end;

        .other-guest {
          @include flex-center;
          height: 26px;
          width: 26px;
          min-height: 26px;
          min-width: 26px;
          border-radius: 50%;
          background: var(--highlight-accent-color);
          font-weight: var(--font-weight-bold);
          color: var(--accent-color);
          outline: 1px solid var(--accent-color);
          outline-offset: -1px;
        }
      }

      .user-profile-container {
        display: flex;

        .user-profile {
          background: var(--accent-color);
          color: var(--primary-color);
        }

        .user-organization {
          height: 26px;
          width: 52px;
          max-width: 52px;
          border-radius: 20px;
          overflow: hidden;
          margin-left: 2px;

          img {
            height: 100%;
            width: 100%;
            object-fit: cover;
            vertical-align: top;
          }
        }
      }
    }
  }

  .sidebar-actions-container {
    position: absolute;
    left: -40px;

    .sidebar-action-list {
      margin-bottom: 12px;
      @include flex-center;
      height: 34px;
      width: 34px;
      border-radius: #{$border-radius-circle};
      background: var(--primary-color);
      box-shadow: #{$box-shadow-medium};
    }

    .active {
      background: var(--accent-color);
    }
  }

  .sidebar-right-container {
    min-height: 50vh;
    padding-bottom: 12px;
    position: relative;
    display: flex;
    flex-direction: column;

    .sidebar-right-content-container {
      border-bottom: 1px solid var(--border-color);
      // flex: 1;
      height: calc(100% - 36px);
      position: relative;
      overflow: auto;
    }
  }

  .visualization-right-sideBar {
    min-height: 50vh;
    max-height: 60vh;

    .sidebar-right-content-container {
      .dataSideBar {
        .inputs-wrapper {
          .datas {
            .input-value {
              padding: 5px 10px;
            }

            .input-value,
            .rename-input {
              margin-right: 24px;
              width: 170px;
              overflow: hidden;
              text-overflow: ellipsis;
              white-space: nowrap;
            }
          }
        }

        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 10px 12px;

        .datas {
          display: flex;
          align-items: center;
          justify-content: space-between;

          .datas__class {
            display: flex;
            align-items: center;

            .multi-level-dropdown {
              width: 170px;

              .dropdown-button {
                display: flex;
                justify-content: space-between;
                gap: 6px;
              }
            }
          }

          .datas__class {
            display: flex;
            gap: 12px;

            // .datas__separator {
            // }

            .disable {
              cursor: not-allowed;
              pointer-events: none;
              /* Disables all mouse interactions */
              opacity: 0.5;
              /* Optional: Makes the button look visually disabled */
            }
          }
        }

        .sideBarHeader {
          color: var(--accent-color);
          border-bottom: 1px solid var(--border-color);
          padding-bottom: 6px;
        }

        .inputs-wrapper {
          display: flex;
          flex-direction: column;
          gap: 6px;
        }

        .selectedMain-container {
          display: flex;
          flex-direction: column;
          gap: 6px;
          border-bottom: 1px solid var(--border-color);
          padding-bottom: 10px;

          .selectedMain {
            display: flex;
            align-items: center;
            gap: 6px;

            main {
              width: 35%;
              white-space: nowrap;
              /* Prevent wrapping */
            }

            .icon {
              padding: 0;
              cursor: pointer;
            }

            button {
              background-color: transparent;
              box-shadow: none;
              color: #5273eb;
              padding: 6px;
              font-size: var(--font-size-xlarge);
            }

            .bulletPoint {
              color: #5273eb;
              font-size: var(--font-size-large);
            }

            .regularDropdown-container {
              width: 100%;
            }

            &:first-child {
              gap: 4px;
            }
          }
        }

        .child {
          width: 100%;
          gap: 6px;
        }

        .infoBox {
          display: flex;
          align-items: flex-start;
          gap: 6px;
          color: #444;
          border-radius: 6px;
          font-size: var(--font-weight-regular);

          .infoIcon {
            padding: 0px 7px;
            border-radius: 50%;
            border: 1px solid gray;
          }

          p {
            margin: 0;
          }
        }
      }

      .design {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 15px;
        padding: 0;
        font-size: var(--font-weight-regular);
        color: #4a4a4a;

        .reviewChart {
          width: 100%;

          .floating {
            width: 100%;
          }
        }

        .selectedWidget {
          padding: 6px 12px;
          border-top: 1px solid var(--border-color);
          border-bottom: 1px solid var(--border-color);
        }
      }

      .reviewChart {
        width: 100%;
        height: 150px;
        background: #f0f0f0;
        // border-radius: 8px;
        display: flex;
        align-items: center;
        // justify-content: center;
      }

      .optionsContainer {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 0 12px;

        .option {
          display: flex;
          align-items: center;
          justify-content: space-between;
          gap: 12px;

          .regularDropdown-container,
          input {
            width: 160px;
          }

          &:last-child {
            flex-direction: column;

            .header {
              width: 100%;
              display: flex;
              justify-content: space-between;
            }

            .colorDisplayer {
              width: 100%;
              display: flex;
              justify-content: start;
              align-items: center;

              input[type="color"] {
                border: none;
                outline: none;
                background: none;
                width: 24px;
                height: 26px;
                border-radius: 3.2px;
              }
            }
          }

          span {
            min-width: 100px;
          }
        }
      }
    }
  }

  .machine-mechanics-container {
    .machine-mechanics-header {
      padding: 8px 12px;
      border-top: 1px solid var(--border-color);
      border-bottom: 1px solid var(--border-color);
      color: var(--accent-color);
    }

    .process-list-container {
      display: flex;
      align-items: center;
      gap: 4px;
      padding: 8px;
      border-bottom: 1px solid var(--border-color);

      .label {
        margin-right: 8px;
      }

      .add-new-process {
        @include flex-center;
        height: 24px;
        min-width: 24px;
        cursor: pointer;
        background: var(--background-color-secondary);
        border-radius: #{$border-radius-medium};

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

        &:hover {
          background: var(--accent-color);

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

  .machine-mechanics-content-container,
  .simulations-container,
  .event-proprties-wrapper {
    max-height: calc(60vh - (47px - 35px));
    overflow: auto;
    overflow-y: scroll;

    .header {
      @include flex-space-between;
      padding: 6px 12px;
      padding-right: 6px;

      .add-button {
        @include flex-center;
        padding: 2px 4px;
        background: var(--accent-color);
        color: var(--primary-color);
        border-radius: #{$border-radius-small};
        cursor: pointer;

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

    .global-props {
      .property-list-container {
        .property-item {
          .value-field-container {
            margin: 0;
            input {
              padding: 5px 4px;
            }
            .dropdown {
              top: 4px;
              right: 4px;
            }
          }
        }
      }
    }

    .selected-actions-details {
      .selected-actions-header .input-value {
        padding: 8px 12px;
        color: var(--accent-color);
      }
      .selected-actions-list {
        margin-bottom: 8px;
        .eye-dropper-input-container{
          padding: 6px 12px;
          .regularDropdown-container {
            padding: 5px 8px;
            outline: 2px solid var(--border-color);
            outline-offset: -2px;
            border: none;
          }
        }
        .value-field-container {
          margin: 0;
          input {
            padding: 5px 4px;
          }
          .dropdown {
            top: 4px;
            right: 4px;
          }
        }
      }
    }

    .lists-main-container {
      margin: 2px 8px;
      width: calc(100% - 12px);
      margin-right: 4px;
      background: var(--background-color-gray);
      border-radius: #{$border-radius-small};
      min-height: 120px;

      .list-container {
        padding: 4px;
        height: calc(100% - 16px);
        overflow-y: scroll;

        .list-item {
          @include flex-space-between;
          padding: 2px 12px;
          width: 100%;
          margin: 2px 0;
          border-radius: #{$border-radius-small};
        }

        .value {
          display: flex;
          justify-content: flex-start;
          align-items: center;
          min-width: 80%;
          gap: 6px;

          input {
            width: fit-content;
            outline: none;
            accent-color: var(--accent-color);
          }
        }

        .active {
          background: var(--highlight-accent-color);

          .value .input-value {
            color: var(--accent-color);
          }

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

        .remove-button {
          @include flex-center;
          height: 18px;
          width: 18px;
          cursor: pointer;
          border-radius: #{$border-radius-small};
          transform: translateX(4px);

          &:hover {
            background-color: var(--accent-color);

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

      .resize-icon {
        @include flex-center;
        padding: 4px;
        cursor: grab;

        &:active {
          cursor: grabbing;
        }
      }
    }

    .selected-properties-container {
      padding: 12px;

      .properties-header {
        color: var(--accent-color);
        font-weight: var(--font-weight-regular);
        padding: 8px 0;
      }

      .input-toggle-container {
        padding: 0;
        margin-bottom: 6px;
      }

      .value-field-container {
        margin-bottom: 6px;
        padding: 0;
        @include flex-space-between;

        .label {
          width: 40%;
        }

        .regularDropdown-container {
          width: 60%;
        }

        .default {
          width: 60%;
        }
      }
    }

    .simulation-process {
      .collapse-header-container {
        @include flex-space-between;
        padding-right: 12px;
        margin-top: 8px;
        border-top: 1px solid var(--border-color);
        border-bottom: 1px solid var(--border-color);

        .header {
          color: var(--accent-color);
        }
      }

      .process-container {
        padding: 0 12px;
        margin: 6px 0;

        .value {
          @include flex-space-between;

          .arrow-container {
            height: 16px;
            width: 16px;
          }

          .active {
            rotate: 90deg;
          }
        }

        .children-drop {
          .value {
            padding: 6px;
            border-left: 1px solid var(--border-color);
          }
        }
      }
    }

    .footer {
      @include flex-center;
      justify-content: flex-start;
      gap: 4px;
      padding: 12px;
      font-size: var(--font-size-tiny);
    }

    .compare-simulations-container {
      margin: 6px;
      background: var(--background-color-gray);
      padding: 12px;
      border-radius: #{$border-radius-medium};

      .compare-simulations-header {
        font-weight: var(--font-weight-medium);
      }

      .content {
        padding: 12px 0;
        font-size: var(--font-size-small);

        span {
          font-size: inherit;
          color: var(--accent-color);
        }
      }

      .input {
        display: flex;
        flex-direction: row-reverse;

        input {
          width: fit-content;
          background: var(--accent-color);
          color: var(--highlight-accent-color);
          padding: 2px 8px;
          cursor: pointer;
        }
      }
    }
  }

  .global-properties-container,
  .analysis-main-container,
  .asset-properties-container,
  .zone-properties-container {
    .header {
      @include flex-space-between;
      padding: 8px 12px;
      border-top: 1px solid var(--highlight-accent-color);
      border-bottom: 1px solid var(--highlight-accent-color);
      color: var(--accent-color);

      .input-value {
        color: inherit;
      }
    }

    .input-container {
      @include flex-center;

      .remove-button {
        @include flex-center;
        height: 18px;
        width: 18px;
        margin-bottom: 6px;
        border-radius: 8px 0 0 8px;

        &:hover {
          background-color: var(--accent-color);

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

    .optimize-button,
    .generate-report-button,
    .button-save {
      @include flex-center;
      background-color: var(--accent-color);
      color: var(--primary-color);
      border-radius: #{$border-radius-large};
      padding: 2px;
      gap: 4px;
      margin: 4px 12px;
      cursor: pointer;
      font-size: var(--font-size-small);
      margin-bottom: 8px;
    }

    .split {
      height: 1px;
      background: var(--highlight-accent-color);
      margin: 8px;
    }

    .custom-input-container {
      .header {
        @include flex-space-between;
        border: none;

        .eyedrop-button {
          @include flex-center;
        }
      }

      .inputs-container {
        @include flex-space-between;
        padding-bottom: 8px;

        .input-container {
          padding: 0 12px;
          margin-top: 6px;
          gap: 6px;
        }
      }

      .custom-input-label {
        white-space: nowrap;
      }
    }

    .analysis-content-container {
      min-height: 50vh;
      max-height: 60vh;
      overflow-y: auto;

      .dropdown-header-container,
      .dropdown-content-container {
        padding: 6px 12px;
        border-top: 1px solid var(--highlight-accent-color);
      }

      .input-range-container {
        .input-container {
          width: 75%;
        }
      }
    }

    .buttons-container {
      @include flex-space-between;
      padding: 12px;
      gap: 12px;

      input {
        border: none;
        cursor: pointer;
        transition: all 0.2s;

        &:hover {
          transform: translateY(-2px);
          box-shadow: #{$box-shadow-medium};
          outline: 1px solid var(--accent-color);
        }
      }

      .cancel {
        background: transparent;
        color: var(--accent-color);
      }

      .submit {
        background: var(--accent-color);
        color: var(--highlight-accent-color);
      }
    }

    .create-custom-analysis-container {
      margin: 6px;
      background: var(--background-color-gray);
      padding: 12px;
      border-radius: #{$border-radius-medium};

      .custom-analysis-header {
        font-weight: var(--font-weight-medium);
      }

      .content {
        padding: 12px 0;
        font-size: var(--font-size-small);

        span {
          font-size: inherit;
          color: var(--accent-color);
        }
      }

      .input {
        display: flex;
        flex-direction: row-reverse;

        input {
          width: fit-content;
          background: var(--accent-color);
          color: var(--highlight-accent-color);
          padding: 2px 8px;
          cursor: pointer;
        }
      }
    }
  }
}

.assets-container {
  padding: 0 6px;

  .assets-wrapper {
    width: 100%;
    position: relative;
    margin: 8px 10px;

    h2 {
      color: var(--text-color);
      font-family: $large;
      font-weight: $bold-weight;
    }

    .categories-container {
      width: 100%;
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      height: 100%;
      gap: 3px;
      padding: 10px 0;

      .category {
        width: 117px;
        height: 95px;
        border-radius: 3.59px;
        background-color: var(--background-color-gray);
        padding: 8px;
        padding-top: 12px;
        font-weight: $bold-weight;
        position: relative;
        overflow: hidden;

        .category-name {
          position: relative;
          z-index: 3;
          font-size: var(--font-size-regular);
          // -webkit-text-fill-color: transparent;
          // -webkit-text-stroke: 1px black;
        }

        &::after {
          content: "";
          width: 60px;
          height: 60px;
          border-radius: 50%;
          background-color: var(--circle-color, #000);
          position: absolute;
          top: 60%;
          right: -10px;
          transform: translate(0, -50%);
        }

        &:nth-child(1),
        &:nth-child(9) {
          &::after {
            @include gradient-by-child(1); // First child uses the first color
          }
        }

        &:nth-child(2),
        &:nth-child(10) {
          &::after {
            @include gradient-by-child(2); // Second child uses the second color
          }
        }

        &:nth-child(3),
        &:nth-child(11) {
          &::after {
            @include gradient-by-child(3); // Third child uses the third color
          }
        }

        &:nth-child(4),
        &:nth-child(12) {
          &::after {
            @include gradient-by-child(4); // Fourth child uses the fourth color
          }
        }

        &:nth-child(5),
        &:nth-child(13) {
          &::after {
            @include gradient-by-child(5); // Fifth child uses the fifth color
          }
        }

        &:nth-child(6),
        &:nth-child(14) {
          &::after {
            @include gradient-by-child(6); // Fifth child uses the fifth color
          }
        }

        &:nth-child(7),
        &:nth-child(15) {
          &::after {
            @include gradient-by-child(7); // Fifth child uses the fifth color
          }
        }

        .category-image {
          position: absolute;
          // top: 50%;
          bottom: 0;
          right: -10px;
          transform: translate(0, 0%) scale(0.8);
          z-index: 2;
          height: 80%;
        }
      }
    }

    .assets-container {
      width: 100%;
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      height: 100%;
      gap: 3px;
      padding: 10px 0;

      .assets {
        width: 117px;
        height: 95px;
        border-radius: #{$border-radius-small};
        background-color: var(--background-color-gray);
        font-weight: $medium-weight;
        position: relative;
        overflow: hidden;
        padding: 0;

        &:hover {
          .asset-name {
            opacity: 1;
          }
        }

        .asset-name {
          position: absolute;
          top: 0;
          z-index: 3;
          padding: 8px;
          width: 100%;
          max-height: 38px;
          font-size: var(--font-size-regular);
          background: color-mix(
            in srgb,
            var(--background-color) 40%,
            transparent
          );
          backdrop-filter: blur(5px);
          opacity: 0;
          transition: opacity 0.3s ease;
          display: -webkit-box;
          -webkit-line-clamp: 2;
          -webkit-box-orient: vertical;
          overflow: hidden;
          text-overflow: ellipsis;
        }

        .asset-image {
          height: 100%;
          width: 100%;
          z-index: 2;
          object-fit: cover;
        }
      }
    }

    .back-button {
      position: absolute;
      top: 0;
      right: 0;
      @include flex-center;
      cursor: pointer;
    }
  }
}

.assets-container {
  width: 100%;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  height: 100%;
  gap: 3px;
  padding: 10px 0;

  .assets {
    width: 117px;
    height: 95px;
    border-radius: 3.59px;
    background-color: var(--background-color-gray);
    padding: 8px;
    padding-top: 12px;
    font-weight: $medium-weight;
    position: relative;
    overflow: hidden;

    .asset-name {
      position: relative;
      z-index: 3;
      font-size: var(--font-size-regular);
    }

    .asset-image {
      height: 100%;
      width: 100%;
      position: absolute;
      // top: 50%;
      // right: 5px;
      // transform: translate(0, -50%);
      top: 0;
      left: 0;
      z-index: 2;
    }
  }
}

.assets-result {
  width: 100%;
  height: 100%;
  margin: 8px 10px;

  .assets-wrapper {
    margin: 0;
  }
}
