/**
 * @file media_library.theme.css
 *
 * @todo Move into the Seven theme when this module is marked as stable.
 * @see https://www.drupal.org/project/drupal/issues/2980769
 */

.media-library-views-form__header .form-item {
  margin-right: 8px;
}

#drupal-modal .view-header {
  margin: 16px 0;
}

.media-library-item {
  justify-content: center;
  vertical-align: top;
  border: 1px solid #dbdbdb;
  margin: 16px 16px 2px 2px;
  width: 180px;
  background: #fff;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.media-library-view {
  min-height: 300px;
}

.media-library-view .form-actions {
  margin: 0.75em 0;
}

.media-library-view .media-library-view--form-actions {
  clear: left;
  margin: 0.75em 0;
  align-self: flex-end;
}

.media-library-item .field--name-thumbnail {
  background-color: #ebebeb;
  overflow: hidden;
  text-align: center;
}

.media-library-item .field--name-thumbnail img {
  height: 180px;
  object-fit: contain;
  object-position: center center;
}

.media-library-item.is-hover,
.media-library-item.checked,
.media-library-item.is-focus {
  border-color: #40b6ff;
  border-width: 3px;
  border-radius: 3px;
  margin: 14px 14px 0 0;
}

.media-library-item.checked {
  border-color: #0076c0;
}

.media-library-item .js-click-to-select-checkbox input {
  width: 30px;
  height: 30px;
}

.media-library-item .js-click-to-select-checkbox .form-item {
  margin: 0;
}

.media-library-item__preview {
  padding-bottom: 34px;
}

.media-library-item__status {
  color: #e4e4e4;
  font-style: italic;
  background: #666;
  padding: 5px 10px;
  font-size: 12px;
}

.media-library-item .views-field-operations {
  height: 30px;
}

.media-library-item .views-field-operations .dropbutton-wrapper {
  display: inline-block;
  position: absolute;
  right: 5px;
  bottom: 5px;
}

.media-library-item__attributes {
  position: absolute;
  bottom: 0;
  display: block;
  padding: 5px;
  max-width: calc(100% - 10px);
  max-height: calc(100% - 50px);
  overflow: hidden;
  background: white;
}

.media-library-item__name {
  font-size: 14px;
}

.media-library-item__name a {
  display: block;
  text-decoration: underline;
  margin: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-library-item__attributes:hover .media-library-item__name a,
.media-library-item__name a:focus,
.media-library-item.is-focus .media-library-item__name a,
.media-library-item.checked .media-library-item__name a {
  white-space: normal;
}

.media-library-item__name a:focus {
  border: 2px solid;
  margin: 0;
}

.media-library-item__type {
  font-size: 12px;
  color: #696969;
}

.media-library-select-all {
  margin: 10px 0 10px 0;
}

.media-library-select-all input {
  margin-right: 10px;
}

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

.media-library-selection {
  margin-bottom: 1.5rem;
}

.media-library-widget {
  position: relative;
}

.media-library-widget__toggle-weight {
  position: absolute;
  right: 5px;
  top: 5px;
}

.media-library-item .form-item {
  margin: 0.75em;
}

.media-library-item__remove,
.media-library-item__remove:hover,
.media-library-item__remove:focus,
.media-library-item__remove.button,
.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;
  top: 0;
  right: 0;
  width: 24px;
  height: 24px;
  margin: 5px;
  padding: 0;
  background: url('../../../misc/icons/787878/ex.svg') #fff center no-repeat;
  background-size: 16px 16px;
  border: 2px solid #ccc;
  border-radius: 20px;
  color: transparent;
  text-shadow: none;
  transition: 0.2s border-color;
}

.media-library-item__remove:hover,
.media-library-item__remove:focus,
.media-library-item__remove.button:hover,
.media-library-item__remove.button:focus,
.media-library-item__remove.button:disabled:active {
  border-color: #40b6ff;
}

/* Style the wrappers around new media and files */
.media-library-upload__media,
.media-library-upload__file {
  display: flex;
  flex-wrap: wrap;
  padding: 20px 0 20px 0;
}

.media-library-upload__file {
  align-items: center;
}

.media-library-upload__file-label {
  margin-right: 10px;
}

/* @todo Remove in https://www.drupal.org/project/drupal/issues/2987921 */
.media-library-upload__source-field .file,
.media-library-upload__source-field .button,
.media-library-upload__source-field .image-preview,
.media-library-upload__source-field .form-type-managed-file > label,
.media-library-upload__source-field .file-size {
  display: none;
}

.media-library-upload__media-preview {
  margin-right: 20px;
  width: 220px;
  background: #ebebeb;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-library-upload__media-preview img {
  display: block;
}

/* @todo Remove or re-work in https://www.drupal.org/node/2985168 */
.media-library-widget .media-library-item__name a,
.media-library-view.view-display-id-widget .media-library-item__name a {
  color: black;
  text-decoration: none;
}

@media screen and (max-width: 600px) {
  .media-library-item {
    width: 150px;
  }
  .media-library-item .field--name-thumbnail img {
    height: 150px;
    width: 150px;
  }
  .media-library-item .views-field-operations .dropbutton-wrapper {
    position: relative;
    right: 0;
    border: 0;
  }
}
