/*
 * DO NOT EDIT THIS FILE.
 * See the following change record for more information,
 * https://www.drupal.org/node/3084859
 * @preserve
 */

/**
 * @file
 *
 * Style the media library items.
 */

.media-library-item {
  position: relative;
  background: none;

  /* Ajax throbbers inside a media library item. */
  .ajax-progress {
    position: absolute;
    z-index: calc(var(--vertical-tabs-menu--z-index) + 1);
    box-sizing: border-box;
    width: 3.5rem;
    height: 3.5rem;
    margin: -1.5rem;
    transform: translateY(-50%);
    border: var(--input-border-size) solid var(--jui-dropdown-border-color);
    border-radius: 3.5rem;
    background: var(--admin-color-bg-raised);
    box-shadow: 0 0.25rem 0.625rem var(--jui-dropdown-shadow-color);
    inset-block-start: 50%;
    inset-inline-start: 50%;
  }

  .ajax-progress__throbber {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-start: 50%;
    width: 1.75rem;
    height: 1.75rem;
    margin: -0.875rem;
    border: 3px solid var(--admin-color-link);
    border-inline-end: 0.1875rem dotted transparent;
  }

  label {
    display: inline-block;
  }

  .ajax-progress__message {
    display: none;
  }

  .form-item {
    margin: var(--admin-space-xs);
  }
}

.media-library-item__preview-wrapper {
  position: relative;

  .media-library-item:focus & {
    box-shadow: none;
  }
}

.media-library-item--grid {
  justify-content: center;
  box-sizing: border-box;
  padding: 0.5rem;
  vertical-align: top;
  border-radius: var(--admin-radius-xl);
  outline: none;

  /**
   * The media library grid item focus border is moved to a child element to
   * improve padding.
   */
  &:focus {
    outline: none;
    box-shadow: none;

    .media-library-item__preview-wrapper {
      outline: var(--focus-outline);
      box-shadow: var(--focus-box-shadow);
    }
  }

  /* Media library widget weight field styles. */
  .form-item {
    margin: 0.75em;
  }

  .form-boolean--type-checkbox:checked {
    border-color: var(--button--focus-border-color);
    background-color: var(--button--focus-border-color);
  }
}

/* Edit/remove button base appearance. */

.media-library-edit__link,
.media-library-item__edit,
.media-library-item__edit.button,
.media-library-item__remove,
.media-library-item__remove.button {
  border-color: var(--admin-color-border);

  &:focus {
    outline: var(--focus-outline);
  }
}

.media-library-edit__link,
.media-library-item__edit {
  inset-block-start: 0.625rem;
  inset-inline-end: 3.125rem;
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3e  %3cg fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e    %3cpath d='M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z'%3e%3c/path%3e  %3c/g%3e%3c/svg%3e");
  background-size: 0.75rem 0.75rem;
}

.media-library-item__remove,
.media-library-item__remove.button {
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3e  %3cg fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e    %3cpath d='M20 4L4 20' /%3e    %3cpath d='M4 4L20 20' /%3e  %3c/g%3e%3c/svg%3e");
  background-size: 0.75rem 0.75rem;
}

.media-library-item__click-to-select-checkbox {
  position: absolute;
  z-index: 1;
  inset-block-start: 1rem;
  inset-inline-start: 1rem;
  display: block;

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

  .form-item {
    margin: 0;
  }

  .form-boolean {
    width: 1.8125rem;
    height: 1.8125rem;
    border-radius: var(--admin-radius-xs);
    box-shadow: 0 2px 4px rgb(0, 0, 0, 0.15);

    &:hover,
    &:active {
      border-color: transparent;
    }

    &:checked {
      border-color: var(--admin-color-primary);
      background-color: var(--admin-color-primary);
    }
  }
}

.media-library-item__click-to-select-trigger {
  cursor: pointer;
}

/* Media library item table styles. */

.media-library-item--table img {
  max-width: 6.25rem;
  height: auto;
}

/* Media library entity view display styles. */

.media-library-item__preview {
  position: relative;
  overflow: clip;
  border: 1px solid var(--admin-color-border);
  border-radius: var(--admin-radius-xl);
  aspect-ratio: 1;
  background-color: var(--admin-color-bg-surface-nested);
  background-image: linear-gradient(-45deg, var(--admin-color-border) 25%, transparent 26%), linear-gradient(-45deg, var(--admin-color-border) 25%, transparent 26%), linear-gradient(135deg, var(--admin-color-border) 25%, transparent 26%), linear-gradient(135deg, var(--admin-color-border) 25%, transparent 26%);
  background-position:
    0 0,
    var(--admin-pattern-square) var(--admin-pattern-square),
    var(--admin-pattern-square) var(--admin-pattern-square),
    0 0;
  background-size: calc(var(--admin-pattern-square) * 2) calc(var(--admin-pattern-square) * 2);

  svg,
  img {
    position: absolute;
    max-width: 100%;
    max-height: 100%;
    margin: auto;
    object-fit: cover;
    inset: 0;
  }

  .media-library-item.is-hover & {
    border-color: var(--admin-color-text);
    box-shadow: 0 0 0 2px var(--admin-color-text);

    .gin--dark-mode & {
      border-color: var(--admin-color-border);
    }
  }

  .media-library-item.checked &,
  .media-library-item.is-active & {
    border-color: var(--admin-color-primary);
    box-shadow: 0 0 0 2px var(--admin-color-primary);
  }
}

/*
 * Status overlay shown during media processing; only fires for transient
 * states.
 */

.media-library-item__status {
  position: absolute;
  inset-block-start: 2.5rem;
  inset-inline-start: 0.3125rem;
  padding: 0.3125rem 0.625rem;
  pointer-events: none;
  color: #e4e4e4;
  background: #666;
  font-size: 0.75rem;
  font-style: italic;
}

.media-library-item__attributes {
  padding: var(--admin-space-xs);
}

.media-library-item__name {
  text-wrap: pretty;
  color: var(--admin-color-text);
  font-size: 0.875rem;
}

.media-library-item__content {
  display: flex;
  height: 100%;

  article {
    width: 100%;
  }
}

.media-library-item__type {
  color: #696969;
  font-size: 0.75rem;
}

.media-library-item--disabled {
  pointer-events: none;
  opacity: 0.5;
}

/**
 * Media library widget edit and delete button styles.
 *
 * We have to override the .button styles since buttons make heavy use of
 * background and border property changes.
 */

.media-library-item__edit,
.media-library-item__edit:hover,
.media-library-item__edit:focus,
.media-library-item__remove,
.media-library-item__remove:hover,
.media-library-item__remove:focus,
.media-library-item__remove.button,
.media-library-item__remove.button:first-child,
.media-library-item__remove.button:disabled,
.media-library-item__remove.button:disabled:active,
.media-library-item__remove.button:hover,
.media-library-item__remove.button:focus {
  position: absolute;
  z-index: 1;
  inset-block-start: 0.625rem;
  overflow: hidden;
  width: 1.5rem;
  height: 1.5rem;
  margin: 0.3125rem;
  padding: 0;
  transition: 0.2s border-color;
  color: transparent;
  background-size: 0.75rem;
  text-shadow: none;
  font-size: 0;
}

.media-library-item__edit {
  inset-inline-end: 2.5rem;
  border: 1px solid var(--admin-color-border);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3e%3cg fill='%23545560'%3e%3cpath d='M14.545 3.042l-1.586-1.585a1.003 1.003 0 00-1.414 0L10.252 2.75l3 3 1.293-1.293a1.004 1.004 0 000-1.415zM5.25 13.751l-3-3 6.998-6.998 3 3zM.908 14.775c-.087.262.055.397.316.312l2.001-.667-1.65-1.646-.667 2.001z'/%3e%3c/g%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.75rem;

  &:active {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3e%3cg%3e%3cpath fill='%23ffffff' d='M14.545 3.042l-1.586-1.585c-.389-.389-1.025-.389-1.414 0l-1.293 1.293 3 3 1.293-1.293c.389-.389.389-1.026 0-1.415z'/%3e%3crect fill='%23ffffff' x='5.129' y='3.8' transform='matrix(-.707 -.707 .707 -.707 6.189 20.064)' width='4.243' height='9.899'/%3e%3cpath fill='%23ffffff' d='M.908 14.775c-.087.262.055.397.316.312l2.001-.667-1.65-1.646-.667 2.001z'/%3e%3c/g%3e%3c/svg%3e");
  }
}

.media-library-item__remove,
.media-library-item__remove.button,
.media-library-item__remove.button:first-child,
.media-library-item__remove.button:disabled,
.media-library-item__remove.button:disabled:active,
.media-library-item__remove.button:hover,
.media-library-item__remove.button:focus {
  inset-inline-end: 0.625rem;
  border: 1px solid var(--admin-color-border);
  background-image: url("data:image/svg+xml,%3csvg width='16' height='16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M2.344 2.343l11.313 11.313M2.344 13.657L13.657 2.343' stroke='%2355565B' stroke-width='3'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.75rem;
}

.media-library-item__remove:active,
.media-library-item__remove.button:active,
.media-library-item__remove.button:disabled:active {
  border-color: var(--admin-color-link);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3e%3cpath fill='%23ffffff' d='M3.51 13.925c.194.194.512.195.706.001l3.432-3.431c.194-.194.514-.194.708 0l3.432 3.431c.192.194.514.193.707-.001l1.405-1.417c.191-.195.189-.514-.002-.709l-3.397-3.4c-.192-.193-.192-.514-.002-.708l3.401-3.43c.189-.195.189-.515 0-.709l-1.407-1.418c-.195-.195-.513-.195-.707-.001l-3.43 3.431c-.195.194-.516.194-.708 0l-3.432-3.431c-.195-.195-.512-.194-.706.001l-1.407 1.417c-.194.195-.194.515 0 .71l3.403 3.429c.193.195.193.514-.001.708l-3.4 3.399c-.194.195-.195.516-.001.709l1.406 1.419z'/%3e%3c/svg%3e");
}
