@mixin checkout__tooltip(
    $name-space:             null,
    $z-index:                null,
    $min-width:              null,
    $padding:                null,
    $arrow-size:             null,
    $error-background-color: null,
    $error-color:            null
) {
    .#{$name-space}tooltip {
        @include checkout__reset;
        position: absolute;
        z-index: $z-index;
        padding: $padding;
        min-width: $min-width;

        @if $arrow-size {
            margin-top: $arrow-size;

            &:before {
                content: '';
                display: block;
                position: absolute;
                top: 0;
                transform: translateY(-50%) rotate(45deg);
                width: $arrow-size;
                height: $arrow-size;
            }
        }

        &--error {
            background-color: $error-background-color;
            color: $error-color;
            border: solid 1px currentColor;
        }

        @if $arrow-size {
            &--error:before {
                border-style: solid;
                border-width: 1px;
                border-color: currentColor $error-background-color $error-background-color currentColor;
                background-color: $error-background-color;
            }
        }

        // stylelint-disable-next-line
        &__content {}

        &__close-button {
            @include checkout__reset-button;
        }

        @content;
    }
}

@mixin checkout__tooltip--left($left: 0, $arrow-left: 10px) {
    left: $left;

    &:before {
        left: $arrow-left;
    }
}

@mixin checkout__tooltip--right($right: 0, $arrow-right: 10px) {
    right: $right;

    &:before {
        right: $arrow-right;
    }
}