@import 'themes/pxt/globals/site.variables';

// Expanded error list
.errorList {
    position: relative;
    max-height: @errorListHeight;
    min-height: @errorListHeight;
    border-top: 2px var(--pxt-neutral-stencil1) solid;

    *:focus {
        outline: none;
    }

    .errorListHeader {
        padding: 0.75em 1em;
        height: @errorListHeaderHeight;
        margin-bottom: 0;
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;

        &:hover {
            cursor: pointer;
        }

        &:not(:hover):not(:focus) > .toggleButton > i {
            opacity: 0.5;
        }

        h4 {
            margin: 0;
            display: inline-block;
            vertical-align: middle;
        }

        .countBubble {
            margin: 0 1rem;
        }

        &:hover > .toggleButton > i , &:focus > .toggleButton > i{
            font-size: 1.4em;
        }

        .error-help-container {
            margin: 0 1rem;

            .error-help-button {
                padding: 0.7rem;
                line-height: 0.8rem;

                i {
                    margin-right: 0.4rem;
                }
            }

            .error-help-loader {
                display: flex;
                flex-direction: row;
                justify-content: flex-start;
                align-items: center;
                width: fit-content;
                cursor: progress;

                // Match button
                padding: 0.7rem;
                font-weight: 400;
                line-height: 0.8rem;
                font-size: 16px;

                .analyzing-label {
                    margin: 0 1rem;
                }
            }
        }

        .filler {
            flex-grow: 1;
        }

        .toggleButton {
            float: right;
            position: relative;
            vertical-align: middle;

            i {
                font-size: 1.3em;
            }
        }
    }

    .debuggerSuggestion {
        background: none;
        color: var(--pxt-link);
        cursor: pointer;
        padding: 0.7rem;
        line-height: 0.8rem;

        &:hover {
            color: var(--pxt-link-hover);
        }

        &:focus, &:focus-visible {
            color: var(--pxt-link-hover);
            border: 2px solid var(--pxt-focus-border);

            &::after {
                // Hide inner-focus outline, since we have the outer border
                outline: none;
            }
        }

        i {
            margin-right: 0.4rem;
        }
    }

    .errorListInner {
        height: @errorListInnerHeight;
        padding: 0 0 1em 0;
        overflow-y: auto;

        .exceptionMessage {
            color: var(--pxt-target-foreground1);
            padding: 0.5em 1em;
            width: 70%;
        }

        // errors
        .ui.selection.list {
            color: var(--pxt-target-foreground1);
            margin: 0;
            padding: 0;

            .item {
                border-radius: unset;
                padding: 0.5em 1em;
                color: var(--pxt-target-foreground1);
                cursor: pointer;
                line-height: 1.2rem;
                width: 100%;
                text-align: start;

                &:hover, &:focus {
                    background-color: var(--pxt-neutral-alpha20) !important;
                }

                &:nth-child(even):not(:hover) {
                    background-color: var(--pxt-neutral-alpha10);
                }

                &.stackframe {
                    padding-left: 2em;
                }
            }
        }
    }

    .note {
        margin: 1rem;
        padding: 0.5rem;
        border-radius: 0.2rem;
        background-color: var(--pxt-neutral-alpha10);
        white-space: pre-line; // Preserve new lines
    }
}

// collapsed error list
.errorList.errorListSummary {
    min-height: unset;

    &:hover {
        background-color: var(--pxt-neutral-alpha20);
    }
}
