// (C) 2025 GoodData Corporation

@use "../../../styles/scss/variables";

.gd-ui-kit-drawer {
    $root: &;

    position: absolute;
    overflow: hidden;
    left: 0;
    top: 0;
    bottom: 0;
    right: 0;

    &--anchor-left {
        left: 0;
        top: 0;
        bottom: 0;

        #{$root}__content {
            top: 0;
            left: 0;
            bottom: 0;
            max-width: 100vw;
            transform: translateX(-105%);
            border-right: 1px solid variables.$gd-border-color;
        }
    }

    &--anchor-left#{$root}--view-open {
        #{$root}__content {
            transform: translateX(0);
        }
        #{$root}__backdrop {
            opacity: 1;
        }
    }

    &--anchor-right {
        right: 0;
        top: 0;
        bottom: 0;

        #{$root}__content {
            top: 0;
            right: 0;
            bottom: 0;
            max-width: 100vw;
            transform: translateX(105%);
            border-left: 1px solid variables.$gd-border-color;
        }
    }

    &--anchor-right#{$root}--view-open {
        #{$root}__content {
            transform: translateX(0);
        }
        #{$root}__backdrop {
            opacity: 1;
        }
    }

    @media #{variables.$small-only} {
        &--anchor-left,
        &--anchor-right {
            #{$root}__content {
                width: 100vw;
            }
        }
    }

    &__backdrop {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        opacity: 0;
        background-color: rgba(0, 0, 0, 0.5);
    }

    &__content {
        position: absolute;
        background: var(--gd-palette-complementary-1, #f5f8fa);
        box-shadow: 0 4px 4px 0 color-mix(in sRGB, variables.$gd-color-dark 25%, transparent);

        #{$root}__close-button {
            position: absolute;
            top: 0;
            right: 0;
        }

        #{$root}__scrollable {
            padding: 10px 15px;
            overflow: auto;
            overscroll-behavior: contain;
            height: calc(100% - 20px);
        }

        #{$root}__header {
            display: flex;
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
        }
    }

    &__content--showCloseButton {
        padding-top: 30px;
    }
}
