@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');

:root {
  --primary-color: #685655;
  --border-radius: 6px;
}

body {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  background-color: var(--primary-color);
  background-image: url("data:image/svg+xml,%3Csvg width='6' height='6' viewBox='0 0 6 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23000000' fill-opacity='0.5' fill-rule='evenodd'%3E%3Cpath d='M5 0h1L0 6V5zM6 5v1H5z'/%3E%3C/g%3E%3C/svg%3E");
}

button {
  font-family: 'Montserrat', sans-serif;
  font-size: 1rem;
  background-color: var(--primary-color);
  color: #ffffff;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
}

.toggle-modal-container {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0.75rem;
}

.toggle-modal {
  color: #ffffff;
  padding: 1.25rem;
  margin: 0;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: var(--border-radius);
  cursor: pointer;
  text-align: center;
  text-transform: uppercase;
  user-select: none;

  &:hover {
    background-color: rgba(0, 0, 0, 0.75);
  }
}

.sort-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1.5rem 0.75rem;
  font-size: 1.125rem;
  color: #ffffff;
}

.select-container {
  position: relative;

  select {
    display: none;
  }

  .select {
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: var(--border-radius);
    padding: 0.5rem 1rem;
    padding-right: calc(1rem + 1.125rem);
    cursor: pointer;
    user-select: none;

    &::after {
      font-family: Phosphor;
      content: '\E136';
      position: absolute;
      top: 50%;
      right: 0.5rem;
      transform: translate(0, -50%);
    }

    &.active::after {
      content: '\E13C';
    }

    &:hover {
      background-color: rgba(0, 0, 0, 0.75);
    }
  }

  .options {
    position: absolute;
    top: 100%;
    background-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.75);
    border-radius: var(--border-radius);
    overflow: hidden;

    div {
      padding: 0.5rem 1rem;
      cursor: pointer;
      user-select: none;
      white-space: nowrap;

      &:hover,
      &.selected {
        background-color: rgba(0, 0, 0, 0.25);
      }
    }

    .select:not(.active) + & {
      display: none;
    }
  }
}

.bookmarks-container {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.75rem;

  @media (min-width: 600px) {
    flex-direction: row;
  }
}

.no-bookmarks {
  font-size: 1.25rem;
  font-weight: bold;
  color: #ffffff;
}

.bookmark {
  background-color: rgba(0, 0, 0, 0.5);
  color: #ffffff;
  border-radius: var(--border-radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bookmark-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.bookmark-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;

  img {
    height: 1.25rem;
    width: 1.25rem;
  }

  a {
    font-size: 1.25rem;
    font-weight: bold;
    text-transform: uppercase;

    &:link,
    &:visited {
      color: #ffffff;
      text-decoration: none;
    }

    &:hover,
    &:active {
      text-decoration: underline;
    }

    @media (min-width: 600px) {
      max-width: 15rem;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }
}

.delete-bookmark {
  cursor: pointer;
  font-size: 1.125rem;
}

.modal-container {
  background-color: rgba(0, 0, 0, 0.75);
  display: none;
  justify-content: center;
  align-items: center;
  position: fixed;
  inset: 0;

  &.show-modal {
    display: flex;
  }
}

.modal {
  background-color: #ffffff;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.75);
  border-radius: calc(1.5 * var(--border-radius));
  width: 500px;
  max-width: 80%;
  overflow: hidden;
  animation: modal-open 0.6s;
}

.close-modal {
  color: #ffffff;
  font-size: 1.5rem;
  position: relative;
  top: 1rem;
  right: 1rem;
  cursor: pointer;
  float: right;
}

.modal-header {
  background-color: var(--primary-color);
  color: #ffffff;
  padding: 1rem;

  h3 {
    margin: 0;
  }
}

.modal-content {
  padding: 1.25rem 1rem;
  background-color: #f5f5f5;
}

.bookmark-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;

  label {
    color: var(--primary-color);
    display: block;
    margin-inline: 0.25rem;
  }

  input {
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    padding: 0.5rem;
    border: 1px solid var(--primary-color);
    border-radius: var(--border-radius);
    outline: none;
  }
}

.save-bookmark {
  align-self: flex-start;
  padding: 0.5rem 2rem;
  margin-top: 0.5rem;

  &:hover {
    filter: brightness(1.25);
  }

  &:focus {
    outline: none;
  }
}

@keyframes modal-open {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}
