// Copyright (C) 2017-2024 Smart code 203358507

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

:import('~stremio/components/Toggle/styles.less') {
    checkbox-icon: icon;
}

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

.settings-container {
    height: calc(100% - var(--safe-area-inset-bottom));
    width: 100%;
    background-color: transparent;

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

        .side-menu-container {
            flex: none;
            align-self: stretch;
            display: flex;
            flex-direction: column;
            width: 18rem;
            padding: 3rem 1.5rem;

            .side-menu-button {
                flex: none;
                align-self: stretch;
                display: flex;
                align-items: center;
                height: 4rem;
                border-radius: 4rem;
                padding: 2rem;
                margin-bottom: 0.5rem;
                font-size: 1.1rem;
                font-weight: 500;
                color: var(--primary-foreground-color);
                opacity: 0.4;

                &.selected {
                    font-weight: 600;
                    color: var(--primary-foreground-color);
                    background-color: var(--overlay-color);
                    opacity: 1;
                }

                &:hover {
                    background-color: var(--overlay-color);
                }
            }

            .spacing {
                flex: 1;
            }

            .version-info-label {
                flex: 0 1 auto;
                margin: 0.5rem 0;
                color: var(--primary-foreground-color);
                opacity: 0.3;
            }
        }

        .sections-container {
            flex: 1;
            align-self: stretch;
            padding: 0 3rem;
            overflow-y: auto;

            .section-container {
                display: flex;
                flex-direction: column;
                padding: 3rem 0;
                overflow: visible;

                &:not(:last-child) {
                    border-bottom: thin solid var(--overlay-color);
                }

                .section-title {
                    flex: none;
                    align-self: stretch;
                    font-size: 1.8rem;
                    line-height: 3.4rem;
                    margin-bottom: 3rem;
                    color: var(--primary-foreground-color);
                }

                .section-category-container {
                    display: flex;
                    flex-direction: row;
                    align-items: center;
                    gap: 0 1em;
                    margin-bottom: 1.5rem;
                    line-height: 2.4rem;

                    .label {
                        flex: none;
                        font-size: 1.1rem;
                        color: var(--primary-foreground-color);
                    }

                    .icon {
                        flex: none;
                        width: 2rem;
                        height: 2rem;
                        color: var(--primary-foreground-color);
                    }
                }

                .option-container {
                    flex: none;
                    align-self: stretch;
                    display: flex;
                    flex-direction: row;
                    align-items: center;
                    max-width: 35rem;
                    margin-bottom: 2rem;
                    overflow: visible;

                    &.link-container {
                        margin-bottom: 0.5rem;
                    }
                    
                    &:last-child {
                        margin-bottom: 0;
                    }

                    &.user-info-option-container {
                        gap: 1rem;

                        .user-info-content {
                            flex: 1;
                            display: flex;
                            flex-direction: row;
                            align-items: center;

                            .avatar-container {
                                flex: none;
                                align-self: stretch;
                                height: 5rem;
                                width: 5rem;
                                margin-right: 1rem;
                                border: 2px solid var(--primary-accent-color);
                                border-radius: 50%;
                                background-size: cover;
                                background-repeat: no-repeat;
                                background-position: center;
                                background-origin: content-box;
                                background-clip: content-box;
                                opacity: 0.9;
                                background-color: var(--primary-foreground-color);
                            }

                            .email-logout-container {
                                flex: none;
                                display: flex;
                                flex-direction: column;

                                .email-label-container, .logout-button-container {
                                    display: flex;
                                    flex-direction: row;
                                    align-items: center;
                                }

                                .email-label-container {
                                    .email-label {
                                        flex: 1;
                                        font-size: 1.1rem;
                                        color: var(--primary-foreground-color);
                                        opacity: 0.7;
                                    }
                                }

                                .logout-button-container {
                                    &:hover, &:focus {
                                        outline: none;

                                        .logout-label {
                                            text-decoration: underline;
                                        }
                                    }

                                    .logout-label {
                                        flex: 1;
                                        color: var(--primary-accent-color);
                                    }
                                }
                            }
                        }

                        .user-panel-container {
                            flex: none;
                            display: flex;
                            flex-direction: row;
                            align-items: center;
                            width: 10rem;
                            height: 3.5rem;
                            border-radius: 3.5rem;
                            background-color: var(--overlay-color);

                            &:hover {
                                outline: var(--focus-outline-size) solid var(--primary-foreground-color);
                                background-color: transparent;
                            }

                            .user-panel-label {
                                flex: 1;
                                max-height: 2.4em;
                                padding: 0 0.5rem;
                                font-weight: 500;
                                text-align: center;
                                color: var(--primary-foreground-color);
                            }
                        }
                    }

                    .option-name-container, .option-input-container {
                        flex: 1 1 50%;
                        display: flex;
                        flex-direction: row;
                        align-items: center;

                        .icon {
                            flex: none;
                            width: 1.5rem;
                            height: 1.5rem;
                            margin-right: 0.5rem;
                            color: var(--primary-foreground-color);
                        }

                        .label {
                            flex-grow: 0;
                            flex-shrink: 1;
                            flex-basis: auto;
                            line-height: 1.5rem;
                            color: var(--primary-foreground-color);
                        }

                        &.trakt-icon {
                            .icon {
                                width: 3rem;
                                height: 3rem;
                                color: var(--color-trakt);
                            }
                        }
                    }

                    .option-name-container {
                        justify-content: flex-start;
                        padding: 1rem 1rem 1rem 0;
                        margin-right: 2rem;
                    }

                    .option-input-container {
                        padding: 1rem 1.5rem;

                        &.button-container {
                            justify-content: center;
                            height: 3.5rem;
                            border-radius: 3.5rem;
                            background-color: var(--overlay-color);

                            &:hover {
                                outline: var(--focus-outline-size) solid var(--primary-foreground-color);
                                background-color: transparent;
                            }

                            .label {
                                font-weight: 500;
                            }
                        }

                        &.multiselect-container {
                            >.multiselect-label {
                                line-height: 1.5rem;
                                max-height: 1.5rem;
                            }

                            .multiselect-menu-container {
                                overflow: auto;
                            }
                        }

                        &.link-input-container {
                            flex: 0 1 auto;
                            padding: 0;
                            
                            .label {
                                color: var(--primary-accent-color);
                            }

                            &:hover {
                                .label {
                                    text-decoration: underline;
                                }
                            }
                        }

                        &.checkbox-container {
                            justify-content: center;

                            .checkbox-icon {
                                width: 1.5rem;
                                height: 1.5rem;
                            }
                        }

                        &.color-input-container {
                            padding: 1.3rem 1rem;
                            border-radius: 3rem;
                            border: 2px solid transparent;
                            transition: 0.3s all ease-in-out;

                            &:hover {
                                border-color: var(--overlay-color);
                            }
                        }

                        &.info-container {
                            justify-content: center;

                            &.selectable {
                                user-select: text;

                                .label {
                                    user-select: text;
                                }
                            }
                        }

                        &.configure-input-container {
                            padding: 0;

                            .label {
                                flex-grow: 1;
                                white-space: pre;
                                text-overflow: ellipsis;
                                padding: 0 1rem;
                            }

                            .configure-button-container {
                                flex: none;
                                width: 3rem;
                                height: 3rem;
                                border-radius: 100%;
                                display: flex;
                                flex-direction: row;
                                align-items: center;
                                justify-content: center;
                                background-color: var(--overlay-color);

                                &:hover {
                                    outline: var(--focus-outline-size) solid var(--primary-foreground-color);
                                    background-color: transparent;
                                }

                                .icon {
                                    flex: none;
                                    width: 1rem;
                                    height: 1rem;
                                    margin: 0;
                                    color: var(--primary-foreground-color);
                                }
                            }
                        }

                        &.shortcut-container {
                            justify-content: center;
                            padding: 0;
                            overflow: visible;

                            kbd {
                                flex: 0 1 auto;
                                height: 2.5rem;
                                min-width: 2.5rem;
                                line-height: 2.5rem;
                                padding: 0 1rem;
                                font-weight: 500;
                                color: var(--primary-foreground-color);
                                border-radius: 0.25em;
                                box-shadow: 0 4px 0 1px var(--modal-background-color);
                                background-color: var(--overlay-color);
                            }

                            .label {
                                margin: 0 1rem;
                                white-space: nowrap;
                                color: var(--primary-foreground-color);
                            }
                        }
                    }
                }
            }

            .versions-section-container {
                display: none;
            }
        }
    }
}

@media only screen and (max-width: @xsmall) {
    .settings-container {
        .settings-content {
            .side-menu-container {
                display: none;
            }

            .sections-container {
                .versions-section-container {
                    display: flex;
                }
            }
        }
    }
}

@media only screen and (max-width: @minimum) {
    .settings-container {
        .settings-content {
            flex-direction: column-reverse;

            .side-menu-container {
                display: none;
            }

            .sections-container {
                padding: 0 1.5rem;

                .section-container {
                    .user-info-option-container {
                        flex-direction: column;
                        align-items: flex-start;

                        .user-panel-container {
                            width: 100% !important;
                        }
                    }
                }

                .versions-section-container {
                    display: flex;
                }
            }
        }
    }
}