/*
 * Copyright 2023 Harness, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

.spaceSelector {
  border-radius: 4px;
  padding: 6px 10px !important;
  border: 1px solid var(--grey-200);
  background: var(--primary-bg) !important;
  margin-bottom: var(--spacing-medium) !important;
  height: 48px;

  &.selected,
  &:hover {
    background: var(--primary-1) !important;
    border-radius: 4px;
    border: 1px solid var(--primary-3);
    box-shadow: 0px 2px 4px 0px rgba(96, 97, 112, 0.16), 0px 0px 1px 0px rgba(40, 41, 61, 0.04);
    color: var(--primary-7);
  }

  > div {
    height: 100%;
    flex-grow: 1;
    align-items: center;
  }

  .label {
    flex-grow: 1;
  }

  .spaceLabel {
    color: var(--gray-500);
    font-size: 8px !important;
    font-weight: 600 !important;
    line-height: 17px !important;
  }

  .spaceName {
    color: var(--black);
    font-size: 13px !important;
    line-height: 20px !important;
    padding-left: 10px !important;
  }

  .icon {
    display: flex;
    align-items: center;
  }
}

.popoverPortal {
  width: min(calc(100vw - var(--nav-menu-width)), 840px) !important;
  height: 100vh;
  position: fixed;
  left: 241px;
  top: -5px;

  > div {
    height: 100%;
    width: 100%;
  }
}

.popoverTarget {
  display: block !important;
}

.popoverContent {
  position: relative;
  height: 100%;
  width: min(calc(100vw - var(--nav-menu-width)), 840px) !important;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0px 2px 4px rgba(96, 97, 112, 0.16)) drop-shadow(0px 0px 1px rgba(40, 41, 61, 0.04));

  &::before {
    position: fixed;
    content: '';
    top: 0;
    left: var(--nav-menu-width);
    width: 100vw;
    height: 100vh;
    background-color: rgba(26, 26, 26, 0.4);
  }

  :global {
    .bp3-popover-arrow {
      left: -11px !important;
      transform: rotate(180deg) translateY(-4px);
    }
  }

  > div {
    height: 100%;
    width: 100%;
    max-width: inherit !important;
    border-radius: 0 !important;

    &::before {
      box-shadow: none !important;
      filter: drop-shadow(0px 2px 4px rgba(96, 97, 112, 0.16)) drop-shadow(0px 0px 1px rgba(40, 41, 61, 0.04));
    }
  }
}

.nameContainer {
  position: relative;

  .name {
    flex-grow: 1;
    align-items: baseline !important;
    width: calc(100% - 100px) !important;

    > span {
      width: 100%;
      > span {
        width: 100%;
      }
    }

    & + span:last-of-type {
      align-self: center;
    }
  }

  .pinned {
    transform: rotate(-90deg);
    position: absolute;
    top: 7px;
    left: -43px;
    font-size: var(--font-size-xsmall) !important;
    padding: 6px 14px;
  }

  .repoName {
    font-weight: 600 !important;
    font-size: 16px !important;
    line-height: 24px !important;
    color: var(--grey-800);

    .repoScope {
      color: var(--grey-400);
      padding: 2px 6px;
      font-size: var(--font-size-xsmall) !important;
      border-radius: 4px;
      border: 1px solid var(--grey-200);
      display: inline-block;
      margin-left: var(--spacing-medium);
      text-transform: uppercase;
      line-height: 16px;
    }
  }

  .desc {
    color: var(--grey-500);
    font-size: 13px;
    padding-top: var(--spacing-xsmall) !important;
  }
}

.table {
  [class*='TableV2--header'] [class*='variation-table-headers'] {
    text-transform: none;
    color: var(--grey-400);
    font-weight: 500;
    font-size: 13px;
  }

  .row {
    height: 66px;
    box-shadow: 0px 0px 1px rgba(40, 41, 61, 0.08), 0px 0.5px 2px rgba(96, 97, 112, 0.16);
    overflow: hidden;
    width: 766px;
    padding: var(--spacing-small) !important;
    &.noDesc > div {
      height: 44px;
    }
  }
}

.iconContainer {
  padding-top: var(--spacing-4) !important;
}

.tableContainer {
  overflow-y: scroll !important;
  height: calc(100vh - 100px) !important;
}
