.container {
    display: flex;
    flex-direction: column;

    flex: 1;
    height: 100%;

    &.vertical {
        height: auto;
    }
}

.tabButtons {
    position: relative;
    min-height: 48px;
    white-space: nowrap;
    overflow-x: auto;

    display: flex;
    align-items: stretch;

    .border & {
        border-bottom: 1px solid var(--a100);
    }

    .vertical & {
        flex-direction: column;

        overflow: hidden;
    }
}

.tabButton {
    position: relative;
    flex-shrink: 0;

    display: inline-flex;
    gap: 0.5em;
    align-items: center;
    justify-content: center;

    padding: 0 8px;
    min-width: 60px;
    min-height: 32px;

    font-size: 0.8rem;
    font-weight: 500;

    user-select: none;
    appearance: none;

    color: var(--a600);
    background: transparent;
    border: 0;

    transition: color 0.2s ease;

    &:disabled {
        opacity: 0.7;
        pointer-events: none;
    }

    &:not(:disabled) {
        cursor: pointer;

        &:hover,
        &[aria-selected="true"] {
            color: var(--a900);
        }
    }

    // bottom border
    &[aria-selected="true"]::before {
        content: "";

        position: absolute;
        left: 8px;
        bottom: 0;

        width: calc(100% - 16px);
        height: 2px;

        background: var(--a1000);

        .vertical & {
            width: 2px;
            height: calc(100% - 16px);

            left: 0;
            bottom: 8px;
        }
    }

    &:first-child {
        margin-left: 8px;
    }

    &:last-child {
        margin-right: 8px;
    }

    &:focus {
        outline: none; // remove focus ring, .tabButtonsBackground replaces it
    }

    .vertical & {
        display: flex;
        justify-content: flex-start;

        min-width: unset;

        margin-left: 0;
        margin-right: 0;

        padding: 0 16px;
    }
}

.tabButtonsBackground {
    position: absolute;
    top: 8px;
    height: calc(100% - 16px);
    pointer-events: none;

    transition: transform, width, height;

    // transform, width, height, transition-duration, opacity set by JS

    // must be separate element for a different transition-duration
    &::after {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;

        background: var(--a50);
        border-radius: 6px;

        opacity: inherit;
        transition: opacity 0.1s;
    }

    .vertical & {
        width: calc(100% - 16px);
        height: 100%;
        left: 8px;
    }
}

.tabPanel {
    flex: 1;

    display: none;

    overflow: hidden;

    &.active {
        display: flex;
    }
}

.tabPanelContent {
    flex: 1;
    overflow: hidden;
}

.closeButton {
    background: transparent;
    border: 0;

    padding: 2px;
    border-radius: 4px;

    cursor: pointer;

    &:hover,
    &:active {
        background: var(--a100);
    }
}
