/*
 * Component: Modal
 */
@theme-prefix: wf;
@modal-width: 820px;
@modal-header-bg: #F5F5F5;
@modal-body-bg: #fff;
@modal-border-color: #F5F5F5;
@modal-footer-border-color: @modal-border-color;
@modal-header-padding: 20px;
@modal-body-padding: 20px;
@modal-footer-padding: @modal-header-padding;
@modal-backdrop-bg: rgba(0,0,0,.4);
@modal-border-radius: 4px;
@printable-modal-bg: #F5F5F5;
// Container that the modal scrolls within
.@{theme-prefix}-modal {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: all .3s ease-in-out;

    // modal close
    span.modal-close {
        width: 24px;
        height: 24px;
        text-align: center;
        border-radius: 50%;
        background: rgba(0,0,0,0.8);
        border: 1px solid #f2f2f2;
        position: absolute;
        top: -8px;
        right: -8px;
        z-index: 9999;
        cursor: pointer;
        i {
            font-size: 7px;
        }
        &:hover {
            background: rgba(0,0,0,1);
        }
    }

    .@{theme-prefix}-modal-dialog {
        position: relative;
        width: 95%;
        max-width: @modal-width;
        max-height: 100%;
        margin-top: -100px;
        transition: all .3s ease-in-out;
    }
    .@{theme-prefix}-modal-content {
        background-color: @modal-body-bg;
        border: 1px solid @modal-border-color;
        border-radius: @modal-border-radius;
        box-shadow: 0 3px 9px rgba(0,0,0,.5);
        background-clip: padding-box;
        // Remove focus outline from opened modal
        outline: 0;
        max-height: 90vh;
        overflow-y: auto;
    }
    &.@{theme-prefix}-modal-open {
        opacity: 1;
        visibility: visible;
        .@{theme-prefix}-modal-dialog {
            margin-top: 0px;
        }
    }
}
// Modal header
// Top section of the modal w/ title and dismiss
.@{theme-prefix}-modal-header {
    padding: @modal-header-padding;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 3px 3px 0 0;
    font-weight: 600;
    color: #000;

    h2, h3, h4, h5 {
        margin: 0;
        font-size: 23px;
    }

    &.has-border {
        border-bottom: 1px solid @modal-border-color;
    }
    &.has-bg {
        background: @modal-header-bg;
    }

    .@{theme-prefix}-close {
        color: #cec9cb;
        font-size: 16px;
        padding: 5px;
        margin-right: -5px;
        cursor: pointer;
        &:hover {
            color: #ccc;
        }
    }
    .@{theme-prefix}-icon {
        color: #ccc;
        margin-right: 10px;
        vertical-align: text-top;
        &:before {
            font-size: 20px;
        }
    }
}
.@{theme-prefix}-modal-body {
    position: relative;
    padding: @modal-body-padding;
    background: #fff;
}
// Footer (for actions)
.@{theme-prefix}-modal-footer {
    padding: @modal-footer-padding;
    text-align: right; // right align buttons

    &.has-border {
        border-top: 1px solid @modal-border-color;
    }

    // Properly space out buttons
    .@{theme-prefix}-btn + .@{theme-prefix}-btn {
        margin-left: 15px;
        margin-bottom: 0; // account for input[type="submit"] which gets the bottom margin like all other inputs
    }

    // but override that for button groups
    .@{theme-prefix}-btn-group .@{theme-prefix}-btn + .@{theme-prefix}-btn {
        margin-left: -1px;
    }
    // and override it for block buttons as well
    .@{theme-prefix}-btn-block + .@{theme-prefix}-btn-block {
        margin-left: 0;
    }
}
// Measure scrollbar width for padding body during modal show/hide
.@{theme-prefix}-modal-scrollbar-measure {
    position: absolute;
    top: -9999px;
    width: 50px;
    height: 50px;
    overflow: scroll;
}

.modal-title {
    margin-bottom: 20px;
    * {
        margin: 0;
        font-size: 18px;
        font-weight: 400;
    }
}
