@use '../variables'as *;
@use '../mixins'as *;


$banner-background-default      : $component-background-default;
$banner-background-default-dark : $component-background-default-dark;
$banner-background-inverse      : $component-background-inverse;
$banner-background-inverse-dark : $component-background-inverse-dark;
$banner-color-default           : $component-color-default;
$banner-color-default-dark      : $component-color-default-dark;
$banner-border-color            : $component-border-default;
$banner-border-color-dark       : $component-border-default-dark;
$banner-border-radius           : $border-radius-default;

$banner-color-accent   : $component-background-accent;
$banner-color-secondary: $component-background-secondary;

@mixin banner-color($color) {
    $val            : get-theme-color($color);
    border-color    : $val;
    background-color: $val;
    color           : $banner-color-default-dark;

}

@mixin banner {
    div.#{$prefix}-banner {
        display             : none;
        //  justify-content : space-between;
        align-items         : center;
        border              : 1px solid $banner-border-color;
        background-color    : $banner-background-default;
        color               : $banner-color-default;
        border-radius       : $banner-border-radius;
        box-shadow          : $shadow;
        margin              : 0 $margin-global;
        @include component-padding(normal, true);

        &.#{$prefix}-active {
            display: flex;
        }

        .#{$prefix}-message {
            //color: $banner-color-default;
            flex: 1 1 auto;
        }

        .#{$prefix}-close,
        .#{$prefix}-icon-close {
            order: 100;
        }

        .#{$prefix}-message-icon {
            order: -1;
        }
    }
}

@mixin banner-theme {
    div.#{$prefix}-banner {

        &.#{$prefix}-accent {
            @include banner-color('accent');
        }

        &.#{$prefix}-secondary {
            @include banner-color('secondary');
        }

    }
}

@mixin banner-signals {
    div.#{$prefix}-banner {
        &.#{$prefix}-success {
            @include banner-color('success');
        }

        &.#{$prefix}-error {
            @include banner-color('error');
        }

        &.#{$prefix}-warning {
            @include banner-color('warning');
        }
    }
}

@mixin banner-dark {
    @include mode-dark {
        div.#{$prefix}-banner {
            @include not-colors {
                border          : 1px solid $banner-border-color-dark;
                background-color: $banner-background-default-dark;
                color           : $banner-color-default-dark;
            }
        }
    }
}

@mixin banner-signals-dark {
    @include mode-dark {
        div.#{$prefix}-banner {
            &.#{$prefix}-success {
                @include banner-color('success-dark');
            }

            &.#{$prefix}-error {
                @include banner-color('error-dark');
            }

            &.#{$prefix}-warning {
                @include banner-color('warning-dark');
            }
        }
    }
}

@mixin banner-theme-dark {
    @include mode-dark {
        div.#{$prefix}-banner {
            &.#{$prefix}-accent {
                @include banner-color('accent-dark');
            }

            &.#{$prefix}-secondary {
                @include banner-color('secondary-dark');
            }
        }
    }
}

@mixin banner-print {
    .#{$prefix}-print {
        div.#{$prefix}-banner {
            border          : $component-print-border;
            background-color: $component-print-background;
            color           : $component-print-color;
            box-shadow      : $component-print-shadow;
        }
    }
}

@mixin definitions($options: ()) {
    @include banner();

    @if(not-option-disabled($options, 'dark')) {
        @include banner-dark();
    }

    @if(not-option-disabled($options, 'print')) {
        @include banner-print();
    }

    @if(not-option-disabled($options, 'theme')) {
        @include banner-theme();

        @if(not-option-disabled($options, 'dark')) {
            @include banner-theme-dark();
        }
    }

    @if(not-option-disabled($options, 'signal')) {
        @include banner-signals();

        @if(not-option-disabled($options, 'dark')) {
            @include banner-signals-dark();
        }
    }

}