@use '../variables'as *;
@use '../mixins'as *;

$tooltip-background-color     : $component-background-default;
$tooltip-background-color-dark: $component-background-default-dark;
$tooltip-text-color           : $component-color-default;
$tooltip-text-color-dark      : $component-color-default-dark;

$tooltip-border-color      :$component-border-default;
$tooltip-border-color-dark :$component-border-default-dark;

$tooltip-border-radius  : $border-radius-default;
$tooltip-font-size      : $font-small;
$tooltip-animation-time : $animation-duration-short;

@mixin tooltip {
    .cui-tooltip-data {
        display         : flex;
        justify-content : center;
        align-items     : center;
        position        : fixed;
        border          : 1px solid $tooltip-border-color;
        border-radius   : $tooltip-border-radius;
        font-size       : $tooltip-font-size;
        background-color: $tooltip-background-color;
        box-shadow      : $shadow;
        text-transform  : capitalize;
        @include component-padding(small);
        // border     : 1px solid transparent;
        user-select: none;
        z-index    : 1160;
    }
}

@mixin tooltip-content {

    .#{$prefix}-tooltip-content {
        position       : absolute;
        display        : flex;
        justify-content: center;
        align-items    : center;
        @include component-padding(sameSmall);
        background-color: $tooltip-background-color;
        box-shadow      : $shadow;
        max-width       : $tooltip-max-width;
        color           : $tooltip-text-color;
        border          : 1px solid $tooltip-border-color;
        border-radius   : $tooltip-border-radius;
        font-size       : $tooltip-font-size;
        user-select     : none;
        transform       : scale(1);
        transform-origin: center;
    }
}

@mixin tooltip-dark {
    .#{$prefix}-dark {
        .cui-tooltip-data {
            background-color: $tooltip-background-color-dark;
            color           : $tooltip-text-color-dark;
            border-color    : $tooltip-border-color-dark;
        }
    }
}

@mixin tooltip-print {
    .#{$prefix}-print {


        .cui-tooltip-data {
            border          : $component-print-border;
            background-color: $component-print-background;
            color           : $component-print-color;
            box-shadow      : $component-print-shadow;
        }
    }
}

@mixin tooltip-animation {
    .#{$prefix}-animation-tooltip-in {
        animation: tooltipIn $tooltip-animation-time ease-out forwards;
    }

    @keyframes tooltipIn {
        0% {
            transform: scale(0);
            opacity  : 0;
        }

        40% {
            transform: scale(0.6);
            opacity  : 0.3;
        }

        50% {
            transform: scale(1.2);
            opacity  : 0.6;
        }

        100% {
            transform: scale(1, 1);
            opacity  : 1;
        }
    }
}

@mixin definitions($options:()) {
    @include tooltip();

    @if(not-option-disabled($options, 'dark')) {
        @include tooltip-dark();
    }

    @if(not-option-disabled($options, 'print')) {
        @include tooltip-print();
    }

    @if(not-option-disabled($options, 'animation')) {
        @include tooltip-animation();
    }

}