@use 'src/styles/abstracts' as *;

.RunDetail {
  height: 100%;
  &__runDetailContainer {
    height: 100%;
    background: $cuddle-10;
    .BaseTable__row-cell {
      font-size: 15px;
      @include monospaceFontFamily(15);
    }
    &__Tabs {
      .MuiTabs-fixed {
        overflow: auto !important;
      }
      .MuiTabs-scroller {
        --ms-overflow-style: none;
        --scrollbar-width: none;
        scrollbar-width: none;
        &::-webkit-scrollbar {
          display: none;
        }
      }
      .MuiTabs-indicator {
        display: none;
      }
    }
    &__appBarContainer {
      height: 4.375rem;
      background: #ffffff;
      display: flex;
      align-items: center;
      &__appBarBox {
        display: flex;
        padding-top: $space-unit;
        justify-content: space-between;
        &__runInfoBox {
          max-width: 50%;
        }
        &__explore {
          display: flex;
          flex: 1;
          align-items: center;
          justify-content: flex-end;
          margin-right: 1rem;
          margin-bottom: 1rem;
        }
        &__actionContainer {
          width: 4.5rem;
          display: flex;
          justify-content: center;
          align-items: center;
          border-left: $border-main;
          margin-bottom: $space-unit;
          i {
            color: $pico-70;
          }
          a {
            text-decoration: unset;
          }
        }
      }
      &__appBarTitleBox {
        display: flex;
        flex-direction: column;
        font-size: $text-md;
        font-weight: $font-600;
        color: $text-color;
        align-items: flex-start;
        height: fit-content;
        max-width: 100%;
        width: auto;
        &__appBarTitleBoxWrapper {
          display: flex;
          width: 100%;
        }
        &__experimentName {
          display: inline-block;
          max-width: 100%;
          text-decoration: none;


          &:hover {
            text-decoration: underline;
            color: inherit;
          }
        }
        &__runName {
          display: flex;
          width: 100%;
          margin-left: $space-xxs;
          margin-bottom: $space-xxs;
        }
        &__date {
          display: flex;
          i {
            margin-right: $space-xxs;
            color: #606986;
          }
        }
        &__Skeleton {
          margin-right: $space-xs;
        }
        &__buttonSelectToggler {
          width: 1.5rem;
          height: 1.5rem;
          top: -$space-xxxxs;
          &.opened {
            background: #e8f1fc;
          }
          .MuiButton-label {
            padding-top: $space-xxxxs;
          }
        }
        &__container {
          display: flex;
          align-items: flex-start;
          margin-right: $space-xxxs;
          cursor: pointer;
          max-width: calc(100% - 6.5rem);

          &__pageName {
            margin-right: 0.4375em;
            text-transform: capitalize;
            text-decoration: none;
          }
          &__runHash {
            margin-left: 0.4375em;
            text-transform: lowercase;
          }
        }
        span {
          display: block;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
          max-width: 100%;
        }
      }
      .StatusLabel {
        margin-left: $space-xs;
      }
    }

    &__tabPanelBox {
      overflow-y: auto;
      height: calc(100vh - 112px);
      &__suspenseLoaderContainer {
        width: 100%;
        display: flex;
        justify-content: center;
        height: 100%;
        align-items: center;
      }
    }

    &__tabsContainer {
      background: #ffffff;
      box-shadow: 0 toRem(4px) toRem(6px) rgba(144, 175, 218, 0.2),
        0 1px 0 0 $cuddle-20;
      border-top: $border-grey-lighter;
      position: relative;
      z-index: 1;
      .PrivateTabIndicator-root-1 {
        display: none;
      }
      .MuiTabs-root {
        height: toRem(40px);
        min-height: auto;
      }
      .MuiTabs-flexContainer {
        .MuiTab-textColorPrimary {
          color: $pico-80;
          font-size: $text-md;
          font-weight: $font-500;
          text-transform: unset;
          min-height: 40px;
          transition: all 0.18s ease-out;
          &:hover {
            color: $pico;
            background-color: $cuddle-30;
          }
          .MuiTab-wrapper {
            line-height: 1.05;
          }
          &.MuiTab-root {
            padding: 0.625rem $space-unit;
            min-width: auto !important;
            border-right: 1px solid transparent;
            text-transform: capitalize;
          }
          &.Mui-selected {
            color: $pico;
            position: relative;
            &::before {
              content: '';
              width: 100%;
              height: toRem(3px);
              background: $primary-color;
              position: absolute;
              left: 0;
              bottom: 0;
              transition: all 3s;
            }
          }
        }
      }
      .PrivateTabIndicator-root-5 {
        display: none;
      }
      &.MuiPaper-rounded {
        border-radius: unset;
      }
    }
    &__tabPanel {
      .MuiBox-root {
        height: 100%;
        .RunDetailTabLoader {
          display: flex;
          align-items: center;
          justify-content: center;
          height: 100%;
        }
      }
      &.overviewPanel {
        position: relative;
        overflow: hidden;
        .RunOverviewTab {
          padding: 0 1rem;
        }
      }
    }
  }
  .TraceVisualizationWrapper {
    padding: 1.5rem 0;
  }
}

.RunDetailParamsTabWrapper {
  height: 100%;
  border-radius: $border-radius-lg;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.RunDetailParamsTab {
  padding: 1.5rem;
  border: $border-grey;
  border-radius: 0.5rem;
  height: 100%;
  overflow: auto;
  background-color: #ffffff;
}

.RunDistributionsTab {
  padding: 0.75rem;
}

.RunDetailMetricsTab {
  padding: 0 0 $space-lg;
  &__header {
    margin: $space-lg 0;
    padding-bottom: 0.625rem;
    border-bottom: $border-grey;
  }
  &__container {
    height: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: $space-lg;
    align-items: stretch;
    &__chartContainer {
      position: relative;
      width: calc(50% - 0.75rem);
      border: $border-grey;
      border-radius: 0.5rem;
      background: $white;
      &__chartBox {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 24.5rem;
        padding: 0.625rem;
        .LineChart__container {
          background-color: transparent;
        }
      }
      &__metricDetailBox {
        border-top: $border-grey;
        padding: 1rem 1.5rem 1.5rem;
        &__metricName {
          margin: $space-xs 0;
          word-break: break-all;
        }
        &__pin {
          position: absolute;
          top: $space-xs;
          right: $space-xs;
          z-index: 1;
        }
        .SelectForm__tags__item {
          margin-top: 0.5rem;
        }
        .Badge {
          margin-right: $space-xxs;
          margin-bottom: $space-xxs;
        }
      }
    }
  }
}

.RunSelectPopoverWrapper {
  &__selectPopoverContent {
    height: 20rem;
    width: 37.5rem;

    &__contentContainer {
      height: calc(100% - 2.25rem);
      display: flex;
      &__experimentsListContainer {
        background: $white;
        width: 50%;
        height: 100%;
        position: relative;

        &__experimentList {
          overflow-y: auto;
          height: 100%;
          box-shadow: inset -0.0625rem 0 0 $border-color-main;
          padding: 0.375rem 0 0.5rem 0.5rem;
          &::before {
            content: '';
            position: absolute;
            background: linear-gradient(
              180deg,
              rgba(248, 250, 253, 0) 0%,
              #f8fafd 75.52%
            );
            height: $space-xs;
            width: 100%;
            bottom: 0;
            left: 0;
            z-index: 1;
          }
          &__experimentContainer {
            position: relative;
            width: 100%;
            margin-bottom: $space-xxxxs;
            border-radius: 0.3125rem 0 0 0.3125rem;

            &:last-child {
              margin-bottom: 0;
            }
            .experimentBox {
              height: auto;
              display: flex;
              align-items: center;
              cursor: pointer;
              border-radius: 0.3125rem 0 0 0.3125rem;
              padding: 0.5rem 1.5rem 0.5rem 1rem;
              border-bottom: $border-transparent;
              border-top: $border-transparent;

              &:hover {
                border-radius: $border-radius-sm;
                background: $cuddle-20;
                margin-right: 0.5rem;
                padding: 0.5rem 1rem;
              }
              &__experimentName {
                width: 100%;
                word-break: break-all;
                @include monospaceFontFamily();
              }
            }

            &.selected {
              .experimentBox {
                background: $cuddle-10;
                border-bottom: $border-main;
                border-top: $border-main;
                &:hover {
                  padding: 0.5rem 1.5rem 0.5rem 1rem;
                  margin-right: 0;
                  border-radius: 0.3125rem 0 0 0.3125rem;
                }
              }
              &::before {
                content: '';
                height: 100%;
                border-radius: 0.3125rem 0 0 0.3125rem;
                top: 0;
                left: 0;
                background: $denim;
                width: 0.25rem;
                position: absolute;
              }
            }
          }
        }
      }
      &__runsListContainer {
        background: $cuddle-10;
        height: 100%;
        width: 50%;
        position: relative;
        padding: 0.375rem 0.5rem 0 0.5rem;
        &::before {
          content: '';
          position: absolute;
          background: linear-gradient(
            180deg,
            rgba(248, 250, 253, 0) 0%,
            #f8fafd 75.52%
          );
          height: $space-xs;
          width: 100%;
          bottom: 0;
          left: 0;
          z-index: 1;
        }
        &__runsList {
          overflow: auto;
          height: 100%;
          padding-bottom: $space-xs;
          .IllustrationBlock {
            height: calc(100% - 3rem);
          }
          &__loadMoreButtonWrapper {
            margin-top: 0.5rem;
            display: flex;
            justify-content: center;
            &__button {
              background: $cuddle-30;
              &:hover {
                background: $cuddle-50;
              }
            }
          }
          &__runBox {
            height: auto;
            padding: 0.5rem 0.5rem;
            display: flex;
            align-items: flex-start;
            cursor: pointer;
            text-decoration: unset;
            margin-bottom: $space-xxxxs;
            position: relative;
            flex-direction: column;
            border-radius: $border-radius-sm;
            &:last-child {
              margin-bottom: 0;
            }
            &__runName {
              width: 95%;
              margin-bottom: $space-xxs;
              position: relative;
              @include monospaceFontFamily();
              span {
                display: block;
                max-width: 100%;
                word-break: break-all;
              }
              &.in-progress {
                &::after {
                  content: '';
                  position: absolute;
                  right: -0.875rem;
                  width: 0.375rem;
                  height: 0.375rem;
                  top: 0.375rem;
                  border-radius: $border-radius-circle;
                  background: $success-color-100;
                }
              }
            }
            &__runDate {
              display: flex;
              align-items: center;
              @include monospaceFontFamily(14);
              i {
                margin-right: $space-xxs;
              }
            }

            &:hover {
              background: $cuddle-20;
            }
            &.selected {
              background: $primary-color-10;
            }
          }
        }
      }
    }
    &__headerContainer {
      background: #f3f8fe;
      width: 100%;
      height: 2.25rem;
      display: flex;
      border-bottom: $border-main;
      i {
        transform: rotate(90deg);
        align-items: center;
        display: flex;
      }
      &__titleContainer {
        width: 50%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        &:first-child {
          border-right: $border-main;
        }
      }
    }
  }
  &__loaderContainer {
    height: 100%;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .MuiPaper-root {
    width: 37.5rem;
    background: $white;
    border: $border-main;
    box-sizing: border-box;
    box-shadow: 0 0.25rem 0.375rem rgba(144, 175, 218, 0.2);
    border-radius: 0.3125rem 0.3125rem 0 0;
    height: 20rem;
  }
}
