@import (reference) '~stremio-colors/dist/less/stremio-colors.less';
@import (reference) '~stremio/common/screen-sizes.less';

:import('~stremio/common/Multiselect/styles.less') {
    multiselect-menu-container: menu-container;
    multiselect-modal-container: modal-container;
    multiselect-option-container: option-container;
    multiselect-icon: icon;
    multiselect-label: label;
}

:import('~stremio/common/PaginationInput/styles.less') {
    pagination-prev-button-container: prev-button-container;
    pagination-next-button-container: next-button-container;
    pagination-button-icon: icon;
    pagination-label: label;
}

.discover-container {
    width: 100%;
    height: 100%;
    background-color: @color-background-dark2;

    .discover-content {
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: row;

        .catalog-container {
            flex: 1;
            align-self: stretch;
            display: flex;
            flex-direction: column;

            .selectable-inputs-container {
                flex: none;
                align-self: stretch;
                display: flex;
                flex-direction: row;
                padding: 1.5rem;
                overflow: visible;

                .select-input {
                    flex: 0 1 15rem;
                    height: 3.5rem;

                    &:not(:first-child) {
                        margin-left: 1.5rem;
                    }

                    &:nth-child(n+4) {
                        display: none;

                        &~.filter-container {
                            display: flex;
                        }
                    }

                    .multiselect-menu-container {
                        max-height: calc(3.2rem * 7);
                        overflow: auto;
                    }
                }

                .filter-container {
                    flex: none;
                    display: none;
                    align-items: center;
                    justify-content: center;
                    width: 3.5rem;
                    height: 3.5rem;
                    margin-left: 1.5rem;
                    background-color: @color-background;

                    .filter-icon {
                        flex: none;
                        width: 1.4rem;
                        height: 1.4rem;
                        fill: @color-secondaryvariant1-90;
                    }
                }

                .spacing {
                    flex: 1;
                }

                .pagination-input {
                    flex: none;
                    height: 3.5rem;
                    margin-left: 1.5rem;

                    &.pagination-input-placeholder {
                        pointer-events: none;

                        .pagination-prev-button-container, .pagination-next-button-container {
                            .pagination-button-icon {
                                fill: @color-surface-dark5-90;
                            }
                        }

                        .pagination-label {
                            color: @color-surface-dark5-90;
                        }
                    }

                    .pagination-prev-button-container, .pagination-next-button-container {
                        width: 3.5rem;
                        height: 3.5rem;

                        .pagination-button-icon {
                            width: 1rem;
                            height: 1rem;
                        }
                    }

                    .pagination-label {
                        width: 3rem;
                    }
                }
            }

            .missing-addon-warning-container {
                flex: none;
                align-self: stretch;
                display: flex;
                flex-direction: column;
                align-items: center;
                padding: 0 1.5rem 1.5rem 1.5rem;

                .warning-label {
                    flex: none;
                    max-height: 2.4em;
                    margin-bottom: 1rem;
                    font-size: 1.4rem;
                    text-align: center;
                    color: @color-surface-light5-90;
                }

                .install-button {
                    flex: none;
                    min-width: 10rem;
                    max-width: 15rem;
                    padding: 1rem;
                    background-color: @color-accent3;

                    &:hover {
                        background-color: @color-accent3-light1;
                    }

                    .label {
                        max-height: 2.4em;
                        font-weight: 500;
                        text-align: center;
                        color: @color-surface-light5-90;
                    }
                }
            }

            .message-container {
                flex: 0 1 auto;
                align-self: stretch;
                display: flex;
                flex-direction: column;
                align-items: center;
                padding: 0 1.5rem;
                overflow-y: auto;

                &:first-child {
                    padding: 4rem;
                }

                .image {
                    flex: none;
                    width: 12rem;
                    height: 12rem;
                    margin-bottom: 1rem;
                    object-fit: contain;
                    object-position: center;
                    opacity: 0.9;
                }

                .message-label {
                    flex: none;
                    font-size: 2.5rem;
                    text-align: center;
                    color: @color-secondaryvariant2-light1-90;
                }
            }

            .meta-items-container {
                flex: 1;
                align-self: stretch;
                display: grid;
                grid-auto-rows: max-content;
                align-items: center;
                grid-gap: 0.5rem;
                margin-right: 1.5rem;
                padding: 0 1.5rem;
                overflow-y: auto;

                .meta-item-placeholder {
                    padding: 1rem;

                    .poster-container {
                        padding-bottom: calc(100% * var(--poster-shape-ratio));
                        background-color: var(--color-placeholder-background);
                    }

                    .title-bar-container {
                        display: flex;
                        flex-direction: row;
                        align-items: center;
                        height: 2.8rem;

                        .title-label {
                            flex: none;
                            width: 60%;
                            height: 1.2rem;
                            background-color: var(--color-placeholder-background);
                        }
                    }
                }
            }
        }

        .meta-preview-container {
            flex: none;
            align-self: stretch;
            width: 28rem;
            background-color: @color-background-dark3;
        }
    }
}

.selectable-inputs-modal-container {
    .selectable-input-container {
        display: flex;
        flex-direction: row;
        align-items: center;

        &:not(:last-child) {
            margin-bottom: 1rem;
        }

        .select-input-label {
            flex: none;
            width: 10rem;
            max-height: 2.4em;
            margin-right: 1.5rem;
            font-size: 1.1rem;
            color: @color-background-dark2-90;
        }

        .select-input {
            flex: none;
            width: 15rem;
            height: 3.5rem;
            background-color: @color-surface-light2;

            &:hover, &:focus {
                background-color: @color-surface-light3;
            }

            &:focus {
                outline-color: @color-background-dark2;
            }

            .multiselect-label {
                font-weight: normal;
                color: @color-background-dark2-90;
            }

            .multiselect-icon {
                fill: @color-background-dark2-90;
            }
        }
    }
}

.multiselect-modal-container {
    .multiselect-menu-container {
        width: 15rem;
        max-height: calc(3.2rem * 7);
        overflow-y: auto;

        .multiselect-option-container {
            background: none;

            &:hover, &:focus {
                background-color: @color-surface-light3;
            }

            &:focus {
                outline-color: @color-background-dark2;
            }

            .multiselect-label {
                color: @color-background-dark2-90;
            }

            .multiselect-icon {
                fill: @color-background-dark2-90;
            }
        }
    }
}

@media only screen and (min-width: @xxlarge) {
    .discover-container {
        .discover-content {
            .catalog-container {
                .meta-items-container {
                    grid-template-columns: repeat(10, 1fr);
                }
            }
        }
    }
}

@media only screen and (max-width: @xxlarge) {
    .discover-container {
        .discover-content {
            .catalog-container {
                .meta-items-container {
                    grid-template-columns: repeat(9, 1fr);
                }
            }
        }
    }
}

@media only screen and (max-width: @xlarge) {
    .discover-container {
        .discover-content {
            .catalog-container {
                .meta-items-container {
                    grid-template-columns: repeat(8, 1fr);
                }
            }
        }
    }
}

@media only screen and (max-width: @large) {
    .discover-container {
        .discover-content {
            .catalog-container {
                .meta-items-container {
                    grid-template-columns: repeat(7, 1fr);
                }
            }
        }
    }
}

@media only screen and (max-width: @normal) {
    .discover-container {
        .discover-content {
            .catalog-container {
                .meta-items-container {
                    grid-template-columns: repeat(6, 1fr);
                }
            }
        }
    }
}

@media only screen and (max-width: @medium) {
    .discover-container {
        .discover-content {
            .catalog-container {
                .meta-items-container {
                    grid-template-columns: repeat(5, 1fr);
                }
            }
        }
    }
}

@media only screen and (max-width: @small) {
    .discover-container {
        .discover-content {
            .catalog-container {
                .meta-items-container {
                    grid-template-columns: repeat(4, 1fr);
                }
            }
        }
    }
}

@media only screen and (max-width: @xsmall) {
    .discover-container {
        .discover-content {
            .catalog-container {
                .meta-items-container {
                    grid-template-columns: repeat(5, 1fr);
                    margin-right: 0;
                }
            }

            .meta-preview-container {
                display: none;
            }
        }
    }
}

@media only screen and (max-width: @minimum) {
    .discover-container {
        .discover-content {
            .catalog-container {
                .meta-items-container {
                    grid-template-columns: repeat(4, 1fr);
                    margin-right: 0;
                }
            }

            .meta-preview-container {
                display: none;
            }
        }
    }
}