/*
 * Extension plugin styles
 *
 * @author  Christopher Smith <chris@jalakai.co.uk>
 * @author  Piyush Mishra <me@piyushmishra.com>
 * @author  Håkan Sandell <sandell.hakan@gmail.com>
 * @author  Anika Henke <anika@selfthinker.org>
 * @author  Andreas Gohr <andi@splitbrain.org>
 */

/**
 * very simple lightbox
 * @link http://webdesign.tutsplus.com/tutorials/htmlcss-tutorials/super-simple-lightbox-with-css-and-jquery/
 */
#plugin__extensionlightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url(images/overlay.png) repeat;
    text-align: center;
    cursor: pointer;
    z-index: 9999;

    p {
        text-align: right;
        color: #fff;
        margin-right: 20px;
        font-size: 12px;
    }

    img {
        box-shadow: 0 0 25px #111;
        max-width: 90%;
        max-height: 90%;
    }
}

/**
 * general styles
 */
#extension__manager {
    // tab layout - most of it is in the main template
    ul.tabs li.active a {
        background-color: @ini_background_alt;
        border-bottom: solid 1px @ini_background_alt;
        z-index: 2;
    }

    .panelHeader {
        background-color: @ini_background_alt;
        margin: 0 0 10px 0;
        padding: 10px 10px 8px;
        overflow: hidden;
    }
}


#extension__list {
    @thumbwidth: 125px; // width of the thumbnail column, can be increased once we have larger thumbnails

    &, * {
        box-sizing: border-box;
    }

    section.extension {
        display: grid;
        grid-template-columns: @thumbwidth auto 22%;
        grid-template-rows: repeat(4, auto);
        margin-bottom: 1em;
        border-bottom: 1px solid @ini_border;
        word-break: break-word;

        > .screenshot {
            grid-column: 1;
            grid-row: 1;
            padding-top: 0.5em;
            padding-right: 0.5em;
            margin-bottom: 1.5em; // adds space for the detail summary label
            position: relative;

            img.shot {
                border: 1px solid @ini_border;
                border-radius: 2px;
                width: 100%;
                height: auto;
            }

            .id {
                font-size: 80%;
                color: @ini_text_alt;
                background-color: @ini_background_alt;
                padding: 0.1em 0.25em;
                position: absolute;
                top: 0.5em;
                left: 0;
                border-bottom-left-radius: 2px;
                white-space: nowrap;
                max-width: 100%;
                overflow: hidden;
                text-overflow: ellipsis;
                cursor: default;
            }

            .popularity {
                cursor: default;
                img {
                    vertical-align: middle;
                    height: 1.2rem;
                    width: auto;
                }
            }
        }

        > .main {
            grid-column: 2;
            grid-row: 1;
            padding: 0.5em;
            min-height: 7em;

            > h2 {
                font-size: 100%;
                line-height: 1.2;
                font-weight: normal;
                display: flex;
                gap: 1em;
                justify-content: space-between;

                strong {
                    font-size: 120%;
                    font-weight: bold;
                }

                .version {
                    white-space: nowrap;
                }
            }

            .linkbar {
                a.bugs {
                    background-image: url('images/bug.svg');
                }
                a.donate {
                    background-image: url('images/coffee.svg');
                }
            }
        }

        > .actions {
            grid-column: 3;
            grid-row: 1;
            padding: 0.5em 0 0.5em 0.5em;
            display: flex;
            flex-direction: column;
            align-items: end;
            gap: 0.5em;

            .available {
                line-height: 1.2;
                margin-bottom: 1em;
                text-align: right;

                .version {
                    white-space: nowrap;
                    background: linear-gradient(to top, @ini_highlight, transparent);
                }
            }
        }


        > .notices {
            grid-column: 2 / span 2;
            grid-row: 2;
            padding: 0 0.5em;

            ul, li {
                list-style: none;
                margin: 0.5em 0 0 0;
                padding: 0;

                div.li {
                    display: flex;
                    line-height: 1.2em;
                    gap: 0.25em;
                    align-items: center;
                    span.icon svg {
                        fill: @ini_link;
                    }
                }

                &.error div.li span.icon svg {
                    fill: #f33;
                }
                &.security div.li span.icon svg,
                &.warning div.li span.icon svg {
                    fill: #f90;
                }
            }
        }

        > .details {
            grid-column: 1 / span 3;
            grid-row: 3;

            details {
                font-size: 90%;
                border: 1px solid transparent; // fixes jumping summary
                summary {
                    cursor: pointer;
                    float: left;
                    margin-top: -1.5em; // moves it up into the screenshot margin
                    color: @ini_text_alt;
                }

                &[open] {
                    dl {
                        margin: 0.5em 0 0.5em 0;
                    }
                }

                dl {
                    margin: 0;
                    display: grid;
                    grid-template-columns: @thumbwidth auto;

                    dt {
                        grid-column: 1;
                    }

                    dd {
                        grid-column: 2;
                        margin: 0 0 0 0.5em;
                    }
                }
            }
        }
    }

    section.extension.installed.disabled {
        .screenshot img,
        .main,
        .details {
            opacity: 0.5;
        }
    }

    &.filter {
        section.extension {
            display: none;
        }
        section.extension.update {
            display: grid;
        }
    }
}

/**
 * Search form
 */
#extension__manager form.search {
    display: block;
    margin-bottom: 2em;

    span {
        font-weight: bold;
    }

    input.edit {
        width: 25em;
    }
}

/**
 * Install form
 */
#extension__manager form.install {
    text-align: center;
    display: block;
    width: 60%;
}
