:root {
  --ls-draggable-handle-height: 30px;
}

.cp__plugins {
  &-page {
    > h1 {
      padding: 0 0 20px;
      font-size: 38px;
    }

    .tabs {
      .ui__button {
        background-color: transparent;
        margin: 0 8px;

        > span {
          display: flex;
          align-items: center;
          font-size: 16px;
          font-weight: normal;

          svg {
            margin-right: 6px;
          }
        }

        &.active {
          background-color: var(--ls-tertiary-background-color);
        }
      }
    }
  }

  &-installed {
    min-height: 60vh;
    padding-top: 5px;
  }

  &-marketplace {
    min-height: 60vh;
    padding-top: 20px;

    &.has-installing {
      .ctl {
        a.btn {
          pointer-events: none;
        }
      }
    }
  }

  &-item-lists {
    @apply w-full grid grid-flow-row gap-3 pt-1;
  }

  &-item-card {
    @apply flex py-3 px-1 rounded-md;

    background-color: var(--ls-secondary-background-color);
    height: 160px;

    li {
      margin: 0;
    }

    .head {
      max-height: 60px;
      overflow: hidden;
    }

    .desc {
      height: 60px;
      overflow: hidden;
    }

    .flag {
      position: absolute;
      bottom: 24px;
      left: 0;
      width: 100%;

      > p {
        color: var(--ls-primary-text-color);
        opacity: .8;

        > small:last-child {
          cursor: pointer;
        }
      }

      &.is-top {
        width: unset;
        top: 4px;
        right: 6px;
        left: unset;
        bottom: unset;

        &:hover {
          opacity: .8;
        }
      }
    }

    > .l {
      padding: 8px;

      svg, .icon {
        width: 70px;
        height: 70px;
        opacity: .8;

        &:hover {
          opacity: 1;
        }
      }
    }

    > .r {
      flex: 1;
      position: relative;

      p {
        @apply py-1 m-0;
      }

      .ctl {
        @apply flex pl-2 items-center justify-between absolute w-full;

        bottom: -8px;
        right: 7px;

        .de {
          font-size: 10px;
          padding: 5px 0;
          padding-right: 10px;
          border-radius: 2px;
          user-select: none;
          transition: none;
          opacity: .2;
          position: relative;
          z-index: var(--ls-z-index-level-1);

          .menu-list {
            @apply shadow-md rounded-sm absolute hidden list-none overflow-hidden m-0 p-0;

            background-color: var(--ls-primary-background-color);
            top: 20px;
            left: 0;
            min-width: 120px;

            > li {
              margin: 0;
              padding: 5px;
              transition: background-color .2s;
              user-select: none;
              font-weight: bold;
              opacity: .9;

              &:hover {
                background-color: var(--ls-quaternary-background-color);

                &:active {
                  opacity: 1;
                }
              }
            }
          }

          &.err {
            @apply text-red-500 opacity-100;
          }

          &.log {
            padding: 5px;
          }

          svg {
            width: 15px;
            height: 15px;
          }

          &:hover {
            opacity: .9;

            .menu-list {
              display: block;
            }
          }
        }

        > .l {
          @apply flex items-center;
          margin-left: -80px;
        }

        a.btn {
          display: inline-flex;
          align-items: center;
          line-height: 1;
          padding: 4px;
          font-size: 13px;
          border-radius: 2px;
          user-select: none;
          position: relative;
          margin-left: 4px;

          svg {
            opacity: .3;
          }

          &:hover {
            svg {
              opacity: .8;
            }
          }

          &:active {
            opacity: .6;
          }

          &.disabled {
            pointer-events: none;
            cursor: default;
          }

          &.installing {
            small {
              position: absolute;
              transform: scale(.5) translateX(-180%);
              margin-right: 2px;
            }
          }
        }

        .ui__toggle {
          margin-left: 5px;
        }
      }
    }

    &.market {
      .ctl {
        padding-left: 12px;
        bottom: -5px;
      }
    }
  }

  &-details {
  }
}

.cp__themes {
  &-installed {
    margin: -2rem;
    outline: none;
    padding: 1rem;

    > .it {
      user-select: none;
      background-color: var(--ls-secondary-background-color);
      border: 1px solid transparent;
      margin-bottom: 4px;
      cursor: pointer;
      opacity: .8;

      > section {
        line-height: 1.1em;

        > strong {
          font-size: 14px;
        }

        > small {
          font-size: 11px;
        }
      }

      &.is-active {
        background-color: var(--ls-tertiary-background-color);
        border: 1px solid var(--ls-quaternary-background-color);
        opacity: 1;
      }

      &:hover {
        opacity: 1;
      }
    }
  }
}

.lsp-iframe-sandbox, .lsp-shadow-sandbox, .lsp-ui-float {
  height: 100%;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 0;

  &-container {
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
    visibility: hidden;
    display: none;
    height: 0;
    width: 0;
    padding: 0;
    margin: 0;

    &.visible {
      z-index: var(--ls-z-index-level-2);
      width: 100%;
      height: 100%;
      visibility: visible;
      display: block;
    }

    &[draggable=true] {
      -webkit-user-drag: none;

      > .draggable-handle {
        display: block;
        height: var(--ls-draggable-handle-height);
        cursor: move;
        user-select: none;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        overflow: hidden;

        > .th {
          display: flex;
          align-items: center;
          height: var(--ls-draggable-handle-height);
          user-select: none;
          position: relative;
          background-color: var(--ls-secondary-background-color);
          color: var(--ls-primary-text-color);

          > .l {
            flex-basis: 80%;
          }

          > .r {
            position: absolute;
            right: 0;
            top: 0;
          }

          h3 {
            padding: 0 5px;
            white-space: nowrap;
            max-width: 60%;
            overflow: hidden;
            -webkit-line-clamp: 1;
            text-overflow: ellipsis;
          }

          a.button {
            &:hover {
              background-color: transparent;
            }
          }
        }
      }

      .lsp-iframe-sandbox,
      .lsp-shadow-sandbox,
      .ls-ui-float-content {
        height: calc(100% - var(--ls-draggable-handle-height));
        width: 100%;
        margin-top: var(--ls-draggable-handle-height);
        overflow: auto;
      }

      .ls-ui-float-content {
        user-select: text;
      }

      &.is-dragging {
        /*height: var(--ls-draggable-handle-height) !important;*/
        overflow: hidden;
        opacity: .7;

        > .draggable-handle {
          background-color: rgba(0, 0, 0, .1);
          height: 100%;
          z-index: 3;
        }
      }
    }

    &[resizable=true] {
      > .resizable-handle {
        position: absolute;
        bottom: -1px;
        right: -1px;
        height: 15px;
        width: 15px;
        z-index: 2;
        opacity: 0;
        cursor: nwse-resize;
        user-select: none;
      }

      &.is-resizing {
        > .resizable-handle {
          width: 90%;
          height: 80%;
        }
      }
    }
  }
}

.lsp-ui-float-container {
  top: 40%;
  left: 30%;
  border:2px solid var(--ls-border-color);

  .draggable-handle {
  }

  &.visible {
    height: unset;
  }
}

.ui-items-container {
  &[data-type=toolbar] {
    @apply flex items-center;

    > .injected-ui-item-toolbar {
      @apply hover:opacity-100 transition-opacity;
    }
  }

  &[data-type=pagebar] {
    @apply flex items-start pl-2;

    > .injected-ui-item-pagebar {
      @apply pr-3 opacity-30 hover:opacity-100 transition-opacity;
    }
  }
}

.lsp-frame-readme {
  margin: -2rem;
  min-height: 75vh;
  min-width: 900px;
}

html[data-theme='dark'] {
  .lsp-frame-readme {
    background-color: #eeeeee;
  }
}

.block-content {
  .lsp-hook-ui-slot {
    display: inline-flex;

    [data-injected-ui] {
      display: inline-flex;
    }
  }
}

body[data-page=plugins] {
  .cp__sidebar-main-content {
    max-width: 1280px !important;
    width: 80%;
    padding-left: 30px;
    padding-right: 30px;
  }
}
