@import "../../styles/modules/importAll";

.LibraryListing {
    vertical-align: middle;
    min-height: 100%;

    ul,
    ol {
        list-style: none;
    }
    
    .LibraryListingGroup {
        margin: 1em auto;
        padding: 0.5rem 1.5rem;
        h3 {
            color: $textSecondary;
        }
        ol {
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;
        }
    }
    .LibraryListingItem {
        width: 370px;
        width: calc((100vw - 20.5rem) / 3);
        min-width: 370px;
        margin: 1rem 0.25rem;
        position: relative;
        min-height: 6rem;
        background-color: rgba($textSecondary, 0);
        transition: background-color 0.1s ease;
        h3 {
            color: rgba($black, 1);
            font-weight: 300;
        }
        &:hover {
            background-color: rgba($black, 0.05);
            .entityIcon {
                opacity: 1;
            }
            h3 {
                color: $black;
            }
        }
        &.FAILED {
            background-color: $lightErrorRed;
            &:hover {
                background: $lightErrorRed;
            }
        }
        &.PENDING {
            &:hover {
                background-color: transparent;
            }
        }
        &:hover .checkboxContainer {
            opacity: 1;
        }
        .checkboxContainer.show {
            opacity: 1;
        }
        .checkboxContainer {
            transition: opacity 0.1s ease;
            opacity: 0;
            width: 2rem;
            cursor: pointer;
            position: absolute;
            height: 100%;
            left: 0;
            top: 0;
            input[type="checkbox"] {
                width: 17px;
                height: 17px;
                @include border-radius(3px);
                border: 1px solid black;
                margin-top: 38px;
                margin-left: 7px;
            }
            input {
                cursor: pointer;
            }
            &:hover {
                background-color: lighten($black, 80%);
            }
        }
        .entityBody {
            text-decoration: none;
            max-width: 100%;
        }
        .entityIcon {
            position: absolute;
            height: 4rem;
            width: 4rem;
            color: #f7f7fa;
            background-size: cover;
            background-repeat: no-repeat;
            opacity: 0.7;
            left: 30px;
            top: 17px;

            img {
                width: 100%;
                height: auto;
            }
        }
        .textContents {
            vertical-align: top;
            overflow: hidden;
            padding: 15px 20px 15px 100px;
            p {
                /* Withouth this, long URLs in error messages willl break layout */
                word-break: break-word;
            }
        }
        .VisualisationLabel {
            font-size: 0.9em;

            p {
                color: $midGrey;
            }

            &.VisualisationLabel__type {
                font-weight: 600;
            }

            &.VisualisationLabel__meta {
                font-style: italic;
                p {
                    color: $midLightGrey;
                }
            }
        }
        .entityName {
            text-transform: capitalize;
            text-overflow: ellipsis;
            overflow: hidden;
        }
        .entityControls {
            width: 1rem;
            opacity: 0;
            transition: opacity 0.3s ease;
            position: absolute;
            height: 100%;
            right: 0;
            top: 0;
            width: 20px;
            opacity: 0;
            .showControls {
                padding: 21px 6px;
                font-size: 2rem;
                height: 100%;
                width: 20px;
            }
            &:hover {
                background-color: lighten($black, 80%);
            }
        }
        &:hover .entityControls {
            opacity: 1;
        }
        .pendingOverlay {
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            background-color: rgba(0, 0, 0, 0.1);
        }
    }
    .noItemsMessage, .noSearchResults {
        display: block;
        text-align: center;
        padding-top: 8rem;
    }
    .LibraryListingGroup:last-child .LibraryListingItem:last-child {
        margin-bottom: 6rem;
    }

    .ErrorScreen {
        flex: 1;

        .ErrorScreen__inner {
            max-width: 580px;
        }

        h1 {
            font-size: 5em;
            line-height: 1.4em;
        }

        h2 {
            font-size: 1.6em;
        }
    }

    &.LibraryListing--empty {
        display: flex;
    }
}