@use 'sass:map';
@use '../../base' as *;
@use 'igniteui-theming/sass/animations/easings' as *;

/// @deprecated Use the `css-vars` mixin instead.
/// @see {mixin} css-vars
/// @param {Map} $theme - The theme used to style the component.
@mixin overlay($theme) {
    @include css-vars($theme, '.igx-overlay__wrapper--modal, .igx-overlay__content--modal');

    %overlay-display {
        width: 0;
        height: 0;
        box-sizing: content-box;
    }

    %overlay-wrapper {
        position: fixed;
        inset: 0;
        background: transparent;
        transition: background .25s $in-out-quad;
        pointer-events: none;
        box-sizing: content-box;

        // Override browser's default popover styles to maintain our custom positioning
        &[popover] {
            // Reset popover defaults to use our positioning with !important to override UA styles
            position: fixed !important;
            margin: 0 !important;
            border: 0 !important;
            padding: 0 !important;
            width: auto;
            height: auto;
            overflow: visible !important;

            &:not(:popover-open) {
                display: initial !important;
            }
        }
    }

    %overlay-wrapper--modal {
        background: var-get($theme, 'background-color');
        pointer-events: initial;
    }

    %overlay-wrapper--flex {
        display: flex;
    }

    %overlay-wrapper--flex-container {
        display: flex;
        position: absolute;
    }

    %overlay-content {
        position: absolute;
        pointer-events: all;
        box-sizing: content-box;
    }

    %overlay-content--modal {
        pointer-events: initial;
    }

    %overlay-content--elastic {
        overflow: auto;
    }

    %overlay-content--relative {
        position: relative;
    }

    %igx-toggle--hidden:not(%igx-toggle--hidden-webkit) {
        display: none !important;
    }

    %igx-toggle--hidden-webkit {
        // WARN: This is a workaround around a bug in Safari.
        position: absolute;
        visibility: hidden;
        // width/height/min-width to 0 needed for bug #14303
        width: 0;
        min-width: 0;
        height: 0;
        // needed for bug #14302
        padding: 0 !important;
        top: 0;
        left: 0;
        margin: -1px;
        border: none;
        clip: rect(0, 0, 0, 0);
        outline: 0;
        pointer-events: none;
        overflow: hidden;
        appearance: none;
    }
}
