.media-pack-library {
    display: flex;
    flex-direction: column;
    gap: 8px;

    > details {
        &:not(:last-of-type) {
            padding-bottom: 8px;
            border-bottom: 1px solid var(--h-ruler-color);
        }

        summary {
            list-style: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            user-select: none;
            background: var(--modal-bg-color);

            &::-webkit-details-marker {
                display: none;
            }

            &::before {
                /*noinspection CssNoGenericFontName*/
                font-family: "icons";
                font-size: 16px;
                content: "\e93c";
                transition: 0.2s transform;
                display: inline-block;
            }

            > div {
                margin-left: auto;
                display: flex;
                gap: 4px;
            }
        }

        &[open] summary {
            position: sticky;
            padding-bottom: 8px;
            z-index: 5;
            top: 46px;

            &::before {
                transform: rotate(90deg);
            }
        }
    }
}

.media-pack {
    .media-pack-files {
        margin: 16px;
    }

    .meta {
        font-size: 1rem;
        margin: 16px;
    }
}

.media-pack-files {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0;

    + button {
        margin-top: 8px;
    }

    .text {
        grid-column: 1 / -1;
        justify-self: center;
        align-self: center;
    }

    button.file {
        margin: 0;
        padding: 0;
        height: 100%;
        width: 100%;
    }

    .file {
        &.in-progress {
            --progress: 100%;

            &::after {
                content: "";
                position: absolute;
                top: 0;
                right: 0;
                width: var(--progress);
                height: 100%;
                backdrop-filter: blur(10px) brightness(80%);
                -webkit-backdrop-filter: blur(10px) brightness(80%);
            }
        }

        &.no-thumb {
            border: 1px solid var(--input-border-color);
            display: flex;
            justify-content: center;
            align-items: center;

            &::before {
                font-family: "icons";
                font-size: 28px;
                content: "\e90d";
                transition: 0.2s transform;
            }
        }
    }
}

.media-pack-file {
    position: relative;

    button[data-action="MediaPack.fileMenu"] {
        position: absolute;
        font-size: 20px;
        padding: 5px;
        z-index: 1;
        top: 4px;
        right: 4px;
    }
}

.file-upload {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    font-size: 12px;
    gap: 4px;
    border: 1px solid var(--input-border-color);
    width: 100%;
    height: 100%;
    aspect-ratio: 4/3;

    .icon {
        font-size: 28px;
    }
}

.media-pack-list {
    margin: 16px;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    grid-template-rows: masonry;
}

.media-pack-card {
    gap: 8px;

    header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 16px;
    }

    h4 {
        font-weight: normal;
        margin: 0;
        flex-grow: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        a {
            display: block;
        }
    }

    &.own {
        border-top-color: var(--own-content-highlight-color);
    }

    > .meta {
        font-size: 0.8rem;
        margin: 0;
    }

    a.button {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    > button:last-child {
        margin-top: auto;
    }
}

.media-pack-card > .meta,
.media-pack .meta {
    color: var(--meta-info-color);
    display: flex;
    gap: 8px;
}

.added-to-library {
    margin: auto auto 0 auto;
}
