/* TODO fix the background color when hovering,
 * maybe add a hover effect to the thumbnail as well */

.paper {
  height: 120px;
  cursor: pointer;
  display: flex;
  align-items: stretch;

  /* Needed so the corners of the child elements respect the border radius */
  overflow: hidden;
  box-shadow: 0 0 0 1px
    light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-4));
  border-radius: var(--mantine-radius-md);
  background-color: light-dark(
    var(--mantine-color-white),
    var(--mantine-color-dark-7)
  );

  &:hover {
    background-color: light-dark(
      var(--mantine-color-gray-1),
      var(--mantine-color-dark-6)
    );

    &[data-selected="true"] {
      background-color: var(--mantine-primary-color-light-hover);
    }
  }

  /* biome-ignore format: preserve linebreaks */
  transition:
    background-color 150ms ease,
    box-shadow 150ms ease;

  &[data-selected="true"] {
    box-shadow: 0 0 0 2px
      light-dark(var(--mantine-primary-color-6), var(--mantine-primary-color-5));
    background-color: var(--mantine-primary-color-light);
  }
}

.content {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 8px;
  flex-grow: 1;
}

.menu {
  display: none; /* Changes to "flex" when hovered */
  align-items: center;
  position: absolute;
  top: -12px;
  right: 12px;
  height: 32px;
}

.paper:hover .menu {
  display: flex;
}

.checkbox-root {
  display: none; /* Changes to "flex" when hovered or selected */
  position: absolute;
  background-color: var(--mantine-color-dark-6);
  padding: var(--mantine-spacing-xs);
  cursor: pointer;
  border-top-left-radius: inherit;
  border-bottom-right-radius: inherit;
  box-shadow: inherit;

  & * {
    cursor: pointer;
  }

  &[data-checked="true"] {
    background-color: var(--mantine-primary-color-filled);
  }
}

.paper[data-selected="true"] .checkbox-root,
.paper:hover .checkbox-root {
  display: block;
}
