@import "styles/keyframes.scss";
@import "styles/colors.scss";

.no-link,
.no-category {
  min-width: 0;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  animation: fadein 0.3s both;

  & p {
    min-width: 0;
    width: 100%;
    text-align: center;
    text-overflow: ellipsis;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
  }
}

.links-wrapper {
  height: calc(100%); // FIXME: eurk
  min-width: 0;
  padding: 10px;
  display: flex;
  flex: 1;
  flex-direction: column;

  & h2 {
    color: $blue;
    margin-bottom: 15px;
    font-weight: 500;

    & .links-count {
      color: $grey;
      font-weight: 300;
      font-size: 0.8em;
    }
  }
}

.category-header {
  display: flex;
  gap: 0.25em;
  align-items: center;
  justify-content: space-between;

  & .category-name {
    min-width: 0;
    width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
  }

  & .category-controls {
    display: flex;
    gap: 0.5em;
    align-items: center;
  }
}

.links {
  height: 100%;
  width: 100%;
  min-width: 0;
  display: flex;
  flex: 1;
  gap: 0.5em;
  padding: 3px;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: scroll;
}

.link {
  user-select: none;
  cursor: pointer;
  height: fit-content;
  width: 100%;
  color: $blue;
  background-color: $white;
  padding: 0.75em 1em;
  border: 1px solid $lightest-grey;
  border-radius: 3px;
  outline: 3px solid transparent;
  display: flex;
  align-items: center;

  &:hover {
    border: 1px solid transparent;
    outline: 3px solid $light-blue;

    & .url-pathname {
      animation: fadein 0.3s both;
    }

    & .controls {
      display: flex;
      animation: fadein 0.3s both;
    }
  }
}

.link > a {
  height: 100%;
  max-width: calc(100% - 125px); // TODO: faut fix ça, c'est pas beau
  text-decoration: none;
  display: flex;
  flex: 1;
  flex-direction: column;
  transition: 0.1s;

  &,
  &:hover {
    border: 0;
  }

  & .link-name {
    width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
  }

  & .link-name .link-category {
    color: $grey;
    font-size: 0.9em;
  }

  & .link-url {
    width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    color: $grey;
    font-size: 0.8em;

    & .url-pathname {
      opacity: 0;
    }
  }
}

.link .controls {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;

  & > * {
    border: 0;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.1s;

    &:hover {
      transform: scale(1.3);
    }

    & svg {
      height: 20px;
      width: 20px;
    }
  }
}

.favicon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.favicon-loader {
  position: absolute;
  top: 0;
  left: 0;
  background-color: $white;

  & > * {
    animation: rotate 1s both reverse infinite linear;
  }
}
