@use "variables" as *;

:host {
    width: 100%;
    height: 100%;
}

:host ::ng-deep {
    .p-treenode-label {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .p-treenode-content:has(span.active) {
        pointer-events: none;
        background-color: $color-palette-primary-200;
    }

    .p-treenode-content .p-tree-toggler {
        .arrow-icon {
            color: $color-palette-gray-600;
        }

        .folder-icon {
            color: $color-palette-gray-800;
        }
    }

    .p-treenode-content.p-highlight .p-tree-toggler {
        .folder-icon {
            color: $text-color-highlight;
        }

        .arrow-icon {
            color: $text-color-highlight;
        }
    }
}

/* Modes for toggler icon rendering */
:host ::ng-deep {
    .p-tree {
        width: 100%;
        height: 100%;
        border: none;
        overflow-y: auto;

        /* First-only mode (show folder icon on first root node only) */
        &.first-only {
            .toggler-first {
                display: none;
            }

            .p-tree-container > p-treenode:first-child {
                .toggler-first {
                    display: block;
                }

                .toggler-regular {
                    display: none;
                }
            }
        }

        /* All-folder mode (show folder icon on all root nodes) */
        &.folder-all {
            .toggler-first {
                display: block;
            }

            .toggler-regular {
                display: none;
            }
        }
    }
}

.loading-container {
    gap: $spacing-4;
    font-weight: normal;
    user-select: none;
    pointer-events: none;

    .loading-icon {
        font-size: $icon-xxl;
        color: $color-palette-gray-400;
        z-index: 1;
    }

    .loading-text {
        font-size: $font-size-md;
    }
}

.pulse-container {
    position: relative;
    display: inline-block;
}

.pulse-container::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6.5rem;
    height: 6.5rem;
    border-radius: 50%;
    background-color: $color-palette-secondary-300;
    animation: pulse 2s infinite cubic-bezier(0.66, 0, 0.34, 1);
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.4;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0;
    }
}
