// (C) 2022-2025 GoodData Corporation

@use "variables";

.gd-dialog-list-loading {
    display: flex;
    flex: 1;
    justify-content: center;
    align-items: center;
    min-height: 50px;
    padding-bottom: 5px;
    font-weight: normal;
    font-family: variables.$gd-font-primary;
    font-size: 14px;
    line-height: 20px;
    color: var(--gd-palette-complementary-6, #94a1ad);
}

.gd-dialog-list-empty {
    display: flex;
    flex: 1;
    justify-content: center;
    align-items: center;
    padding-top: 10px;
    text-align: center;
    font-weight: normal;
    font-family: variables.$gd-font-primary;
    font-size: 14px;
    line-height: 20px;
    color: var(--gd-palette-complementary-6, #94a1ad);
}

.gd-dialog-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0 7px 0;
    white-space: nowrap;

    h3 {
        font-size: 11px;
        font-weight: bold;
        text-transform: uppercase;
        color: variables.$gd-color-state-blank;
        margin-right: 10px;
    }

    .gd-dialog-list-header-divider {
        width: 100%;
        border-top: 1px solid variables.$gd-border-color;
        margin: 10px 0;
    }

    .gd-dialog-list-header-button {
        margin-top: -1px;

        button {
            height: 20px;
            display: flex;
            align-items: center;
        }
    }
}

.gd-dialog-list-wrapper {
    box-sizing: inherit;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    margin-left: -20px;
    width: calc(100% + 40px);
    padding-left: 20px;
}

.gd-dialog-list {
    flex: 1;
    padding-right: 20px;
    min-height: 40px;
    overflow: auto;
    overscroll-behavior: contain;
}

.gd-dialog-list-item-basic {
    display: inline-flex;
    flex-direction: row-reverse;
    overflow: hidden;
    width: 100%;
    height: 50px;
    cursor: default;

    .gd-dialog-list-item-content {
        display: flex;
        flex: 1;
        overflow: hidden;
        white-space: nowrap;

        .gd-dialog-list-item-icon {
            display: flex;
            justify-content: center;
            align-items: center;
            flex-basis: 32px;
            height: 32px;
            margin: auto 0;
            background-color: variables.$is-focused-background;
            border-radius: 100px;
            flex-shrink: 0;
        }

        .gd-dialog-list-item-text {
            display: flex;
            flex: 1;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            overflow: hidden;
            line-height: 20px;
            white-space: nowrap;
            padding-left: 10px;
        }

        .gd-dialog-list-item-title {
            display: inline-flex;
            width: 100%;
            white-space: nowrap;
        }

        .gd-dialog-list-item-badge-after {
            margin-left: 5px;
        }

        .gd-dialog-list-item-subtitle {
            display: inline-block;
            width: 100%;
            white-space: nowrap;
            color: variables.$gd-color-state-blank;
        }

        .gd-dialog-list-item-shortened-text {
            display: block;
            overflow: hidden;
        }
    }

    .gd-dialog-list-item-action {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100%;
        cursor: pointer;
        flex-shrink: 0;
    }

    .gd-dialog-list-item-delete {
        display: flex;
        justify-content: center;
        align-items: center;
        flex-basis: 36px;
        height: 100%;
        cursor: pointer;
        flex-shrink: 0;
    }

    .gd-dialog-list-item-delete-icon {
        display: none;
        margin: auto;

        @media #{variables.$small-only} {
            display: block;
        }

        &::after {
            content: "\e61a";
            position: relative;
            font-family: variables.$gd-font-indigo;
            color: variables.$gd-color-state-blank;
            font-size: 16px;
            font-weight: 400;
            top: 1px;
        }

        &.disabled {
            display: none;
        }
    }

    .gd-dialog-list-item-delete:hover {
        background-color: var(--gd-palette-error-lightest, #fff2f1);

        ~ .gd-dialog-list-item-content {
            background-color: var(--gd-palette-error-lightest, #fff2f1);
        }

        ~ .gd-dialog-list-item-action {
            background-color: var(--gd-palette-error-lightest, #fff2f1);
        }

        .gd-dialog-list-item-delete-icon::after {
            color: variables.$gd-palette-error-base;
        }
    }

    &:hover {
        background: variables.$is-focused-background;

        .gd-dialog-list-item-icon {
            background: transparent;
        }

        .gd-dialog-list-item-delete-icon {
            display: block;

            &.disabled {
                display: none;
            }
        }
    }

    &.clickable:hover {
        cursor: pointer;
    }

    &.disabled,
    &.disabled:hover {
        cursor: default;

        .gd-dialog-list-item-title,
        .gd-dialog-list-item-subtitle {
            color: variables.$gd-color-disabled;
        }
    }
}

.gd-content-divider {
    border-top: 1px solid variables.$gd-border-color;
    height: 0;
    margin-top: 10px;
    margin-bottom: 5px;
}
