/**
 * Selected media in a field widget.
 *
 * The remove control is a sibling of the preview. Shrink the item to the
 * preview and park the control on its corner, on every admin form.
 */
.media-library-selection .js-media-library-item-inner {
  position: relative;
  width: fit-content;
  max-width: 100%;
}

.media-library-selection .js-media-library-item-inner img {
  display: block;
  max-width: 100%;
  height: auto;
}

.media-library-selection .media-library-item__remove {
  position: absolute;
  z-index: 2;
  inset-block-start: 0.375rem;
  inset-inline-end: 0.375rem;
  width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  overflow: hidden;
  appearance: none;
  color: transparent;
  font-size: 0;
  line-height: 0;
  cursor: pointer;
  background-color: rgba(255, 255, 255, 0.94);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none'%3e%3cpath d='M3.5 3.5l9 9M12.5 3.5l-9 9' stroke='%23212529' stroke-width='1.75' stroke-linecap='round'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.7rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}

.media-library-selection .media-library-item__remove:hover,
.media-library-selection .media-library-item__remove:focus {
  background-color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.media-library-selection .media-library-item__remove:focus-visible {
  outline: 2px solid var(--bs-primary, #3a405a);
  outline-offset: 2px;
}

#media-library-content svg {
  height: 3rem;
  width: auto;
  max-width: 100%;
}

/**
 * Newly uploaded (unsaved) media in the add form.
 * Structure/classes: item-list--media-library-add-form-media-list + preprocess.
 * Flex layout uses Bootstrap utilities on the Twig/preprocess side.
 */
.media-library-add-form__fields {
  flex-grow: 1;
  min-width: 0;
}

.media-library-add-form__preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 8.75rem;
  background-color: var(--bs-light, #f8f9fa);
}

.media-library-add-form__preview img {
  max-height: 100px;
  width: auto;
  max-width: 100%;
  height: auto;
}

.media-library-add-form__media:last-child {
  border-bottom: 0 !important;
  padding-bottom: 0 !important;
}
