@use "sass:math";

%scrollbar {

  $size: 0;
  $radius: 0;

  &::-webkit-scrollbar {
    width: $size;
    height: $size;
    border-radius: math.div($size, 2);
  }

  &::-webkit-scrollbar-button {
    display: none;
  }

  &::-webkit-scrollbar-button:hover {
    display: none;
  }

  &::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.4);
    box-shadow: none;
    border-radius: $radius;

    &:hover {
      background-color: rgba(0, 0, 0, 0.4);
    }
  }

  &::-webkit-scrollbar-track {
    background-color: transparent;
    border-radius: $radius;

    &:hover {
      background-color: transparent;
    }
  }

}

.data-tree {
  &__item {
    display: flex;
    align-items: baseline;
    gap: 0.8em;
  }

  // &__title {}
  // &__extra {}
}

.category-tree {
  &__actions {
    flex-grow: 1;
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    column-gap: 10px;
    padding: 13.5px 18.75px;

    .btn {
      margin: 0;
      background-color: var(--theme-elevation-200);
    }
  }

  &__foot {
    display: flex;
    gap: 2rem;

    &>.btn,
    &>.form-submit {
      flex: 1 1 calc(50% - 1rem);

      &>.btn {
        width: 100%;
      }
    }
  }
}

.category {
  &__conflicts {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    font-size: 11px;
  }

  &__conflict {
    color: var(--theme-error-500);
  }
}

.category-popup {

  &__content {
    display: flex;
    flex-direction: column;
    row-gap: 0.5rem;
    max-height: 480px;
    overflow-y: auto;
    overflow-x: hidden;
    @extend %scrollbar;
  }

  &__card {
    &>h4 {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      border-bottom: 2px solid var(--theme-elevation-150);

      span {
        font-size: 1.2rem;
      }

      small {
        font-size: 0.8rem;
        color: var(--theme-error-500);
      }
    }

    &>ul {
      list-style: none;
      display: flex;
      flex-direction: column;
      row-gap: 1rem;
      padding: 0;
      margin: 0 0 1rem 0;

      &>li {
        width: 100%;
        display: flex;
        flex-direction: column;
        row-gap: 0.5rem;

        .btn {
          flex: 0;
          display: flex;
          justify-content: space-between;
          align-items: baseline;
          gap: 0.8em;
          padding: 0.15em 0.75em;
          background-color: var(--theme-bg);
          box-shadow: inset 0 0 0 1px var(--theme-error-400);
          font-size: 0.9rem;
          line-height: 1;

          &:hover {
            box-shadow: inset 0 0 0 1px var(--theme-error-600);
          }

          span {
            text-overflow: ellipsis;
            overflow: hidden;
            white-space: nowrap;
          }

          small {
            color: var(--theme-error-500);
            font-size: 0.8rem;
          }
        }
      }
    }
  }

  &__url {
    color: var(--theme-elevation-250);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    margin: 0;
  }

}

.category-edit {
  &__modal {

    &:before,
    &:after {
      content: " ";
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      pointer-events: none;
    }

    &:before {
      background: var(--theme-bg);
      opacity: 0.85;
    }

    &:after {
      backdrop-filter: blur(5px);
    }

    .template-minimal {
      display: flex;
      width: 100%;
      justify-content: center;
      align-items: center;
      padding: 1.9230769231rem;
      margin-left: auto;
      margin-right: auto;
      min-height: 100%;
      min-height: 100vh;
      z-index: 1;
      position: relative;

      &__wrap {
        display: flex;
        flex-direction: column;
        justify-content: center;
      }
    }

    .collection-edit {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      width: 100%;
      padding: 0;
      margin: 0;
      min-height: 0;
      height: auto;

      &__header {
        width: 100%;
      }

      &__header-content {
        display: flex;
        justify-content: space-between;
        width: 100%;
        align-items: center;
        margin: 0 0 2rem;

        h2 {
          margin: 0;
        }

        .icon--x {
          width: 44px;
          height: 44px;
        }
      }

      &__edit {
        padding: 0;
        margin: 0;
      }

      &__main {
        width: 100%;
      }

      &__form {
        width: 100%;
        height: auto;
        z-index: 1000;
      }
    }
  }

  &__header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    margin: 0 0 0.6rem 0;

    h3 {
      display: flex;
      gap: 0.5em;
      margin: 0;

      svg {
        width: 1em;
        height: 1em;
        fill: currentColor;
      }
    }
  }

  &__main {
    .rich-text__editor {
      overflow-x: hidden;
      overflow-y: auto;
      max-height: Max(160px, calc(100vh - 650px));
    }
  }

  &__reference {
    color: var(--theme-elevation-400);
  }

  &__preview {
    margin: 0 0 0.6rem 0;
    padding: 1em;
    max-height: 150px;
    overflow-x: hidden;
    overflow-y: auto;
    border: 2px solid var(--theme-elevation-150);
    border-radius: 4px;
    color: var(--theme-elevation-400);
  }

  &__foot {
    display: flex;
    gap: 2rem;

    &>.btn,
    &>.form-submit {
      flex: 1 1 calc(50% - 1rem);

      &>.btn {
        width: 100%;
      }
    }
  }
}
