/**
 * @file media-library.css

 * Styling for Media Library.
 */

.media-library-wrapper {
  display: flex;
  margin: -1em;
}

/**
 * @todo Reuse or build on vertical tabs styling for the media library menu.
 *   https://www.drupal.org/project/drupal/issues/3023767
 */
.media-library-menu {
  display: block;
  width: 600px;
  max-width: 20%;
  margin: 0; /* LTR */
  padding: 0;
  border-bottom: 1px solid #ccc;
  background-color: #e6e5e1;
  line-height: 1;
}
[dir="rtl"] .media-library-menu {
  margin: 0;
}

/**
 * @todo Use a class instead of the li element.
 *   https://www.drupal.org/project/drupal/issues/3029227
 */
.media-library-menu li {
  display: block;
  padding: 0;
  list-style: none;
}

.media-library-menu__link {
  position: relative;
  display: block;
  box-sizing: border-box;
  padding: 15px;
  text-decoration: none;
  border-bottom: 1px solid #b3b2ad;
  background-color: #f2f2f0;
  text-shadow: 0 1px hsla(0, 0%, 100%, 0.6);
}

.media-library-menu__link:active,
.media-library-menu__link:hover,
.media-library-menu__link:focus {
  background: #fcfcfa;
  text-shadow: none;
}

.media-library-menu__link:focus,
.media-library-menu__link:active {
  outline: none;
}

.media-library-menu__link.active {
  z-index: 1;
  margin-right: -1px; /* LTR */
  color: #000;
  border-right: 1px solid #fcfcfa; /* LTR */
  border-bottom: 1px solid #b3b2ad;
  background-color: #fff;
  box-shadow: 0 5px 5px -5px hsla(0, 0%, 0%, 0.3);
}
[dir="rtl"] .media-library-menu__link.active {
  margin-right: 0;
  margin-left: -1px;
  border-right: 0;
  border-left: 1px solid #fcfcfa;
}

.media-library-content {
  width: 100%;
  padding: 1em;
  border-left: 1px solid #b3b2ad; /* LTR */
  outline: none;
}
[dir="rtl"] .media-library-content {
  border-right: 1px solid #b3b2ad;
  border-left: 0;
}

/* Generic media add form styles. */
.media-library-add-form--without-input .form-item {
  margin: 0 0 1em;
}

/**
 * Remove outline from added media list.
 *
 * The added media list receives focus after adding new media, but since it is
 * not an interactive element, it does not need an outline.
 */
.media-library-add-form__added-media {
  margin: 0;
  padding: 0;
  outline: none;
}

.media-library-add-form__input-wrapper {
  padding: 16px;
  border: 1px solid #bfbfbf;
  border-radius: 2px;
  background: #fcfcfa;
}

/* Style the media add upload form. */
.media-library-add-form--upload.media-library-add-form--without-input .form-item-upload {
  margin-bottom: 0;
}

.media-library-add-form .file-upload-help {
  margin: 8px 0 0;
}

/* Style the media add oEmbed form. */
.media-library-add-form--oembed .media-library-add-form__input-wrapper {
  display: flex;
}

@media screen and (max-width: 37.5em) {
  .media-library-add-form--oembed .media-library-add-form__input-wrapper {
    display: block;
  }
}

.media-library-add-form--oembed.media-library-add-form--without-input .form-item-url {
  margin-bottom: 0;
}

.media-library-add-form-oembed-url {
  width: 100%;
}

/**
 * @todo Remove .button when styles are moved to the seven theme in
 *   https://www.drupal.org/project/drupal/issues/2980769
 */
.button.media-library-add-form-oembed-submit {
  align-self: center;
}

/* Media add form selection styles. */
.media-library-add-form__selected-media {
  margin-top: 1em;
}

/* Change to padding to account for the negative margin for flex grid. */
.media-library-add-form__selected-media .details-wrapper {
  padding: 0 10px 1em 10px;
}

.media-library-add-form__selected-media .media-library-item .field--name-thumbnail img {
  height: 100px;
}

/* Generic media library view styles. */
.media-library-select-all {
  flex-basis: 100%;
  width: 100%;
  margin: 10px 8px;
}
.media-library-select-all input {
  margin-right: 10px;
}
[dir="rtl"] .media-library-select-all input {
  margin-left: 10px;
}

.media-library-views-form,
.media-library-selection,
.media-library-add-form__selected-media .details-wrapper,
.media-library-views-form__bulk_form,
.media-library-view .form--inline {
  display: flex;
  flex-wrap: wrap;
}

.media-library-views-form > .form-actions {
  flex-basis: 100%;
}

.media-library-views-form__header {
  flex-basis: 100%;
}

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

.media-library-views-form__rows {
  display: flex;
  flex-wrap: wrap;
  flex-basis: 100%;
  margin: 0 -8px;
}

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

@media screen and (max-width: 600px) {
  .media-library-view .form-actions {
    flex-basis: 100%;
  }
}

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

/**
 * Override the table display of the visually hidden labels.
 *
 * The width, height and overflow properties in the styles for the
 * .visually-hidden class do not work correctly if the element has a table
 * display.
 */
.media-library-item label {
  display: inline-block;
}

/* Media library widget view styles. */
.media-library-wrapper .media-library-view {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}

.media-library-wrapper .view-header {
  align-self: flex-end;
  margin: 1em 0;
  text-align: right; /* LTR */
}
[dir="rtl"] .media-library-wrapper .view-header {
  text-align: left;
}

.media-library-wrapper .media-library-view .view-content {
  flex: 0 0 100%;
}

.media-library-wrapper .views-display-link {
  margin: 0;
  padding-left: 22px; /* LTR */
  color: #333;
  font-size: 15px;
  line-height: 16px;
}
[dir="rtl"] .media-library-wrapper .views-display-link {
  padding-right: 22px;
  padding-left: 0;
}

.media-library-wrapper .views-display-link.is-active {
  font-weight: bold;
}

.media-library-wrapper .views-display-link-widget {
  margin-right: 15px;
  background: url(../../images/icons/333333/grid.svg) left 0 no-repeat; /* LTR */
}
[dir="rtl"] .media-library-wrapper .views-display-link-widget {
  background-position: right 0;
}

.media-library-wrapper .views-display-link-widget_table {
  background: url(../../images/icons/333333/table.svg) left 0 no-repeat; /* LTR */
}
[dir="rtl"] .media-library-wrapper .views-display-link-widget_table {
  background-position: right 0;
}

/**
 * Style the media library grid items.
 */
.media-library-item {
  position: relative;
}

/**
* The media library item container receives screen reader focus when items are
* removed. Since it is not an interactive element, it does not need an
* outline.
*/
.media-library-item--grid {
  justify-content: center;
  box-sizing: border-box;
  width: 50%;
  padding: 8px;
  vertical-align: top;
  outline: none;
  background: #fff;
}

.media-library-item--grid:before {
  position: absolute;
  top: 7px;
  left: 7px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  content: "";
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  pointer-events: none;
  border: 1px solid #dbdbdb;
}

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

/* The selected items in the add form should be shown a bit smaller. */
.media-library-add-form__selected-media .media-library-item--small {
  width: 33.3%;
}

.media-library-widget-modal .ui-dialog-buttonpane {
  display: flex;
  align-items: center;
}

.media-library-widget-modal .ui-dialog-buttonpane .form-actions {
  flex: 1;
}

/**
 * By default, the dialog is too narrow to be usable.
 * @see Drupal.ckeditor.openDialog()
 */
.ui-dialog--narrow.media-library-widget-modal {
  max-width: 75%;
}

@media screen and (min-width: 45em) {
  .media-library-item--grid {
    width: 33.3%;
  }

  /* Change the width for the modal and widget since there is less space. */
  .media-library-widget-modal .media-library-item--grid,
  .media-library-selection .media-library-item--grid {
    width: 50%;
  }

  /* The selected items in the add form should be shown a bit smaller. */
  .media-library-add-form__selected-media .media-library-item--small {
    width: 25%;
  }
}

@media screen and (min-width: 60em) {
  .media-library-item--grid {
    width: 25%;
  }

  /* Change the width for the modal and widget since there is less space. */
  .media-library-widget-modal .media-library-item--grid,
  .media-library-selection .media-library-item--grid {
    width: 33.3%;
  }

  /* The selected items in the add form should be shown a bit smaller. */
  .media-library-add-form__selected-media .media-library-item--small {
    width: 16.6%;
  }
}

@media screen and (min-width: 77em) {
  .media-library-item--grid {
    width: 16.6%;
  }

  /* Change the width for the modal and widget since there is less space. */
  .media-library-widget-modal .media-library-item--grid,
  .media-library-selection .media-library-item--grid {
    width: 25%;
  }

  /* The selected items in the add form should be shown a bit smaller. */
  .media-library-add-form__selected-media .media-library-item--small {
    width: 16.6%;
  }
}

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

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

.media-library-item--grid.is-hover:before,
.media-library-item--grid.checked:before,
.media-library-item--grid.is-focus:before {
  top: 5px;
  left: 5px;
  border-width: 3px;
  border-color: #40b6ff;
  border-radius: 3px;
}

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

.media-library-item__click-to-select-checkbox {
  position: absolute;
  z-index: 1;
  top: 16px;
  left: 16px; /* LTR */
  display: block;
}
[dir="rtl"] .media-library-item__click-to-select-checkbox {
  right: 16px;
  left: auto;
}

.media-library-item__click-to-select-checkbox input {
  width: 20px;
  height: 20px;
}

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

.media-library-item__click-to-select-trigger {
  overflow: hidden;
  height: 100%;
  cursor: pointer;
}

/* Media library item table styles. */
.media-library-item--table img {
  max-width: 100px;
  height: auto;
}

/* Media library entity view display styles. */
.media-library-item__preview {
  padding-bottom: 34px;
}

.field--widget-media-library-widget .media-library-item__preview {
  cursor: move;
}

.field--widget-media-library-widget .js-media-library-item:only-child .media-library-item__preview {
  cursor: inherit;
}

.media-library-item__status {
  position: absolute;
  top: 40px;
  left: 5px; /* LTR */
  padding: 5px 10px;
  pointer-events: none;
  color: #e4e4e4;
  background: #666;
  font-size: 12px;
  font-style: italic;
}
[dir="rtl"] .media-library-item__status {
  right: 5px;
  left: auto;
}

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

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

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

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

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

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

/* Media library widget styles. */
.media-library-widget {
  position: relative;
}

/**
 * @todo Change to .media-library-open-button when styles are moved to the
 *   seven theme in https://www.drupal.org/project/drupal/issues/2980769
 */
.button.media-library-open-button {
  margin-bottom: 1em;
  margin-left: 0; /* LTR */
}
[dir="rtl"] .button.media-library-open-button {
  margin-right: 0;
  margin-left: 1em;
}

.media-library-widget__toggle-weight {
  position: absolute;
  top: 5px;
  right: 5px; /* LTR */
}
[dir="rtl"] .media-library-widget__toggle-weight {
  right: auto;
  left: 5px;
}

/* Add negative margin for flex grid. */
.media-library-selection {
  margin: 1em -8px;
}

/**
 * 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;
  top: 10px;
  overflow: hidden;
  width: 21px;
  height: 21px;
  margin: 5px;
  padding: 0;
  transition: 0.2s border-color;
  color: transparent;
  border: 2px solid #ccc;
  border-radius: 20px;
  background-size: 13px;
  text-shadow: none;
  font-size: 0;
}

.media-library-item__edit {
  right: 40px; /* LTR */
}
[dir="rtl"] .media-library-item__edit {
  right: auto;
  left: 40px;
}

.media-library-item__remove {
  right: 10px; /* LTR */
}
[dir="rtl"] .media-library-item__remove {
  right: auto;
  left: 10px;
}

.media-library-item__edit {
  background: url("../../images/icons/787878/pencil.svg") #fff center no-repeat;
  background-size: 13px;
}
.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 {
  background: url("../../images/icons/787878/ex.svg") #fff center no-repeat;
  background-size: 13px;
}
.media-library-item__edit:hover,
.media-library-item__edit:focus,
.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 added media item container.
 *
 * The added media container receives screen reader focus since it has the role
 * 'listitem'. Since it is not an interactive element, it does not need an
 * outline.
 */
.media-library-add-form__media {
  position: relative;
  display: flex;
  padding: 1em 0;
  border-bottom: 1px solid #c0c0c0;
  outline: none;
}

/* Do not show the top padding for the first item. */
.media-library-add-form__media:first-child {
  padding-top: 0;
}

/**
 * Change the position of the remove button for the first item.
 *
 * The first item doesn't have a top padding, change the location of the remove
 * button as well.
 */
.media-library-add-form__media:first-child .media-library-add-form__remove-button[type="submit"] {
  top: 5px;
}

/* Do not show the bottom border and padding for the last item. */
.media-library-add-form__media:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.media-library-add-form__preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 220px;
  margin-right: 20px; /* LTR */
  background: #ebebeb;
}
[dir="rtl"] .media-library-add-form__preview {
  margin-right: 0;
  margin-left: 20px;
}

/**
 * @todo Remove [type="submit"] when styles are moved to the seven theme in
 *   https://www.drupal.org/project/drupal/issues/2980769
 */
.media-library-add-form__remove-button[type="submit"] {
  position: absolute;
  top: 25px;
  right: 6px; /* LTR */
  width: auto;
  margin: 0;
  padding: 2px 20px 2px 2px; /* LTR */
  text-transform: lowercase;
  color: transparent;
  border: 0;
  border-radius: 0;
  background: transparent url(../../images/icons/787878/ex.svg) right 2px no-repeat; /* LTR */
  font-weight: normal;
  line-height: 16px;
}
[dir="rtl"] .media-library-add-form__remove-button[type="submit"] {
  right: auto;
  left: 13px;
  padding: 2px 2px 2px 20px;
  background-position: left 2px;
}

.media-library-add-form__remove-button:focus,
.media-library-add-form__remove-button.button:disabled,
.media-library-add-form__remove-button.button:disabled:active,
.media-library-add-form__remove-button.button:focus {
  color: #787878;
  border: 0;
  background: transparent url(../../images/icons/787878/ex.svg) right 2px no-repeat; /* LTR */
}
[dir="rtl"] .media-library-add-form__remove-button:focus,
[dir="rtl"] .media-library-add-form__remove-button.button:disabled,
[dir="rtl"] .media-library-add-form__remove-button.button:disabled:active,
[dir="rtl"] .media-library-add-form__remove-button.button:focus {
  background-position: left 2px;
}

.media-library-add-form__remove-button:hover,
.media-library-add-form__remove-button.button:hover {
  color: #e00;
  border: 0;
  background: transparent url(../../images/icons/ee0000/ex.svg) right 2px no-repeat; /* LTR */
  box-shadow: none;
}
[dir="rtl"] .media-library-add-form__remove-button:hover,
[dir="rtl"] .media-library-add-form__remove-button.button:hover {
  background-position: left 2px;
}

/* @todo Remove in https://www.drupal.org/project/drupal/issues/3064914 */
.views-live-preview .media-library-view div.views-row + div.views-row {
  margin-top: 0;
}
