.media-library {
  .library-wrap {
    position: fixed;
    z-index: 100;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: auto;
    margin: 0;
    display: none;
    border-left: 1px solid $adminBlue;

    &.opened {
      display: block;
      background: $almostWhite;
      width: 50%;
      right: 0;
      left: auto;
    }

    .aa-loader-wrap {
      position: relative;
      display: flex;
      height: 100%;
      justify-content: center;

      .aa-loader {
        align-self: center;
      }
    }

    .container, .container-fluid {
      max-width: none;
      padding: 0;

      > .row {
        margin: 0;
      }
    }

    $titleBarHeight: 40px;

    .title-bar {
      display: flex;
      height: $titleBarHeight;
      padding: 5px 20px;
      padding-right: 0;
      background: $adminBlue;

      .title {
        font-size: 22px;
        margin-right: auto;
        color: $almostWhite;
      }

      .close-btn {
        color: $almostWhite;
        background: $adminRed;
        border: 0;
        line-height: 20px;
        padding: 0;
        width: 40px;
        height: 40px;
        align-self: center;
        border-radius: 0;
        margin-right: 0;

        &:hover {
          background-color: darken($adminRed, 10%);
        }
      }
    }

    .library-content {
      display: flex;
      flex-direction: column;
      height: calc(100vh - $titleBarHeight);

      .library-actions,
      .library-listing,
      .library-upload, {
        padding: 10px;
        gap: 10px;

        > .container > .row {
          row-gap: 20px;
        }
      }

      .library-actions {
        .col {
          display: flex;
          gap: 30px;
        }

        .form-group {
          margin-bottom: 0;
        }

        .library-search {
          flex-basis: 70%;
        }

        .library-pagination {
          &.unused {
            pointer-events: none;
            touch-action: none;
            opacity: .4;
          }
          .pagination {
            margin-bottom: 0;
            button[disabled] {
              opacity: .4;
            }
          }

          .page-input {
            width: 50px;
            text-align: center;
            border: 1px solid $lightGray;
            border-left: 0;
            border-right: 0;
            outline: none;
          }
        }

        .counter {
          margin-left: auto;
          vertical-align: baseline;
          align-self: center;
        }
      }

      .library-listing {
        overflow: auto;

        > .container > .row {
          overflow: auto;
          padding-bottom: 40px;
        }


        .media-item, .fake-media-item {
          .inner-wrap {
            display: flex;
            flex-direction: column;
            height: 100%;
            position: relative;
            border: 1px solid $lightGray;
            padding: 10px;
            border-radius: $defaultRadius;
          }

            .badge-wrap, .infos-wrap {
                position: absolute;
                top: 20px;
                font-weight: bold;
                display: flex;
                flex-direction: column;
            }
            .badge-wrap .badge,
            .infos-wrap .info {
                padding: 3px 5px;
                border-radius: .35rem;
                margin-bottom: 5px;
                font-size: 12px;
            }
            .badge-wrap {
                left: 20px;
                .badge {
                    background-color: $adminBlue;
                    color: $almostWhite;
                }
            }
            .infos-wrap {
                right: 20px;
                align-items: end;
                > .info {
                    //text-align: right;
                    background-color: $almostWhite;
                    color: $adminBlue;
                }
            }

          .media-preview {
            max-height: 300px;
            overflow: hidden;
            background: repeating-linear-gradient(-45deg, #eaecf4, #eaecf4 10px, #d0d2e2 0, #d0d2e2 20px);
            border-radius: 5px;
            //margin-bottom: 10px;
            border: 1px solid #d0d2e2;
            padding: 10px;
            height: 100%;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;

            > img,
            > i {
              display: block;
              align-self: center;
            }

            > img {
              height: auto;
              max-width: 100%;
              max-height: calc(100% - 5px);
            }

            > i {
              font-size: 50px;
              color: $adminBlue;
              text-align: center;
              margin: 0 auto;
              opacity: .5;
            }
          }

          .media-bottom {
            flex-direction: column;
            margin-top: auto;
            position: absolute;
            bottom: 20px;
            left: 20px;
            right: 20px;


            button {
              display: block;
              width: 100%;
            }

              .actions {
                  display: none;
              }
          }

          &[data-media-type="file"] {
            min-height: 175px;
          }

          .filename-holder {
            text-overflow: ellipsis;
            max-width: 100%;
            word-wrap: normal;
            white-space: nowrap;
            overflow: hidden;
          }

          .size-holder {
            text-align: right;
          }

            &:hover {
                .media-bottom {
                    .actions {
                        display: flex;
                    }
                }
            }
        }
      }
    }


    .library-upload {
      .action-bar {
        margin-bottom: 20px;

        .media-type-select {
          align-self: center;

          label {
            margin: 0;
          }
        }
      }

      .errors, .successes {
        margin-bottom: 10px;
      }

      .errors {
        color: $adminRed;
      }

      .successes {
        color: $adminGreen;
      }

      .drag-n-drop {
        display: flex;
        flex-direction: column;
        color: $adminBlue;
        border: 5px dashed $lightGray;
        border-radius: 30px;
        min-height: 300px;
        justify-content: center;
        cursor: pointer;

        &.is-dragging, &:hover {
          border-color: $adminBlue;

          i, p {
            color: $adminBlue;
          }
        }

        i, p {
          color: $lightGray;
          align-self: center;
          pointer-events: none;
          touch-action: none;
        }

        i {
          font-size: 60px;
          margin-bottom: 10px;
        }

        p {
          font-size: 20px;
          font-style: italic;
        }
      }

      .size-info-pane {
        margin-top: 20px;
      }
    }


  }

  .library-backdrop {
    display: none;
    background: $adminBlue;
    opacity: .3;
    position: fixed;
    z-index: 50;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }

  .library-wrap.opened + .library-backdrop {
    display: block;
  }
}
