// WP auth check: If the login form pops up, do not show any modal
body.modal-open .#{$ANTD_PREFIX}-modal-root {
    display: none !important;
}

// Fix global styles
.#{$ANTD_PREFIX}-app {
    a:not(.button, .nav-tab, .page-title-action) {
        text-decoration: underline;
    }
}

// Fix select dropdowns and messages in modals
.#{$ANTD_PREFIX}-select-dropdown,
.#{$ANTD_PREFIX}-message,
.#{$ANTD_PREFIX}-image-preview-mask,
.#{$ANTD_PREFIX}-image-preview-wrap,
.#{$ANTD_PREFIX}-dropdown,
.#{$ANTD_PREFIX}-dropdown-menu-submenu-popup {
    z-index: 105000000 !important;
}

// Fix modal, popver and tooltip
.#{$ANTD_PREFIX}-modal-mask,
.#{$ANTD_PREFIX}-modal-wrap {
    z-index: 99999999 !important;
}
.#{$ANTD_PREFIX}-tooltip {
    z-index: 100000079 !important;

    a {
        color: inherit !important;
        text-decoration: underline;
    }
}
.#{$ANTD_PREFIX}-popover {
    z-index: 100000029 !important;
}

// Fix forms.css to be compatible with antd checkboxes
.#{$ANTD_PREFIX}-checkbox-input {
    margin-top: 0px !important;
}

// Non-bordered cards should not have any box shadow
.#{$ANTD_PREFIX}-card:not(.#{$ANTD_PREFIX}-card-bordered) {
    box-shadow: none !important;
}

// Some themes add additional margin, antd does handle this already
.#{$ANTD_PREFIX}-table table {
    margin: 0 !important;
}

.#{$ANTD_PREFIX}-tabs-tabpane-no-margin {
    margin: 0 !important;
    padding: 0 !important;
}

// Antd does not support Select with addonBefore so we workaround it with
// Input.Group: https://github.com/ant-design/ant-design/issues/6866#issuecomment-557708614
.#{$ANTD_PREFIX}-space-compact.#{$ANTD_PREFIX}-select-addon {
    display: flex;

    .#{$ANTD_PREFIX}-input-group-wrapper {
        flex: 0;
    }

    .#{$ANTD_PREFIX}-input {
        width: 0px;
        padding-left: 0px !important;
        padding-right: 0px !important;
    }

    .#{$ANTD_PREFIX}-select {
        flex: 1;
    }

    .#{$ANTD_PREFIX}-select-selector {
        border-left: 0;
    }

    .#{$ANTD_PREFIX}-select-multiple .#{$ANTD_PREFIX}-select-selector {
        padding-top: 0px !important;
        padding-bottom: 0px !important;
    }
}

.#{$ANTD_PREFIX}-radio-disabled > input {
    opacity: 0 !important;
}

// Radio groups
.#{$ANTD_PREFIX}-radio-button-wrapper input[type="radio"] {
    opacity: 0 !important;
}

// Cards within radio button group
.#{$ANTD_PREFIX}-radio-button-card > label {
    height: auto !important;
    padding: 0;
    border-radius: 0px !important;
    margin: 0px 5px 5px 0px !important;

    .#{$ANTD_PREFIX}-card {
        background: transparent;

        .#{$ANTD_PREFIX}-card-cover {
            margin: 5px;
        }
    }

    &.#{$ANTD_PREFIX}-radio-button-wrapper-checked:not(.#{$ANTD_PREFIX}-radio-button-wrapper-disabled) {
        .#{$ANTD_PREFIX}-card-meta-title,
        .#{$ANTD_PREFIX}-card-meta-description {
            color: white;
        }
    }
}

// Sticky footer for forms
.#{$ANTD_PREFIX}-form-sticky-submit {
    position: sticky;
    bottom: 0;
    background: #f1f1f1;
    border-top: 1px solid #d2b798;
    margin-top: 10px;
    padding: 20px 0;
    z-index: 4;
}

.#{$ANTD_PREFIX}-modal-root {
    .#{$ANTD_PREFIX}-form-sticky-submit {
        background: white;
        margin-bottom: 0;
    }

    // A modal without icon should show the content fullwidth
    .#{$ANTD_PREFIX}-modal-confirm-body:not(:has(> [role="img"])) {
        .#{$ANTD_PREFIX}-modal-confirm-paragraph {
            max-width: initial;
        }
    }
}

// A modal dialog with centered image and text
.#{$ANTD_PREFIX}-hero-modal {
    text-align: center;

    .#{$ANTD_PREFIX}-modal-footer {
        text-align: center;
    }

    .#{$ANTD_PREFIX}-modal-body {
        padding: 0 24px;

        img {
            max-width: 90%;
            max-height: 500px;
            height: auto;
        }
    }
}

// See https://stackoverflow.com/a/58399650/5506547
.#{$ANTD_PREFIX}-modal-mount {
    position: relative;
    width: 100%;
    background-repeat: no-repeat;
    background-size: 100% auto;
    background-position: center center;

    .#{$ANTD_PREFIX}-modal-mask,
    .#{$ANTD_PREFIX}-modal-wrap {
        position: absolute;
        z-index: unset;
    }

    .#{$ANTD_PREFIX}-modal-mask {
        background: none;
    }

    .#{$ANTD_PREFIX}-modal-close,
    .#{$ANTD_PREFIX}-modal-footer > button:not(.#{$ANTD_PREFIX}-btn-primary) {
        display: none !important;
    }
}

// Special card
.#{$ANTD_PREFIX}-template-card {
    width: 210px;
    display: inline-block;
    padding: 10px;
    margin: 5px;
    vertical-align: top;

    .#{$ANTD_PREFIX}-card-cover {
        height: 173px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .#{$ANTD_PREFIX}-card-body {
        padding: 20px 5px 10px;
    }

    .#{$ANTD_PREFIX}-ribbon.#{$ANTD_PREFIX}-ribbon-placement-end {
        right: -18px;
        border: 1px solid white;
        box-sizing: content-box;
    }

    .#{$ANTD_PREFIX}-card-meta-description {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .#{$ANTD_PREFIX}-card-actions {
        margin-top: 10px !important;

        a {
            text-decoration: underline;
        }
    }
}

.#{$ANTD_PREFIX}-space-vertical {
    width: 100%;
}

.#{$ANTD_PREFIX}-tabs-nav::before {
    border-color: #e2e2e2 !important;
}

// https://stackoverflow.com/a/9793669/5506547
.#{$ANTD_PREFIX}-select.#{$ANTD_PREFIX}-select-ellipses-left .#{$ANTD_PREFIX}-select-selection-item {
    direction: rtl;
}

.#{$ANTD_PREFIX}-image-preview-operations {
    top: 32px;
}

// Reset https://git.io/JLyJJ
.#{$ANTD_PREFIX}-input {
    padding: 4px 11px !important;
    line-height: 1.5715 !important;
    min-height: auto !important;
    box-shadow: none !important;
    border-radius: 2px !important;
    border: 1px solid #d9d9d9 !important;
    outline: none !important;
}

.#{$ANTD_PREFIX}-list-item {
    background: white;
    padding: 15px !important;

    .#{$ANTD_PREFIX}-badge-count {
        min-width: 9px;
    }

    .#{$ANTD_PREFIX}-list-item-meta-content {
        width: auto !important;
    }
}

// Fix pagination
.#{$ANTD_PREFIX}-pagination > li {
    margin-bottom: 0px !important;
}
