@use 'sass:map';

@use 'mixins/mixins' as *;
@use 'mixins/utils' as *;
@use 'mixins/var' as *;
@use 'common/var' as *;
@use 'common/popup' as *;

@include b(dialog) {
    @include set-component-css-var('dialog', $dialog);

    margin: var(#{getCssVarName('dialog-margin-top')}, 15vh) auto 50px;
    width: var(#{getCssVarName('dialog-width')}, 50%);
    height: var(#{getCssVarName('dialog-height')}, 50%);
    background: getCssVar('dialog', 'bg-color');
    border-radius: getCssVar('dialog', 'border-radius');
    box-shadow: getCssVar('dialog', 'box-shadow');
    box-sizing: border-box;

    &:focus {
        outline: none !important;
    }

    @include when(fullscreen) {
        @include set-css-var-value('dialog-margin-top', 0);
        height: 100%;
        width: 100% !important;
    }

    @include e(wrapper) {
        position: fixed;
        top: 0;
        width: 100%;
        height: 100%;
        background-color: #0000006e;
        z-index: 2000;
    }

    @include when(draggable) {
        @include e(header) {
            cursor: move;
            user-select: none;
        }
    }

    @include e(header) {
        padding: 0 20px;
        height: 50px;
        line-height: 50px;
        box-sizing: border-box;
        word-break: break-all;
        position: relative;
    }

    @include e(headerfull) {
        position: absolute;
        top: 0;
        height: 30px;
        width: 40px;
        text-align: center;
        line-height: 32px;
        cursor: pointer;
        &:hover {
            background: #e9e9eb;
        }
    }
    @include e(headerbtn) {
        position: absolute;
        top: 0;
        height: 30px;
        width: 40px;
        text-align: center;
        line-height: 32px;
        cursor: pointer;
        right: 0;
        &:hover {
            background: #fb4343db;
            color: #ffffff;
        }
    }

    @include e(title) {
        line-height: getCssVar('dialog-font-line-height');
        font-size: getCssVar('dialog-title-font-size');
        color: getCssVar('text-color', 'primary');
    }

    @include e(body) {
        padding: calc(#{getCssVar('dialog-padding-primary')} + 10px) getCssVar('dialog-padding-primary');
        color: getCssVar('text-color', 'regular');
        font-size: getCssVar('dialog-content-font-size');
        word-break: break-all;
        box-sizing: border-box;
        border-top: 1px solid #80808038;
        overflow-y: auto;
    }

    @include e(footer) {
        padding: 0 20px;
        height: 60px;
        line-height: 60px;
        text-align: right;
    }
}

// 过渡动画
/* 渐变设置 */
.fade-enter-from, .fade-leave-to {
    transform: translateY(-30px);
    opacity: 0;
}

.fade-enter-to, .fade-leave-from {
    opacity: 1;
}

.fade-enter-active {
    transition: all 0.5s ease;
}

.fade-leave-active {
    transition: all 0.3s cubic-bezier(1, 0.6, 0.6, 1);
}
