// (C) 2024-2025 GoodData Corporation

@use "variables" as variables;
@use "@gooddata/sdk-ui-kit/styles/scss/variables" as kit-variables;

.gd-gen-ai-chat__window__drawer {
    .gd-ui-kit-drawer__close-button {
        top: 3px;
        right: 3px;
    }

    .gd-ui-kit-drawer__content {
        background: kit-variables.$gd-color-white;
    }
}

.gd-gen-ai-chat__window__conversations__header {
    display: flex;
    align-items: center;
    align-self: stretch;
    width: 100%;
    height: 37px;

    padding: 5px 5px 5px 10px;
    color: kit-variables.$gd-color-text;
    font-size: 14px;
    font-style: normal;
    font-weight: 700;
    line-height: 23px;
}

.gd-gen-ai-chat__window__conversations {
    $root: &;

    width: 220px;
    min-width: 220px;
    position: relative;
    margin: -5px;
    height: calc(100% + 10px);

    &#{$root}--isFullscreen {
        width: 300px;
        min-width: 300px;
    }

    &#{$root}--isSmallScreen,
    &#{$root}--isSmallScreen#{$root}--isFullscreen {
        width: 300px;
        min-width: 300px;
    }

    &__divider {
        width: 100%;
        height: 1px;
        background-color: kit-variables.$gd-border-color;
    }

    &__empty {
        display: flex;
        padding: 20px 0;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 10px;
        flex: 1 0 0;
    }

    &__empty__text {
        align-self: stretch;
        color: kit-variables.$gd-color-state-blank;
        text-align: center;
        font-size: 14px;
        font-style: normal;
        font-weight: 400;
        line-height: 20px;
    }

    &__drop-placeholder {
        z-index: 1;
        position: absolute;
        visibility: hidden;
        text-transform: uppercase;
        inset: 0;
        color: kit-variables.$gd-color-text;
        font-size: 12px;
        font-weight: 700;
        line-height: 14px;
        text-align: center;
        margin: 30px 10px 0 10px;
        padding: 4px 4px;
        border: 2px dashed kit-variables.$gd-palette-primary-base;
        background-color: kit-variables.$gd-palette-primary-dimmed;
        border-radius: 5px;
        min-height: 30px;

        &.isEmpty {
            margin: 5px 10px 0 10px;
            overflow: hidden;
        }

        &.isDragging,
        &.isDraggingOver {
            visibility: visible;
        }

        &.isEmpty.isDragging,
        &.isEmpty.isDraggingOver {
            visibility: visible;
        }

        & &__content {
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 3px;
        }

        &.isDraggingOver &__content {
            background-color: kit-variables.$gd-palette-primary-base;
            color: kit-variables.$gd-color-white;
        }
    }

    &__drop-overlay {
        position: absolute;
        inset: 0;
        pointer-events: none;
    }

    &__list {
        $list-root: &;

        flex-direction: column;
        display: flex;
        margin-left: -10px;
        margin-right: -10px;
        align-items: stretch;
        align-self: stretch;
        height: 100%;

        .gd-ui-kit-menu {
            max-height: none;
            .gd-ui-kit-menu__item-wrapper {
                cursor: grab;
            }

            .gd-ui-kit-menu__item-wrapper:active {
                cursor: grabbing;
            }

            #{$list-root}__delete-button {
                position: absolute;
                right: 0;
            }
            #{$list-root}__delete-button button {
                opacity: 0;
            }
            .gd-ui-kit-menu__item-title {
                width: calc(100% - 20px);
                text-overflow: ellipsis;
                overflow: hidden;
            }

            .gd-ui-kit-menu__item-wrapper:hover #{$list-root}__delete-button button,
            .gd-ui-kit-menu__item-wrapper:focus-within #{$list-root}__delete-button button {
                opacity: 1;
                pointer-events: auto;
            }

            .gd-ui-kit-menu__group-title-container {
                padding: 10px 10px 0 10px;
            }
        }

        &__item.openedMenu {
            .gd-ui-kit-menu__item-wrapper #{$list-root}__delete-button button {
                opacity: 1;
                pointer-events: auto;
            }
            .gd-ui-kit-menu__item {
                background-color: kit-variables.$is-focused-background;
                color: kit-variables.$gd-color-dark;
            }
            .gd-ui-kit-menu__item.gd-ui-kit-menu__item--isSelected {
                background-color: kit-variables.$gd-palette-primary-dimmed;
                color: kit-variables.$gd-palette-primary-base;
            }
        }

        &__item.generatingTitle .gd-ui-kit-menu__item-title,
        &__item.inProgress .gd-ui-kit-menu__item-title {
            @include variables.gd-reasoning();
        }

        &__item.dragging {
            opacity: 0.45;
        }
    }

    &__drop-group {
        position: relative;
    }

    &__delete-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 20px;
        height: 20px;
        margin-left: 6px;
        border: none;
        border-radius: 3px;
        background: transparent;
        color: kit-variables.$gd-color-text-dimmed;
        opacity: 0;
        pointer-events: none;
        cursor: pointer;

        &:hover,
        &:focus-visible {
            color: kit-variables.$gd-palette-error-base;
            background-color: kit-variables.$gd-palette-error-dimmed;
        }
    }

    .gd-ui-kit-menu__items-container {
        overflow-y: auto;
        overflow-x: auto;
        overscroll-behavior: auto;
    }
}

.gd-gen-ai-chat__embed__conversations {
    padding: 5px 10px;

    .gd-gen-ai-chat__window__conversations {
        width: auto;
        min-width: 220px;
        position: relative;
        margin: 0;
        height: calc(100%);
    }
}

.gd-gen-ai-chat__rename-dialog {
    min-width: 440px;

    &__input .gd-input-label {
        text-transform: none;
        font-size: 14px;
        font-style: normal;
        font-weight: 400;
        line-height: 21px;
        margin-bottom: 0;
    }
}
