// Copyright 2024, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0

.block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
    min-height: 0;
    position: relative;

    .block-content {
        display: flex;
        flex-grow: 1;
        width: 100%;
        overflow: hidden;
        min-height: 0;
        padding: 5px;
    }

    .block-focuselem {
        height: 0;
        width: 0;
        input {
            width: 0;
            height: 0;
            opacity: 0;
            pointer-events: none;
        }
    }

    .block-header-animation-wrap {
        max-height: 0;
        transition:
            max-height 0.3s ease-out,
            opacity 0.3s ease-out;
        overflow: hidden;
        position: absolute;
        top: 0;
        width: 100%;
        height: 30px;
        z-index: var(--zindex-header-hover);

        &.is-showing {
            max-height: 30px;
        }
    }

    &.block-frame-tech {
        border: 2px solid var(--border-color);
        border-radius: 4px;
        margin: 10px 2px 2px 2px;
        padding: 10px 2px 2px 2px;
        height: calc(100% - 12px);
        width: calc(100% - 4px);
        overflow: visible;

        &.block-preview {
            background-color: var(--main-bg-color);

            .block-frame-tech-close {
                display: none;
            }
        }

        &.block-focused {
            border: 2px solid var(--accent-color);

            .block-frame-tech-header {
                color: var(--main-text-color);
            }
        }

        .block-frame-tech-header {
            position: absolute;
            max-width: 85%;
            left: 50%;
            transform: translate(-50%, 0);
            overflow: hidden;
            text-overflow: ellipsis;
            top: -11px;
            padding: 4px 6px 4px 6px;
            border-radius: 4px;
            background-color: var(--main-bg-color);
            font: var(--fixed-font);
            color: var(--secondary-text-color);
            white-space: nowrap;
            cursor: grab;
        }

        .block-frame-tech-close {
            position: absolute;
            top: 0;
            right: -2px;
            padding: 0 0 1px 1px;
            border-radius: 4px;
            background-color: var(--panel-bg-color);
            cursor: pointer;
            color: var(--grey-text-color);
            opacity: 0;

            &:hover {
                color: var(--secondary-text-color);
                opacity: 1;
            }
        }
    }

    .block-frame-preview {
        background-color: var(--main-bg-color);
        width: 100%;
        flex-grow: 1;
    }
}

.block-header {
    display: flex;
    flex-direction: row;
    flex-shrink: 0;
    height: 30px;
    width: 100%;
    align-items: center;
    justify-content: center;
    background-color: var(--panel-bg-color);
    user-select: none;
    -webkit-user-select: none;
    cursor: default;
    border-radius: 0 0 4px 4px;
    cursor: grab;

    .block-header-icon {
        font-size: 20px;
        padding: 0 5px;
    }

    .block-header-text {
        padding: 0 5px;
        flex-grow: 1;
        white-space: nowrap;
    }

    .close-button {
        font-size: 12px;
        padding: 5px 5px 5px 5px;
        margin-right: 5px;
        border-radius: 4px;
        cursor: pointer;

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