@import '../styles/_variables.scss';

$tip-size: 15px;
$tip-top: -7px;

.main {
    position: relative;

    .menu-opener {
        border: 0;
        padding-block-start: 0;
        padding-inline-end: 0;
        padding-block-end: 0;
        padding-inline-start: 0;
        min-width: auto;
    }
}

:global {
    .menu-options-wrapper {
        transition-property: opacity;
        transition-duration: .1s;
        transition-timing-function: ease-in-out;
        position: absolute;
        top: 100%;
        right: 0;
        border-radius: $default-border-radius;
        border: 1px solid $duda-gray;
        background-color: white;
        z-index: 2;
        pointer-events: none;
        min-width: 8em;
        box-shadow: 0 2px 4px rgba(71, 64, 64, .2);
        visibility: hidden;

        #arrow,
        #arrow::before {
            border: 1px solid $duda-gray;
            position: absolute;
            background: inherit;
            height: $tip-size;
            width: $tip-size;
        }

        #arrow {
            visibility: hidden;
        }

        #arrow::before {
            content: '';
            transform: rotate(45deg);
        }

        &[data-popper-placement^='top'] > #arrow {
            bottom: -4px;
        }

        &[data-popper-placement^='bottom'] > #arrow {
            top: -4px;
        }

        &[data-popper-placement^='left'] > #arrow {
            right: -4px;
        }

        &[data-popper-placement^='right'] > #arrow {
            left: -4px;
        }

        &--open {
            visibility: visible;
            pointer-events: unset;

            #arrow::before {
                visibility: visible;
            }
        }

        .menu-options-wrapper__option {
            padding: .6em .8em;
            background-color: white;
            position: relative;

            &:first-of-type {
                border-top-left-radius: $default-border-radius;
                border-top-right-radius: $default-border-radius;
            }
            &:last-of-type {
                border-bottom-left-radius: $default-border-radius;
                border-bottom-right-radius: $default-border-radius;
            }

            &:not(:last-of-type) {
                border-bottom: 1px solid $duda-gray;
            }
            &:hover {
                background-color: $light-gray;
            }
        }
    }
}
