@import '../custom.less';
@import '../mixins/mask.less';
@import '../mixins/content.less';
@import '../animation/zoom.less';

@modal-tag-name: r-modal;
@modal-prefix-cls: ~'@{css-prefix}modal';
@confirm-prefix-cls: ~'@{css-prefix}modal-confirm';

@{modal-tag-name} {
    display: none;
}

.@{modal-prefix-cls} {
    width: auto;
    margin: 0 auto;
    position: relative;
    outline: none;
    top: 100px;

    &.zoom-big-enter,
    &.zoom-big-leave {
        animation-duration: 0.3s;
    }

    &-hidden {
        display: none !important;
    }

    &-wrap {
        position: fixed;
        overflow: auto;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: @zindex-modal;
        -webkit-overflow-scrolling: touch;
        outline: 0;
    }

    &-wrap * {
        box-sizing: border-box;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    }

    &-mask {
        .mask();
    }

    &-content {
        position: relative;
        background-color: @white;
        border: 0;
        border-radius: @border-radius-base;
        background-clip: padding-box;
        box-shadow: @shadow-down;

        &-no-mask {
            pointer-events: auto;
        }
    }

    &-header {
        .content-header();
    }

    &-close {
        z-index: 1;
        .content-close(8px, 31px);
    }

    &-body {
        padding: @padding-md;
        font-size: @font-size-base;
        line-height: @line-height-base;

        p {
            margin: 0;
        }
    }

    &-footer {
        border-top: @border-width-base @border-style-base @border-color-split;
        padding: @padding-sm @padding-md+2 @padding-sm @padding-md+2;
        text-align: right;

        button + button {
            margin-left: 8px;
            margin-bottom: 0;
        }
    }

    &-fullscreen {
        width: 100% !important;
        top: 0;
        bottom: 0;
        position: absolute;

        @modal-header-height: 51px;
        @modal-footer-height: 61px;

        .@{modal-prefix-cls}-content {
            width: 100%;
            border-radius: 0;
            position: absolute;
            top: 0;
            bottom: 0;
        }

        .@{modal-prefix-cls}-body {
            width: 100%;
            overflow: auto;
            position: absolute;
            top: @modal-header-height;
            bottom: @modal-footer-height;
        }

        &-no-header .@{modal-prefix-cls}-body {
            top: 0;
        }

        &-no-footer .@{modal-prefix-cls}-body {
            bottom: 0;
        }

        .@{modal-prefix-cls}-footer {
            position: absolute;
            width: 100%;
            bottom: 0;
        }
    }

    &-no-mask {
        pointer-events: none;
    }
}

@media (max-width: @screen-sm) {
    .@{modal-prefix-cls} {
        width: auto !important;
        margin: 10px;
    }

    .@{modal-prefix-cls}-fullscreen {
        width: 100% !important;
        margin: 0;
    }

    .vertical-center-modal {
        .@{modal-prefix-cls} {
            flex: 1;
        }
    }
}

.@{confirm-prefix-cls} {
    padding: 6px @padding-md @padding-xs;

    &-head {
        padding: 0 @padding-sm 0 0;

        &-icon {
            display: inline-block;
            font-size: 30px;
            vertical-align: middle;
            position: relative;
            top: -8px;

            &-info {
                color: @primary-color;
            }

            &-success {
                color: @success-color;
            }

            &-warning {
                color: @warning-color;
            }

            &-error {
                color: @error-color;
            }

            &-confirm {
                color: @warning-color;
            }
        }

        &-title {
            display: inline-block;
            vertical-align: middle;
            margin-left: 10px;
            font-size: @font-size-large;
            color: @title-color;
            font-weight: 500;
        }
    }

    &-body {
        padding-left: 44px;
        font-size: @font-size-base;
        color: @text-color;
        position: relative;

        p {
            margin: 0;
        }
    }

    &-footer {
        margin-top: 20px;
        text-align: right;

        button + button {
            margin-left: 8px;
            margin-bottom: 0;
        }
    }
}
